@unwanted/matrix-sdk-mini 34.12.0-1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1203) hide show
  1. package/CHANGELOG.md +5910 -0
  2. package/LICENSE +177 -0
  3. package/README.md +459 -0
  4. package/git-revision.txt +1 -0
  5. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +14 -0
  6. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +1 -0
  7. package/lib/@types/AESEncryptedSecretStoragePayload.js +1 -0
  8. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +1 -0
  9. package/lib/@types/IIdentityServerProvider.d.ts +9 -0
  10. package/lib/@types/IIdentityServerProvider.d.ts.map +1 -0
  11. package/lib/@types/IIdentityServerProvider.js +1 -0
  12. package/lib/@types/IIdentityServerProvider.js.map +1 -0
  13. package/lib/@types/PushRules.d.ts +140 -0
  14. package/lib/@types/PushRules.d.ts.map +1 -0
  15. package/lib/@types/PushRules.js +94 -0
  16. package/lib/@types/PushRules.js.map +1 -0
  17. package/lib/@types/another-json.d.js +0 -0
  18. package/lib/@types/another-json.d.js.map +1 -0
  19. package/lib/@types/auth.d.ts +208 -0
  20. package/lib/@types/auth.d.ts.map +1 -0
  21. package/lib/@types/auth.js +99 -0
  22. package/lib/@types/auth.js.map +1 -0
  23. package/lib/@types/beacon.d.ts +106 -0
  24. package/lib/@types/beacon.d.ts.map +1 -0
  25. package/lib/@types/beacon.js +119 -0
  26. package/lib/@types/beacon.js.map +1 -0
  27. package/lib/@types/common.d.ts +9 -0
  28. package/lib/@types/common.d.ts.map +1 -0
  29. package/lib/@types/common.js +1 -0
  30. package/lib/@types/common.js.map +1 -0
  31. package/lib/@types/crypto.d.ts +47 -0
  32. package/lib/@types/crypto.d.ts.map +1 -0
  33. package/lib/@types/crypto.js +1 -0
  34. package/lib/@types/crypto.js.map +1 -0
  35. package/lib/@types/event.d.ts +258 -0
  36. package/lib/@types/event.d.ts.map +1 -0
  37. package/lib/@types/event.js +239 -0
  38. package/lib/@types/event.js.map +1 -0
  39. package/lib/@types/events.d.ts +92 -0
  40. package/lib/@types/events.d.ts.map +1 -0
  41. package/lib/@types/events.js +1 -0
  42. package/lib/@types/events.js.map +1 -0
  43. package/lib/@types/extensible_events.d.ts +98 -0
  44. package/lib/@types/extensible_events.d.ts.map +1 -0
  45. package/lib/@types/extensible_events.js +116 -0
  46. package/lib/@types/extensible_events.js.map +1 -0
  47. package/lib/@types/global.d.js +20 -0
  48. package/lib/@types/global.d.js.map +1 -0
  49. package/lib/@types/local_notifications.d.ts +4 -0
  50. package/lib/@types/local_notifications.d.ts.map +1 -0
  51. package/lib/@types/local_notifications.js +1 -0
  52. package/lib/@types/local_notifications.js.map +1 -0
  53. package/lib/@types/location.d.ts +60 -0
  54. package/lib/@types/location.d.ts.map +1 -0
  55. package/lib/@types/location.js +67 -0
  56. package/lib/@types/location.js.map +1 -0
  57. package/lib/@types/matrix-sdk-crypto-wasm.d.js +1 -0
  58. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -0
  59. package/lib/@types/media.d.ts +220 -0
  60. package/lib/@types/media.d.ts.map +1 -0
  61. package/lib/@types/media.js +1 -0
  62. package/lib/@types/media.js.map +1 -0
  63. package/lib/@types/membership.d.ts +41 -0
  64. package/lib/@types/membership.d.ts.map +1 -0
  65. package/lib/@types/membership.js +37 -0
  66. package/lib/@types/membership.js.map +1 -0
  67. package/lib/@types/oidc-client-ts.d.js +18 -0
  68. package/lib/@types/oidc-client-ts.d.js.map +1 -0
  69. package/lib/@types/partials.d.ts +39 -0
  70. package/lib/@types/partials.d.ts.map +1 -0
  71. package/lib/@types/partials.js +53 -0
  72. package/lib/@types/partials.js.map +1 -0
  73. package/lib/@types/polls.d.ts +88 -0
  74. package/lib/@types/polls.d.ts.map +1 -0
  75. package/lib/@types/polls.js +86 -0
  76. package/lib/@types/polls.js.map +1 -0
  77. package/lib/@types/read_receipts.d.ts +36 -0
  78. package/lib/@types/read_receipts.d.ts.map +1 -0
  79. package/lib/@types/read_receipts.js +27 -0
  80. package/lib/@types/read_receipts.js.map +1 -0
  81. package/lib/@types/registration.d.ts +85 -0
  82. package/lib/@types/registration.d.ts.map +1 -0
  83. package/lib/@types/registration.js +1 -0
  84. package/lib/@types/registration.js.map +1 -0
  85. package/lib/@types/requests.d.ts +241 -0
  86. package/lib/@types/requests.d.ts.map +1 -0
  87. package/lib/@types/requests.js +28 -0
  88. package/lib/@types/requests.js.map +1 -0
  89. package/lib/@types/search.d.ts +90 -0
  90. package/lib/@types/search.d.ts.map +1 -0
  91. package/lib/@types/search.js +30 -0
  92. package/lib/@types/search.js.map +1 -0
  93. package/lib/@types/signed.d.ts +9 -0
  94. package/lib/@types/signed.d.ts.map +1 -0
  95. package/lib/@types/signed.js +1 -0
  96. package/lib/@types/signed.js.map +1 -0
  97. package/lib/@types/spaces.d.ts +16 -0
  98. package/lib/@types/spaces.d.ts.map +1 -0
  99. package/lib/@types/spaces.js +1 -0
  100. package/lib/@types/spaces.js.map +1 -0
  101. package/lib/@types/state_events.d.ts +116 -0
  102. package/lib/@types/state_events.d.ts.map +1 -0
  103. package/lib/@types/state_events.js +1 -0
  104. package/lib/@types/state_events.js.map +1 -0
  105. package/lib/@types/synapse.d.ts +19 -0
  106. package/lib/@types/synapse.d.ts.map +1 -0
  107. package/lib/@types/synapse.js +1 -0
  108. package/lib/@types/synapse.js.map +1 -0
  109. package/lib/@types/sync.d.ts +8 -0
  110. package/lib/@types/sync.d.ts.map +1 -0
  111. package/lib/@types/sync.js +25 -0
  112. package/lib/@types/sync.js.map +1 -0
  113. package/lib/@types/threepids.d.ts +12 -0
  114. package/lib/@types/threepids.d.ts.map +1 -0
  115. package/lib/@types/threepids.js +24 -0
  116. package/lib/@types/threepids.js.map +1 -0
  117. package/lib/@types/topic.d.ts +48 -0
  118. package/lib/@types/topic.d.ts.map +1 -0
  119. package/lib/@types/topic.js +57 -0
  120. package/lib/@types/topic.js.map +1 -0
  121. package/lib/@types/uia.d.ts +12 -0
  122. package/lib/@types/uia.d.ts.map +1 -0
  123. package/lib/@types/uia.js +1 -0
  124. package/lib/@types/uia.js.map +1 -0
  125. package/lib/NamespacedValue.d.ts +33 -0
  126. package/lib/NamespacedValue.d.ts.map +1 -0
  127. package/lib/NamespacedValue.js +113 -0
  128. package/lib/NamespacedValue.js.map +1 -0
  129. package/lib/ReEmitter.d.ts +15 -0
  130. package/lib/ReEmitter.d.ts.map +1 -0
  131. package/lib/ReEmitter.js +87 -0
  132. package/lib/ReEmitter.js.map +1 -0
  133. package/lib/ToDeviceMessageQueue.d.ts +28 -0
  134. package/lib/ToDeviceMessageQueue.d.ts.map +1 -0
  135. package/lib/ToDeviceMessageQueue.js +135 -0
  136. package/lib/ToDeviceMessageQueue.js.map +1 -0
  137. package/lib/autodiscovery.d.ts +136 -0
  138. package/lib/autodiscovery.d.ts.map +1 -0
  139. package/lib/autodiscovery.js +464 -0
  140. package/lib/autodiscovery.js.map +1 -0
  141. package/lib/base64.d.ts +28 -0
  142. package/lib/base64.d.ts.map +1 -0
  143. package/lib/base64.js +88 -0
  144. package/lib/base64.js.map +1 -0
  145. package/lib/browser-index.d.ts +8 -0
  146. package/lib/browser-index.d.ts.map +1 -0
  147. package/lib/browser-index.js +35 -0
  148. package/lib/browser-index.js.map +1 -0
  149. package/lib/client.d.ts +4232 -0
  150. package/lib/client.d.ts.map +1 -0
  151. package/lib/client.js +8622 -0
  152. package/lib/client.js.map +1 -0
  153. package/lib/common-crypto/CryptoBackend.d.ts +240 -0
  154. package/lib/common-crypto/CryptoBackend.d.ts.map +1 -0
  155. package/lib/common-crypto/CryptoBackend.js +73 -0
  156. package/lib/common-crypto/CryptoBackend.js.map +1 -0
  157. package/lib/common-crypto/key-passphrase.d.ts +14 -0
  158. package/lib/common-crypto/key-passphrase.d.ts.map +1 -0
  159. package/lib/common-crypto/key-passphrase.js +33 -0
  160. package/lib/common-crypto/key-passphrase.js.map +1 -0
  161. package/lib/content-helpers.d.ts +90 -0
  162. package/lib/content-helpers.d.ts.map +1 -0
  163. package/lib/content-helpers.js +250 -0
  164. package/lib/content-helpers.js.map +1 -0
  165. package/lib/content-repo.d.ts +24 -0
  166. package/lib/content-repo.d.ts.map +1 -0
  167. package/lib/content-repo.js +104 -0
  168. package/lib/content-repo.js.map +1 -0
  169. package/lib/crypto/CrossSigning.d.ts +184 -0
  170. package/lib/crypto/CrossSigning.d.ts.map +1 -0
  171. package/lib/crypto/CrossSigning.js +718 -0
  172. package/lib/crypto/CrossSigning.js.map +1 -0
  173. package/lib/crypto/DeviceList.d.ts +216 -0
  174. package/lib/crypto/DeviceList.d.ts.map +1 -0
  175. package/lib/crypto/DeviceList.js +892 -0
  176. package/lib/crypto/DeviceList.js.map +1 -0
  177. package/lib/crypto/EncryptionSetup.d.ts +152 -0
  178. package/lib/crypto/EncryptionSetup.d.ts.map +1 -0
  179. package/lib/crypto/EncryptionSetup.js +356 -0
  180. package/lib/crypto/EncryptionSetup.js.map +1 -0
  181. package/lib/crypto/OlmDevice.d.ts +457 -0
  182. package/lib/crypto/OlmDevice.d.ts.map +1 -0
  183. package/lib/crypto/OlmDevice.js +1241 -0
  184. package/lib/crypto/OlmDevice.js.map +1 -0
  185. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +109 -0
  186. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +1 -0
  187. package/lib/crypto/OutgoingRoomKeyRequestManager.js +415 -0
  188. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +1 -0
  189. package/lib/crypto/RoomList.d.ts +26 -0
  190. package/lib/crypto/RoomList.d.ts.map +1 -0
  191. package/lib/crypto/RoomList.js +71 -0
  192. package/lib/crypto/RoomList.js.map +1 -0
  193. package/lib/crypto/SecretSharing.d.ts +24 -0
  194. package/lib/crypto/SecretSharing.d.ts.map +1 -0
  195. package/lib/crypto/SecretSharing.js +194 -0
  196. package/lib/crypto/SecretSharing.js.map +1 -0
  197. package/lib/crypto/SecretStorage.d.ts +55 -0
  198. package/lib/crypto/SecretStorage.d.ts.map +1 -0
  199. package/lib/crypto/SecretStorage.js +118 -0
  200. package/lib/crypto/SecretStorage.js.map +1 -0
  201. package/lib/crypto/aes.d.ts +6 -0
  202. package/lib/crypto/aes.d.ts.map +1 -0
  203. package/lib/crypto/aes.js +24 -0
  204. package/lib/crypto/aes.js.map +1 -0
  205. package/lib/crypto/algorithms/base.d.ts +156 -0
  206. package/lib/crypto/algorithms/base.d.ts.map +1 -0
  207. package/lib/crypto/algorithms/base.js +187 -0
  208. package/lib/crypto/algorithms/base.js.map +1 -0
  209. package/lib/crypto/algorithms/index.d.ts +4 -0
  210. package/lib/crypto/algorithms/index.d.ts.map +1 -0
  211. package/lib/crypto/algorithms/index.js +20 -0
  212. package/lib/crypto/algorithms/index.js.map +1 -0
  213. package/lib/crypto/algorithms/megolm.d.ts +385 -0
  214. package/lib/crypto/algorithms/megolm.d.ts.map +1 -0
  215. package/lib/crypto/algorithms/megolm.js +1822 -0
  216. package/lib/crypto/algorithms/megolm.js.map +1 -0
  217. package/lib/crypto/algorithms/olm.d.ts +5 -0
  218. package/lib/crypto/algorithms/olm.d.ts.map +1 -0
  219. package/lib/crypto/algorithms/olm.js +299 -0
  220. package/lib/crypto/algorithms/olm.js.map +1 -0
  221. package/lib/crypto/api.d.ts +32 -0
  222. package/lib/crypto/api.d.ts.map +1 -0
  223. package/lib/crypto/api.js +22 -0
  224. package/lib/crypto/api.js.map +1 -0
  225. package/lib/crypto/backup.d.ts +227 -0
  226. package/lib/crypto/backup.d.ts.map +1 -0
  227. package/lib/crypto/backup.js +824 -0
  228. package/lib/crypto/backup.js.map +1 -0
  229. package/lib/crypto/crypto.d.ts +3 -0
  230. package/lib/crypto/crypto.d.ts.map +1 -0
  231. package/lib/crypto/crypto.js +19 -0
  232. package/lib/crypto/crypto.js.map +1 -0
  233. package/lib/crypto/dehydration.d.ts +34 -0
  234. package/lib/crypto/dehydration.d.ts.map +1 -0
  235. package/lib/crypto/dehydration.js +252 -0
  236. package/lib/crypto/dehydration.js.map +1 -0
  237. package/lib/crypto/device-converter.d.ts +9 -0
  238. package/lib/crypto/device-converter.d.ts.map +1 -0
  239. package/lib/crypto/device-converter.js +42 -0
  240. package/lib/crypto/device-converter.js.map +1 -0
  241. package/lib/crypto/deviceinfo.d.ts +99 -0
  242. package/lib/crypto/deviceinfo.d.ts.map +1 -0
  243. package/lib/crypto/deviceinfo.js +148 -0
  244. package/lib/crypto/deviceinfo.js.map +1 -0
  245. package/lib/crypto/index.d.ts +1209 -0
  246. package/lib/crypto/index.d.ts.map +1 -0
  247. package/lib/crypto/index.js +4097 -0
  248. package/lib/crypto/index.js.map +1 -0
  249. package/lib/crypto/key_passphrase.d.ts +14 -0
  250. package/lib/crypto/key_passphrase.d.ts.map +1 -0
  251. package/lib/crypto/key_passphrase.js +44 -0
  252. package/lib/crypto/key_passphrase.js.map +1 -0
  253. package/lib/crypto/keybackup.d.ts +18 -0
  254. package/lib/crypto/keybackup.d.ts.map +1 -0
  255. package/lib/crypto/keybackup.js +1 -0
  256. package/lib/crypto/keybackup.js.map +1 -0
  257. package/lib/crypto/olmlib.d.ts +129 -0
  258. package/lib/crypto/olmlib.d.ts.map +1 -0
  259. package/lib/crypto/olmlib.js +492 -0
  260. package/lib/crypto/olmlib.js.map +1 -0
  261. package/lib/crypto/recoverykey.d.ts +2 -0
  262. package/lib/crypto/recoverykey.d.ts.map +1 -0
  263. package/lib/crypto/recoverykey.js +19 -0
  264. package/lib/crypto/recoverykey.js.map +1 -0
  265. package/lib/crypto/store/base.d.ts +252 -0
  266. package/lib/crypto/store/base.d.ts.map +1 -0
  267. package/lib/crypto/store/base.js +64 -0
  268. package/lib/crypto/store/base.js.map +1 -0
  269. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +187 -0
  270. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +1 -0
  271. package/lib/crypto/store/indexeddb-crypto-store-backend.js +1145 -0
  272. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -0
  273. package/lib/crypto/store/indexeddb-crypto-store.d.ts +432 -0
  274. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +1 -0
  275. package/lib/crypto/store/indexeddb-crypto-store.js +728 -0
  276. package/lib/crypto/store/indexeddb-crypto-store.js.map +1 -0
  277. package/lib/crypto/store/localStorage-crypto-store.d.ts +119 -0
  278. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +1 -0
  279. package/lib/crypto/store/localStorage-crypto-store.js +531 -0
  280. package/lib/crypto/store/localStorage-crypto-store.js.map +1 -0
  281. package/lib/crypto/store/memory-crypto-store.d.ts +215 -0
  282. package/lib/crypto/store/memory-crypto-store.d.ts.map +1 -0
  283. package/lib/crypto/store/memory-crypto-store.js +622 -0
  284. package/lib/crypto/store/memory-crypto-store.js.map +1 -0
  285. package/lib/crypto/verification/Base.d.ts +105 -0
  286. package/lib/crypto/verification/Base.d.ts.map +1 -0
  287. package/lib/crypto/verification/Base.js +372 -0
  288. package/lib/crypto/verification/Base.js.map +1 -0
  289. package/lib/crypto/verification/Error.d.ts +35 -0
  290. package/lib/crypto/verification/Error.d.ts.map +1 -0
  291. package/lib/crypto/verification/Error.js +86 -0
  292. package/lib/crypto/verification/Error.js.map +1 -0
  293. package/lib/crypto/verification/IllegalMethod.d.ts +15 -0
  294. package/lib/crypto/verification/IllegalMethod.d.ts.map +1 -0
  295. package/lib/crypto/verification/IllegalMethod.js +43 -0
  296. package/lib/crypto/verification/IllegalMethod.js.map +1 -0
  297. package/lib/crypto/verification/QRCode.d.ts +51 -0
  298. package/lib/crypto/verification/QRCode.d.ts.map +1 -0
  299. package/lib/crypto/verification/QRCode.js +277 -0
  300. package/lib/crypto/verification/QRCode.js.map +1 -0
  301. package/lib/crypto/verification/SAS.d.ts +27 -0
  302. package/lib/crypto/verification/SAS.d.ts.map +1 -0
  303. package/lib/crypto/verification/SAS.js +485 -0
  304. package/lib/crypto/verification/SAS.js.map +1 -0
  305. package/lib/crypto/verification/SASDecimal.d.ts +8 -0
  306. package/lib/crypto/verification/SASDecimal.d.ts.map +1 -0
  307. package/lib/crypto/verification/SASDecimal.js +34 -0
  308. package/lib/crypto/verification/SASDecimal.js.map +1 -0
  309. package/lib/crypto/verification/request/Channel.d.ts +18 -0
  310. package/lib/crypto/verification/request/Channel.d.ts.map +1 -0
  311. package/lib/crypto/verification/request/Channel.js +1 -0
  312. package/lib/crypto/verification/request/Channel.js.map +1 -0
  313. package/lib/crypto/verification/request/InRoomChannel.d.ts +113 -0
  314. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +1 -0
  315. package/lib/crypto/verification/request/InRoomChannel.js +351 -0
  316. package/lib/crypto/verification/request/InRoomChannel.js.map +1 -0
  317. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +105 -0
  318. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +1 -0
  319. package/lib/crypto/verification/request/ToDeviceChannel.js +328 -0
  320. package/lib/crypto/verification/request/ToDeviceChannel.js.map +1 -0
  321. package/lib/crypto/verification/request/VerificationRequest.d.ts +227 -0
  322. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +1 -0
  323. package/lib/crypto/verification/request/VerificationRequest.js +937 -0
  324. package/lib/crypto/verification/request/VerificationRequest.js.map +1 -0
  325. package/lib/crypto-api/CryptoEvent.d.ts +69 -0
  326. package/lib/crypto-api/CryptoEvent.d.ts.map +1 -0
  327. package/lib/crypto-api/CryptoEvent.js +33 -0
  328. package/lib/crypto-api/CryptoEvent.js.map +1 -0
  329. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +16 -0
  330. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +1 -0
  331. package/lib/crypto-api/CryptoEventHandlerMap.js +22 -0
  332. package/lib/crypto-api/CryptoEventHandlerMap.js.map +1 -0
  333. package/lib/crypto-api/index.d.ts +978 -0
  334. package/lib/crypto-api/index.d.ts.map +1 -0
  335. package/lib/crypto-api/index.js +304 -0
  336. package/lib/crypto-api/index.js.map +1 -0
  337. package/lib/crypto-api/key-passphrase.d.ts +11 -0
  338. package/lib/crypto-api/key-passphrase.d.ts.map +1 -0
  339. package/lib/crypto-api/key-passphrase.js +51 -0
  340. package/lib/crypto-api/key-passphrase.js.map +1 -0
  341. package/lib/crypto-api/keybackup.d.ts +88 -0
  342. package/lib/crypto-api/keybackup.d.ts.map +1 -0
  343. package/lib/crypto-api/keybackup.js +1 -0
  344. package/lib/crypto-api/keybackup.js.map +1 -0
  345. package/lib/crypto-api/recovery-key.d.ts +11 -0
  346. package/lib/crypto-api/recovery-key.d.ts.map +1 -0
  347. package/lib/crypto-api/recovery-key.js +65 -0
  348. package/lib/crypto-api/recovery-key.js.map +1 -0
  349. package/lib/crypto-api/verification.d.ts +344 -0
  350. package/lib/crypto-api/verification.d.ts.map +1 -0
  351. package/lib/crypto-api/verification.js +91 -0
  352. package/lib/crypto-api/verification.js.map +1 -0
  353. package/lib/digest.d.ts +10 -0
  354. package/lib/digest.d.ts.map +1 -0
  355. package/lib/digest.js +40 -0
  356. package/lib/digest.js.map +1 -0
  357. package/lib/embedded.d.ts +143 -0
  358. package/lib/embedded.d.ts.map +1 -0
  359. package/lib/embedded.js +567 -0
  360. package/lib/embedded.js.map +1 -0
  361. package/lib/errors.d.ts +24 -0
  362. package/lib/errors.d.ts.map +1 -0
  363. package/lib/errors.js +51 -0
  364. package/lib/errors.js.map +1 -0
  365. package/lib/event-mapper.d.ts +10 -0
  366. package/lib/event-mapper.d.ts.map +1 -0
  367. package/lib/event-mapper.js +81 -0
  368. package/lib/event-mapper.js.map +1 -0
  369. package/lib/extensible_events_v1/ExtensibleEvent.d.ts +38 -0
  370. package/lib/extensible_events_v1/ExtensibleEvent.d.ts.map +1 -0
  371. package/lib/extensible_events_v1/ExtensibleEvent.js +57 -0
  372. package/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -0
  373. package/lib/extensible_events_v1/InvalidEventError.d.ts +7 -0
  374. package/lib/extensible_events_v1/InvalidEventError.d.ts.map +1 -0
  375. package/lib/extensible_events_v1/InvalidEventError.js +25 -0
  376. package/lib/extensible_events_v1/InvalidEventError.js.map +1 -0
  377. package/lib/extensible_events_v1/MessageEvent.d.ts +45 -0
  378. package/lib/extensible_events_v1/MessageEvent.d.ts.map +1 -0
  379. package/lib/extensible_events_v1/MessageEvent.js +134 -0
  380. package/lib/extensible_events_v1/MessageEvent.js.map +1 -0
  381. package/lib/extensible_events_v1/PollEndEvent.d.ts +33 -0
  382. package/lib/extensible_events_v1/PollEndEvent.d.ts.map +1 -0
  383. package/lib/extensible_events_v1/PollEndEvent.js +88 -0
  384. package/lib/extensible_events_v1/PollEndEvent.js.map +1 -0
  385. package/lib/extensible_events_v1/PollResponseEvent.d.ts +49 -0
  386. package/lib/extensible_events_v1/PollResponseEvent.d.ts.map +1 -0
  387. package/lib/extensible_events_v1/PollResponseEvent.js +135 -0
  388. package/lib/extensible_events_v1/PollResponseEvent.js.map +1 -0
  389. package/lib/extensible_events_v1/PollStartEvent.d.ts +71 -0
  390. package/lib/extensible_events_v1/PollStartEvent.d.ts.map +1 -0
  391. package/lib/extensible_events_v1/PollStartEvent.js +185 -0
  392. package/lib/extensible_events_v1/PollStartEvent.js.map +1 -0
  393. package/lib/extensible_events_v1/utilities.d.ts +14 -0
  394. package/lib/extensible_events_v1/utilities.d.ts.map +1 -0
  395. package/lib/extensible_events_v1/utilities.js +34 -0
  396. package/lib/extensible_events_v1/utilities.js.map +1 -0
  397. package/lib/feature.d.ts +20 -0
  398. package/lib/feature.d.ts.map +1 -0
  399. package/lib/feature.js +85 -0
  400. package/lib/feature.js.map +1 -0
  401. package/lib/filter-component.d.ts +64 -0
  402. package/lib/filter-component.d.ts.map +1 -0
  403. package/lib/filter-component.js +167 -0
  404. package/lib/filter-component.js.map +1 -0
  405. package/lib/filter.d.ts +97 -0
  406. package/lib/filter.d.ts.map +1 -0
  407. package/lib/filter.js +207 -0
  408. package/lib/filter.js.map +1 -0
  409. package/lib/http-api/errors.d.ts +80 -0
  410. package/lib/http-api/errors.d.ts.map +1 -0
  411. package/lib/http-api/errors.js +185 -0
  412. package/lib/http-api/errors.js.map +1 -0
  413. package/lib/http-api/fetch.d.ts +114 -0
  414. package/lib/http-api/fetch.d.ts.map +1 -0
  415. package/lib/http-api/fetch.js +346 -0
  416. package/lib/http-api/fetch.js.map +1 -0
  417. package/lib/http-api/index.d.ts +33 -0
  418. package/lib/http-api/index.d.ts.map +1 -0
  419. package/lib/http-api/index.js +180 -0
  420. package/lib/http-api/index.js.map +1 -0
  421. package/lib/http-api/interface.d.ts +142 -0
  422. package/lib/http-api/interface.d.ts.map +1 -0
  423. package/lib/http-api/interface.js +35 -0
  424. package/lib/http-api/interface.js.map +1 -0
  425. package/lib/http-api/method.d.ts +10 -0
  426. package/lib/http-api/method.d.ts.map +1 -0
  427. package/lib/http-api/method.js +27 -0
  428. package/lib/http-api/method.js.map +1 -0
  429. package/lib/http-api/prefix.d.ts +31 -0
  430. package/lib/http-api/prefix.d.ts.map +1 -0
  431. package/lib/http-api/prefix.js +32 -0
  432. package/lib/http-api/prefix.js.map +1 -0
  433. package/lib/http-api/utils.d.ts +37 -0
  434. package/lib/http-api/utils.d.ts.map +1 -0
  435. package/lib/http-api/utils.js +178 -0
  436. package/lib/http-api/utils.js.map +1 -0
  437. package/lib/index.d.ts +4 -0
  438. package/lib/index.d.ts.map +1 -0
  439. package/lib/index.js +24 -0
  440. package/lib/index.js.map +1 -0
  441. package/lib/indexeddb-helpers.d.ts +10 -0
  442. package/lib/indexeddb-helpers.d.ts.map +1 -0
  443. package/lib/indexeddb-helpers.js +51 -0
  444. package/lib/indexeddb-helpers.js.map +1 -0
  445. package/lib/indexeddb-worker.d.ts +7 -0
  446. package/lib/indexeddb-worker.d.ts.map +1 -0
  447. package/lib/indexeddb-worker.js +25 -0
  448. package/lib/indexeddb-worker.js.map +1 -0
  449. package/lib/interactive-auth.d.ts +337 -0
  450. package/lib/interactive-auth.d.ts.map +1 -0
  451. package/lib/interactive-auth.js +557 -0
  452. package/lib/interactive-auth.js.map +1 -0
  453. package/lib/logger.d.ts +81 -0
  454. package/lib/logger.d.ts.map +1 -0
  455. package/lib/logger.js +139 -0
  456. package/lib/logger.js.map +1 -0
  457. package/lib/matrix.d.ts +118 -0
  458. package/lib/matrix.d.ts.map +1 -0
  459. package/lib/matrix.js +146 -0
  460. package/lib/matrix.js.map +1 -0
  461. package/lib/matrixrtc/CallMembership.d.ts +66 -0
  462. package/lib/matrixrtc/CallMembership.d.ts.map +1 -0
  463. package/lib/matrixrtc/CallMembership.js +197 -0
  464. package/lib/matrixrtc/CallMembership.js.map +1 -0
  465. package/lib/matrixrtc/LivekitFocus.d.ts +16 -0
  466. package/lib/matrixrtc/LivekitFocus.d.ts.map +1 -0
  467. package/lib/matrixrtc/LivekitFocus.js +20 -0
  468. package/lib/matrixrtc/LivekitFocus.js.map +1 -0
  469. package/lib/matrixrtc/MatrixRTCSession.d.ts +295 -0
  470. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -0
  471. package/lib/matrixrtc/MatrixRTCSession.js +1043 -0
  472. package/lib/matrixrtc/MatrixRTCSession.js.map +1 -0
  473. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +40 -0
  474. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +1 -0
  475. package/lib/matrixrtc/MatrixRTCSessionManager.js +146 -0
  476. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -0
  477. package/lib/matrixrtc/focus.d.ts +10 -0
  478. package/lib/matrixrtc/focus.d.ts.map +1 -0
  479. package/lib/matrixrtc/focus.js +1 -0
  480. package/lib/matrixrtc/focus.js.map +1 -0
  481. package/lib/matrixrtc/index.d.ts +7 -0
  482. package/lib/matrixrtc/index.d.ts.map +1 -0
  483. package/lib/matrixrtc/index.js +21 -0
  484. package/lib/matrixrtc/index.js.map +1 -0
  485. package/lib/matrixrtc/types.d.ts +19 -0
  486. package/lib/matrixrtc/types.d.ts.map +1 -0
  487. package/lib/matrixrtc/types.js +1 -0
  488. package/lib/matrixrtc/types.js.map +1 -0
  489. package/lib/models/MSC3089Branch.d.ts +98 -0
  490. package/lib/models/MSC3089Branch.d.ts.map +1 -0
  491. package/lib/models/MSC3089Branch.js +240 -0
  492. package/lib/models/MSC3089Branch.js.map +1 -0
  493. package/lib/models/MSC3089TreeSpace.d.ts +165 -0
  494. package/lib/models/MSC3089TreeSpace.d.ts.map +1 -0
  495. package/lib/models/MSC3089TreeSpace.js +520 -0
  496. package/lib/models/MSC3089TreeSpace.js.map +1 -0
  497. package/lib/models/ToDeviceMessage.d.ts +17 -0
  498. package/lib/models/ToDeviceMessage.d.ts.map +1 -0
  499. package/lib/models/ToDeviceMessage.js +1 -0
  500. package/lib/models/ToDeviceMessage.js.map +1 -0
  501. package/lib/models/beacon.d.ts +53 -0
  502. package/lib/models/beacon.d.ts.map +1 -0
  503. package/lib/models/beacon.js +174 -0
  504. package/lib/models/beacon.js.map +1 -0
  505. package/lib/models/compare-event-ordering.d.ts +24 -0
  506. package/lib/models/compare-event-ordering.d.ts.map +1 -0
  507. package/lib/models/compare-event-ordering.js +120 -0
  508. package/lib/models/compare-event-ordering.js.map +1 -0
  509. package/lib/models/device.d.ts +45 -0
  510. package/lib/models/device.d.ts.map +1 -0
  511. package/lib/models/device.js +77 -0
  512. package/lib/models/device.js.map +1 -0
  513. package/lib/models/event-context.d.ts +62 -0
  514. package/lib/models/event-context.d.ts.map +1 -0
  515. package/lib/models/event-context.js +113 -0
  516. package/lib/models/event-context.js.map +1 -0
  517. package/lib/models/event-status.d.ts +19 -0
  518. package/lib/models/event-status.d.ts.map +1 -0
  519. package/lib/models/event-status.js +30 -0
  520. package/lib/models/event-status.js.map +1 -0
  521. package/lib/models/event-timeline-set.d.ts +312 -0
  522. package/lib/models/event-timeline-set.d.ts.map +1 -0
  523. package/lib/models/event-timeline-set.js +813 -0
  524. package/lib/models/event-timeline-set.js.map +1 -0
  525. package/lib/models/event-timeline.d.ts +219 -0
  526. package/lib/models/event-timeline.d.ts.map +1 -0
  527. package/lib/models/event-timeline.js +455 -0
  528. package/lib/models/event-timeline.js.map +1 -0
  529. package/lib/models/event.d.ts +811 -0
  530. package/lib/models/event.d.ts.map +1 -0
  531. package/lib/models/event.js +1520 -0
  532. package/lib/models/event.js.map +1 -0
  533. package/lib/models/invites-ignorer.d.ts +136 -0
  534. package/lib/models/invites-ignorer.d.ts.map +1 -0
  535. package/lib/models/invites-ignorer.js +382 -0
  536. package/lib/models/invites-ignorer.js.map +1 -0
  537. package/lib/models/poll.d.ts +67 -0
  538. package/lib/models/poll.d.ts.map +1 -0
  539. package/lib/models/poll.js +241 -0
  540. package/lib/models/poll.js.map +1 -0
  541. package/lib/models/profile-keys.d.ts +8 -0
  542. package/lib/models/profile-keys.d.ts.map +1 -0
  543. package/lib/models/profile-keys.js +8 -0
  544. package/lib/models/profile-keys.js.map +1 -0
  545. package/lib/models/read-receipt.d.ts +115 -0
  546. package/lib/models/read-receipt.d.ts.map +1 -0
  547. package/lib/models/read-receipt.js +366 -0
  548. package/lib/models/read-receipt.js.map +1 -0
  549. package/lib/models/related-relations.d.ts +11 -0
  550. package/lib/models/related-relations.d.ts.map +1 -0
  551. package/lib/models/related-relations.js +33 -0
  552. package/lib/models/related-relations.js.map +1 -0
  553. package/lib/models/relations-container.d.ts +44 -0
  554. package/lib/models/relations-container.d.ts.map +1 -0
  555. package/lib/models/relations-container.js +132 -0
  556. package/lib/models/relations-container.js.map +1 -0
  557. package/lib/models/relations.d.ts +114 -0
  558. package/lib/models/relations.d.ts.map +1 -0
  559. package/lib/models/relations.js +354 -0
  560. package/lib/models/relations.js.map +1 -0
  561. package/lib/models/room-member.d.ts +204 -0
  562. package/lib/models/room-member.d.ts.map +1 -0
  563. package/lib/models/room-member.js +360 -0
  564. package/lib/models/room-member.js.map +1 -0
  565. package/lib/models/room-receipts.d.ts +39 -0
  566. package/lib/models/room-receipts.d.ts.map +1 -0
  567. package/lib/models/room-receipts.js +392 -0
  568. package/lib/models/room-receipts.js.map +1 -0
  569. package/lib/models/room-state.d.ts +468 -0
  570. package/lib/models/room-state.d.ts.map +1 -0
  571. package/lib/models/room-state.js +984 -0
  572. package/lib/models/room-state.js.map +1 -0
  573. package/lib/models/room-summary.d.ts +29 -0
  574. package/lib/models/room-summary.d.ts.map +1 -0
  575. package/lib/models/room-summary.js +28 -0
  576. package/lib/models/room-summary.js.map +1 -0
  577. package/lib/models/room.d.ts +1203 -0
  578. package/lib/models/room.d.ts.map +1 -0
  579. package/lib/models/room.js +3336 -0
  580. package/lib/models/room.js.map +1 -0
  581. package/lib/models/search-result.d.ts +20 -0
  582. package/lib/models/search-result.d.ts.map +1 -0
  583. package/lib/models/search-result.js +52 -0
  584. package/lib/models/search-result.js.map +1 -0
  585. package/lib/models/thread.d.ts +246 -0
  586. package/lib/models/thread.d.ts.map +1 -0
  587. package/lib/models/thread.js +861 -0
  588. package/lib/models/thread.js.map +1 -0
  589. package/lib/models/typed-event-emitter.d.ts +157 -0
  590. package/lib/models/typed-event-emitter.d.ts.map +1 -0
  591. package/lib/models/typed-event-emitter.js +227 -0
  592. package/lib/models/typed-event-emitter.js.map +1 -0
  593. package/lib/models/user.d.ts +195 -0
  594. package/lib/models/user.d.ts.map +1 -0
  595. package/lib/models/user.js +218 -0
  596. package/lib/models/user.js.map +1 -0
  597. package/lib/oidc/authorize.d.ts +90 -0
  598. package/lib/oidc/authorize.d.ts.map +1 -0
  599. package/lib/oidc/authorize.js +278 -0
  600. package/lib/oidc/authorize.js.map +1 -0
  601. package/lib/oidc/discovery.d.ts +14 -0
  602. package/lib/oidc/discovery.d.ts.map +1 -0
  603. package/lib/oidc/discovery.js +66 -0
  604. package/lib/oidc/discovery.js.map +1 -0
  605. package/lib/oidc/error.d.ts +18 -0
  606. package/lib/oidc/error.d.ts.map +1 -0
  607. package/lib/oidc/error.js +35 -0
  608. package/lib/oidc/error.js.map +1 -0
  609. package/lib/oidc/index.d.ts +17 -0
  610. package/lib/oidc/index.d.ts.map +1 -0
  611. package/lib/oidc/index.js +29 -0
  612. package/lib/oidc/index.js.map +1 -0
  613. package/lib/oidc/register.d.ts +43 -0
  614. package/lib/oidc/register.d.ts.map +1 -0
  615. package/lib/oidc/register.js +96 -0
  616. package/lib/oidc/register.js.map +1 -0
  617. package/lib/oidc/tokenRefresher.d.ts +69 -0
  618. package/lib/oidc/tokenRefresher.d.ts.map +1 -0
  619. package/lib/oidc/tokenRefresher.js +148 -0
  620. package/lib/oidc/tokenRefresher.js.map +1 -0
  621. package/lib/oidc/validate.d.ts +90 -0
  622. package/lib/oidc/validate.d.ts.map +1 -0
  623. package/lib/oidc/validate.js +194 -0
  624. package/lib/oidc/validate.js.map +1 -0
  625. package/lib/pushprocessor.d.ts +128 -0
  626. package/lib/pushprocessor.d.ts.map +1 -0
  627. package/lib/pushprocessor.js +685 -0
  628. package/lib/pushprocessor.js.map +1 -0
  629. package/lib/randomstring.d.ts +5 -0
  630. package/lib/randomstring.d.ts.map +1 -0
  631. package/lib/randomstring.js +43 -0
  632. package/lib/randomstring.js.map +1 -0
  633. package/lib/realtime-callbacks.d.ts +18 -0
  634. package/lib/realtime-callbacks.d.ts.map +1 -0
  635. package/lib/realtime-callbacks.js +177 -0
  636. package/lib/realtime-callbacks.js.map +1 -0
  637. package/lib/receipt-accumulator.d.ts +51 -0
  638. package/lib/receipt-accumulator.d.ts.map +1 -0
  639. package/lib/receipt-accumulator.js +164 -0
  640. package/lib/receipt-accumulator.js.map +1 -0
  641. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +112 -0
  642. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -0
  643. package/lib/rendezvous/MSC4108SignInWithQR.js +392 -0
  644. package/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -0
  645. package/lib/rendezvous/RendezvousChannel.d.ts +27 -0
  646. package/lib/rendezvous/RendezvousChannel.d.ts.map +1 -0
  647. package/lib/rendezvous/RendezvousChannel.js +1 -0
  648. package/lib/rendezvous/RendezvousChannel.js.map +1 -0
  649. package/lib/rendezvous/RendezvousCode.d.ts +9 -0
  650. package/lib/rendezvous/RendezvousCode.d.ts.map +1 -0
  651. package/lib/rendezvous/RendezvousCode.js +1 -0
  652. package/lib/rendezvous/RendezvousCode.js.map +1 -0
  653. package/lib/rendezvous/RendezvousError.d.ts +6 -0
  654. package/lib/rendezvous/RendezvousError.d.ts.map +1 -0
  655. package/lib/rendezvous/RendezvousError.js +23 -0
  656. package/lib/rendezvous/RendezvousError.js.map +1 -0
  657. package/lib/rendezvous/RendezvousFailureReason.d.ts +31 -0
  658. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +1 -0
  659. package/lib/rendezvous/RendezvousFailureReason.js +38 -0
  660. package/lib/rendezvous/RendezvousFailureReason.js.map +1 -0
  661. package/lib/rendezvous/RendezvousIntent.d.ts +5 -0
  662. package/lib/rendezvous/RendezvousIntent.d.ts.map +1 -0
  663. package/lib/rendezvous/RendezvousIntent.js +22 -0
  664. package/lib/rendezvous/RendezvousIntent.js.map +1 -0
  665. package/lib/rendezvous/RendezvousTransport.d.ts +36 -0
  666. package/lib/rendezvous/RendezvousTransport.d.ts.map +1 -0
  667. package/lib/rendezvous/RendezvousTransport.js +1 -0
  668. package/lib/rendezvous/RendezvousTransport.js.map +1 -0
  669. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +58 -0
  670. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +1 -0
  671. package/lib/rendezvous/channels/MSC4108SecureChannel.js +246 -0
  672. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -0
  673. package/lib/rendezvous/channels/index.d.ts +2 -0
  674. package/lib/rendezvous/channels/index.d.ts.map +1 -0
  675. package/lib/rendezvous/channels/index.js +18 -0
  676. package/lib/rendezvous/channels/index.js.map +1 -0
  677. package/lib/rendezvous/index.d.ts +10 -0
  678. package/lib/rendezvous/index.d.ts.map +1 -0
  679. package/lib/rendezvous/index.js +23 -0
  680. package/lib/rendezvous/index.js.map +1 -0
  681. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +61 -0
  682. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +1 -0
  683. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +253 -0
  684. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -0
  685. package/lib/rendezvous/transports/index.d.ts +2 -0
  686. package/lib/rendezvous/transports/index.d.ts.map +1 -0
  687. package/lib/rendezvous/transports/index.js +18 -0
  688. package/lib/rendezvous/transports/index.js.map +1 -0
  689. package/lib/room-hierarchy.d.ts +35 -0
  690. package/lib/room-hierarchy.d.ts.map +1 -0
  691. package/lib/room-hierarchy.js +136 -0
  692. package/lib/room-hierarchy.js.map +1 -0
  693. package/lib/rust-crypto/CrossSigningIdentity.d.ts +33 -0
  694. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +1 -0
  695. package/lib/rust-crypto/CrossSigningIdentity.js +157 -0
  696. package/lib/rust-crypto/CrossSigningIdentity.js.map +1 -0
  697. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +98 -0
  698. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +1 -0
  699. package/lib/rust-crypto/DehydratedDeviceManager.js +285 -0
  700. package/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -0
  701. package/lib/rust-crypto/KeyClaimManager.d.ts +33 -0
  702. package/lib/rust-crypto/KeyClaimManager.d.ts.map +1 -0
  703. package/lib/rust-crypto/KeyClaimManager.js +82 -0
  704. package/lib/rust-crypto/KeyClaimManager.js.map +1 -0
  705. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +43 -0
  706. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -0
  707. package/lib/rust-crypto/OutgoingRequestProcessor.js +195 -0
  708. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -0
  709. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +47 -0
  710. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +1 -0
  711. package/lib/rust-crypto/OutgoingRequestsManager.js +148 -0
  712. package/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -0
  713. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +120 -0
  714. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +1 -0
  715. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +467 -0
  716. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -0
  717. package/lib/rust-crypto/RoomEncryptor.d.ts +98 -0
  718. package/lib/rust-crypto/RoomEncryptor.d.ts.map +1 -0
  719. package/lib/rust-crypto/RoomEncryptor.js +299 -0
  720. package/lib/rust-crypto/RoomEncryptor.js.map +1 -0
  721. package/lib/rust-crypto/backup.d.ts +254 -0
  722. package/lib/rust-crypto/backup.d.ts.map +1 -0
  723. package/lib/rust-crypto/backup.js +837 -0
  724. package/lib/rust-crypto/backup.js.map +1 -0
  725. package/lib/rust-crypto/constants.d.ts +3 -0
  726. package/lib/rust-crypto/constants.d.ts.map +1 -0
  727. package/lib/rust-crypto/constants.js +19 -0
  728. package/lib/rust-crypto/constants.js.map +1 -0
  729. package/lib/rust-crypto/device-converter.d.ts +28 -0
  730. package/lib/rust-crypto/device-converter.d.ts.map +1 -0
  731. package/lib/rust-crypto/device-converter.js +123 -0
  732. package/lib/rust-crypto/device-converter.js.map +1 -0
  733. package/lib/rust-crypto/index.d.ts +61 -0
  734. package/lib/rust-crypto/index.d.ts.map +1 -0
  735. package/lib/rust-crypto/index.js +152 -0
  736. package/lib/rust-crypto/index.js.map +1 -0
  737. package/lib/rust-crypto/libolm_migration.d.ts +81 -0
  738. package/lib/rust-crypto/libolm_migration.d.ts.map +1 -0
  739. package/lib/rust-crypto/libolm_migration.js +459 -0
  740. package/lib/rust-crypto/libolm_migration.js.map +1 -0
  741. package/lib/rust-crypto/rust-crypto.d.ts +556 -0
  742. package/lib/rust-crypto/rust-crypto.d.ts.map +1 -0
  743. package/lib/rust-crypto/rust-crypto.js +2016 -0
  744. package/lib/rust-crypto/rust-crypto.js.map +1 -0
  745. package/lib/rust-crypto/secret-storage.d.ts +22 -0
  746. package/lib/rust-crypto/secret-storage.d.ts.map +1 -0
  747. package/lib/rust-crypto/secret-storage.js +63 -0
  748. package/lib/rust-crypto/secret-storage.js.map +1 -0
  749. package/lib/rust-crypto/verification.d.ts +319 -0
  750. package/lib/rust-crypto/verification.d.ts.map +1 -0
  751. package/lib/rust-crypto/verification.js +816 -0
  752. package/lib/rust-crypto/verification.js.map +1 -0
  753. package/lib/scheduler.d.ts +132 -0
  754. package/lib/scheduler.d.ts.map +1 -0
  755. package/lib/scheduler.js +259 -0
  756. package/lib/scheduler.js.map +1 -0
  757. package/lib/secret-storage.d.ts +370 -0
  758. package/lib/secret-storage.d.ts.map +1 -0
  759. package/lib/secret-storage.js +466 -0
  760. package/lib/secret-storage.js.map +1 -0
  761. package/lib/serverCapabilities.d.ts +72 -0
  762. package/lib/serverCapabilities.d.ts.map +1 -0
  763. package/lib/serverCapabilities.js +105 -0
  764. package/lib/serverCapabilities.js.map +1 -0
  765. package/lib/service-types.d.ts +5 -0
  766. package/lib/service-types.d.ts.map +1 -0
  767. package/lib/service-types.js +22 -0
  768. package/lib/service-types.js.map +1 -0
  769. package/lib/sliding-sync-sdk.d.ts +107 -0
  770. package/lib/sliding-sync-sdk.d.ts.map +1 -0
  771. package/lib/sliding-sync-sdk.js +903 -0
  772. package/lib/sliding-sync-sdk.js.map +1 -0
  773. package/lib/sliding-sync.d.ts +343 -0
  774. package/lib/sliding-sync.d.ts.map +1 -0
  775. package/lib/sliding-sync.js +817 -0
  776. package/lib/sliding-sync.js.map +1 -0
  777. package/lib/store/index.d.ts +201 -0
  778. package/lib/store/index.d.ts.map +1 -0
  779. package/lib/store/index.js +1 -0
  780. package/lib/store/index.js.map +1 -0
  781. package/lib/store/indexeddb-backend.d.ts +24 -0
  782. package/lib/store/indexeddb-backend.d.ts.map +1 -0
  783. package/lib/store/indexeddb-backend.js +1 -0
  784. package/lib/store/indexeddb-backend.js.map +1 -0
  785. package/lib/store/indexeddb-local-backend.d.ts +129 -0
  786. package/lib/store/indexeddb-local-backend.d.ts.map +1 -0
  787. package/lib/store/indexeddb-local-backend.js +597 -0
  788. package/lib/store/indexeddb-local-backend.js.map +1 -0
  789. package/lib/store/indexeddb-remote-backend.d.ts +79 -0
  790. package/lib/store/indexeddb-remote-backend.d.ts.map +1 -0
  791. package/lib/store/indexeddb-remote-backend.js +210 -0
  792. package/lib/store/indexeddb-remote-backend.js.map +1 -0
  793. package/lib/store/indexeddb-store-worker.d.ts +35 -0
  794. package/lib/store/indexeddb-store-worker.d.ts.map +1 -0
  795. package/lib/store/indexeddb-store-worker.js +146 -0
  796. package/lib/store/indexeddb-store-worker.js.map +1 -0
  797. package/lib/store/indexeddb.d.ts +142 -0
  798. package/lib/store/indexeddb.d.ts.map +1 -0
  799. package/lib/store/indexeddb.js +347 -0
  800. package/lib/store/indexeddb.js.map +1 -0
  801. package/lib/store/local-storage-events-emitter.d.ts +30 -0
  802. package/lib/store/local-storage-events-emitter.d.ts.map +1 -0
  803. package/lib/store/local-storage-events-emitter.js +37 -0
  804. package/lib/store/local-storage-events-emitter.js.map +1 -0
  805. package/lib/store/memory.d.ts +209 -0
  806. package/lib/store/memory.d.ts.map +1 -0
  807. package/lib/store/memory.js +432 -0
  808. package/lib/store/memory.js.map +1 -0
  809. package/lib/store/stub.d.ts +161 -0
  810. package/lib/store/stub.d.ts.map +1 -0
  811. package/lib/store/stub.js +268 -0
  812. package/lib/store/stub.js.map +1 -0
  813. package/lib/sync-accumulator.d.ts +172 -0
  814. package/lib/sync-accumulator.d.ts.map +1 -0
  815. package/lib/sync-accumulator.js +532 -0
  816. package/lib/sync-accumulator.js.map +1 -0
  817. package/lib/sync.d.ts +260 -0
  818. package/lib/sync.d.ts.map +1 -0
  819. package/lib/sync.js +1686 -0
  820. package/lib/sync.js.map +1 -0
  821. package/lib/testing.d.ts +81 -0
  822. package/lib/testing.d.ts.map +1 -0
  823. package/lib/testing.js +162 -0
  824. package/lib/testing.js.map +1 -0
  825. package/lib/thread-utils.d.ts +10 -0
  826. package/lib/thread-utils.d.ts.map +1 -0
  827. package/lib/thread-utils.js +31 -0
  828. package/lib/thread-utils.js.map +1 -0
  829. package/lib/timeline-window.d.ts +168 -0
  830. package/lib/timeline-window.d.ts.map +1 -0
  831. package/lib/timeline-window.js +494 -0
  832. package/lib/timeline-window.js.map +1 -0
  833. package/lib/types.d.ts +33 -0
  834. package/lib/types.d.ts.map +1 -0
  835. package/lib/types.js +33 -0
  836. package/lib/types.js.map +1 -0
  837. package/lib/utils/decryptAESSecretStorageItem.d.ts +12 -0
  838. package/lib/utils/decryptAESSecretStorageItem.d.ts.map +1 -0
  839. package/lib/utils/decryptAESSecretStorageItem.js +50 -0
  840. package/lib/utils/decryptAESSecretStorageItem.js.map +1 -0
  841. package/lib/utils/encryptAESSecretStorageItem.d.ts +16 -0
  842. package/lib/utils/encryptAESSecretStorageItem.d.ts.map +1 -0
  843. package/lib/utils/encryptAESSecretStorageItem.js +68 -0
  844. package/lib/utils/encryptAESSecretStorageItem.js.map +1 -0
  845. package/lib/utils/internal/deriveKeys.d.ts +10 -0
  846. package/lib/utils/internal/deriveKeys.d.ts.map +1 -0
  847. package/lib/utils/internal/deriveKeys.js +60 -0
  848. package/lib/utils/internal/deriveKeys.js.map +1 -0
  849. package/lib/utils.d.ts +267 -0
  850. package/lib/utils.d.ts.map +1 -0
  851. package/lib/utils.js +749 -0
  852. package/lib/utils.js.map +1 -0
  853. package/lib/version-support.d.ts +19 -0
  854. package/lib/version-support.d.ts.map +1 -0
  855. package/lib/version-support.js +37 -0
  856. package/lib/version-support.js.map +1 -0
  857. package/lib/webrtc/audioContext.d.ts +15 -0
  858. package/lib/webrtc/audioContext.d.ts.map +1 -0
  859. package/lib/webrtc/audioContext.js +46 -0
  860. package/lib/webrtc/audioContext.js.map +1 -0
  861. package/lib/webrtc/call.d.ts +560 -0
  862. package/lib/webrtc/call.d.ts.map +1 -0
  863. package/lib/webrtc/call.js +2541 -0
  864. package/lib/webrtc/call.js.map +1 -0
  865. package/lib/webrtc/callEventHandler.d.ts +37 -0
  866. package/lib/webrtc/callEventHandler.d.ts.map +1 -0
  867. package/lib/webrtc/callEventHandler.js +344 -0
  868. package/lib/webrtc/callEventHandler.js.map +1 -0
  869. package/lib/webrtc/callEventTypes.d.ts +73 -0
  870. package/lib/webrtc/callEventTypes.d.ts.map +1 -0
  871. package/lib/webrtc/callEventTypes.js +13 -0
  872. package/lib/webrtc/callEventTypes.js.map +1 -0
  873. package/lib/webrtc/callFeed.d.ts +128 -0
  874. package/lib/webrtc/callFeed.d.ts.map +1 -0
  875. package/lib/webrtc/callFeed.js +289 -0
  876. package/lib/webrtc/callFeed.js.map +1 -0
  877. package/lib/webrtc/groupCall.d.ts +323 -0
  878. package/lib/webrtc/groupCall.d.ts.map +1 -0
  879. package/lib/webrtc/groupCall.js +1337 -0
  880. package/lib/webrtc/groupCall.js.map +1 -0
  881. package/lib/webrtc/groupCallEventHandler.d.ts +31 -0
  882. package/lib/webrtc/groupCallEventHandler.d.ts.map +1 -0
  883. package/lib/webrtc/groupCallEventHandler.js +178 -0
  884. package/lib/webrtc/groupCallEventHandler.js.map +1 -0
  885. package/lib/webrtc/mediaHandler.d.ts +89 -0
  886. package/lib/webrtc/mediaHandler.d.ts.map +1 -0
  887. package/lib/webrtc/mediaHandler.js +437 -0
  888. package/lib/webrtc/mediaHandler.js.map +1 -0
  889. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +8 -0
  890. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +1 -0
  891. package/lib/webrtc/stats/callFeedStatsReporter.js +82 -0
  892. package/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -0
  893. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +25 -0
  894. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +1 -0
  895. package/lib/webrtc/stats/callStatsReportGatherer.js +199 -0
  896. package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -0
  897. package/lib/webrtc/stats/callStatsReportSummary.d.ts +17 -0
  898. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +1 -0
  899. package/lib/webrtc/stats/callStatsReportSummary.js +1 -0
  900. package/lib/webrtc/stats/callStatsReportSummary.js.map +1 -0
  901. package/lib/webrtc/stats/connectionStats.d.ts +28 -0
  902. package/lib/webrtc/stats/connectionStats.d.ts.map +1 -0
  903. package/lib/webrtc/stats/connectionStats.js +26 -0
  904. package/lib/webrtc/stats/connectionStats.js.map +1 -0
  905. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +5 -0
  906. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +1 -0
  907. package/lib/webrtc/stats/connectionStatsBuilder.js +27 -0
  908. package/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -0
  909. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +7 -0
  910. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +1 -0
  911. package/lib/webrtc/stats/connectionStatsReportBuilder.js +121 -0
  912. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -0
  913. package/lib/webrtc/stats/groupCallStats.d.ts +22 -0
  914. package/lib/webrtc/stats/groupCallStats.d.ts.map +1 -0
  915. package/lib/webrtc/stats/groupCallStats.js +78 -0
  916. package/lib/webrtc/stats/groupCallStats.js.map +1 -0
  917. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +10 -0
  918. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +1 -0
  919. package/lib/webrtc/stats/media/mediaSsrcHandler.js +57 -0
  920. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -0
  921. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +12 -0
  922. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +1 -0
  923. package/lib/webrtc/stats/media/mediaTrackHandler.js +62 -0
  924. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -0
  925. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +86 -0
  926. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +1 -0
  927. package/lib/webrtc/stats/media/mediaTrackStats.js +142 -0
  928. package/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -0
  929. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +22 -0
  930. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +1 -0
  931. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +76 -0
  932. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -0
  933. package/lib/webrtc/stats/statsReport.d.ts +99 -0
  934. package/lib/webrtc/stats/statsReport.d.ts.map +1 -0
  935. package/lib/webrtc/stats/statsReport.js +32 -0
  936. package/lib/webrtc/stats/statsReport.js.map +1 -0
  937. package/lib/webrtc/stats/statsReportEmitter.d.ts +15 -0
  938. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +1 -0
  939. package/lib/webrtc/stats/statsReportEmitter.js +33 -0
  940. package/lib/webrtc/stats/statsReportEmitter.js.map +1 -0
  941. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +16 -0
  942. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +1 -0
  943. package/lib/webrtc/stats/summaryStatsReportGatherer.js +116 -0
  944. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +1 -0
  945. package/lib/webrtc/stats/trackStatsBuilder.d.ts +19 -0
  946. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +1 -0
  947. package/lib/webrtc/stats/trackStatsBuilder.js +168 -0
  948. package/lib/webrtc/stats/trackStatsBuilder.js.map +1 -0
  949. package/lib/webrtc/stats/transportStats.d.ts +11 -0
  950. package/lib/webrtc/stats/transportStats.d.ts.map +1 -0
  951. package/lib/webrtc/stats/transportStats.js +1 -0
  952. package/lib/webrtc/stats/transportStats.js.map +1 -0
  953. package/lib/webrtc/stats/transportStatsBuilder.d.ts +5 -0
  954. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +1 -0
  955. package/lib/webrtc/stats/transportStatsBuilder.js +34 -0
  956. package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -0
  957. package/lib/webrtc/stats/valueFormatter.d.ts +4 -0
  958. package/lib/webrtc/stats/valueFormatter.d.ts.map +1 -0
  959. package/lib/webrtc/stats/valueFormatter.js +25 -0
  960. package/lib/webrtc/stats/valueFormatter.js.map +1 -0
  961. package/package.json +134 -0
  962. package/src/@types/AESEncryptedSecretStoragePayload.ts +29 -0
  963. package/src/@types/IIdentityServerProvider.ts +24 -0
  964. package/src/@types/PushRules.ts +209 -0
  965. package/src/@types/another-json.d.ts +19 -0
  966. package/src/@types/auth.ts +252 -0
  967. package/src/@types/beacon.ts +140 -0
  968. package/src/@types/common.ts +22 -0
  969. package/src/@types/crypto.ts +73 -0
  970. package/src/@types/event.ts +370 -0
  971. package/src/@types/events.ts +119 -0
  972. package/src/@types/extensible_events.ts +150 -0
  973. package/src/@types/global.d.ts +70 -0
  974. package/src/@types/local_notifications.ts +19 -0
  975. package/src/@types/location.ts +92 -0
  976. package/src/@types/matrix-sdk-crypto-wasm.d.ts +44 -0
  977. package/src/@types/media.ts +245 -0
  978. package/src/@types/membership.ts +57 -0
  979. package/src/@types/oidc-client-ts.d.ts +24 -0
  980. package/src/@types/partials.ts +67 -0
  981. package/src/@types/polls.ts +119 -0
  982. package/src/@types/read_receipts.ts +61 -0
  983. package/src/@types/registration.ts +102 -0
  984. package/src/@types/requests.ts +314 -0
  985. package/src/@types/search.ts +119 -0
  986. package/src/@types/signed.ts +25 -0
  987. package/src/@types/spaces.ts +37 -0
  988. package/src/@types/state_events.ts +147 -0
  989. package/src/@types/synapse.ts +40 -0
  990. package/src/@types/sync.ts +27 -0
  991. package/src/@types/threepids.ts +29 -0
  992. package/src/@types/topic.ts +63 -0
  993. package/src/@types/uia.ts +29 -0
  994. package/src/NamespacedValue.ts +123 -0
  995. package/src/ReEmitter.ts +93 -0
  996. package/src/ToDeviceMessageQueue.ts +153 -0
  997. package/src/autodiscovery.ts +505 -0
  998. package/src/base64.ts +88 -0
  999. package/src/browser-index.ts +44 -0
  1000. package/src/client.ts +10474 -0
  1001. package/src/common-crypto/CryptoBackend.ts +302 -0
  1002. package/src/common-crypto/README.md +4 -0
  1003. package/src/common-crypto/key-passphrase.ts +43 -0
  1004. package/src/content-helpers.ts +288 -0
  1005. package/src/content-repo.ts +117 -0
  1006. package/src/crypto/CrossSigning.ts +773 -0
  1007. package/src/crypto/DeviceList.ts +989 -0
  1008. package/src/crypto/EncryptionSetup.ts +351 -0
  1009. package/src/crypto/OlmDevice.ts +1500 -0
  1010. package/src/crypto/OutgoingRoomKeyRequestManager.ts +485 -0
  1011. package/src/crypto/RoomList.ts +70 -0
  1012. package/src/crypto/SecretSharing.ts +240 -0
  1013. package/src/crypto/SecretStorage.ts +136 -0
  1014. package/src/crypto/aes.ts +23 -0
  1015. package/src/crypto/algorithms/base.ts +236 -0
  1016. package/src/crypto/algorithms/index.ts +20 -0
  1017. package/src/crypto/algorithms/megolm.ts +2216 -0
  1018. package/src/crypto/algorithms/olm.ts +381 -0
  1019. package/src/crypto/api.ts +70 -0
  1020. package/src/crypto/backup.ts +922 -0
  1021. package/src/crypto/crypto.ts +18 -0
  1022. package/src/crypto/dehydration.ts +272 -0
  1023. package/src/crypto/device-converter.ts +45 -0
  1024. package/src/crypto/deviceinfo.ts +158 -0
  1025. package/src/crypto/index.ts +4414 -0
  1026. package/src/crypto/key_passphrase.ts +42 -0
  1027. package/src/crypto/keybackup.ts +47 -0
  1028. package/src/crypto/olmlib.ts +539 -0
  1029. package/src/crypto/recoverykey.ts +18 -0
  1030. package/src/crypto/store/base.ts +348 -0
  1031. package/src/crypto/store/indexeddb-crypto-store-backend.ts +1250 -0
  1032. package/src/crypto/store/indexeddb-crypto-store.ts +845 -0
  1033. package/src/crypto/store/localStorage-crypto-store.ts +579 -0
  1034. package/src/crypto/store/memory-crypto-store.ts +680 -0
  1035. package/src/crypto/verification/Base.ts +409 -0
  1036. package/src/crypto/verification/Error.ts +76 -0
  1037. package/src/crypto/verification/IllegalMethod.ts +50 -0
  1038. package/src/crypto/verification/QRCode.ts +310 -0
  1039. package/src/crypto/verification/SAS.ts +494 -0
  1040. package/src/crypto/verification/SASDecimal.ts +37 -0
  1041. package/src/crypto/verification/request/Channel.ts +34 -0
  1042. package/src/crypto/verification/request/InRoomChannel.ts +371 -0
  1043. package/src/crypto/verification/request/ToDeviceChannel.ts +354 -0
  1044. package/src/crypto/verification/request/VerificationRequest.ts +976 -0
  1045. package/src/crypto-api/CryptoEvent.ts +93 -0
  1046. package/src/crypto-api/CryptoEventHandlerMap.ts +32 -0
  1047. package/src/crypto-api/index.ts +1175 -0
  1048. package/src/crypto-api/key-passphrase.ts +58 -0
  1049. package/src/crypto-api/keybackup.ts +115 -0
  1050. package/src/crypto-api/recovery-key.ts +69 -0
  1051. package/src/crypto-api/verification.ts +408 -0
  1052. package/src/digest.ts +34 -0
  1053. package/src/embedded.ts +631 -0
  1054. package/src/errors.ts +54 -0
  1055. package/src/event-mapper.ts +97 -0
  1056. package/src/extensible_events_v1/ExtensibleEvent.ts +58 -0
  1057. package/src/extensible_events_v1/InvalidEventError.ts +24 -0
  1058. package/src/extensible_events_v1/MessageEvent.ts +145 -0
  1059. package/src/extensible_events_v1/PollEndEvent.ts +97 -0
  1060. package/src/extensible_events_v1/PollResponseEvent.ts +148 -0
  1061. package/src/extensible_events_v1/PollStartEvent.ts +207 -0
  1062. package/src/extensible_events_v1/utilities.ts +35 -0
  1063. package/src/feature.ts +87 -0
  1064. package/src/filter-component.ts +207 -0
  1065. package/src/filter.ts +245 -0
  1066. package/src/http-api/errors.ts +199 -0
  1067. package/src/http-api/fetch.ts +383 -0
  1068. package/src/http-api/index.ts +191 -0
  1069. package/src/http-api/interface.ts +178 -0
  1070. package/src/http-api/method.ts +25 -0
  1071. package/src/http-api/prefix.ts +48 -0
  1072. package/src/http-api/utils.ts +200 -0
  1073. package/src/index.ts +25 -0
  1074. package/src/indexeddb-helpers.ts +50 -0
  1075. package/src/indexeddb-worker.ts +24 -0
  1076. package/src/interactive-auth.ts +694 -0
  1077. package/src/logger.ts +185 -0
  1078. package/src/matrix.ts +177 -0
  1079. package/src/matrixrtc/CallMembership.ts +247 -0
  1080. package/src/matrixrtc/LivekitFocus.ts +39 -0
  1081. package/src/matrixrtc/MatrixRTCSession.ts +1319 -0
  1082. package/src/matrixrtc/MatrixRTCSessionManager.ts +166 -0
  1083. package/src/matrixrtc/focus.ts +25 -0
  1084. package/src/matrixrtc/index.ts +22 -0
  1085. package/src/matrixrtc/types.ts +36 -0
  1086. package/src/models/MSC3089Branch.ts +272 -0
  1087. package/src/models/MSC3089TreeSpace.ts +565 -0
  1088. package/src/models/ToDeviceMessage.ts +38 -0
  1089. package/src/models/beacon.ts +214 -0
  1090. package/src/models/compare-event-ordering.ts +139 -0
  1091. package/src/models/device.ts +85 -0
  1092. package/src/models/event-context.ts +110 -0
  1093. package/src/models/event-status.ts +39 -0
  1094. package/src/models/event-timeline-set.ts +979 -0
  1095. package/src/models/event-timeline.ts +476 -0
  1096. package/src/models/event.ts +1751 -0
  1097. package/src/models/invites-ignorer.ts +376 -0
  1098. package/src/models/poll.ts +285 -0
  1099. package/src/models/profile-keys.ts +7 -0
  1100. package/src/models/read-receipt.ts +422 -0
  1101. package/src/models/related-relations.ts +39 -0
  1102. package/src/models/relations-container.ts +149 -0
  1103. package/src/models/relations.ts +368 -0
  1104. package/src/models/room-member.ts +457 -0
  1105. package/src/models/room-receipts.ts +439 -0
  1106. package/src/models/room-state.ts +1130 -0
  1107. package/src/models/room-summary.ts +47 -0
  1108. package/src/models/room.ts +3822 -0
  1109. package/src/models/search-result.ts +57 -0
  1110. package/src/models/thread.ts +923 -0
  1111. package/src/models/typed-event-emitter.ts +246 -0
  1112. package/src/models/user.ts +302 -0
  1113. package/src/oidc/authorize.ts +274 -0
  1114. package/src/oidc/discovery.ts +60 -0
  1115. package/src/oidc/error.ts +33 -0
  1116. package/src/oidc/index.ts +34 -0
  1117. package/src/oidc/register.ts +123 -0
  1118. package/src/oidc/tokenRefresher.ts +149 -0
  1119. package/src/oidc/validate.ts +282 -0
  1120. package/src/pushprocessor.ts +837 -0
  1121. package/src/randomstring.ts +51 -0
  1122. package/src/realtime-callbacks.ts +191 -0
  1123. package/src/receipt-accumulator.ts +189 -0
  1124. package/src/rendezvous/MSC4108SignInWithQR.ts +444 -0
  1125. package/src/rendezvous/RendezvousChannel.ts +48 -0
  1126. package/src/rendezvous/RendezvousCode.ts +25 -0
  1127. package/src/rendezvous/RendezvousError.ts +26 -0
  1128. package/src/rendezvous/RendezvousFailureReason.ts +49 -0
  1129. package/src/rendezvous/RendezvousIntent.ts +20 -0
  1130. package/src/rendezvous/RendezvousTransport.ts +58 -0
  1131. package/src/rendezvous/channels/MSC4108SecureChannel.ts +270 -0
  1132. package/src/rendezvous/channels/index.ts +17 -0
  1133. package/src/rendezvous/index.ts +25 -0
  1134. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +270 -0
  1135. package/src/rendezvous/transports/index.ts +17 -0
  1136. package/src/room-hierarchy.ts +152 -0
  1137. package/src/rust-crypto/CrossSigningIdentity.ts +183 -0
  1138. package/src/rust-crypto/DehydratedDeviceManager.ts +306 -0
  1139. package/src/rust-crypto/KeyClaimManager.ts +86 -0
  1140. package/src/rust-crypto/OutgoingRequestProcessor.ts +236 -0
  1141. package/src/rust-crypto/OutgoingRequestsManager.ts +143 -0
  1142. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +501 -0
  1143. package/src/rust-crypto/RoomEncryptor.ts +352 -0
  1144. package/src/rust-crypto/backup.ts +881 -0
  1145. package/src/rust-crypto/constants.ts +18 -0
  1146. package/src/rust-crypto/device-converter.ts +128 -0
  1147. package/src/rust-crypto/index.ts +237 -0
  1148. package/src/rust-crypto/libolm_migration.ts +530 -0
  1149. package/src/rust-crypto/rust-crypto.ts +2205 -0
  1150. package/src/rust-crypto/secret-storage.ts +60 -0
  1151. package/src/rust-crypto/verification.ts +830 -0
  1152. package/src/scheduler.ts +309 -0
  1153. package/src/secret-storage.ts +693 -0
  1154. package/src/serverCapabilities.ts +139 -0
  1155. package/src/service-types.ts +20 -0
  1156. package/src/sliding-sync-sdk.ts +1026 -0
  1157. package/src/sliding-sync.ts +965 -0
  1158. package/src/store/index.ts +261 -0
  1159. package/src/store/indexeddb-backend.ts +41 -0
  1160. package/src/store/indexeddb-local-backend.ts +610 -0
  1161. package/src/store/indexeddb-remote-backend.ts +213 -0
  1162. package/src/store/indexeddb-store-worker.ts +157 -0
  1163. package/src/store/indexeddb.ts +397 -0
  1164. package/src/store/local-storage-events-emitter.ts +46 -0
  1165. package/src/store/memory.ts +448 -0
  1166. package/src/store/stub.ts +280 -0
  1167. package/src/sync-accumulator.ts +689 -0
  1168. package/src/sync.ts +1920 -0
  1169. package/src/testing.ts +191 -0
  1170. package/src/thread-utils.ts +31 -0
  1171. package/src/timeline-window.ts +536 -0
  1172. package/src/types.ts +59 -0
  1173. package/src/utils/decryptAESSecretStorageItem.ts +54 -0
  1174. package/src/utils/encryptAESSecretStorageItem.ts +73 -0
  1175. package/src/utils/internal/deriveKeys.ts +63 -0
  1176. package/src/utils.ts +763 -0
  1177. package/src/version-support.ts +36 -0
  1178. package/src/webrtc/audioContext.ts +44 -0
  1179. package/src/webrtc/call.ts +3074 -0
  1180. package/src/webrtc/callEventHandler.ts +425 -0
  1181. package/src/webrtc/callEventTypes.ts +93 -0
  1182. package/src/webrtc/callFeed.ts +364 -0
  1183. package/src/webrtc/groupCall.ts +1735 -0
  1184. package/src/webrtc/groupCallEventHandler.ts +234 -0
  1185. package/src/webrtc/mediaHandler.ts +484 -0
  1186. package/src/webrtc/stats/callFeedStatsReporter.ts +94 -0
  1187. package/src/webrtc/stats/callStatsReportGatherer.ts +219 -0
  1188. package/src/webrtc/stats/callStatsReportSummary.ts +30 -0
  1189. package/src/webrtc/stats/connectionStats.ts +47 -0
  1190. package/src/webrtc/stats/connectionStatsBuilder.ts +28 -0
  1191. package/src/webrtc/stats/connectionStatsReportBuilder.ts +140 -0
  1192. package/src/webrtc/stats/groupCallStats.ts +93 -0
  1193. package/src/webrtc/stats/media/mediaSsrcHandler.ts +57 -0
  1194. package/src/webrtc/stats/media/mediaTrackHandler.ts +76 -0
  1195. package/src/webrtc/stats/media/mediaTrackStats.ts +176 -0
  1196. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +90 -0
  1197. package/src/webrtc/stats/statsReport.ts +133 -0
  1198. package/src/webrtc/stats/statsReportEmitter.ts +49 -0
  1199. package/src/webrtc/stats/summaryStatsReportGatherer.ts +148 -0
  1200. package/src/webrtc/stats/trackStatsBuilder.ts +207 -0
  1201. package/src/webrtc/stats/transportStats.ts +26 -0
  1202. package/src/webrtc/stats/transportStatsBuilder.ts +48 -0
  1203. package/src/webrtc/stats/valueFormatter.ts +27 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupCall.js","names":["TypedEventEmitter","CallFeed","SPEAKING_THRESHOLD","CallErrorCode","CallEvent","CallState","genCallID","setTracksEnabled","createNewMatrixCall","CallError","RoomStateEvent","logger","ReEmitter","SDPStreamMetadataPurpose","EventType","CallEventHandlerEvent","GroupCallEventHandlerEvent","mapsEqual","GroupCallStats","StatsReport","SummaryStatsReportGatherer","CallFeedStatsReporter","KnownMembership","GroupCallIntent","GroupCallType","GroupCallTerminationReason","GroupCallEvent","GroupCallStatsReportEvent","GroupCallErrorCode","GroupCallError","Error","constructor","code","msg","err","_defineProperty","GroupCallUnknownDeviceError","userId","UnknownDevice","OtherUserSpeakingError","GroupCallState","DEVICE_TIMEOUT","getCallUserId","call","_call$getOpponentMemb","getOpponentMember","invitee","GroupCall","client","room","type","isPtt","intent","groupCallId","dataChannelsEnabled","dataChannelOptions","isCallWithoutVideoAndAudio","_room$currentState$ge","_room$currentState$ge2","useLivekit","arguments","length","undefined","livekitServiceURL","Map","report","emit","ConnectionStats","ByteSentStats","extendSummaryReport","participants","SummaryStats","localCallFeed","expandCallFeedReport","callFeeds","forEachCall","callId","getFeeds","forEach","f","push","CallFeedStats","LocalCallFeedUninitialized","newCall","_newCall$getOpponentM","_this$calls$get","roomId","state","Ringing","warn","concat","log","reject","opponentUserId","info","deviceMap","calls","get","prevCall","getOpponentDeviceId","hangup","Replaced","set","initCall","feeds","getLocalFeeds","map","feed","clone","callExpected","stream","getAudioTracks","getVideoTracks","answerWithCallFeeds","CallsChanged","needsRetry","participantMap","callMap","retriesMap","retryCallCounts","deviceId","participant","_retriesMap$get","_retriesMap","retries","getOpponentSessionId","sessionId","wantsOutgoingCall","placeOutgoingCalls","opponentMemberId","opponentDeviceId","currentUserMediaFeed","getUserMediaFeed","remoteUsermediaFeed","remoteFeedChanged","currentCallForUserDevice","addUserMediaFeed","replaceUserMediaFeed","removeUserMediaFeed","currentScreenshareFeed","getScreenshareFeed","remoteScreensharingFeed","remoteScreenshareFeedChanged","addScreenshareFeed","replaceScreenshareFeed","removeScreenshareFeed","_oldState","_call$getOpponentMemb2","Ended","audioMuted","isAudioMuted","localUsermediaStream","isMicrophoneMuted","setMicrophoneMuted","videoMuted","isVideoMuted","isLocalVideoMuted","setLocalVideoMuted","Connected","delete","size","_call$getOpponentMemb3","_call$getOpponentMemb4","hangupReason","getMember","disposeCall","topAvg","nextActiveSpeaker","callFeed","userMediaFeeds","isLocal","total","speakingVolumeSamples","reduce","acc","volume","Math","max","avg","activeSpeaker","ActiveSpeakerChanged","updateParticipants","expected","Entered","newState","oldState","updateMemberState","catch","e","error","reEmitter","_livekitServiceURL","creationTs","currentState","getStateEvents","GroupCallPrefix","getTs","on","Update","onRoomState","ParticipantsChanged","onParticipantsChanged","GroupCallStateChanged","onStateChanged","LocalScreenshareStateChanged","onLocalFeedsChanged","allowCallWithoutVideoAndAudio","create","_this","_asyncToGenerator","Date","now","groupCallEventHandler","groupCalls","Outgoing","sendCallStateEvent","_this2","groupCallState","sendStateEvent","updateLivekitServiceURL","newURL","_state","value","prevValue","_participants","participantStateEqual","x","y","screensharing","deviceMapsEqual","_creationTs","enteredViaAnotherSession","_enteredViaAnotherSession","values","localScreenshareFeed","hasLocalParticipant","_this$participants$ge","_this$participants$ge2","getUserId","has","getDeviceId","_this$participants$ge3","member","initLocalCallFeed","_this3","InitializingLocalCallFeed","initCallFeedPromise","initLocalCallFeedInternal","_this4","getMediaHandler","getUserMediaStream","Video","MediaStream","stopUserMediaStream","purpose","Usermedia","initWithAudioMuted","initWithVideoMuted","LocalCallFeedInitialized","updateLocalUsermediaStream","_this5","oldStream","setNewStream","micShouldBeMuted","vidShouldBeMuted","id","enter","_this6","Incoming","onIncomingCall","callEventHandler","retryCallLoopInterval","setInterval","onRetryCallLoop","retryCallInterval","onActiveSpeakerLoop","activeSpeakerLoopInterval","activeSpeakerInterval","dispose","_this$stats","stopScreensharingStream","localDesktopCapturerSourceId","stopAllStreams","transmitTimer","clearTimeout","clearInterval","participantsExpirationTimer","UserHangup","clear","removeListener","stats","stop","leave","terminate","_arguments","_this7","emitStateEvent","off","existingStateEvent","_objectSpread","getContent","CallEnded","muted","_this8","hasAudioDevice","sendUpdatesBefore","setTimeout","pttMaxTransmitTime","_call$localUsermediaF","localUsermediaFeed","setAudioVideoMuted","sendUpdates","_ref","updates","sendMetadataUpdate","Promise","all","apply","hasPermission","checkAudioPermissionIfNecessary","LocalMuteStateChanged","_this9","hasAudioTrack","getTracks","_unused","_this10","hasVideoDevice","_unused2","setScreensharingEnabled","enabled","_arguments2","_this11","opts","isScreensharing","getScreensharingStream","_loop","track","onTrackEnded","removeEventListener","addEventListener","desktopCapturerSourceId","Screenshare","pushLocalFeed","throwOnFail","NoUserMedia","localScreensharingFeed","removeLocalFeed","localUserId","localDeviceId","_this12","callsChanged","_loop2","_userId2","_this12$calls$get","_loop3","debug","NewSession","opponentSessionId","placeCallWithCallFeeds","then","createDataChannel","PlaceCallFailed","SignallingFailed","getMemberStateEvents","GroupCallMemberPrefix","onCallFeedsChanged","onCallStateChanged","onCallHangup","onCallReplaced","callHandlers","FeedsChanged","State","Hangup","reEmit","Object","initStats","getGroupCallStats","usermediaFeed","screenshareFeed","find","measureVolumeActivity","UserMediaFeedsChanged","existingFeed","replacementFeed","feedIndex","findIndex","splice","screenshareFeeds","ScreenshareFeedsChanged","localMember","entered","nextExpiration","Infinity","getStateKey","content","Array","isArray","devices","validDevices","filter","d","device_id","session_id","expires_ts","membership","Join","some","getSessionId","updateDevices","fn","_arguments3","_this13","_event$getContent","keepAlive","event","otherCalls","c","newDevices","newCalls","newContent","addDeviceToMemberState","_this14","_this15","resendMemberStateTimer","cleanMemberState","_this16","myDevices","getDevices","device","last_seen_ts","userID","statsCollectIntervalTime","reports","CONNECTION_STATS","onConnectionStats","BYTE_SENT_STATS","onByteSentStats","SUMMARY_STATS","onSummaryStats","CALL_FEED_REPORT","onCallFeedReport","setGroupCallStatsInterval","interval","start"],"sources":["../../src/webrtc/groupCall.ts"],"sourcesContent":["import { TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\nimport { CallFeed, SPEAKING_THRESHOLD } from \"./callFeed.ts\";\nimport { MatrixClient, IMyDevice } from \"../client.ts\";\nimport {\n CallErrorCode,\n CallEvent,\n CallEventHandlerMap,\n CallState,\n genCallID,\n MatrixCall,\n setTracksEnabled,\n createNewMatrixCall,\n CallError,\n} from \"./call.ts\";\nimport { RoomMember } from \"../models/room-member.ts\";\nimport { Room } from \"../models/room.ts\";\nimport { RoomStateEvent } from \"../models/room-state.ts\";\nimport { logger } from \"../logger.ts\";\nimport { ReEmitter } from \"../ReEmitter.ts\";\nimport { SDPStreamMetadataPurpose } from \"./callEventTypes.ts\";\nimport { MatrixEvent } from \"../models/event.ts\";\nimport { EventType } from \"../@types/event.ts\";\nimport { CallEventHandlerEvent } from \"./callEventHandler.ts\";\nimport { GroupCallEventHandlerEvent } from \"./groupCallEventHandler.ts\";\nimport { IScreensharingOpts } from \"./mediaHandler.ts\";\nimport { mapsEqual } from \"../utils.ts\";\nimport { GroupCallStats } from \"./stats/groupCallStats.ts\";\nimport {\n ByteSentStatsReport,\n CallFeedReport,\n ConnectionStatsReport,\n StatsReport,\n SummaryStatsReport,\n} from \"./stats/statsReport.ts\";\nimport { SummaryStatsReportGatherer } from \"./stats/summaryStatsReportGatherer.ts\";\nimport { CallFeedStatsReporter } from \"./stats/callFeedStatsReporter.ts\";\nimport { KnownMembership } from \"../@types/membership.ts\";\nimport { CallMembershipData } from \"../matrixrtc/CallMembership.ts\";\n\nexport enum GroupCallIntent {\n Ring = \"m.ring\",\n Prompt = \"m.prompt\",\n Room = \"m.room\",\n}\n\nexport enum GroupCallType {\n Video = \"m.video\",\n Voice = \"m.voice\",\n}\n\nexport enum GroupCallTerminationReason {\n CallEnded = \"call_ended\",\n}\n\nexport type CallsByUserAndDevice = Map<string, Map<string, MatrixCall>>;\n\n/**\n * Because event names are just strings, they do need\n * to be unique over all event types of event emitter.\n * Some objects could emit more then one set of events.\n */\nexport enum GroupCallEvent {\n GroupCallStateChanged = \"group_call_state_changed\",\n ActiveSpeakerChanged = \"active_speaker_changed\",\n CallsChanged = \"calls_changed\",\n UserMediaFeedsChanged = \"user_media_feeds_changed\",\n ScreenshareFeedsChanged = \"screenshare_feeds_changed\",\n LocalScreenshareStateChanged = \"local_screenshare_state_changed\",\n LocalMuteStateChanged = \"local_mute_state_changed\",\n ParticipantsChanged = \"participants_changed\",\n Error = \"group_call_error\",\n}\n\nexport type GroupCallEventHandlerMap = {\n [GroupCallEvent.GroupCallStateChanged]: (newState: GroupCallState, oldState: GroupCallState) => void;\n [GroupCallEvent.ActiveSpeakerChanged]: (activeSpeaker: CallFeed | undefined) => void;\n [GroupCallEvent.CallsChanged]: (calls: CallsByUserAndDevice) => void;\n [GroupCallEvent.UserMediaFeedsChanged]: (feeds: CallFeed[]) => void;\n [GroupCallEvent.ScreenshareFeedsChanged]: (feeds: CallFeed[]) => void;\n [GroupCallEvent.LocalScreenshareStateChanged]: (\n isScreensharing: boolean,\n feed?: CallFeed,\n sourceId?: string,\n ) => void;\n [GroupCallEvent.LocalMuteStateChanged]: (audioMuted: boolean, videoMuted: boolean) => void;\n [GroupCallEvent.ParticipantsChanged]: (participants: Map<RoomMember, Map<string, ParticipantState>>) => void;\n /**\n * Fires whenever an error occurs when call.js encounters an issue with setting up the call.\n * <p>\n * The error given will have a code equal to either `MatrixCall.ERR_LOCAL_OFFER_FAILED` or\n * `MatrixCall.ERR_NO_USER_MEDIA`. `ERR_LOCAL_OFFER_FAILED` is emitted when the local client\n * fails to create an offer. `ERR_NO_USER_MEDIA` is emitted when the user has denied access\n * to their audio/video hardware.\n * @param error - The error raised by MatrixCall.\n * @example\n * ```\n * matrixCall.on(\"error\", function(err){\n * console.error(err.code, err);\n * });\n * ```\n */\n [GroupCallEvent.Error]: (error: GroupCallError) => void;\n};\n\nexport enum GroupCallStatsReportEvent {\n ConnectionStats = \"GroupCall.connection_stats\",\n ByteSentStats = \"GroupCall.byte_sent_stats\",\n SummaryStats = \"GroupCall.summary_stats\",\n CallFeedStats = \"GroupCall.call_feed_stats\",\n}\n\n/**\n * The final report-events that get consumed by client.\n */\nexport type GroupCallStatsReportEventHandlerMap = {\n [GroupCallStatsReportEvent.ConnectionStats]: (report: GroupCallStatsReport<ConnectionStatsReport>) => void;\n [GroupCallStatsReportEvent.ByteSentStats]: (report: GroupCallStatsReport<ByteSentStatsReport>) => void;\n [GroupCallStatsReportEvent.SummaryStats]: (report: GroupCallStatsReport<SummaryStatsReport>) => void;\n [GroupCallStatsReportEvent.CallFeedStats]: (report: GroupCallStatsReport<CallFeedReport>) => void;\n};\n\nexport enum GroupCallErrorCode {\n NoUserMedia = \"no_user_media\",\n UnknownDevice = \"unknown_device\",\n PlaceCallFailed = \"place_call_failed\",\n}\n\nexport interface GroupCallStatsReport<\n T extends ConnectionStatsReport | ByteSentStatsReport | SummaryStatsReport | CallFeedReport,\n> {\n report: T;\n}\n\nexport class GroupCallError extends Error {\n public code: string;\n\n public constructor(code: GroupCallErrorCode, msg: string, err?: Error) {\n // Still don't think there's any way to have proper nested errors\n if (err) {\n super(msg + \": \" + err);\n } else {\n super(msg);\n }\n\n this.code = code;\n }\n}\n\nexport class GroupCallUnknownDeviceError extends GroupCallError {\n public constructor(public userId: string) {\n super(GroupCallErrorCode.UnknownDevice, \"No device found for \" + userId);\n }\n}\n\nexport class OtherUserSpeakingError extends Error {\n public constructor() {\n super(\"Cannot unmute: another user is speaking\");\n }\n}\n\nexport interface IGroupCallDataChannelOptions {\n ordered: boolean;\n maxPacketLifeTime: number;\n maxRetransmits: number;\n protocol: string;\n}\n\nexport interface IGroupCallRoomState {\n \"m.intent\": GroupCallIntent;\n \"m.type\": GroupCallType;\n \"m.terminated\"?: GroupCallTerminationReason;\n \"io.element.ptt\"?: boolean;\n // TODO: Specify data-channels\n \"dataChannelsEnabled\"?: boolean;\n \"dataChannelOptions\"?: IGroupCallDataChannelOptions;\n\n \"io.element.livekit_service_url\"?: string;\n}\n\nexport interface IGroupCallRoomMemberFeed {\n purpose: SDPStreamMetadataPurpose;\n}\n\nexport interface IGroupCallRoomMemberDevice {\n device_id: string;\n session_id: string;\n expires_ts: number;\n feeds: IGroupCallRoomMemberFeed[];\n}\n\nexport interface IGroupCallRoomMemberCallState {\n \"m.call_id\": string;\n \"m.foci\"?: string[];\n \"m.devices\": IGroupCallRoomMemberDevice[];\n}\n\nexport interface IGroupCallRoomMemberState {\n \"m.calls\": IGroupCallRoomMemberCallState[];\n}\n\n// XXX: this hasn't made it into the MSC yet\nexport interface ExperimentalGroupCallRoomMemberState {\n memberships: CallMembershipData[];\n}\n\nexport enum GroupCallState {\n LocalCallFeedUninitialized = \"local_call_feed_uninitialized\",\n InitializingLocalCallFeed = \"initializing_local_call_feed\",\n LocalCallFeedInitialized = \"local_call_feed_initialized\",\n Entered = \"entered\",\n Ended = \"ended\",\n}\n\nexport interface ParticipantState {\n sessionId: string;\n screensharing: boolean;\n}\n\ninterface ICallHandlers {\n onCallFeedsChanged: (feeds: CallFeed[]) => void;\n onCallStateChanged: (state: CallState, oldState: CallState | undefined) => void;\n onCallHangup: (call: MatrixCall) => void;\n onCallReplaced: (newCall: MatrixCall) => void;\n}\n\nconst DEVICE_TIMEOUT = 1000 * 60 * 60; // 1 hour\n\nfunction getCallUserId(call: MatrixCall): string | null {\n return call.getOpponentMember()?.userId || call.invitee || null;\n}\n\nexport class GroupCall extends TypedEventEmitter<\n GroupCallEvent | CallEvent | GroupCallStatsReportEvent,\n GroupCallEventHandlerMap & CallEventHandlerMap & GroupCallStatsReportEventHandlerMap\n> {\n // Config\n public activeSpeakerInterval = 1000;\n public retryCallInterval = 5000;\n public participantTimeout = 1000 * 15;\n public pttMaxTransmitTime = 1000 * 20;\n\n public activeSpeaker?: CallFeed;\n public localCallFeed?: CallFeed;\n public localScreenshareFeed?: CallFeed;\n public localDesktopCapturerSourceId?: string;\n public readonly userMediaFeeds: CallFeed[] = [];\n public readonly screenshareFeeds: CallFeed[] = [];\n public groupCallId: string;\n public readonly allowCallWithoutVideoAndAudio: boolean;\n\n private readonly calls = new Map<string, Map<string, MatrixCall>>(); // user_id -> device_id -> MatrixCall\n private callHandlers = new Map<string, Map<string, ICallHandlers>>(); // user_id -> device_id -> ICallHandlers\n private activeSpeakerLoopInterval?: ReturnType<typeof setTimeout>;\n private retryCallLoopInterval?: ReturnType<typeof setTimeout>;\n private retryCallCounts: Map<string, Map<string, number>> = new Map(); // user_id -> device_id -> count\n private reEmitter: ReEmitter;\n private transmitTimer: ReturnType<typeof setTimeout> | null = null;\n private participantsExpirationTimer: ReturnType<typeof setTimeout> | null = null;\n private resendMemberStateTimer: ReturnType<typeof setInterval> | null = null;\n private initWithAudioMuted = false;\n private initWithVideoMuted = false;\n private initCallFeedPromise?: Promise<void>;\n private _livekitServiceURL?: string;\n\n private stats: GroupCallStats | undefined;\n /**\n * Configure default webrtc stats collection interval in ms\n * Disable collecting webrtc stats by setting interval to 0\n */\n private statsCollectIntervalTime = 0;\n\n public constructor(\n private client: MatrixClient,\n public room: Room,\n public type: GroupCallType,\n public isPtt: boolean,\n public intent: GroupCallIntent,\n groupCallId?: string,\n private dataChannelsEnabled?: boolean,\n private dataChannelOptions?: IGroupCallDataChannelOptions,\n isCallWithoutVideoAndAudio?: boolean,\n // this tells the js-sdk not to actually establish any calls to exchange media and just to\n // create the group call signaling events, with the intention that the actual media will be\n // handled using livekit. The js-sdk doesn't contain any code to do the actual livekit call though.\n private useLivekit = false,\n livekitServiceURL?: string,\n ) {\n super();\n this.reEmitter = new ReEmitter(this);\n this.groupCallId = groupCallId ?? genCallID();\n this._livekitServiceURL = livekitServiceURL;\n this.creationTs =\n room.currentState.getStateEvents(EventType.GroupCallPrefix, this.groupCallId)?.getTs() ?? null;\n this.updateParticipants();\n\n room.on(RoomStateEvent.Update, this.onRoomState);\n this.on(GroupCallEvent.ParticipantsChanged, this.onParticipantsChanged);\n this.on(GroupCallEvent.GroupCallStateChanged, this.onStateChanged);\n this.on(GroupCallEvent.LocalScreenshareStateChanged, this.onLocalFeedsChanged);\n this.allowCallWithoutVideoAndAudio = !!isCallWithoutVideoAndAudio;\n }\n\n private onConnectionStats = (report: ConnectionStatsReport): void => {\n // Final emit of the summary event, to be consumed by the client\n this.emit(GroupCallStatsReportEvent.ConnectionStats, { report });\n };\n\n private onByteSentStats = (report: ByteSentStatsReport): void => {\n // Final emit of the summary event, to be consumed by the client\n this.emit(GroupCallStatsReportEvent.ByteSentStats, { report });\n };\n\n private onSummaryStats = (report: SummaryStatsReport): void => {\n SummaryStatsReportGatherer.extendSummaryReport(report, this.participants);\n // Final emit of the summary event, to be consumed by the client\n this.emit(GroupCallStatsReportEvent.SummaryStats, { report });\n };\n\n private onCallFeedReport = (report: CallFeedReport): void => {\n if (this.localCallFeed) {\n report = CallFeedStatsReporter.expandCallFeedReport(report, [this.localCallFeed], \"from-local-feed\");\n }\n\n const callFeeds: CallFeed[] = [];\n this.forEachCall((call) => {\n if (call.callId === report.callId) {\n call.getFeeds().forEach((f) => callFeeds.push(f));\n }\n });\n\n report = CallFeedStatsReporter.expandCallFeedReport(report, callFeeds, \"from-call-feed\");\n this.emit(GroupCallStatsReportEvent.CallFeedStats, { report });\n };\n\n public async create(): Promise<GroupCall> {\n this.creationTs = Date.now();\n this.client.groupCallEventHandler!.groupCalls.set(this.room.roomId, this);\n this.client.emit(GroupCallEventHandlerEvent.Outgoing, this);\n\n await this.sendCallStateEvent();\n\n return this;\n }\n\n private async sendCallStateEvent(): Promise<void> {\n const groupCallState: IGroupCallRoomState = {\n \"m.intent\": this.intent,\n \"m.type\": this.type,\n \"io.element.ptt\": this.isPtt,\n // TODO: Specify data-channels better\n \"dataChannelsEnabled\": this.dataChannelsEnabled,\n \"dataChannelOptions\": this.dataChannelsEnabled ? this.dataChannelOptions : undefined,\n };\n if (this.livekitServiceURL) {\n groupCallState[\"io.element.livekit_service_url\"] = this.livekitServiceURL;\n }\n\n await this.client.sendStateEvent(this.room.roomId, EventType.GroupCallPrefix, groupCallState, this.groupCallId);\n }\n\n public get livekitServiceURL(): string | undefined {\n return this._livekitServiceURL;\n }\n\n public updateLivekitServiceURL(newURL: string): Promise<void> {\n this._livekitServiceURL = newURL;\n return this.sendCallStateEvent();\n }\n\n private _state = GroupCallState.LocalCallFeedUninitialized;\n\n /**\n * The group call's state.\n */\n public get state(): GroupCallState {\n return this._state;\n }\n\n private set state(value: GroupCallState) {\n const prevValue = this._state;\n if (value !== prevValue) {\n this._state = value;\n this.emit(GroupCallEvent.GroupCallStateChanged, value, prevValue);\n }\n }\n\n private _participants = new Map<RoomMember, Map<string, ParticipantState>>();\n\n /**\n * The current participants in the call, as a map from members to device IDs\n * to participant info.\n */\n public get participants(): Map<RoomMember, Map<string, ParticipantState>> {\n return this._participants;\n }\n\n private set participants(value: Map<RoomMember, Map<string, ParticipantState>>) {\n const prevValue = this._participants;\n const participantStateEqual = (x: ParticipantState, y: ParticipantState): boolean =>\n x.sessionId === y.sessionId && x.screensharing === y.screensharing;\n const deviceMapsEqual = (x: Map<string, ParticipantState>, y: Map<string, ParticipantState>): boolean =>\n mapsEqual(x, y, participantStateEqual);\n\n // Only update if the map actually changed\n if (!mapsEqual(value, prevValue, deviceMapsEqual)) {\n this._participants = value;\n this.emit(GroupCallEvent.ParticipantsChanged, value);\n }\n }\n\n private _creationTs: number | null = null;\n\n /**\n * The timestamp at which the call was created, or null if it has not yet\n * been created.\n */\n public get creationTs(): number | null {\n return this._creationTs;\n }\n\n private set creationTs(value: number | null) {\n this._creationTs = value;\n }\n\n private _enteredViaAnotherSession = false;\n\n /**\n * Whether the local device has entered this call via another session, such\n * as a widget.\n */\n public get enteredViaAnotherSession(): boolean {\n return this._enteredViaAnotherSession;\n }\n\n public set enteredViaAnotherSession(value: boolean) {\n this._enteredViaAnotherSession = value;\n this.updateParticipants();\n }\n\n /**\n * Executes the given callback on all calls in this group call.\n * @param f - The callback.\n */\n public forEachCall(f: (call: MatrixCall) => void): void {\n for (const deviceMap of this.calls.values()) {\n for (const call of deviceMap.values()) f(call);\n }\n }\n\n public getLocalFeeds(): CallFeed[] {\n const feeds: CallFeed[] = [];\n\n if (this.localCallFeed) feeds.push(this.localCallFeed);\n if (this.localScreenshareFeed) feeds.push(this.localScreenshareFeed);\n\n return feeds;\n }\n\n public hasLocalParticipant(): boolean {\n return (\n this.participants.get(this.room.getMember(this.client.getUserId()!)!)?.has(this.client.getDeviceId()!) ??\n false\n );\n }\n\n /**\n * Determines whether the given call is one that we were expecting to exist\n * given our knowledge of who is participating in the group call.\n */\n private callExpected(call: MatrixCall): boolean {\n const userId = getCallUserId(call);\n const member = userId === null ? null : this.room.getMember(userId);\n const deviceId = call.getOpponentDeviceId();\n return member !== null && deviceId !== undefined && this.participants.get(member)?.get(deviceId) !== undefined;\n }\n\n public async initLocalCallFeed(): Promise<void> {\n if (this.useLivekit) {\n logger.info(\"Livekit group call: not starting local call feed.\");\n return;\n }\n\n if (this.state !== GroupCallState.LocalCallFeedUninitialized) {\n throw new Error(`Cannot initialize local call feed in the \"${this.state}\" state.`);\n }\n this.state = GroupCallState.InitializingLocalCallFeed;\n\n // wraps the real method to serialise calls, because we don't want to try starting\n // multiple call feeds at once\n if (this.initCallFeedPromise) return this.initCallFeedPromise;\n\n try {\n this.initCallFeedPromise = this.initLocalCallFeedInternal();\n await this.initCallFeedPromise;\n } finally {\n this.initCallFeedPromise = undefined;\n }\n }\n\n private async initLocalCallFeedInternal(): Promise<void> {\n logger.log(`GroupCall ${this.groupCallId} initLocalCallFeedInternal() running`);\n\n let stream: MediaStream;\n\n try {\n stream = await this.client.getMediaHandler().getUserMediaStream(true, this.type === GroupCallType.Video);\n } catch (error) {\n // If is allowed to join a call without a media stream, then we\n // don't throw an error here. But we need an empty Local Feed to establish\n // a connection later.\n if (this.allowCallWithoutVideoAndAudio) {\n stream = new MediaStream();\n } else {\n this.state = GroupCallState.LocalCallFeedUninitialized;\n throw error;\n }\n }\n\n // The call could've been disposed while we were waiting, and could\n // also have been started back up again (hello, React 18) so if we're\n // still in this 'initializing' state, carry on, otherwise bail.\n if (this._state !== GroupCallState.InitializingLocalCallFeed) {\n this.client.getMediaHandler().stopUserMediaStream(stream);\n throw new Error(\"Group call disposed while gathering media stream\");\n }\n\n const callFeed = new CallFeed({\n client: this.client,\n roomId: this.room.roomId,\n userId: this.client.getUserId()!,\n deviceId: this.client.getDeviceId()!,\n stream,\n purpose: SDPStreamMetadataPurpose.Usermedia,\n audioMuted: this.initWithAudioMuted || stream.getAudioTracks().length === 0 || this.isPtt,\n videoMuted: this.initWithVideoMuted || stream.getVideoTracks().length === 0,\n });\n\n setTracksEnabled(stream.getAudioTracks(), !callFeed.isAudioMuted());\n setTracksEnabled(stream.getVideoTracks(), !callFeed.isVideoMuted());\n\n this.localCallFeed = callFeed;\n this.addUserMediaFeed(callFeed);\n\n this.state = GroupCallState.LocalCallFeedInitialized;\n }\n\n public async updateLocalUsermediaStream(stream: MediaStream): Promise<void> {\n if (this.localCallFeed) {\n const oldStream = this.localCallFeed.stream;\n this.localCallFeed.setNewStream(stream);\n const micShouldBeMuted = this.localCallFeed.isAudioMuted();\n const vidShouldBeMuted = this.localCallFeed.isVideoMuted();\n logger.log(\n `GroupCall ${this.groupCallId} updateLocalUsermediaStream() (oldStreamId=${oldStream.id}, newStreamId=${stream.id}, micShouldBeMuted=${micShouldBeMuted}, vidShouldBeMuted=${vidShouldBeMuted})`,\n );\n setTracksEnabled(stream.getAudioTracks(), !micShouldBeMuted);\n setTracksEnabled(stream.getVideoTracks(), !vidShouldBeMuted);\n this.client.getMediaHandler().stopUserMediaStream(oldStream);\n }\n }\n\n public async enter(): Promise<void> {\n if (this.state === GroupCallState.LocalCallFeedUninitialized) {\n await this.initLocalCallFeed();\n } else if (this.state !== GroupCallState.LocalCallFeedInitialized) {\n throw new Error(`Cannot enter call in the \"${this.state}\" state`);\n }\n\n logger.log(`GroupCall ${this.groupCallId} enter() running`);\n this.state = GroupCallState.Entered;\n\n this.client.on(CallEventHandlerEvent.Incoming, this.onIncomingCall);\n\n for (const call of this.client.callEventHandler!.calls.values()) {\n this.onIncomingCall(call);\n }\n\n if (!this.useLivekit) {\n this.retryCallLoopInterval = setInterval(this.onRetryCallLoop, this.retryCallInterval);\n\n this.activeSpeaker = undefined;\n this.onActiveSpeakerLoop();\n this.activeSpeakerLoopInterval = setInterval(this.onActiveSpeakerLoop, this.activeSpeakerInterval);\n }\n }\n\n private dispose(): void {\n if (this.localCallFeed) {\n this.removeUserMediaFeed(this.localCallFeed);\n this.localCallFeed = undefined;\n }\n\n if (this.localScreenshareFeed) {\n this.client.getMediaHandler().stopScreensharingStream(this.localScreenshareFeed.stream);\n this.removeScreenshareFeed(this.localScreenshareFeed);\n this.localScreenshareFeed = undefined;\n this.localDesktopCapturerSourceId = undefined;\n }\n\n this.client.getMediaHandler().stopAllStreams();\n\n if (this.transmitTimer !== null) {\n clearTimeout(this.transmitTimer);\n this.transmitTimer = null;\n }\n\n if (this.retryCallLoopInterval !== undefined) {\n clearInterval(this.retryCallLoopInterval);\n this.retryCallLoopInterval = undefined;\n }\n\n if (this.participantsExpirationTimer !== null) {\n clearTimeout(this.participantsExpirationTimer);\n this.participantsExpirationTimer = null;\n }\n\n if (this.state !== GroupCallState.Entered) {\n return;\n }\n\n this.forEachCall((call) => call.hangup(CallErrorCode.UserHangup, false));\n\n this.activeSpeaker = undefined;\n clearInterval(this.activeSpeakerLoopInterval);\n\n this.retryCallCounts.clear();\n clearInterval(this.retryCallLoopInterval);\n\n this.client.removeListener(CallEventHandlerEvent.Incoming, this.onIncomingCall);\n this.stats?.stop();\n }\n\n public leave(): void {\n this.dispose();\n this.state = GroupCallState.LocalCallFeedUninitialized;\n }\n\n public async terminate(emitStateEvent = true): Promise<void> {\n this.dispose();\n\n this.room.off(RoomStateEvent.Update, this.onRoomState);\n this.client.groupCallEventHandler!.groupCalls.delete(this.room.roomId);\n this.client.emit(GroupCallEventHandlerEvent.Ended, this);\n this.state = GroupCallState.Ended;\n\n if (emitStateEvent) {\n const existingStateEvent = this.room.currentState.getStateEvents(\n EventType.GroupCallPrefix,\n this.groupCallId,\n )!;\n\n await this.client.sendStateEvent(\n this.room.roomId,\n EventType.GroupCallPrefix,\n {\n ...existingStateEvent.getContent(),\n \"m.terminated\": GroupCallTerminationReason.CallEnded,\n },\n this.groupCallId,\n );\n }\n }\n\n /*\n * Local Usermedia\n */\n\n public isLocalVideoMuted(): boolean {\n if (this.localCallFeed) {\n return this.localCallFeed.isVideoMuted();\n }\n\n return true;\n }\n\n public isMicrophoneMuted(): boolean {\n if (this.localCallFeed) {\n return this.localCallFeed.isAudioMuted();\n }\n\n return true;\n }\n\n /**\n * Sets the mute state of the local participants's microphone.\n * @param muted - Whether to mute the microphone\n * @returns Whether muting/unmuting was successful\n */\n public async setMicrophoneMuted(muted: boolean): Promise<boolean> {\n // hasAudioDevice can block indefinitely if the window has lost focus,\n // and it doesn't make much sense to keep a device from being muted, so\n // we always allow muted = true changes to go through\n if (!muted && !(await this.client.getMediaHandler().hasAudioDevice())) {\n return false;\n }\n\n const sendUpdatesBefore = !muted && this.isPtt;\n\n // set a timer for the maximum transmit time on PTT calls\n if (this.isPtt) {\n // Set or clear the max transmit timer\n if (!muted && this.isMicrophoneMuted()) {\n this.transmitTimer = setTimeout(() => {\n this.setMicrophoneMuted(true);\n }, this.pttMaxTransmitTime);\n } else if (muted && !this.isMicrophoneMuted()) {\n if (this.transmitTimer !== null) clearTimeout(this.transmitTimer);\n this.transmitTimer = null;\n }\n }\n\n this.forEachCall((call) => call.localUsermediaFeed?.setAudioVideoMuted(muted, null));\n\n const sendUpdates = async (): Promise<void> => {\n const updates: Promise<void>[] = [];\n this.forEachCall((call) => updates.push(call.sendMetadataUpdate()));\n\n await Promise.all(updates).catch((e) =>\n logger.info(\n `GroupCall ${this.groupCallId} setMicrophoneMuted() failed to send some metadata updates`,\n e,\n ),\n );\n };\n\n if (sendUpdatesBefore) await sendUpdates();\n\n if (this.localCallFeed) {\n logger.log(\n `GroupCall ${this.groupCallId} setMicrophoneMuted() (streamId=${this.localCallFeed.stream.id}, muted=${muted})`,\n );\n\n const hasPermission = await this.checkAudioPermissionIfNecessary(muted);\n\n if (!hasPermission) {\n return false;\n }\n\n this.localCallFeed.setAudioVideoMuted(muted, null);\n // I don't believe its actually necessary to enable these tracks: they\n // are the one on the GroupCall's own CallFeed and are cloned before being\n // given to any of the actual calls, so these tracks don't actually go\n // anywhere. Let's do it anyway to avoid confusion.\n setTracksEnabled(this.localCallFeed.stream.getAudioTracks(), !muted);\n } else {\n logger.log(`GroupCall ${this.groupCallId} setMicrophoneMuted() no stream muted (muted=${muted})`);\n this.initWithAudioMuted = muted;\n }\n\n this.forEachCall((call) =>\n setTracksEnabled(call.localUsermediaFeed!.stream.getAudioTracks(), !muted && this.callExpected(call)),\n );\n this.emit(GroupCallEvent.LocalMuteStateChanged, muted, this.isLocalVideoMuted());\n\n if (!sendUpdatesBefore) await sendUpdates();\n\n return true;\n }\n\n /**\n * If we allow entering a call without a camera and without video, it can happen that the access rights to the\n * devices have not yet been queried. If a stream does not yet have an audio track, we assume that the rights have\n * not yet been checked.\n *\n * `this.client.getMediaHandler().getUserMediaStream` clones the current stream, so it only wanted to be called when\n * not Audio Track exists.\n * As such, this is a compromise, because, the access rights should always be queried before the call.\n */\n private async checkAudioPermissionIfNecessary(muted: boolean): Promise<boolean> {\n // We needed this here to avoid an error in case user join a call without a device.\n try {\n if (!muted && this.localCallFeed && !this.localCallFeed.hasAudioTrack) {\n const stream = await this.client\n .getMediaHandler()\n .getUserMediaStream(true, !this.localCallFeed.isVideoMuted());\n if (stream?.getTracks().length === 0) {\n // if case permission denied to get a stream stop this here\n /* istanbul ignore next */\n logger.log(\n `GroupCall ${this.groupCallId} setMicrophoneMuted() no device to receive local stream, muted=${muted}`,\n );\n return false;\n }\n }\n } catch {\n /* istanbul ignore next */\n logger.log(\n `GroupCall ${this.groupCallId} setMicrophoneMuted() no device or permission to receive local stream, muted=${muted}`,\n );\n return false;\n }\n\n return true;\n }\n\n /**\n * Sets the mute state of the local participants's video.\n * @param muted - Whether to mute the video\n * @returns Whether muting/unmuting was successful\n */\n public async setLocalVideoMuted(muted: boolean): Promise<boolean> {\n // hasAudioDevice can block indefinitely if the window has lost focus,\n // and it doesn't make much sense to keep a device from being muted, so\n // we always allow muted = true changes to go through\n if (!muted && !(await this.client.getMediaHandler().hasVideoDevice())) {\n return false;\n }\n\n if (this.localCallFeed) {\n /* istanbul ignore next */\n logger.log(\n `GroupCall ${this.groupCallId} setLocalVideoMuted() (stream=${this.localCallFeed.stream.id}, muted=${muted})`,\n );\n\n try {\n const stream = await this.client.getMediaHandler().getUserMediaStream(true, !muted);\n await this.updateLocalUsermediaStream(stream);\n this.localCallFeed.setAudioVideoMuted(null, muted);\n setTracksEnabled(this.localCallFeed.stream.getVideoTracks(), !muted);\n } catch {\n // No permission to video device\n /* istanbul ignore next */\n logger.log(\n `GroupCall ${this.groupCallId} setLocalVideoMuted() no device or permission to receive local stream, muted=${muted}`,\n );\n return false;\n }\n } else {\n logger.log(`GroupCall ${this.groupCallId} setLocalVideoMuted() no stream muted (muted=${muted})`);\n this.initWithVideoMuted = muted;\n }\n\n const updates: Promise<unknown>[] = [];\n this.forEachCall((call) => updates.push(call.setLocalVideoMuted(muted)));\n await Promise.all(updates);\n\n // We setTracksEnabled again, independently from the call doing it\n // internally, since we might not be expecting the call\n this.forEachCall((call) =>\n setTracksEnabled(call.localUsermediaFeed!.stream.getVideoTracks(), !muted && this.callExpected(call)),\n );\n\n this.emit(GroupCallEvent.LocalMuteStateChanged, this.isMicrophoneMuted(), muted);\n\n return true;\n }\n\n public async setScreensharingEnabled(enabled: boolean, opts: IScreensharingOpts = {}): Promise<boolean> {\n if (enabled === this.isScreensharing()) {\n return enabled;\n }\n\n if (enabled) {\n try {\n logger.log(\n `GroupCall ${this.groupCallId} setScreensharingEnabled() is asking for screensharing permissions`,\n );\n const stream = await this.client.getMediaHandler().getScreensharingStream(opts);\n\n for (const track of stream.getTracks()) {\n const onTrackEnded = (): void => {\n this.setScreensharingEnabled(false);\n track.removeEventListener(\"ended\", onTrackEnded);\n };\n\n track.addEventListener(\"ended\", onTrackEnded);\n }\n\n logger.log(\n `GroupCall ${this.groupCallId} setScreensharingEnabled() granted screensharing permissions. Setting screensharing enabled on all calls`,\n );\n\n this.localDesktopCapturerSourceId = opts.desktopCapturerSourceId;\n this.localScreenshareFeed = new CallFeed({\n client: this.client,\n roomId: this.room.roomId,\n userId: this.client.getUserId()!,\n deviceId: this.client.getDeviceId()!,\n stream,\n purpose: SDPStreamMetadataPurpose.Screenshare,\n audioMuted: false,\n videoMuted: false,\n });\n this.addScreenshareFeed(this.localScreenshareFeed);\n\n this.emit(\n GroupCallEvent.LocalScreenshareStateChanged,\n true,\n this.localScreenshareFeed,\n this.localDesktopCapturerSourceId,\n );\n\n // TODO: handle errors\n this.forEachCall((call) => call.pushLocalFeed(this.localScreenshareFeed!.clone()));\n\n return true;\n } catch (error) {\n if (opts.throwOnFail) throw error;\n logger.error(\n `GroupCall ${this.groupCallId} setScreensharingEnabled() enabling screensharing error`,\n error,\n );\n this.emit(\n GroupCallEvent.Error,\n new GroupCallError(\n GroupCallErrorCode.NoUserMedia,\n \"Failed to get screen-sharing stream: \",\n error as Error,\n ),\n );\n return false;\n }\n } else {\n this.forEachCall((call) => {\n if (call.localScreensharingFeed) call.removeLocalFeed(call.localScreensharingFeed);\n });\n this.client.getMediaHandler().stopScreensharingStream(this.localScreenshareFeed!.stream);\n this.removeScreenshareFeed(this.localScreenshareFeed!);\n this.localScreenshareFeed = undefined;\n this.localDesktopCapturerSourceId = undefined;\n this.emit(GroupCallEvent.LocalScreenshareStateChanged, false, undefined, undefined);\n return false;\n }\n }\n\n public isScreensharing(): boolean {\n return !!this.localScreenshareFeed;\n }\n\n /*\n * Call Setup\n *\n * There are two different paths for calls to be created:\n * 1. Incoming calls triggered by the Call.incoming event.\n * 2. Outgoing calls to the initial members of a room or new members\n * as they are observed by the RoomState.members event.\n */\n\n private onIncomingCall = (newCall: MatrixCall): void => {\n // The incoming calls may be for another room, which we will ignore.\n if (newCall.roomId !== this.room.roomId) {\n return;\n }\n\n if (newCall.state !== CallState.Ringing) {\n logger.warn(\n `GroupCall ${this.groupCallId} onIncomingCall() incoming call no longer in ringing state - ignoring`,\n );\n return;\n }\n\n if (!newCall.groupCallId || newCall.groupCallId !== this.groupCallId) {\n logger.log(\n `GroupCall ${this.groupCallId} onIncomingCall() ignored because it doesn't match the current group call`,\n );\n newCall.reject();\n return;\n }\n\n const opponentUserId = newCall.getOpponentMember()?.userId;\n if (opponentUserId === undefined) {\n logger.warn(`GroupCall ${this.groupCallId} onIncomingCall() incoming call with no member - ignoring`);\n return;\n }\n\n if (this.useLivekit) {\n logger.info(\"Received incoming call whilst in signaling-only mode! Ignoring.\");\n return;\n }\n\n const deviceMap = this.calls.get(opponentUserId) ?? new Map<string, MatrixCall>();\n const prevCall = deviceMap.get(newCall.getOpponentDeviceId()!);\n\n if (prevCall?.callId === newCall.callId) return;\n\n logger.log(\n `GroupCall ${this.groupCallId} onIncomingCall() incoming call (userId=${opponentUserId}, callId=${newCall.callId})`,\n );\n\n if (prevCall) prevCall.hangup(CallErrorCode.Replaced, false);\n // We must do this before we start initialising / answering the call as we\n // need to know it is the active call for this user+deviceId and to not ignore\n // events from it.\n deviceMap.set(newCall.getOpponentDeviceId()!, newCall);\n this.calls.set(opponentUserId, deviceMap);\n\n this.initCall(newCall);\n\n const feeds = this.getLocalFeeds().map((feed) => feed.clone());\n if (!this.callExpected(newCall)) {\n // Disable our tracks for users not explicitly participating in the\n // call but trying to receive the feeds\n for (const feed of feeds) {\n setTracksEnabled(feed.stream.getAudioTracks(), false);\n setTracksEnabled(feed.stream.getVideoTracks(), false);\n }\n }\n newCall.answerWithCallFeeds(feeds);\n\n this.emit(GroupCallEvent.CallsChanged, this.calls);\n };\n\n /**\n * Determines whether a given participant expects us to call them (versus\n * them calling us).\n * @param userId - The participant's user ID.\n * @param deviceId - The participant's device ID.\n * @returns Whether we need to place an outgoing call to the participant.\n */\n private wantsOutgoingCall(userId: string, deviceId: string): boolean {\n const localUserId = this.client.getUserId()!;\n const localDeviceId = this.client.getDeviceId()!;\n return (\n // If a user's ID is less than our own, they'll call us\n userId >= localUserId &&\n // If this is another one of our devices, compare device IDs to tell whether it'll call us\n (userId !== localUserId || deviceId > localDeviceId)\n );\n }\n\n /**\n * Places calls to all participants that we're responsible for calling.\n */\n private placeOutgoingCalls(): void {\n let callsChanged = false;\n\n for (const [{ userId }, participantMap] of this.participants) {\n const callMap = this.calls.get(userId) ?? new Map<string, MatrixCall>();\n\n for (const [deviceId, participant] of participantMap) {\n const prevCall = callMap.get(deviceId);\n\n if (\n prevCall?.getOpponentSessionId() !== participant.sessionId &&\n this.wantsOutgoingCall(userId, deviceId)\n ) {\n callsChanged = true;\n\n if (prevCall !== undefined) {\n logger.debug(\n `GroupCall ${this.groupCallId} placeOutgoingCalls() replacing call (userId=${userId}, deviceId=${deviceId}, callId=${prevCall.callId})`,\n );\n prevCall.hangup(CallErrorCode.NewSession, false);\n }\n\n const newCall = createNewMatrixCall(this.client, this.room.roomId, {\n invitee: userId,\n opponentDeviceId: deviceId,\n opponentSessionId: participant.sessionId,\n groupCallId: this.groupCallId,\n });\n\n if (newCall === null) {\n logger.error(\n `GroupCall ${this.groupCallId} placeOutgoingCalls() failed to create call (userId=${userId}, device=${deviceId})`,\n );\n callMap.delete(deviceId);\n } else {\n this.initCall(newCall);\n callMap.set(deviceId, newCall);\n\n logger.debug(\n `GroupCall ${this.groupCallId} placeOutgoingCalls() placing call (userId=${userId}, deviceId=${deviceId}, sessionId=${participant.sessionId})`,\n );\n\n newCall\n .placeCallWithCallFeeds(\n this.getLocalFeeds().map((feed) => feed.clone()),\n participant.screensharing,\n )\n .then(() => {\n if (this.dataChannelsEnabled) {\n newCall.createDataChannel(\"datachannel\", this.dataChannelOptions);\n }\n })\n .catch((e) => {\n logger.warn(\n `GroupCall ${this.groupCallId} placeOutgoingCalls() failed to place call (userId=${userId})`,\n e,\n );\n\n if (e instanceof CallError && e.code === GroupCallErrorCode.UnknownDevice) {\n this.emit(GroupCallEvent.Error, e);\n } else {\n this.emit(\n GroupCallEvent.Error,\n new GroupCallError(\n GroupCallErrorCode.PlaceCallFailed,\n `Failed to place call to ${userId}`,\n ),\n );\n }\n\n newCall.hangup(CallErrorCode.SignallingFailed, false);\n if (callMap.get(deviceId) === newCall) callMap.delete(deviceId);\n });\n }\n }\n }\n\n if (callMap.size > 0) {\n this.calls.set(userId, callMap);\n } else {\n this.calls.delete(userId);\n }\n }\n\n if (callsChanged) this.emit(GroupCallEvent.CallsChanged, this.calls);\n }\n\n /*\n * Room Member State\n */\n\n private getMemberStateEvents(): MatrixEvent[];\n private getMemberStateEvents(userId: string): MatrixEvent | null;\n private getMemberStateEvents(userId?: string): MatrixEvent[] | MatrixEvent | null {\n return userId === undefined\n ? this.room.currentState.getStateEvents(EventType.GroupCallMemberPrefix)\n : this.room.currentState.getStateEvents(EventType.GroupCallMemberPrefix, userId);\n }\n\n private onRetryCallLoop = (): void => {\n let needsRetry = false;\n\n for (const [{ userId }, participantMap] of this.participants) {\n const callMap = this.calls.get(userId);\n let retriesMap = this.retryCallCounts.get(userId);\n\n for (const [deviceId, participant] of participantMap) {\n const call = callMap?.get(deviceId);\n const retries = retriesMap?.get(deviceId) ?? 0;\n\n if (\n call?.getOpponentSessionId() !== participant.sessionId &&\n this.wantsOutgoingCall(userId, deviceId) &&\n retries < 3\n ) {\n if (retriesMap === undefined) {\n retriesMap = new Map();\n this.retryCallCounts.set(userId, retriesMap);\n }\n retriesMap.set(deviceId, retries + 1);\n needsRetry = true;\n }\n }\n }\n\n if (needsRetry) this.placeOutgoingCalls();\n };\n\n private initCall(call: MatrixCall): void {\n const opponentMemberId = getCallUserId(call);\n\n if (!opponentMemberId) {\n throw new Error(\"Cannot init call without user id\");\n }\n\n const onCallFeedsChanged = (): void => this.onCallFeedsChanged(call);\n const onCallStateChanged = (state: CallState, oldState?: CallState): void =>\n this.onCallStateChanged(call, state, oldState);\n const onCallHangup = this.onCallHangup;\n const onCallReplaced = (newCall: MatrixCall): void => this.onCallReplaced(call, newCall);\n\n let deviceMap = this.callHandlers.get(opponentMemberId);\n if (deviceMap === undefined) {\n deviceMap = new Map();\n this.callHandlers.set(opponentMemberId, deviceMap);\n }\n\n deviceMap.set(call.getOpponentDeviceId()!, {\n onCallFeedsChanged,\n onCallStateChanged,\n onCallHangup,\n onCallReplaced,\n });\n\n call.on(CallEvent.FeedsChanged, onCallFeedsChanged);\n call.on(CallEvent.State, onCallStateChanged);\n call.on(CallEvent.Hangup, onCallHangup);\n call.on(CallEvent.Replaced, onCallReplaced);\n\n call.isPtt = this.isPtt;\n\n this.reEmitter.reEmit(call, Object.values(CallEvent));\n\n call.initStats(this.getGroupCallStats());\n\n onCallFeedsChanged();\n }\n\n private disposeCall(call: MatrixCall, hangupReason: CallErrorCode): void {\n const opponentMemberId = getCallUserId(call);\n const opponentDeviceId = call.getOpponentDeviceId()!;\n\n if (!opponentMemberId) {\n throw new Error(\"Cannot dispose call without user id\");\n }\n\n const deviceMap = this.callHandlers.get(opponentMemberId)!;\n const { onCallFeedsChanged, onCallStateChanged, onCallHangup, onCallReplaced } =\n deviceMap.get(opponentDeviceId)!;\n\n call.removeListener(CallEvent.FeedsChanged, onCallFeedsChanged);\n call.removeListener(CallEvent.State, onCallStateChanged);\n call.removeListener(CallEvent.Hangup, onCallHangup);\n call.removeListener(CallEvent.Replaced, onCallReplaced);\n\n deviceMap.delete(opponentMemberId);\n if (deviceMap.size === 0) this.callHandlers.delete(opponentMemberId);\n\n if (call.hangupReason === CallErrorCode.Replaced) {\n return;\n }\n\n const usermediaFeed = this.getUserMediaFeed(opponentMemberId, opponentDeviceId);\n\n if (usermediaFeed) {\n this.removeUserMediaFeed(usermediaFeed);\n }\n\n const screenshareFeed = this.getScreenshareFeed(opponentMemberId, opponentDeviceId);\n\n if (screenshareFeed) {\n this.removeScreenshareFeed(screenshareFeed);\n }\n }\n\n private onCallFeedsChanged = (call: MatrixCall): void => {\n const opponentMemberId = getCallUserId(call);\n const opponentDeviceId = call.getOpponentDeviceId()!;\n\n if (!opponentMemberId) {\n throw new Error(\"Cannot change call feeds without user id\");\n }\n\n const currentUserMediaFeed = this.getUserMediaFeed(opponentMemberId, opponentDeviceId);\n const remoteUsermediaFeed = call.remoteUsermediaFeed;\n const remoteFeedChanged = remoteUsermediaFeed !== currentUserMediaFeed;\n\n const deviceMap = this.calls.get(opponentMemberId);\n const currentCallForUserDevice = deviceMap?.get(opponentDeviceId);\n if (currentCallForUserDevice?.callId !== call.callId) {\n // the call in question is not the current call for this user/deviceId\n // so ignore feed events from it otherwise we'll remove our real feeds\n return;\n }\n\n if (remoteFeedChanged) {\n if (!currentUserMediaFeed && remoteUsermediaFeed) {\n this.addUserMediaFeed(remoteUsermediaFeed);\n } else if (currentUserMediaFeed && remoteUsermediaFeed) {\n this.replaceUserMediaFeed(currentUserMediaFeed, remoteUsermediaFeed);\n } else if (currentUserMediaFeed && !remoteUsermediaFeed) {\n this.removeUserMediaFeed(currentUserMediaFeed);\n }\n }\n\n const currentScreenshareFeed = this.getScreenshareFeed(opponentMemberId, opponentDeviceId);\n const remoteScreensharingFeed = call.remoteScreensharingFeed;\n const remoteScreenshareFeedChanged = remoteScreensharingFeed !== currentScreenshareFeed;\n\n if (remoteScreenshareFeedChanged) {\n if (!currentScreenshareFeed && remoteScreensharingFeed) {\n this.addScreenshareFeed(remoteScreensharingFeed);\n } else if (currentScreenshareFeed && remoteScreensharingFeed) {\n this.replaceScreenshareFeed(currentScreenshareFeed, remoteScreensharingFeed);\n } else if (currentScreenshareFeed && !remoteScreensharingFeed) {\n this.removeScreenshareFeed(currentScreenshareFeed);\n }\n }\n };\n\n private onCallStateChanged = (call: MatrixCall, state: CallState, _oldState: CallState | undefined): void => {\n if (state === CallState.Ended) return;\n\n const audioMuted = this.localCallFeed!.isAudioMuted();\n\n if (call.localUsermediaStream && call.isMicrophoneMuted() !== audioMuted) {\n call.setMicrophoneMuted(audioMuted);\n }\n\n const videoMuted = this.localCallFeed!.isVideoMuted();\n\n if (call.localUsermediaStream && call.isLocalVideoMuted() !== videoMuted) {\n call.setLocalVideoMuted(videoMuted);\n }\n\n const opponentUserId = call.getOpponentMember()?.userId;\n if (state === CallState.Connected && opponentUserId) {\n const retriesMap = this.retryCallCounts.get(opponentUserId);\n retriesMap?.delete(call.getOpponentDeviceId()!);\n if (retriesMap?.size === 0) this.retryCallCounts.delete(opponentUserId);\n }\n };\n\n private onCallHangup = (call: MatrixCall): void => {\n if (call.hangupReason === CallErrorCode.Replaced) return;\n\n const opponentUserId = call.getOpponentMember()?.userId ?? this.room.getMember(call.invitee!)!.userId;\n const deviceMap = this.calls.get(opponentUserId);\n\n // Sanity check that this call is in fact in the map\n if (deviceMap?.get(call.getOpponentDeviceId()!) === call) {\n this.disposeCall(call, call.hangupReason as CallErrorCode);\n deviceMap.delete(call.getOpponentDeviceId()!);\n if (deviceMap.size === 0) this.calls.delete(opponentUserId);\n this.emit(GroupCallEvent.CallsChanged, this.calls);\n }\n };\n\n private onCallReplaced = (prevCall: MatrixCall, newCall: MatrixCall): void => {\n const opponentUserId = prevCall.getOpponentMember()!.userId;\n\n let deviceMap = this.calls.get(opponentUserId);\n if (deviceMap === undefined) {\n deviceMap = new Map();\n this.calls.set(opponentUserId, deviceMap);\n }\n\n prevCall.hangup(CallErrorCode.Replaced, false);\n this.initCall(newCall);\n deviceMap.set(prevCall.getOpponentDeviceId()!, newCall);\n this.emit(GroupCallEvent.CallsChanged, this.calls);\n };\n\n /*\n * UserMedia CallFeed Event Handlers\n */\n\n public getUserMediaFeed(userId: string, deviceId: string): CallFeed | undefined {\n return this.userMediaFeeds.find((f) => f.userId === userId && f.deviceId! === deviceId);\n }\n\n private addUserMediaFeed(callFeed: CallFeed): void {\n this.userMediaFeeds.push(callFeed);\n callFeed.measureVolumeActivity(true);\n this.emit(GroupCallEvent.UserMediaFeedsChanged, this.userMediaFeeds);\n }\n\n private replaceUserMediaFeed(existingFeed: CallFeed, replacementFeed: CallFeed): void {\n const feedIndex = this.userMediaFeeds.findIndex(\n (f) => f.userId === existingFeed.userId && f.deviceId! === existingFeed.deviceId,\n );\n\n if (feedIndex === -1) {\n throw new Error(\"Couldn't find user media feed to replace\");\n }\n\n this.userMediaFeeds.splice(feedIndex, 1, replacementFeed);\n\n existingFeed.dispose();\n replacementFeed.measureVolumeActivity(true);\n this.emit(GroupCallEvent.UserMediaFeedsChanged, this.userMediaFeeds);\n }\n\n private removeUserMediaFeed(callFeed: CallFeed): void {\n const feedIndex = this.userMediaFeeds.findIndex(\n (f) => f.userId === callFeed.userId && f.deviceId! === callFeed.deviceId,\n );\n\n if (feedIndex === -1) {\n throw new Error(\"Couldn't find user media feed to remove\");\n }\n\n this.userMediaFeeds.splice(feedIndex, 1);\n\n callFeed.dispose();\n this.emit(GroupCallEvent.UserMediaFeedsChanged, this.userMediaFeeds);\n\n if (this.activeSpeaker === callFeed) {\n this.activeSpeaker = this.userMediaFeeds[0];\n this.emit(GroupCallEvent.ActiveSpeakerChanged, this.activeSpeaker);\n }\n }\n\n private onActiveSpeakerLoop = (): void => {\n let topAvg: number | undefined = undefined;\n let nextActiveSpeaker: CallFeed | undefined = undefined;\n\n for (const callFeed of this.userMediaFeeds) {\n if (callFeed.isLocal() && this.userMediaFeeds.length > 1) continue;\n\n const total = callFeed.speakingVolumeSamples.reduce(\n (acc, volume) => acc + Math.max(volume, SPEAKING_THRESHOLD),\n );\n const avg = total / callFeed.speakingVolumeSamples.length;\n\n if (!topAvg || avg > topAvg) {\n topAvg = avg;\n nextActiveSpeaker = callFeed;\n }\n }\n\n if (nextActiveSpeaker && this.activeSpeaker !== nextActiveSpeaker && topAvg && topAvg > SPEAKING_THRESHOLD) {\n this.activeSpeaker = nextActiveSpeaker;\n this.emit(GroupCallEvent.ActiveSpeakerChanged, this.activeSpeaker);\n }\n };\n\n /*\n * Screenshare Call Feed Event Handlers\n */\n\n public getScreenshareFeed(userId: string, deviceId: string): CallFeed | undefined {\n return this.screenshareFeeds.find((f) => f.userId === userId && f.deviceId! === deviceId);\n }\n\n private addScreenshareFeed(callFeed: CallFeed): void {\n this.screenshareFeeds.push(callFeed);\n this.emit(GroupCallEvent.ScreenshareFeedsChanged, this.screenshareFeeds);\n }\n\n private replaceScreenshareFeed(existingFeed: CallFeed, replacementFeed: CallFeed): void {\n const feedIndex = this.screenshareFeeds.findIndex(\n (f) => f.userId === existingFeed.userId && f.deviceId! === existingFeed.deviceId,\n );\n\n if (feedIndex === -1) {\n throw new Error(\"Couldn't find screenshare feed to replace\");\n }\n\n this.screenshareFeeds.splice(feedIndex, 1, replacementFeed);\n\n existingFeed.dispose();\n this.emit(GroupCallEvent.ScreenshareFeedsChanged, this.screenshareFeeds);\n }\n\n private removeScreenshareFeed(callFeed: CallFeed): void {\n const feedIndex = this.screenshareFeeds.findIndex(\n (f) => f.userId === callFeed.userId && f.deviceId! === callFeed.deviceId,\n );\n\n if (feedIndex === -1) {\n throw new Error(\"Couldn't find screenshare feed to remove\");\n }\n\n this.screenshareFeeds.splice(feedIndex, 1);\n\n callFeed.dispose();\n this.emit(GroupCallEvent.ScreenshareFeedsChanged, this.screenshareFeeds);\n }\n\n /**\n * Recalculates and updates the participant map to match the room state.\n */\n private updateParticipants(): void {\n const localMember = this.room.getMember(this.client.getUserId()!)!;\n if (!localMember) {\n // The client hasn't fetched enough of the room state to get our own member\n // event. This probably shouldn't happen, but sanity check & exit for now.\n logger.warn(\n `GroupCall ${this.groupCallId} updateParticipants() tried to update participants before local room member is available`,\n );\n return;\n }\n\n if (this.participantsExpirationTimer !== null) {\n clearTimeout(this.participantsExpirationTimer);\n this.participantsExpirationTimer = null;\n }\n\n if (this.state === GroupCallState.Ended) {\n this.participants = new Map();\n return;\n }\n\n const participants = new Map<RoomMember, Map<string, ParticipantState>>();\n const now = Date.now();\n const entered = this.state === GroupCallState.Entered || this.enteredViaAnotherSession;\n let nextExpiration = Infinity;\n\n for (const e of this.getMemberStateEvents()) {\n const member = this.room.getMember(e.getStateKey()!);\n const content = e.getContent<Record<any, unknown>>();\n const calls: Record<any, unknown>[] = Array.isArray(content[\"m.calls\"]) ? content[\"m.calls\"] : [];\n const call = calls.find((call) => call[\"m.call_id\"] === this.groupCallId);\n const devices: Record<any, unknown>[] = Array.isArray(call?.[\"m.devices\"]) ? call![\"m.devices\"] : [];\n\n // Filter out invalid and expired devices\n let validDevices = devices.filter(\n (d) =>\n typeof d.device_id === \"string\" &&\n typeof d.session_id === \"string\" &&\n typeof d.expires_ts === \"number\" &&\n d.expires_ts > now &&\n Array.isArray(d.feeds),\n ) as unknown as IGroupCallRoomMemberDevice[];\n\n // Apply local echo for the unentered case\n if (!entered && member?.userId === this.client.getUserId()!) {\n validDevices = validDevices.filter((d) => d.device_id !== this.client.getDeviceId()!);\n }\n\n // Must have a connected device and be joined to the room\n if (validDevices.length > 0 && member?.membership === KnownMembership.Join) {\n const deviceMap = new Map<string, ParticipantState>();\n participants.set(member, deviceMap);\n\n for (const d of validDevices) {\n deviceMap.set(d.device_id, {\n sessionId: d.session_id,\n screensharing: d.feeds.some((f) => f.purpose === SDPStreamMetadataPurpose.Screenshare),\n });\n if (d.expires_ts < nextExpiration) nextExpiration = d.expires_ts;\n }\n }\n }\n\n // Apply local echo for the entered case\n if (entered) {\n let deviceMap = participants.get(localMember);\n if (deviceMap === undefined) {\n deviceMap = new Map();\n participants.set(localMember, deviceMap);\n }\n\n if (!deviceMap.has(this.client.getDeviceId()!)) {\n deviceMap.set(this.client.getDeviceId()!, {\n sessionId: this.client.getSessionId(),\n screensharing: this.getLocalFeeds().some((f) => f.purpose === SDPStreamMetadataPurpose.Screenshare),\n });\n }\n }\n\n this.participants = participants;\n if (nextExpiration < Infinity) {\n this.participantsExpirationTimer = setTimeout(() => this.updateParticipants(), nextExpiration - now);\n }\n }\n\n /**\n * Updates the local user's member state with the devices returned by the given function.\n * @param fn - A function from the current devices to the new devices. If it\n * returns null, the update will be skipped.\n * @param keepAlive - Whether the request should outlive the window.\n */\n private async updateDevices(\n fn: (devices: IGroupCallRoomMemberDevice[]) => IGroupCallRoomMemberDevice[] | null,\n keepAlive = false,\n ): Promise<void> {\n const now = Date.now();\n const localUserId = this.client.getUserId()!;\n\n const event = this.getMemberStateEvents(localUserId);\n const content = event?.getContent<Record<any, unknown>>() ?? {};\n const calls: Record<any, unknown>[] = Array.isArray(content[\"m.calls\"]) ? content[\"m.calls\"] : [];\n\n let call: Record<any, unknown> | null = null;\n const otherCalls: Record<any, unknown>[] = [];\n for (const c of calls) {\n if (c[\"m.call_id\"] === this.groupCallId) {\n call = c;\n } else {\n otherCalls.push(c);\n }\n }\n if (call === null) call = {};\n\n const devices: Record<any, unknown>[] = Array.isArray(call[\"m.devices\"]) ? call[\"m.devices\"] : [];\n\n // Filter out invalid and expired devices\n const validDevices = devices.filter(\n (d) =>\n typeof d.device_id === \"string\" &&\n typeof d.session_id === \"string\" &&\n typeof d.expires_ts === \"number\" &&\n d.expires_ts > now &&\n Array.isArray(d.feeds),\n ) as unknown as IGroupCallRoomMemberDevice[];\n\n const newDevices = fn(validDevices);\n if (newDevices === null) return;\n\n const newCalls = [...(otherCalls as unknown as IGroupCallRoomMemberCallState[])];\n if (newDevices.length > 0) {\n newCalls.push({\n ...call,\n \"m.call_id\": this.groupCallId,\n \"m.devices\": newDevices,\n });\n }\n\n const newContent: IGroupCallRoomMemberState = { \"m.calls\": newCalls };\n\n await this.client.sendStateEvent(this.room.roomId, EventType.GroupCallMemberPrefix, newContent, localUserId, {\n keepAlive,\n });\n }\n\n private async addDeviceToMemberState(): Promise<void> {\n await this.updateDevices((devices) => [\n ...devices.filter((d) => d.device_id !== this.client.getDeviceId()!),\n {\n device_id: this.client.getDeviceId()!,\n session_id: this.client.getSessionId(),\n expires_ts: Date.now() + DEVICE_TIMEOUT,\n feeds: this.getLocalFeeds().map((feed) => ({ purpose: feed.purpose })),\n // TODO: Add data channels\n },\n ]);\n }\n\n private async updateMemberState(): Promise<void> {\n // Clear the old update interval before proceeding\n if (this.resendMemberStateTimer !== null) {\n clearInterval(this.resendMemberStateTimer);\n this.resendMemberStateTimer = null;\n }\n\n if (this.state === GroupCallState.Entered) {\n // Add the local device\n await this.addDeviceToMemberState();\n\n // Resend the state event every so often so it doesn't become stale\n this.resendMemberStateTimer = setInterval(\n async () => {\n logger.log(`GroupCall ${this.groupCallId} updateMemberState() resending call member state\"`);\n try {\n await this.addDeviceToMemberState();\n } catch (e) {\n logger.error(\n `GroupCall ${this.groupCallId} updateMemberState() failed to resend call member state`,\n e,\n );\n }\n },\n (DEVICE_TIMEOUT * 3) / 4,\n );\n } else {\n // Remove the local device\n await this.updateDevices(\n (devices) => devices.filter((d) => d.device_id !== this.client.getDeviceId()!),\n true,\n );\n }\n }\n\n /**\n * Cleans up our member state by filtering out logged out devices, inactive\n * devices, and our own device (if we know we haven't entered).\n */\n public async cleanMemberState(): Promise<void> {\n const { devices: myDevices } = await this.client.getDevices();\n const deviceMap = new Map<string, IMyDevice>(myDevices.map((d) => [d.device_id, d]));\n\n // updateDevices takes care of filtering out inactive devices for us\n await this.updateDevices((devices) => {\n const newDevices = devices.filter((d) => {\n const device = deviceMap.get(d.device_id);\n return (\n device?.last_seen_ts !== undefined &&\n !(\n d.device_id === this.client.getDeviceId()! &&\n this.state !== GroupCallState.Entered &&\n !this.enteredViaAnotherSession\n )\n );\n });\n\n // Skip the update if the devices are unchanged\n return newDevices.length === devices.length ? null : newDevices;\n });\n }\n\n private onRoomState = (): void => this.updateParticipants();\n\n private onParticipantsChanged = (): void => {\n // Re-run setTracksEnabled on all calls, so that participants that just\n // left get denied access to our media, and participants that just\n // joined get granted access\n this.forEachCall((call) => {\n const expected = this.callExpected(call);\n for (const feed of call.getLocalFeeds()) {\n setTracksEnabled(feed.stream.getAudioTracks(), !feed.isAudioMuted() && expected);\n setTracksEnabled(feed.stream.getVideoTracks(), !feed.isVideoMuted() && expected);\n }\n });\n\n if (this.state === GroupCallState.Entered && !this.useLivekit) this.placeOutgoingCalls();\n\n // Update the participants stored in the stats object\n };\n\n private onStateChanged = (newState: GroupCallState, oldState: GroupCallState): void => {\n if (\n newState === GroupCallState.Entered ||\n oldState === GroupCallState.Entered ||\n newState === GroupCallState.Ended\n ) {\n // We either entered, left, or ended the call\n this.updateParticipants();\n this.updateMemberState().catch((e) =>\n logger.error(\n `GroupCall ${this.groupCallId} onStateChanged() failed to update member state devices\"`,\n e,\n ),\n );\n }\n };\n\n private onLocalFeedsChanged = (): void => {\n if (this.state === GroupCallState.Entered) {\n this.updateMemberState().catch((e) =>\n logger.error(\n `GroupCall ${this.groupCallId} onLocalFeedsChanged() failed to update member state feeds`,\n e,\n ),\n );\n }\n };\n\n public getGroupCallStats(): GroupCallStats {\n if (this.stats === undefined) {\n const userID = this.client.getUserId() || \"unknown\";\n this.stats = new GroupCallStats(this.groupCallId, userID, this.statsCollectIntervalTime);\n this.stats.reports.on(StatsReport.CONNECTION_STATS, this.onConnectionStats);\n this.stats.reports.on(StatsReport.BYTE_SENT_STATS, this.onByteSentStats);\n this.stats.reports.on(StatsReport.SUMMARY_STATS, this.onSummaryStats);\n this.stats.reports.on(StatsReport.CALL_FEED_REPORT, this.onCallFeedReport);\n }\n return this.stats;\n }\n\n public setGroupCallStatsInterval(interval: number): void {\n this.statsCollectIntervalTime = interval;\n if (this.stats !== undefined) {\n this.stats.stop();\n this.stats.setInterval(interval);\n if (interval > 0) {\n this.stats.start();\n }\n }\n }\n}\n"],"mappings":";;;;AAAA,SAASA,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,eAAe;AAE5D,SACIC,aAAa,EACbC,SAAS,EAETC,SAAS,EACTC,SAAS,EAETC,gBAAgB,EAChBC,mBAAmB,EACnBC,SAAS,QACN,WAAW;AAGlB,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,qBAAqB;AAE9D,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,qBAAqB,QAAQ,uBAAuB;AAC7D,SAASC,0BAA0B,QAAQ,4BAA4B;AAEvE,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,cAAc,QAAQ,2BAA2B;AAC1D,SAIIC,WAAW,QAER,wBAAwB;AAC/B,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,eAAe,QAAQ,yBAAyB;AAGzD,WAAYC,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAM3B,WAAYC,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAKzB,WAAYC,0BAA0B,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;AAMtC;AACA;AACA;AACA;AACA;AACA,WA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 @@
1
+ import { MatrixClient } from "../client.ts";
2
+ import { GroupCall } from "./groupCall.ts";
3
+ import { RoomMember } from "../models/room-member.ts";
4
+ export declare enum GroupCallEventHandlerEvent {
5
+ Incoming = "GroupCall.incoming",
6
+ Outgoing = "GroupCall.outgoing",
7
+ Ended = "GroupCall.ended",
8
+ Participants = "GroupCall.participants"
9
+ }
10
+ export type GroupCallEventHandlerEventHandlerMap = {
11
+ [GroupCallEventHandlerEvent.Incoming]: (call: GroupCall) => void;
12
+ [GroupCallEventHandlerEvent.Outgoing]: (call: GroupCall) => void;
13
+ [GroupCallEventHandlerEvent.Ended]: (call: GroupCall) => void;
14
+ [GroupCallEventHandlerEvent.Participants]: (participants: RoomMember[], call: GroupCall) => void;
15
+ };
16
+ export declare class GroupCallEventHandler {
17
+ private client;
18
+ groupCalls: Map<string, GroupCall>;
19
+ private roomDeferreds;
20
+ constructor(client: MatrixClient);
21
+ start(): Promise<void>;
22
+ stop(): void;
23
+ private getRoomDeferred;
24
+ waitUntilRoomReadyForGroupCalls(roomId: string): Promise<void>;
25
+ getGroupCallById(groupCallId: string): GroupCall | undefined;
26
+ private createGroupCallForRoom;
27
+ private createGroupCallFromRoomStateEvent;
28
+ private onRoomsChanged;
29
+ private onRoomStateChanged;
30
+ }
31
+ //# sourceMappingURL=groupCallEventHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupCallEventHandler.d.ts","sourceRoot":"","sources":["../../src/webrtc/groupCallEventHandler.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,SAAS,EAAgE,MAAM,gBAAgB,CAAC;AAGzG,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAKtD,oBAAY,0BAA0B;IAClC,QAAQ,uBAAuB;IAC/B,QAAQ,uBAAuB;IAC/B,KAAK,oBAAoB;IACzB,YAAY,2BAA2B;CAC1C;AAED,MAAM,MAAM,oCAAoC,GAAG;IAC/C,CAAC,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACjE,CAAC,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACjE,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAC9D,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACpG,CAAC;AAOF,qBAAa,qBAAqB;IASX,OAAO,CAAC,MAAM;IAR1B,UAAU,yBAAgC;IAMjD,OAAO,CAAC,aAAa,CAAmC;gBAE7B,MAAM,EAAE,YAAY;IAElC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA6B5B,IAAI,IAAI,IAAI;IAKnB,OAAO,CAAC,eAAe;IAgBhB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAInE,OAAO,CAAC,sBAAsB;IAwB9B,OAAO,CAAC,iCAAiC;IA+DzC,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,kBAAkB,CA2BxB;CACL"}
@@ -0,0 +1,178 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ /*
4
+ Copyright 2021 Šimon Brandner <simon.bra.ag@gmail.com>
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ */
18
+
19
+ import { ClientEvent } from "../client.js";
20
+ import { GroupCall, GroupCallIntent, GroupCallType } from "./groupCall.js";
21
+ import { RoomStateEvent } from "../models/room-state.js";
22
+ import { logger } from "../logger.js";
23
+ import { EventType } from "../@types/event.js";
24
+ import { SyncState } from "../sync.js";
25
+ export var GroupCallEventHandlerEvent = /*#__PURE__*/function (GroupCallEventHandlerEvent) {
26
+ GroupCallEventHandlerEvent["Incoming"] = "GroupCall.incoming";
27
+ GroupCallEventHandlerEvent["Outgoing"] = "GroupCall.outgoing";
28
+ GroupCallEventHandlerEvent["Ended"] = "GroupCall.ended";
29
+ GroupCallEventHandlerEvent["Participants"] = "GroupCall.participants";
30
+ return GroupCallEventHandlerEvent;
31
+ }({});
32
+ export class GroupCallEventHandler {
33
+ constructor(client) {
34
+ this.client = client;
35
+ _defineProperty(this, "groupCalls", new Map());
36
+ // roomId -> GroupCall
37
+ // All rooms we know about and whether we've seen a 'Room' event
38
+ // for them. The promise will be fulfilled once we've processed that
39
+ // event which means we're "up to date" on what calls are in a room
40
+ // and get
41
+ _defineProperty(this, "roomDeferreds", new Map());
42
+ _defineProperty(this, "onRoomsChanged", room => {
43
+ this.createGroupCallForRoom(room);
44
+ });
45
+ _defineProperty(this, "onRoomStateChanged", (event, state) => {
46
+ var eventType = event.getType();
47
+ if (eventType === EventType.GroupCallPrefix) {
48
+ var groupCallId = event.getStateKey();
49
+ var content = event.getContent();
50
+ var currentGroupCall = this.groupCalls.get(state.roomId);
51
+ if (!currentGroupCall && !content["m.terminated"] && !event.isRedacted()) {
52
+ this.createGroupCallFromRoomStateEvent(event);
53
+ } else if (currentGroupCall && currentGroupCall.groupCallId === groupCallId) {
54
+ if (content["m.terminated"] || event.isRedacted()) {
55
+ currentGroupCall.terminate(false);
56
+ } else if (content["m.type"] !== currentGroupCall.type) {
57
+ // TODO: Handle the callType changing when the room state changes
58
+ logger.warn("GroupCallEventHandler onRoomStateChanged() currently does not support changing type (roomId=".concat(state.roomId, ")"));
59
+ }
60
+ } else if (currentGroupCall && currentGroupCall.groupCallId !== groupCallId) {
61
+ // TODO: Handle new group calls and multiple group calls
62
+ logger.warn("GroupCallEventHandler onRoomStateChanged() currently does not support multiple calls (roomId=".concat(state.roomId, ")"));
63
+ }
64
+ }
65
+ });
66
+ }
67
+ start() {
68
+ var _this = this;
69
+ return _asyncToGenerator(function* () {
70
+ // We wait until the client has started syncing for real.
71
+ // This is because we only support one call at a time, and want
72
+ // the latest. We therefore want the latest state of the room before
73
+ // we create a group call for the room so we can be fairly sure that
74
+ // the group call we create is really the latest one.
75
+ if (_this.client.getSyncState() !== SyncState.Syncing) {
76
+ logger.debug("GroupCallEventHandler start() waiting for client to start syncing");
77
+ yield new Promise(resolve => {
78
+ var onSync = () => {
79
+ if (_this.client.getSyncState() === SyncState.Syncing) {
80
+ _this.client.off(ClientEvent.Sync, onSync);
81
+ return resolve();
82
+ }
83
+ };
84
+ _this.client.on(ClientEvent.Sync, onSync);
85
+ });
86
+ }
87
+ var rooms = _this.client.getRooms();
88
+ for (var room of rooms) {
89
+ _this.createGroupCallForRoom(room);
90
+ }
91
+ _this.client.on(ClientEvent.Room, _this.onRoomsChanged);
92
+ _this.client.on(RoomStateEvent.Events, _this.onRoomStateChanged);
93
+ })();
94
+ }
95
+ stop() {
96
+ this.client.removeListener(ClientEvent.Room, this.onRoomsChanged);
97
+ this.client.removeListener(RoomStateEvent.Events, this.onRoomStateChanged);
98
+ }
99
+ getRoomDeferred(roomId) {
100
+ var deferred = this.roomDeferreds.get(roomId);
101
+ if (deferred === undefined) {
102
+ var resolveFunc;
103
+ deferred = {
104
+ prom: new Promise(resolve => {
105
+ resolveFunc = resolve;
106
+ })
107
+ };
108
+ deferred.resolve = resolveFunc;
109
+ this.roomDeferreds.set(roomId, deferred);
110
+ }
111
+ return deferred;
112
+ }
113
+ waitUntilRoomReadyForGroupCalls(roomId) {
114
+ return this.getRoomDeferred(roomId).prom;
115
+ }
116
+ getGroupCallById(groupCallId) {
117
+ return [...this.groupCalls.values()].find(groupCall => groupCall.groupCallId === groupCallId);
118
+ }
119
+ createGroupCallForRoom(room) {
120
+ var callEvents = room.currentState.getStateEvents(EventType.GroupCallPrefix);
121
+ var sortedCallEvents = callEvents.sort((a, b) => b.getTs() - a.getTs());
122
+ for (var callEvent of sortedCallEvents) {
123
+ var content = callEvent.getContent();
124
+ if (content["m.terminated"] || callEvent.isRedacted()) {
125
+ continue;
126
+ }
127
+ logger.debug("GroupCallEventHandler createGroupCallForRoom() choosing group call from possible calls (stateKey=".concat(callEvent.getStateKey(), ", ts=").concat(callEvent.getTs(), ", roomId=").concat(room.roomId, ", numOfPossibleCalls=").concat(callEvents.length, ")"));
128
+ this.createGroupCallFromRoomStateEvent(callEvent);
129
+ break;
130
+ }
131
+ this.getRoomDeferred(room.roomId).resolve();
132
+ }
133
+ createGroupCallFromRoomStateEvent(event) {
134
+ var roomId = event.getRoomId();
135
+ var content = event.getContent();
136
+ var room = this.client.getRoom(roomId);
137
+ if (!room) {
138
+ logger.warn("GroupCallEventHandler createGroupCallFromRoomStateEvent() couldn't find room for call (roomId=".concat(roomId, ")"));
139
+ return;
140
+ }
141
+ var groupCallId = event.getStateKey();
142
+ var callType = content["m.type"];
143
+ if (!Object.values(GroupCallType).includes(callType)) {
144
+ logger.warn("GroupCallEventHandler createGroupCallFromRoomStateEvent() received invalid call type (type=".concat(callType, ", roomId=").concat(roomId, ")"));
145
+ return;
146
+ }
147
+ var callIntent = content["m.intent"];
148
+ if (!Object.values(GroupCallIntent).includes(callIntent)) {
149
+ logger.warn("Received invalid group call intent (type=".concat(callType, ", roomId=").concat(roomId, ")"));
150
+ return;
151
+ }
152
+ var isPtt = Boolean(content["io.element.ptt"]);
153
+ var dataChannelOptions;
154
+ if (content !== null && content !== void 0 && content.dataChannelsEnabled && content !== null && content !== void 0 && content.dataChannelOptions) {
155
+ // Pull out just the dataChannelOptions we want to support.
156
+ var {
157
+ ordered,
158
+ maxPacketLifeTime,
159
+ maxRetransmits,
160
+ protocol
161
+ } = content.dataChannelOptions;
162
+ dataChannelOptions = {
163
+ ordered,
164
+ maxPacketLifeTime,
165
+ maxRetransmits,
166
+ protocol
167
+ };
168
+ }
169
+ var groupCall = new GroupCall(this.client, room, callType, isPtt, callIntent, groupCallId,
170
+ // Because without Media section a WebRTC connection is not possible, so need a RTCDataChannel to set up a
171
+ // no media WebRTC connection anyway.
172
+ (content === null || content === void 0 ? void 0 : content.dataChannelsEnabled) || this.client.isVoipWithNoMediaAllowed, dataChannelOptions, this.client.isVoipWithNoMediaAllowed, this.client.useLivekitForGroupCalls, content["io.element.livekit_service_url"]);
173
+ this.groupCalls.set(room.roomId, groupCall);
174
+ this.client.emit(GroupCallEventHandlerEvent.Incoming, groupCall);
175
+ return groupCall;
176
+ }
177
+ }
178
+ //# sourceMappingURL=groupCallEventHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupCallEventHandler.js","names":["ClientEvent","GroupCall","GroupCallIntent","GroupCallType","RoomStateEvent","logger","EventType","SyncState","GroupCallEventHandlerEvent","GroupCallEventHandler","constructor","client","_defineProperty","Map","room","createGroupCallForRoom","event","state","eventType","getType","GroupCallPrefix","groupCallId","getStateKey","content","getContent","currentGroupCall","groupCalls","get","roomId","isRedacted","createGroupCallFromRoomStateEvent","terminate","type","warn","concat","start","_this","_asyncToGenerator","getSyncState","Syncing","debug","Promise","resolve","onSync","off","Sync","on","rooms","getRooms","Room","onRoomsChanged","Events","onRoomStateChanged","stop","removeListener","getRoomDeferred","deferred","roomDeferreds","undefined","resolveFunc","prom","set","waitUntilRoomReadyForGroupCalls","getGroupCallById","values","find","groupCall","callEvents","currentState","getStateEvents","sortedCallEvents","sort","a","b","getTs","callEvent","length","getRoomId","getRoom","callType","Object","includes","callIntent","isPtt","Boolean","dataChannelOptions","dataChannelsEnabled","ordered","maxPacketLifeTime","maxRetransmits","protocol","isVoipWithNoMediaAllowed","useLivekitForGroupCalls","emit","Incoming"],"sources":["../../src/webrtc/groupCallEventHandler.ts"],"sourcesContent":["/*\nCopyright 2021 Šimon Brandner <simon.bra.ag@gmail.com>\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MatrixEvent } from \"../models/event.ts\";\nimport { MatrixClient, ClientEvent } from \"../client.ts\";\nimport { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from \"./groupCall.ts\";\nimport { Room } from \"../models/room.ts\";\nimport { RoomState, RoomStateEvent } from \"../models/room-state.ts\";\nimport { RoomMember } from \"../models/room-member.ts\";\nimport { logger } from \"../logger.ts\";\nimport { EventType } from \"../@types/event.ts\";\nimport { SyncState } from \"../sync.ts\";\n\nexport enum GroupCallEventHandlerEvent {\n Incoming = \"GroupCall.incoming\",\n Outgoing = \"GroupCall.outgoing\",\n Ended = \"GroupCall.ended\",\n Participants = \"GroupCall.participants\",\n}\n\nexport type GroupCallEventHandlerEventHandlerMap = {\n [GroupCallEventHandlerEvent.Incoming]: (call: GroupCall) => void;\n [GroupCallEventHandlerEvent.Outgoing]: (call: GroupCall) => void;\n [GroupCallEventHandlerEvent.Ended]: (call: GroupCall) => void;\n [GroupCallEventHandlerEvent.Participants]: (participants: RoomMember[], call: GroupCall) => void;\n};\n\ninterface RoomDeferred {\n prom: Promise<void>;\n resolve?: () => void;\n}\n\nexport class GroupCallEventHandler {\n public groupCalls = new Map<string, GroupCall>(); // roomId -> GroupCall\n\n // All rooms we know about and whether we've seen a 'Room' event\n // for them. The promise will be fulfilled once we've processed that\n // event which means we're \"up to date\" on what calls are in a room\n // and get\n private roomDeferreds = new Map<string, RoomDeferred>();\n\n public constructor(private client: MatrixClient) {}\n\n public async start(): Promise<void> {\n // We wait until the client has started syncing for real.\n // This is because we only support one call at a time, and want\n // the latest. We therefore want the latest state of the room before\n // we create a group call for the room so we can be fairly sure that\n // the group call we create is really the latest one.\n if (this.client.getSyncState() !== SyncState.Syncing) {\n logger.debug(\"GroupCallEventHandler start() waiting for client to start syncing\");\n await new Promise<void>((resolve) => {\n const onSync = (): void => {\n if (this.client.getSyncState() === SyncState.Syncing) {\n this.client.off(ClientEvent.Sync, onSync);\n return resolve();\n }\n };\n this.client.on(ClientEvent.Sync, onSync);\n });\n }\n\n const rooms = this.client.getRooms();\n\n for (const room of rooms) {\n this.createGroupCallForRoom(room);\n }\n\n this.client.on(ClientEvent.Room, this.onRoomsChanged);\n this.client.on(RoomStateEvent.Events, this.onRoomStateChanged);\n }\n\n public stop(): void {\n this.client.removeListener(ClientEvent.Room, this.onRoomsChanged);\n this.client.removeListener(RoomStateEvent.Events, this.onRoomStateChanged);\n }\n\n private getRoomDeferred(roomId: string): RoomDeferred {\n let deferred = this.roomDeferreds.get(roomId);\n if (deferred === undefined) {\n let resolveFunc: () => void;\n deferred = {\n prom: new Promise<void>((resolve) => {\n resolveFunc = resolve;\n }),\n };\n deferred.resolve = resolveFunc!;\n this.roomDeferreds.set(roomId, deferred);\n }\n\n return deferred;\n }\n\n public waitUntilRoomReadyForGroupCalls(roomId: string): Promise<void> {\n return this.getRoomDeferred(roomId).prom;\n }\n\n public getGroupCallById(groupCallId: string): GroupCall | undefined {\n return [...this.groupCalls.values()].find((groupCall) => groupCall.groupCallId === groupCallId);\n }\n\n private createGroupCallForRoom(room: Room): void {\n const callEvents = room.currentState.getStateEvents(EventType.GroupCallPrefix);\n const sortedCallEvents = callEvents.sort((a, b) => b.getTs() - a.getTs());\n\n for (const callEvent of sortedCallEvents) {\n const content = callEvent.getContent();\n\n if (content[\"m.terminated\"] || callEvent.isRedacted()) {\n continue;\n }\n\n logger.debug(\n `GroupCallEventHandler createGroupCallForRoom() choosing group call from possible calls (stateKey=${callEvent.getStateKey()}, ts=${callEvent.getTs()}, roomId=${\n room.roomId\n }, numOfPossibleCalls=${callEvents.length})`,\n );\n\n this.createGroupCallFromRoomStateEvent(callEvent);\n break;\n }\n\n this.getRoomDeferred(room.roomId).resolve!();\n }\n\n private createGroupCallFromRoomStateEvent(event: MatrixEvent): GroupCall | undefined {\n const roomId = event.getRoomId();\n const content = event.getContent();\n\n const room = this.client.getRoom(roomId);\n\n if (!room) {\n logger.warn(\n `GroupCallEventHandler createGroupCallFromRoomStateEvent() couldn't find room for call (roomId=${roomId})`,\n );\n return;\n }\n\n const groupCallId = event.getStateKey();\n\n const callType = content[\"m.type\"];\n\n if (!Object.values(GroupCallType).includes(callType)) {\n logger.warn(\n `GroupCallEventHandler createGroupCallFromRoomStateEvent() received invalid call type (type=${callType}, roomId=${roomId})`,\n );\n return;\n }\n\n const callIntent = content[\"m.intent\"];\n\n if (!Object.values(GroupCallIntent).includes(callIntent)) {\n logger.warn(`Received invalid group call intent (type=${callType}, roomId=${roomId})`);\n return;\n }\n\n const isPtt = Boolean(content[\"io.element.ptt\"]);\n\n let dataChannelOptions: IGroupCallDataChannelOptions | undefined;\n\n if (content?.dataChannelsEnabled && content?.dataChannelOptions) {\n // Pull out just the dataChannelOptions we want to support.\n const { ordered, maxPacketLifeTime, maxRetransmits, protocol } = content.dataChannelOptions;\n dataChannelOptions = { ordered, maxPacketLifeTime, maxRetransmits, protocol };\n }\n\n const groupCall = new GroupCall(\n this.client,\n room,\n callType,\n isPtt,\n callIntent,\n groupCallId,\n // Because without Media section a WebRTC connection is not possible, so need a RTCDataChannel to set up a\n // no media WebRTC connection anyway.\n content?.dataChannelsEnabled || this.client.isVoipWithNoMediaAllowed,\n dataChannelOptions,\n this.client.isVoipWithNoMediaAllowed,\n this.client.useLivekitForGroupCalls,\n content[\"io.element.livekit_service_url\"],\n );\n\n this.groupCalls.set(room.roomId, groupCall);\n this.client.emit(GroupCallEventHandlerEvent.Incoming, groupCall);\n\n return groupCall;\n }\n\n private onRoomsChanged = (room: Room): void => {\n this.createGroupCallForRoom(room);\n };\n\n private onRoomStateChanged = (event: MatrixEvent, state: RoomState): void => {\n const eventType = event.getType();\n\n if (eventType === EventType.GroupCallPrefix) {\n const groupCallId = event.getStateKey();\n const content = event.getContent();\n\n const currentGroupCall = this.groupCalls.get(state.roomId);\n\n if (!currentGroupCall && !content[\"m.terminated\"] && !event.isRedacted()) {\n this.createGroupCallFromRoomStateEvent(event);\n } else if (currentGroupCall && currentGroupCall.groupCallId === groupCallId) {\n if (content[\"m.terminated\"] || event.isRedacted()) {\n currentGroupCall.terminate(false);\n } else if (content[\"m.type\"] !== currentGroupCall.type) {\n // TODO: Handle the callType changing when the room state changes\n logger.warn(\n `GroupCallEventHandler onRoomStateChanged() currently does not support changing type (roomId=${state.roomId})`,\n );\n }\n } else if (currentGroupCall && currentGroupCall.groupCallId !== groupCallId) {\n // TODO: Handle new group calls and multiple group calls\n logger.warn(\n `GroupCallEventHandler onRoomStateChanged() currently does not support multiple calls (roomId=${state.roomId})`,\n );\n }\n }\n };\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAAuBA,WAAW,QAAQ,cAAc;AACxD,SAASC,SAAS,EAAEC,eAAe,EAAEC,aAAa,QAAsC,gBAAgB;AAExG,SAAoBC,cAAc,QAAQ,yBAAyB;AAEnE,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,QAAQ,YAAY;AAEtC,WAAYC,0BAA0B,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;AAmBtC,OAAO,MAAMC,qBAAqB,CAAC;E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