@selfcommunity/react-ui 0.8.0-embeds.17 → 0.8.0-live.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/lib/cjs/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  2. package/lib/cjs/components/Categories/Categories.js +22 -0
  3. package/lib/cjs/components/CategoriesPopularWidget/CategoriesPopularWidget.js +21 -0
  4. package/lib/cjs/components/CategoriesSuggestionWidget/CategoriesSuggestionWidget.js +21 -0
  5. package/lib/cjs/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +1 -1
  6. package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +2 -2
  7. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +4 -4
  8. package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +49 -0
  9. package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +94 -0
  10. package/lib/cjs/components/CreateLiveStreamButton/index.d.ts +3 -0
  11. package/lib/cjs/components/CreateLiveStreamButton/index.js +5 -0
  12. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +51 -0
  13. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +123 -0
  14. package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.d.ts +46 -0
  15. package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +166 -0
  16. package/lib/cjs/components/CreateLiveStreamDialog/constants.d.ts +1 -0
  17. package/lib/cjs/components/CreateLiveStreamDialog/constants.js +4 -0
  18. package/lib/cjs/components/CreateLiveStreamDialog/index.d.ts +3 -0
  19. package/lib/cjs/components/CreateLiveStreamDialog/index.js +5 -0
  20. package/lib/cjs/components/CreateLiveStreamDialog/types.d.ts +8 -0
  21. package/lib/cjs/components/CreateLiveStreamDialog/types.js +13 -0
  22. package/lib/cjs/components/EditEventButton/EditEventButton.js +1 -1
  23. package/lib/cjs/components/Editor/Editor.d.ts +1 -1
  24. package/lib/cjs/components/Editor/nodes/HashtagNode.d.ts +1 -1
  25. package/lib/cjs/components/Editor/nodes/HashtagNode.js +4 -4
  26. package/lib/cjs/components/Editor/nodes/ImageNode.d.ts +1 -1
  27. package/lib/cjs/components/Editor/nodes/ImageNode.js +6 -6
  28. package/lib/cjs/components/Editor/nodes/MentionNode.d.ts +1 -1
  29. package/lib/cjs/components/Editor/nodes/MentionNode.js +4 -4
  30. package/lib/cjs/components/Editor/plugins/ApiPlugin.d.ts +1 -1
  31. package/lib/cjs/components/Editor/plugins/MentionsPlugin.d.ts +2 -2
  32. package/lib/cjs/components/Editor/shared/useDecorators.d.ts +2 -2
  33. package/lib/cjs/components/Event/Event.js +1 -1
  34. package/lib/cjs/components/EventForm/EventForm.d.ts +7 -12
  35. package/lib/cjs/components/EventForm/EventForm.js +55 -55
  36. package/lib/cjs/components/EventForm/types.d.ts +5 -5
  37. package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +48 -0
  38. package/lib/cjs/components/EventFormDialog/EventFormDialog.js +56 -0
  39. package/lib/cjs/components/EventFormDialog/constants.d.ts +1 -0
  40. package/lib/cjs/components/EventFormDialog/constants.js +4 -0
  41. package/lib/cjs/components/EventFormDialog/index.d.ts +3 -0
  42. package/lib/cjs/components/EventFormDialog/index.js +5 -0
  43. package/lib/cjs/components/EventHeader/EventHeader.js +3 -7
  44. package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +6 -4
  45. package/lib/cjs/components/EventMediaWidget/EventMediaWidget.d.ts +41 -0
  46. package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +253 -0
  47. package/lib/cjs/components/EventMediaWidget/Skeleton.d.ts +2 -0
  48. package/lib/cjs/components/EventMediaWidget/Skeleton.js +28 -0
  49. package/lib/cjs/components/EventMediaWidget/TriggerButton.d.ts +17 -0
  50. package/lib/cjs/components/EventMediaWidget/TriggerButton.js +66 -0
  51. package/lib/cjs/components/EventMediaWidget/asUploadButton.d.ts +7 -0
  52. package/lib/cjs/components/EventMediaWidget/asUploadButton.js +25 -0
  53. package/lib/cjs/components/EventMediaWidget/constants.d.ts +1 -0
  54. package/lib/cjs/components/EventMediaWidget/constants.js +4 -0
  55. package/lib/cjs/components/EventMediaWidget/index.d.ts +4 -0
  56. package/lib/cjs/components/EventMediaWidget/index.js +8 -0
  57. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.d.ts +3 -0
  58. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +18 -13
  59. package/lib/cjs/components/EventMembersWidget/types.d.ts +1 -1
  60. package/lib/cjs/components/Events/Events.js +15 -6
  61. package/lib/cjs/components/Events/LocationEventsFilter.d.ts +14 -0
  62. package/lib/cjs/components/Events/LocationEventsFilter.js +45 -0
  63. package/lib/cjs/components/Events/PastEventsFilter.js +1 -2
  64. package/lib/cjs/components/Feed/Feed.d.ts +2 -2
  65. package/lib/cjs/components/Feed/Feed.js +3 -2
  66. package/lib/cjs/components/Feed/Skeleton.d.ts +1 -1
  67. package/lib/cjs/components/GroupActionsMenu/index.d.ts +57 -0
  68. package/lib/cjs/components/GroupActionsMenu/index.js +157 -0
  69. package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -0
  70. package/lib/cjs/components/GroupHeader/GroupHeader.js +8 -4
  71. package/lib/cjs/components/Groups/Groups.js +26 -0
  72. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.d.ts +55 -0
  73. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +156 -0
  74. package/lib/cjs/components/LiveStreamForm/constants.d.ts +1 -0
  75. package/lib/cjs/components/LiveStreamForm/constants.js +4 -0
  76. package/lib/cjs/components/LiveStreamForm/index.d.ts +3 -0
  77. package/lib/cjs/components/LiveStreamForm/index.js +5 -0
  78. package/lib/cjs/components/LiveStreamForm/types.d.ts +10 -0
  79. package/lib/cjs/components/LiveStreamForm/types.js +2 -0
  80. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.d.ts +48 -0
  81. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +123 -0
  82. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +69 -0
  83. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +186 -0
  84. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/RecordingIndicator.d.ts +4 -0
  85. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/RecordingIndicator.js +31 -0
  86. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/constants.d.ts +1 -0
  87. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/constants.js +4 -0
  88. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/index.d.ts +3 -0
  89. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/index.js +5 -0
  90. package/lib/cjs/components/LiveStreamRoom/constants.d.ts +5 -0
  91. package/lib/cjs/components/LiveStreamRoom/constants.js +8 -0
  92. package/lib/cjs/components/LiveStreamRoom/index.d.ts +3 -0
  93. package/lib/cjs/components/LiveStreamRoom/index.js +5 -0
  94. package/lib/cjs/components/LiveStreamRoom/types.d.ts +22 -0
  95. package/lib/cjs/components/LiveStreamRoom/types.js +8 -0
  96. package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.js +1 -1
  97. package/lib/cjs/components/NavigationMenuIconButton/DefaultHeaderContent.d.ts +1 -1
  98. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +47 -0
  99. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +39 -0
  100. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
  101. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +4 -20
  102. package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
  103. package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -1
  104. package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +35 -2
  105. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
  106. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +3 -3
  107. package/lib/cjs/components/OnBoardingWidget/ActionsButton.d.ts +7 -0
  108. package/lib/cjs/components/OnBoardingWidget/ActionsButton.js +84 -0
  109. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +5 -1
  110. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +96 -23
  111. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +23 -16
  112. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +56 -12
  113. package/lib/cjs/components/PlatformWidget/constants.d.ts +0 -4
  114. package/lib/cjs/components/PlatformWidget/constants.js +1 -5
  115. package/lib/cjs/components/PrivateMessageComponent/Skeleton.d.ts +1 -1
  116. package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
  117. package/lib/cjs/constants/GroupActionsMenu.d.ts +5 -0
  118. package/lib/cjs/constants/GroupActionsMenu.js +8 -0
  119. package/lib/cjs/constants/LiveStream.d.ts +3 -0
  120. package/lib/cjs/constants/LiveStream.js +6 -0
  121. package/lib/cjs/constants/PubSub.d.ts +8 -1
  122. package/lib/cjs/constants/PubSub.js +9 -1
  123. package/lib/cjs/index.d.ts +15 -4
  124. package/lib/cjs/index.js +35 -9
  125. package/lib/cjs/shared/EventActionsMenu/index.d.ts +1 -1
  126. package/lib/cjs/shared/EventActionsMenu/index.js +11 -15
  127. package/lib/cjs/shared/EventInfoDetails/index.js +3 -3
  128. package/lib/cjs/shared/InfiniteScroll/index.d.ts +1 -1
  129. package/lib/cjs/shared/InfiniteScroll/index.js +4 -4
  130. package/lib/cjs/shared/Lightbox/BaseLightbox.d.ts +19 -0
  131. package/lib/cjs/shared/Lightbox/BaseLightbox.js +35 -0
  132. package/lib/cjs/shared/Lightbox/Lightbox.d.ts +31 -17
  133. package/lib/cjs/shared/Lightbox/Lightbox.js +16 -19
  134. package/lib/cjs/shared/Lightbox/constants.d.ts +1 -0
  135. package/lib/cjs/shared/Lightbox/constants.js +4 -0
  136. package/lib/cjs/shared/Lightbox/index.d.ts +4 -2
  137. package/lib/cjs/shared/Lightbox/index.js +4 -1
  138. package/lib/cjs/shared/Media/File/DisplayComponent.js +23 -6
  139. package/lib/cjs/shared/Media/File/asUploadButton.d.ts +1 -1
  140. package/lib/cjs/shared/Media/Link/DisplayComponent.js +5 -5
  141. package/lib/cjs/shared/Media/Link/UrlTextField/index.d.ts +1 -1
  142. package/lib/cjs/shared/MediaChunkUploader/index.js +13 -11
  143. package/lib/cjs/shared/MetadataField/MetadataField.d.ts +1 -1
  144. package/lib/cjs/shared/StickyBox/index.d.ts +4 -4
  145. package/lib/cjs/shared/UsernameTextField/index.d.ts +1 -1
  146. package/lib/cjs/types/composer.d.ts +1 -1
  147. package/lib/cjs/utils/events.d.ts +2 -0
  148. package/lib/cjs/utils/events.js +10 -0
  149. package/lib/cjs/utils/hash.d.ts +2 -1
  150. package/lib/cjs/utils/liveStream.d.ts +4 -0
  151. package/lib/cjs/utils/liveStream.js +25 -0
  152. package/lib/cjs/utils/widget.d.ts +1 -0
  153. package/lib/cjs/utils/widget.js +14 -0
  154. package/lib/esm/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  155. package/lib/esm/components/Categories/Categories.js +23 -1
  156. package/lib/esm/components/CategoriesPopularWidget/CategoriesPopularWidget.js +22 -1
  157. package/lib/esm/components/CategoriesSuggestionWidget/CategoriesSuggestionWidget.js +22 -1
  158. package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +2 -2
  159. package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +2 -2
  160. package/lib/esm/components/CreateEventButton/CreateEventButton.js +4 -4
  161. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +49 -0
  162. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +91 -0
  163. package/lib/esm/components/CreateLiveStreamButton/index.d.ts +3 -0
  164. package/lib/esm/components/CreateLiveStreamButton/index.js +2 -0
  165. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +51 -0
  166. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +120 -0
  167. package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.d.ts +46 -0
  168. package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +163 -0
  169. package/lib/esm/components/CreateLiveStreamDialog/constants.d.ts +1 -0
  170. package/lib/esm/components/CreateLiveStreamDialog/constants.js +1 -0
  171. package/lib/esm/components/CreateLiveStreamDialog/index.d.ts +3 -0
  172. package/lib/esm/components/CreateLiveStreamDialog/index.js +2 -0
  173. package/lib/esm/components/CreateLiveStreamDialog/types.d.ts +8 -0
  174. package/lib/esm/components/CreateLiveStreamDialog/types.js +10 -0
  175. package/lib/esm/components/EditEventButton/EditEventButton.js +1 -1
  176. package/lib/esm/components/Editor/Editor.d.ts +1 -1
  177. package/lib/esm/components/Editor/nodes/HashtagNode.d.ts +1 -1
  178. package/lib/esm/components/Editor/nodes/HashtagNode.js +4 -4
  179. package/lib/esm/components/Editor/nodes/ImageNode.d.ts +1 -1
  180. package/lib/esm/components/Editor/nodes/ImageNode.js +6 -6
  181. package/lib/esm/components/Editor/nodes/MentionNode.d.ts +1 -1
  182. package/lib/esm/components/Editor/nodes/MentionNode.js +4 -4
  183. package/lib/esm/components/Editor/plugins/ApiPlugin.d.ts +1 -1
  184. package/lib/esm/components/Editor/plugins/MentionsPlugin.d.ts +2 -2
  185. package/lib/esm/components/Editor/shared/useDecorators.d.ts +2 -2
  186. package/lib/esm/components/Event/Event.js +1 -1
  187. package/lib/esm/components/EventForm/EventForm.d.ts +7 -12
  188. package/lib/esm/components/EventForm/EventForm.js +56 -56
  189. package/lib/esm/components/EventForm/types.d.ts +5 -5
  190. package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +48 -0
  191. package/lib/esm/components/EventFormDialog/EventFormDialog.js +53 -0
  192. package/lib/esm/components/EventFormDialog/constants.d.ts +1 -0
  193. package/lib/esm/components/EventFormDialog/constants.js +1 -0
  194. package/lib/esm/components/EventFormDialog/index.d.ts +3 -0
  195. package/lib/esm/components/EventFormDialog/index.js +2 -0
  196. package/lib/esm/components/EventHeader/EventHeader.js +3 -7
  197. package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +6 -4
  198. package/lib/esm/components/EventMediaWidget/EventMediaWidget.d.ts +41 -0
  199. package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +250 -0
  200. package/lib/esm/components/EventMediaWidget/Skeleton.d.ts +2 -0
  201. package/lib/esm/components/EventMediaWidget/Skeleton.js +22 -0
  202. package/lib/esm/components/EventMediaWidget/TriggerButton.d.ts +17 -0
  203. package/lib/esm/components/EventMediaWidget/TriggerButton.js +64 -0
  204. package/lib/esm/components/EventMediaWidget/asUploadButton.d.ts +7 -0
  205. package/lib/esm/components/EventMediaWidget/asUploadButton.js +23 -0
  206. package/lib/esm/components/EventMediaWidget/constants.d.ts +1 -0
  207. package/lib/esm/components/EventMediaWidget/constants.js +1 -0
  208. package/lib/esm/components/EventMediaWidget/index.d.ts +4 -0
  209. package/lib/esm/components/EventMediaWidget/index.js +4 -0
  210. package/lib/esm/components/EventMembersWidget/EventMembersWidget.d.ts +3 -0
  211. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +18 -13
  212. package/lib/esm/components/EventMembersWidget/types.d.ts +1 -1
  213. package/lib/esm/components/Events/Events.js +16 -7
  214. package/lib/esm/components/Events/LocationEventsFilter.d.ts +14 -0
  215. package/lib/esm/components/Events/LocationEventsFilter.js +41 -0
  216. package/lib/esm/components/Events/PastEventsFilter.js +1 -2
  217. package/lib/esm/components/Feed/Feed.d.ts +2 -2
  218. package/lib/esm/components/Feed/Feed.js +4 -3
  219. package/lib/esm/components/Feed/Skeleton.d.ts +1 -1
  220. package/lib/esm/components/GroupActionsMenu/index.d.ts +57 -0
  221. package/lib/esm/components/GroupActionsMenu/index.js +154 -0
  222. package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -0
  223. package/lib/esm/components/GroupHeader/GroupHeader.js +9 -5
  224. package/lib/esm/components/Groups/Groups.js +27 -1
  225. package/lib/esm/components/LiveStreamForm/LiveStreamForm.d.ts +55 -0
  226. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +153 -0
  227. package/lib/esm/components/LiveStreamForm/constants.d.ts +1 -0
  228. package/lib/esm/components/LiveStreamForm/constants.js +1 -0
  229. package/lib/esm/components/LiveStreamForm/index.d.ts +3 -0
  230. package/lib/esm/components/LiveStreamForm/index.js +2 -0
  231. package/lib/esm/components/LiveStreamForm/types.d.ts +10 -0
  232. package/lib/esm/components/LiveStreamForm/types.js +1 -0
  233. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.d.ts +48 -0
  234. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +120 -0
  235. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +69 -0
  236. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +183 -0
  237. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/RecordingIndicator.d.ts +4 -0
  238. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/RecordingIndicator.js +28 -0
  239. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/constants.d.ts +1 -0
  240. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/constants.js +1 -0
  241. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/index.d.ts +3 -0
  242. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/index.js +2 -0
  243. package/lib/esm/components/LiveStreamRoom/constants.d.ts +5 -0
  244. package/lib/esm/components/LiveStreamRoom/constants.js +5 -0
  245. package/lib/esm/components/LiveStreamRoom/index.d.ts +3 -0
  246. package/lib/esm/components/LiveStreamRoom/index.js +2 -0
  247. package/lib/esm/components/LiveStreamRoom/types.d.ts +22 -0
  248. package/lib/esm/components/LiveStreamRoom/types.js +4 -0
  249. package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.js +2 -2
  250. package/lib/esm/components/NavigationMenuIconButton/DefaultHeaderContent.d.ts +1 -1
  251. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +47 -0
  252. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +36 -0
  253. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
  254. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +6 -22
  255. package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
  256. package/lib/esm/components/NavigationMenuIconButton/index.js +2 -1
  257. package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +38 -5
  258. package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
  259. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +3 -3
  260. package/lib/esm/components/OnBoardingWidget/ActionsButton.d.ts +7 -0
  261. package/lib/esm/components/OnBoardingWidget/ActionsButton.js +81 -0
  262. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +5 -1
  263. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +99 -26
  264. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +24 -17
  265. package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +59 -14
  266. package/lib/esm/components/PlatformWidget/constants.d.ts +0 -4
  267. package/lib/esm/components/PlatformWidget/constants.js +0 -4
  268. package/lib/esm/components/PrivateMessageComponent/Skeleton.d.ts +1 -1
  269. package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
  270. package/lib/esm/constants/GroupActionsMenu.d.ts +5 -0
  271. package/lib/esm/constants/GroupActionsMenu.js +5 -0
  272. package/lib/esm/constants/LiveStream.d.ts +3 -0
  273. package/lib/esm/constants/LiveStream.js +3 -0
  274. package/lib/esm/constants/PubSub.d.ts +8 -1
  275. package/lib/esm/constants/PubSub.js +8 -0
  276. package/lib/esm/index.d.ts +15 -4
  277. package/lib/esm/index.js +17 -7
  278. package/lib/esm/shared/EventActionsMenu/index.d.ts +1 -1
  279. package/lib/esm/shared/EventActionsMenu/index.js +11 -15
  280. package/lib/esm/shared/EventInfoDetails/index.js +3 -3
  281. package/lib/esm/shared/InfiniteScroll/index.d.ts +1 -1
  282. package/lib/esm/shared/InfiniteScroll/index.js +4 -4
  283. package/lib/esm/shared/Lightbox/BaseLightbox.d.ts +19 -0
  284. package/lib/esm/shared/Lightbox/BaseLightbox.js +33 -0
  285. package/lib/esm/shared/Lightbox/Lightbox.d.ts +31 -17
  286. package/lib/esm/shared/Lightbox/Lightbox.js +15 -19
  287. package/lib/esm/shared/Lightbox/constants.d.ts +1 -0
  288. package/lib/esm/shared/Lightbox/constants.js +1 -0
  289. package/lib/esm/shared/Lightbox/index.d.ts +4 -2
  290. package/lib/esm/shared/Lightbox/index.js +3 -1
  291. package/lib/esm/shared/Media/File/DisplayComponent.js +23 -6
  292. package/lib/esm/shared/Media/File/asUploadButton.d.ts +1 -1
  293. package/lib/esm/shared/Media/Link/DisplayComponent.js +5 -5
  294. package/lib/esm/shared/Media/Link/UrlTextField/index.d.ts +1 -1
  295. package/lib/esm/shared/MediaChunkUploader/index.js +14 -12
  296. package/lib/esm/shared/MetadataField/MetadataField.d.ts +1 -1
  297. package/lib/esm/shared/StickyBox/index.d.ts +4 -4
  298. package/lib/esm/shared/UsernameTextField/index.d.ts +1 -1
  299. package/lib/esm/types/composer.d.ts +1 -1
  300. package/lib/esm/utils/events.d.ts +2 -0
  301. package/lib/esm/utils/events.js +6 -0
  302. package/lib/esm/utils/hash.d.ts +2 -1
  303. package/lib/esm/utils/liveStream.d.ts +4 -0
  304. package/lib/esm/utils/liveStream.js +18 -0
  305. package/lib/esm/utils/widget.d.ts +1 -0
  306. package/lib/esm/utils/widget.js +14 -0
  307. package/lib/umd/245.js +1 -0
  308. package/lib/umd/43.js +2 -0
  309. package/lib/umd/react-ui.js +1 -1
  310. package/lib/umd/react-ui.js.LICENSE.txt +2 -0
  311. package/package.json +22 -10
  312. package/lib/cjs/shared/Media/File/Lightbox/index.d.ts +0 -28
  313. package/lib/cjs/shared/Media/File/Lightbox/index.js +0 -37
  314. package/lib/esm/shared/Media/File/Lightbox/index.d.ts +0 -28
  315. package/lib/esm/shared/Media/File/Lightbox/index.js +0 -34
  316. package/lib/umd/99.js +0 -2
  317. /package/lib/umd/{99.js.LICENSE.txt → 43.js.LICENSE.txt} +0 -0
@@ -47,11 +47,11 @@ export default (props) => {
47
47
  * @param key
48
48
  */
49
49
  const renderPreview = (media, key) => {
50
- if (media.embed.metadata.html) {
51
- return renderHtml(media, key);
52
- }
50
+ // if (media.embed.metadata.html) {
51
+ // return renderHtml(media, key);
52
+ // }
53
53
  const domain = new URL(media.embed.metadata.url).hostname.replace('www.', '');
54
- return (_jsxs(Box, Object.assign({ className: classes.displayLink }, { children: [media.embed.metadata.images && media.embed.metadata.images.length > 0 && (_jsx(_Fragment, { children: fullWidth ? (_jsx(Box, { className: classNames(classes.thumbnailFullWidth, classes.image), style: { background: `url(${media.image})`, paddingBottom: `${100 / media.image_width / media.image_height}%` } })) : (_jsx(Box, { className: classNames(classes.thumbnail, classes.image), style: { background: `url(${media.image})` } })) })), _jsxs(Box, Object.assign({ className: classes.snippet }, { children: [_jsx("b", Object.assign({ className: classes.snippetTitle }, { children: media.embed.metadata.title })), _jsx("br", {}), _jsx("p", Object.assign({ className: classes.snippetDescription }, { children: media.embed.metadata.description })), _jsx("a", Object.assign({ href: media.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(media) }, { children: domain }))] })), _jsx("div", { style: { clear: 'both' } })] })));
54
+ return (_jsxs(Box, Object.assign({ className: classes.displayLink }, { children: [media.embed.metadata.images && media.embed.metadata.images.length > 0 && (_jsx(_Fragment, { children: fullWidth ? (_jsx(Box, { className: classNames(classes.thumbnailFullWidth, classes.image), style: { background: `url(${media.image})`, paddingBottom: `${100 / media.image_width / media.image_height}%` } })) : (_jsx(Box, { className: classNames(classes.thumbnail, classes.image), style: { background: `url(${media.image})` } })) })), _jsxs(Box, Object.assign({ className: classes.snippet }, { children: [_jsx("b", Object.assign({ className: classes.snippetTitle }, { children: media.embed.metadata.title })), _jsx("br", {}), _jsx("p", Object.assign({ className: classes.snippetDescription }, { children: media.embed.metadata.description })), _jsx("a", Object.assign({ href: media.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(media) }, { children: domain }))] })), _jsx("div", { style: { clear: 'both' } })] }), key));
55
55
  };
56
56
  /**
57
57
  * Render html embed
@@ -59,7 +59,7 @@ export default (props) => {
59
59
  * @param key
60
60
  */
61
61
  const renderHtml = (media, key) => {
62
- return (_jsxs(Box, Object.assign({ className: classes.displayHtmlWrap }, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: media.embed.metadata.html }, className: classes.displayHtml }), _jsx("div", Object.assign({ className: classes.displayHtmlPlaceholder, style: { paddingTop: `${(100 * media.embed.metadata.height) / media.embed.metadata.width}%`, maxHeight: media.embed.metadata.height } }, { children: _jsx(CircularProgress, { size: 20, className: classes.displayHtmlLoading }) }))] })));
62
+ return (_jsxs(Box, Object.assign({ className: classes.displayHtmlWrap }, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: media.embed.metadata.html }, className: classes.displayHtml }), _jsx("div", Object.assign({ className: classes.displayHtmlPlaceholder, style: { paddingTop: `${(100 * media.embed.metadata.height) / media.embed.metadata.width}%`, maxHeight: media.embed.metadata.height } }, { children: _jsx(CircularProgress, { size: 20, className: classes.displayHtmlLoading }) }))] }), key));
63
63
  };
64
64
  /**
65
65
  * Renders component
@@ -75,6 +75,6 @@ export interface OutlinedUrlTextFieldProps extends BaseUrlTextFieldProps {
75
75
  */
76
76
  InputProps?: Partial<OutlinedInputProps>;
77
77
  }
78
- export declare type UrlTextFieldProps = StandardUrlTextFieldProps | FilledUrlTextFieldProps | OutlinedUrlTextFieldProps;
78
+ export type UrlTextFieldProps = StandardUrlTextFieldProps | FilledUrlTextFieldProps | OutlinedUrlTextFieldProps;
79
79
  declare const _default: (props: UrlTextFieldProps) => JSX.Element;
80
80
  export default _default;
@@ -1,14 +1,14 @@
1
1
  import { __awaiter } from "tslib";
2
- import { useChunkFinishListener, useChunkStartListener, useItemErrorListener, useItemFinishListener, useRequestPreSend, } from '@rpldy/chunked-uploady';
2
+ import { useChunkFinishListener, useChunkStartListener, useItemErrorListener, useItemFinishListener, useRequestPreSend } from '@rpldy/chunked-uploady';
3
+ import { useItemProgressListener, useItemStartListener } from '@rpldy/uploady';
3
4
  import { Endpoints, http } from '@selfcommunity/api-services';
4
5
  import { useSCContext, useSCUser } from '@selfcommunity/react-core';
5
- import { useItemProgressListener, useItemStartListener } from '@rpldy/uploady';
6
- import { md5 } from '../../utils/hash';
6
+ import { Logger, resizeImage } from '@selfcommunity/utils';
7
7
  import React, { useEffect, useRef, useState } from 'react';
8
8
  import { useIntl } from 'react-intl';
9
- import messages from '../../messages/common';
10
- import { Logger, resizeImage } from '@selfcommunity/utils';
11
9
  import { SCOPE_SC_UI } from '../../constants/Errors';
10
+ import messages from '../../messages/common';
11
+ import { md5 } from '../../utils/hash';
12
12
  export default (props) => {
13
13
  // PROPS
14
14
  const { type = null, onSuccess = null, onProgress = null, onError = null } = props;
@@ -53,7 +53,7 @@ export default (props) => {
53
53
  // @ts-ignore
54
54
  reader.readAsDataURL(item.file);
55
55
  }
56
- chunkStateRef.current.setChunk({ id: item.id, [`upload_id`]: null, completed: 0, name: item.file.name });
56
+ chunkStateRef.current.setChunk({ id: item.id, ['upload_id']: null, completed: 0, name: item.file.name });
57
57
  });
58
58
  useItemProgressListener((item) => {
59
59
  chunkStateRef.current.setChunk({ id: item.id, completed: item.completed });
@@ -100,7 +100,7 @@ export default (props) => {
100
100
  sendOptions: {
101
101
  paramName: 'image',
102
102
  method: Endpoints.ComposerChunkUploadMedia.method,
103
- formatServerResponse: (response, status, headers) => __awaiter(void 0, void 0, void 0, function* () {
103
+ formatServerResponse: (response, status, _headers) => __awaiter(void 0, void 0, void 0, function* () {
104
104
  if (status === 401) {
105
105
  yield refreshSession();
106
106
  }
@@ -109,7 +109,7 @@ export default (props) => {
109
109
  }
110
110
  };
111
111
  if (chunkStateRef.current.chunks[data.item.id].upload_id) {
112
- res.sendOptions.params = { [`upload_id`]: chunkStateRef.current.chunks[data.item.id].upload_id };
112
+ res.sendOptions.params = { ['upload_id']: chunkStateRef.current.chunks[data.item.id].upload_id };
113
113
  }
114
114
  else {
115
115
  chunkStateRef.current.setChunk({ id: data.item.id, type: type || data.sendOptions.paramName });
@@ -118,12 +118,14 @@ export default (props) => {
118
118
  });
119
119
  useChunkFinishListener((data) => __awaiter(void 0, void 0, void 0, function* () {
120
120
  const _data = yield data.uploadData.response.data;
121
- chunkStateRef.current.setChunk({ id: data.item.id, [`upload_id`]: _data.upload_id });
121
+ chunkStateRef.current.setChunk({ id: data.item.id, ['upload_id']: _data.upload_id });
122
122
  }));
123
123
  useRequestPreSend(({ items, options }) => __awaiter(void 0, void 0, void 0, function* () {
124
- const destination = ['JWT', 'OAuth'].includes(scContext.settings.session.type) ? {
125
- headers: { Authorization: `Bearer ${scContext.settings.session.authToken.accessToken}` }
126
- } : {};
124
+ const destination = ['JWT', 'OAuth'].includes(scContext.settings.session.type)
125
+ ? {
126
+ headers: { Authorization: `Bearer ${scContext.settings.session.authToken.accessToken}` }
127
+ }
128
+ : {};
127
129
  if (items.length == 0) {
128
130
  return Promise.resolve({ options, destination });
129
131
  }
@@ -1,6 +1,6 @@
1
1
  import { TextFieldProps } from '@mui/material';
2
2
  import { SCMetadataType } from '@selfcommunity/types';
3
- export declare type MetadataFieldProps = TextFieldProps & {
3
+ export type MetadataFieldProps = TextFieldProps & {
4
4
  metadata: SCMetadataType;
5
5
  };
6
6
  declare const MetadataField: (props: MetadataFieldProps) => JSX.Element;
@@ -32,18 +32,18 @@ import React from 'react';
32
32
  /**
33
33
  * Types/interfaces
34
34
  */
35
- export declare type UseStickyBoxProps = {
35
+ export type UseStickyBoxProps = {
36
36
  offsetTop?: number;
37
37
  offsetBottom?: number;
38
38
  bottom?: boolean;
39
39
  };
40
- export declare type StickyBoxProps = UseStickyBoxProps & {
40
+ export type StickyBoxProps = UseStickyBoxProps & {
41
41
  style?: React.CSSProperties;
42
42
  className?: string;
43
43
  children?: React.ReactNode;
44
44
  };
45
- export declare type useStickyBox = <T = any>(options?: UseStickyBoxProps) => React.RefCallback<T>;
46
- export declare type StickyBoxComponent = React.FunctionComponent<StickyBoxProps>;
45
+ export type useStickyBox = <T = any>(options?: UseStickyBoxProps) => React.RefCallback<T>;
46
+ export type StickyBoxComponent = React.FunctionComponent<StickyBoxProps>;
47
47
  /**
48
48
  * useStickyBox
49
49
  * @param offsetTop
@@ -1,5 +1,5 @@
1
1
  import { TextFieldProps } from '@mui/material';
2
- export declare type UsernameTextFieldProps = {
2
+ export type UsernameTextFieldProps = {
3
3
  /**
4
4
  * Allows the field to accept an email format as well
5
5
  */
@@ -10,6 +10,6 @@ export interface ComposerLayerProps {
10
10
  onSave: (value: any) => void;
11
11
  defaultValue: any;
12
12
  }
13
- export declare type ComposerContentType = Omit<SCFeedPostType, 'id' | 'last_activity_at' | 'added_at' | 'slug' | 'summary' | 'deleted' | 'collapsed' | 'comment_count' | 'share_count' | 'view_count' | 'vote_count' | 'follower_count' | 'reaction' | 'reactions_count' | 'flag_count' | 'type'> & {
13
+ export type ComposerContentType = Omit<SCFeedPostType, 'id' | 'last_activity_at' | 'added_at' | 'slug' | 'summary' | 'deleted' | 'collapsed' | 'comment_count' | 'share_count' | 'view_count' | 'vote_count' | 'follower_count' | 'reaction' | 'reactions_count' | 'flag_count' | 'type'> & {
14
14
  title?: string;
15
15
  };
@@ -0,0 +1,2 @@
1
+ import { SCEventType } from '@selfcommunity/types';
2
+ export declare function checkEventFinished(event: SCEventType | null): boolean;
@@ -0,0 +1,6 @@
1
+ export function checkEventFinished(event) {
2
+ if (event && !event.running) {
3
+ return new Date().getTime() > new Date(event.end_date || event.start_date).getTime();
4
+ }
5
+ return false;
6
+ }
@@ -1 +1,2 @@
1
- export declare const md5: (file: any, chunkSize: any, callback: any) => void;
1
+ import { BatchFile } from '@rpldy/shared';
2
+ export declare const md5: (file: BatchFile['file'], chunkSize: number, callback: (arg: any) => void) => void;
@@ -0,0 +1,4 @@
1
+ export declare function encodePassphrase(passphrase: string): string;
2
+ export declare function decodePassphrase(base64String: string): string;
3
+ export declare function generateRoomId(): string;
4
+ export declare function randomString(length: number): string;
@@ -0,0 +1,18 @@
1
+ export function encodePassphrase(passphrase) {
2
+ return encodeURIComponent(passphrase);
3
+ }
4
+ export function decodePassphrase(base64String) {
5
+ return decodeURIComponent(base64String);
6
+ }
7
+ export function generateRoomId() {
8
+ return `${randomString(4)}-${randomString(4)}`;
9
+ }
10
+ export function randomString(length) {
11
+ let result = '';
12
+ const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
13
+ const charactersLength = characters.length;
14
+ for (let i = 0; i < length; i++) {
15
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
16
+ }
17
+ return result;
18
+ }
@@ -14,6 +14,7 @@ export declare const actionWidgetTypes: {
14
14
  LOAD_PREVIOUS_FAILURE: string;
15
15
  SET_RESULTS: string;
16
16
  SET_VISIBLE_ITEMS: string;
17
+ INITIALIZE: string;
17
18
  RESET: string;
18
19
  };
19
20
  /**
@@ -15,6 +15,7 @@ export const actionWidgetTypes = {
15
15
  LOAD_PREVIOUS_FAILURE: '_load_previous_failure',
16
16
  SET_RESULTS: '_set_results',
17
17
  SET_VISIBLE_ITEMS: '_set_visible_items',
18
+ INITIALIZE: '_initialize',
18
19
  RESET: '_reset'
19
20
  };
20
21
  /**
@@ -53,6 +54,19 @@ export function dataWidgetReducer(state, action) {
53
54
  case actionWidgetTypes.RESET:
54
55
  _state = { isLoadingNext: false, next: null, results: [], count: 0, errorLoadNext: null, initialized: false };
55
56
  break;
57
+ case actionWidgetTypes.INITIALIZE:
58
+ _state = {
59
+ cacheKey: action.payload.cacheKey ? action.payload.cacheKey : null,
60
+ count: action.payload.count ? action.payload.count : 0,
61
+ results: action.payload.results ? action.payload.results : [],
62
+ next: action.payload.next ? action.payload.next : null,
63
+ previous: action.payload.previous ? action.payload.previous : null,
64
+ isLoadingNext: action.payload.isLoadingNext ? action.payload.isLoadingNext : false,
65
+ isLoadingPrevious: action.payload.isLoadingPrevious ? action.payload.isLoadingPrevious : false,
66
+ visibleItems: action.payload.visibleItems ? action.payload.visibleItems : null,
67
+ initialized: false
68
+ };
69
+ break;
56
70
  }
57
71
  LRUCache.set(_state.cacheKey, _state);
58
72
  return _state;
package/lib/umd/245.js ADDED
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SelfCommunityReactUI=t():e.SelfCommunityReactUI=t()}(self,(()=>(()=>{"use strict";function e(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var t,n,i,r={exports:{}},o=r.exports,a=(t||(t=1,function(e){var t,n;t=o,n=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function a(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(i){return"debug"===i&&(i="log"),typeof console!==t&&("trace"===i&&n?s:void 0!==console[i]?a(console,i):void 0!==console.log?a(console,"log"):e)}function u(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function d(e){return function(){typeof console!==t&&(u.call(this),this[e].apply(this,arguments))}}function l(e,t,n){return c(e)||d.apply(this,arguments)}function h(e,n){var a,s,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||l,d.getLevel=function(){return null!=c?c:null!=s?s:a},d.setLevel=function(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),u.call(d)},d.setDefaultLevel=function(e){s=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),u.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(a=p(o.getLevel())),u.call(d),o===d)for(var e in r)r[e].rebuild()},a=p(o?o.getLevel():"WARN");var y=f();null!=y&&(c=p(y)),u.call(d)}(o=new h).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new h(e,o.methodFactory)),t};var f=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=f),o},o.getLoggers=function(){return r},o.default=o,o},e.exports?e.exports=n():t.log=n()}(r)),r.exports);!function(e){e[e.trace=0]="trace",e[e.debug=1]="debug",e[e.info=2]="info",e[e.warn=3]="warn",e[e.error=4]="error",e[e.silent=5]="silent"}(n||(n={})),function(e){e.Default="livekit",e.Room="livekit-room",e.Participant="livekit-participant",e.Track="livekit-track",e.Publication="livekit-track-publication",e.Engine="livekit-engine",e.Signal="livekit-signal",e.PCManager="livekit-pc-manager",e.PCTransport="livekit-pc-transport",e.E2EE="lk-e2ee"}(i||(i={}));let s=a.getLogger("livekit");function c(e){const t=a.getLogger(e);return t.setDefaultLevel(s.getLevel()),t}Object.values(i).map((e=>a.getLogger(e))),s.setDefaultLevel(n.info);const u=a.getLogger("lk-e2ee");function d(e,t){if(!e)throw new Error(t)}function l(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function h(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function f(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}const p=Symbol("@bufbuild/protobuf/enum-type");function y(e,t,n,i){e[p]=m(t,n.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))))}function m(e,t,n){const i=Object.create(null),r=Object.create(null),o=[];for(const e of t){const t=g(e);o.push(t),i[e.name]=t,r[e.no]=t}return{typeName:e,values:o,findName:e=>i[e],findNumber:e=>r[e]}}function g(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class b{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType().runtime.bin,i=n.makeReadOptions(t);return n.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,t){const n=this.getType(),i=n.runtime.json,r=i.makeReadOptions(t);return i.readMessage(n,e,r,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(e instanceof Error?e.message:String(e)))}return this.fromJson(n,t)}toBinary(e){const t=this.getType().runtime.bin,n=t.makeWriteOptions(e),i=n.writerFactory();return t.writeMessage(this,i,n),i.finish()}toJson(e){const t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function v(){let e=0,t=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(e|=(127&i)<<n,0==(128&i))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,0==(128&n))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(t|=(127&i)<<n,0==(128&i))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function k(e,t,n){for(let i=0;i<28;i+=7){const r=e>>>i,o=!(r>>>7==0&&0==t),a=255&(o?128|r:r);if(n.push(a),!o)return}const i=e>>>28&15|(7&t)<<4,r=!(t>>3==0);if(n.push(255&(r?128|i:i)),r){for(let e=3;e<31;e+=7){const i=t>>>e,r=!(i>>>7==0),o=255&(r?128|i:i);if(n.push(o),!r)return}n.push(t>>>31&1)}}const w=4294967296;function S(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let i=0,r=0;function o(t,o){const a=Number(e.slice(t,o));r*=n,i=i*n+a,i>=w&&(r+=i/w|0,i%=w)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?E(i,r):T(i,r)}function I(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(w*t+e);const n=16777215&(e>>>24|t<<8),i=t>>16&65535;let r=(16777215&e)+6777216*n+6710656*i,o=n+8147497*i,a=2*i;const s=1e7;return r>=s&&(o+=Math.floor(r/s),r%=s),o>=s&&(a+=Math.floor(o/s),o%=s),a.toString()+N(o)+N(r)}function T(e,t){return{lo:0|e,hi:0|t}}function E(e,t){return t=~t,e?e=1+~e:t+=1,T(e,t)}const N=e=>{const t=String(e);return"0000000".slice(t.length)+t};function C(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function A(){let e=this.buf[this.pos++],t=127&e;if(0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,0==(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;0!=(128&e)&&t<10;t++)e=this.buf[this.pos++];if(0!=(128&e))throw new Error("invalid varint");return this.assertBounds(),t>>>0}const L=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),r=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const i="bigint"==typeof e?e:BigInt(e);if(i>n||i<t)throw new Error("int64 invalid: ".concat(e));return i},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>r||t<i)throw new Error("uint64 invalid: ".concat(e));return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}const t=e=>d(/^-?[0-9]+$/.test(e),"int64 invalid: ".concat(e)),n=e=>d(/^[0-9]+$/.test(e),"uint64 invalid: ".concat(e));return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),n(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),S(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),S(e)),dec:(e,t)=>function(e,t){let n=T(e,t);const i=2147483648&n.hi;i&&(n=E(n.lo,n.hi));const r=I(n.lo,n.hi);return i?"-"+r:r}(e,t),uDec:(e,t)=>I(e,t)}}();var O,U,F;function D(e,t,n){if(t===n)return!0;if(e==O.BYTES){if(!(t instanceof Uint8Array&&n instanceof Uint8Array))return!1;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case O.UINT64:case O.FIXED64:case O.INT64:case O.SFIXED64:case O.SINT64:return t==n}return!1}function R(e,t){switch(e){case O.BOOL:return!1;case O.UINT64:case O.FIXED64:case O.INT64:case O.SFIXED64:case O.SINT64:return 0==t?L.zero:"0";case O.DOUBLE:case O.FLOAT:return 0;case O.BYTES:return new Uint8Array(0);case O.STRING:return"";default:return 0}}function x(e,t){switch(e){case O.BOOL:return!1===t;case O.STRING:return""===t;case O.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}!function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"}(O||(O={})),function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"}(U||(U={})),function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(F||(F={}));class P{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(h(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return l(e),C(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){f(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){h(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){l(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return l(e),C(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=L.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=L.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=L.enc(e);return k(t.lo,t.hi,this.buf),this}sint64(e){let t=L.enc(e),n=t.hi>>31;return k(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=L.uEnc(e);return k(t.lo,t.hi,this.buf),this}}class B{constructor(e,t){this.varint64=v,this.uint32=A,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case F.Varint:for(;128&this.buf[this.pos++];);break;case F.Bit64:this.pos+=4;case F.Bit32:this.pos+=4;break;case F.LengthDelimited:let n=this.uint32();this.pos+=n;break;case F.StartGroup:for(;;){const[e,n]=this.tag();if(n===F.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return L.dec(...this.varint64())}uint64(){return L.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,L.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return L.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return L.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function _(e){const t=e.field.localName,n=Object.create(null);return n[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return R(t.T,t.L);case"message":const e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}(e),[n,()=>n[t]]}let M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),K=[];for(let e=0;e<M.length;e++)K[M[e].charCodeAt(0)]=e;K["-".charCodeAt(0)]=M.indexOf("+"),K["_".charCodeAt(0)]=M.indexOf("/");const j={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let n,i=new Uint8Array(t),r=0,o=0,a=0;for(let t=0;t<e.length;t++){if(n=K[e.charCodeAt(t)],void 0===n)switch(e[t]){case"=":o=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(o){case 0:a=n,o=1;break;case 1:i[r++]=a<<2|(48&n)>>4,a=n,o=2;break;case 2:i[r++]=(15&a)<<4|(60&n)>>2,a=n,o=3;break;case 3:i[r++]=(3&a)<<6|n,o=0}}if(1==o)throw Error("invalid base64 string.");return i.subarray(0,r)},enc(e){let t,n="",i=0,r=0;for(let o=0;o<e.length;o++)switch(t=e[o],i){case 0:n+=M[t>>2],r=(3&t)<<4,i=1;break;case 1:n+=M[r|t>>4],r=(15&t)<<2,i=2;break;case 2:n+=M[r|t>>6],n+=M[63&t],i=0}return i&&(n+=M[r],n+="=",1==i&&(n+="=")),n}};function V(e,t,n){J(t,e);const i=t.runtime.bin.makeReadOptions(n),r=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter((e=>e.no===t.no))}(e.getType().runtime.bin.listUnknownFields(e),t.field),[o,a]=_(t);for(const e of r)t.runtime.bin.readField(o,i.readerFactory(e.data),t.field,e.wireType,i);return a()}function G(e,t,n,i){J(t,e);const r=t.runtime.bin.makeReadOptions(i),o=t.runtime.bin.makeWriteOptions(i);if(q(e,t)){const n=e.getType().runtime.bin.listUnknownFields(e).filter((e=>e.no!=t.field.no));e.getType().runtime.bin.discardUnknownFields(e);for(const t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const a=o.writerFactory();let s=t.field;s.opt||s.repeated||"enum"!=s.kind&&"scalar"!=s.kind||(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,a,o);const c=r.readerFactory(a.finish());for(;c.pos<c.len;){const[t,n]=c.tag(),i=c.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,i)}}function q(e,t){const n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find((e=>e.no==t.field.no))}function J(e,t){d(e.extendee.typeName==t.getType().typeName,"extension ".concat(e.typeName," can only be applied to message ").concat(e.extendee.typeName))}function X(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[n]:"enum"==e.kind?t[n]!==e.T.values[0].no:!x(e.T,t[n]);case"message":return void 0!==t[n];case"map":return Object.keys(t[n]).length>0}}function W(e,t){const n=e.localName,i=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=i?e.T.values[0].no:void 0;break;case"scalar":t[n]=i?R(e.T,e.L):void 0;break;case"message":t[n]=void 0}}function H(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(b.prototype).every((t=>t in e&&"function"==typeof e[t])))return!1;const n=e.getType();return null!==n&&"function"==typeof n&&"typeName"in n&&"string"==typeof n.typeName&&(void 0===t||n.typeName==t.typeName)}function Y(e,t){return H(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}O.DOUBLE,O.FLOAT,O.INT64,O.UINT64,O.INT32,O.UINT32,O.BOOL,O.STRING,O.BYTES;const z={ignoreUnknownFields:!1},Q={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};const $=Symbol(),Z=Symbol();function ee(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":'"'.concat(e.split('"').join('\\"'),'"');default:return String(e)}}function te(e,t,n,i,r){let o=n.localName;if(n.repeated){if(d("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(ee(t)));const a=e[o];for(const e of t){if(null===e)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(ee(e)));switch(n.kind){case"message":a.push(n.T.fromJson(e,i));break;case"enum":const t=re(n.T,e,i.ignoreUnknownFields,!0);t!==Z&&a.push(t);break;case"scalar":try{a.push(ie(n.T,e,n.L,!0))}catch(t){let i="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(ee(e));throw t instanceof Error&&t.message.length>0&&(i+=": ".concat(t.message)),new Error(i)}}}}else if("map"==n.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(ee(t)));const a=e[o];for(const[e,o]of Object.entries(t)){if(null===o)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: map value null"));let s;try{s=ne(n.K,e)}catch(e){let i="cannot decode map key for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(ee(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}switch(n.V.kind){case"message":a[s]=n.V.T.fromJson(o,i);break;case"enum":const e=re(n.V.T,o,i.ignoreUnknownFields,!0);e!==Z&&(a[s]=e);break;case"scalar":try{a[s]=ie(n.V.T,o,U.BIGINT,!0)}catch(e){let i="cannot decode map value for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(ee(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:o},o="value"),n.kind){case"message":const a=n.T;if(null===t&&"google.protobuf.Value"!=a.typeName)return;let s=e[o];H(s)?s.fromJson(t,i):(e[o]=s=a.fromJson(t,i),a.fieldWrapper&&!n.oneof&&(e[o]=a.fieldWrapper.unwrapField(s)));break;case"enum":const c=re(n.T,t,i.ignoreUnknownFields,!1);switch(c){case $:W(n,e);break;case Z:break;default:e[o]=c}break;case"scalar":try{const i=ie(n.T,t,n.L,!1);i===$?W(n,e):e[o]=i}catch(e){let i="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(ee(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}}}function ne(e,t){if(e===O.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return ie(e,t,U.BIGINT,!0).toString()}function ie(e,t,n,i){if(null===t)return i?R(e,n):$;switch(e){case O.DOUBLE:case O.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const i=Number(t);if(Number.isNaN(i))break;if(!Number.isFinite(i))break;return e==O.FLOAT&&f(i),i;case O.INT32:case O.FIXED32:case O.SFIXED32:case O.SINT32:case O.UINT32:let r;if("number"==typeof t?r=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(r=Number(t)),void 0===r)break;return e==O.UINT32||e==O.FIXED32?h(r):l(r),r;case O.INT64:case O.SFIXED64:case O.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const o=L.parse(t);return n?o.toString():o;case O.FIXED64:case O.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const a=L.uParse(t);return n?a.toString():a;case O.BOOL:if("boolean"!=typeof t)break;return t;case O.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(e){throw new Error("invalid UTF8")}return t;case O.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return j.dec(t)}throw new Error}function re(e,t,n,i){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:i?e.values[0].no:$;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const i=e.findName(t);if(void 0!==i)return i.no;if(n)return Z}throw new Error("cannot decode enum ".concat(e.typeName," from JSON: ").concat(ee(t)))}function oe(e){return!(!e.repeated&&"map"!=e.kind&&(e.oneof||"message"==e.kind||e.opt||e.req))}function ae(e,t,n){if("map"==e.kind){d("object"==typeof t&&null!=t);const i={},r=Object.entries(t);switch(e.V.kind){case"scalar":for(const[t,n]of r)i[t.toString()]=ce(e.V.T,n);break;case"message":for(const[e,t]of r)i[e.toString()]=t.toJson(n);break;case"enum":const t=e.V.T;for(const[e,o]of r)i[e.toString()]=se(t,o,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?i:void 0}if(e.repeated){d(Array.isArray(t));const i=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++)i.push(ce(e.T,t[n]));break;case"enum":for(let r=0;r<t.length;r++)i.push(se(e.T,t[r],n.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)i.push(t[e].toJson(n))}return n.emitDefaultValues||i.length>0?i:void 0}switch(e.kind){case"scalar":return ce(e.T,t);case"enum":return se(e.T,t,n.enumAsInteger);case"message":return Y(e.T,t).toJson(n)}}function se(e,t,n){var i;if(d("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const r=e.findNumber(t);return null!==(i=null==r?void 0:r.name)&&void 0!==i?i:t}function ce(e,t){switch(e){case O.INT32:case O.SFIXED32:case O.SINT32:case O.FIXED32:case O.UINT32:return d("number"==typeof t),t;case O.FLOAT:case O.DOUBLE:return d("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case O.STRING:return d("string"==typeof t),t;case O.BOOL:return d("boolean"==typeof t),t;case O.UINT64:case O.FIXED64:case O.INT64:case O.SFIXED64:case O.SINT64:return d("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case O.BYTES:return d(t instanceof Uint8Array),j.enc(t)}}const ue=Symbol("@bufbuild/protobuf/unknown-fields"),de={readUnknownFields:!0,readerFactory:e=>new B(e)},le={writeUnknownFields:!0,writerFactory:()=>new P};function he(e,t,n,i,r){let{repeated:o,localName:a}=n;switch(n.oneof&&((e=e[n.oneof.localName]).case!=a&&delete e.value,e.case=a,a="value"),n.kind){case"scalar":case"enum":const s="enum"==n.kind?O.INT32:n.T;let c=ye;if("scalar"==n.kind&&n.L>0&&(c=pe),o){let n=e[a];if(i==F.LengthDelimited&&s!=O.STRING&&s!=O.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,s))}else n.push(c(t,s))}else e[a]=c(t,s);break;case"message":const u=n.T;o?e[a].push(fe(t,new u,r,n)):H(e[a])?fe(t,e[a],r,n):(e[a]=fe(t,new u,r,n),!u.fieldWrapper||n.oneof||n.repeated||(e[a]=u.fieldWrapper.unwrapField(e[a])));break;case"map":let[d,l]=function(e,t,n){const i=t.uint32(),r=t.pos+i;let o,a;for(;t.pos<r;){const[i]=t.tag();switch(i){case 1:o=ye(t,e.K);break;case 2:switch(e.V.kind){case"scalar":a=ye(t,e.V.T);break;case"enum":a=t.int32();break;case"message":a=fe(t,new e.V.T,n,void 0)}}}if(void 0===o&&(o=R(e.K,U.BIGINT)),"string"!=typeof o&&"number"!=typeof o&&(o=o.toString()),void 0===a)switch(e.V.kind){case"scalar":a=R(e.V.T,U.BIGINT);break;case"enum":a=e.V.T.values[0].no;break;case"message":a=new e.V.T}return[o,a]}(n,t,r);e[a][d]=l}}function fe(e,t,n,i){const r=t.getType().runtime.bin,o=null==i?void 0:i.delimited;return r.readMessage(t,e,o?i.no:e.uint32(),n,o),t}function pe(e,t){const n=ye(e,t);return"bigint"==typeof n?n.toString():n}function ye(e,t){switch(t){case O.STRING:return e.string();case O.BOOL:return e.bool();case O.DOUBLE:return e.double();case O.FLOAT:return e.float();case O.INT32:return e.int32();case O.INT64:return e.int64();case O.UINT64:return e.uint64();case O.FIXED64:return e.fixed64();case O.BYTES:return e.bytes();case O.FIXED32:return e.fixed32();case O.SFIXED32:return e.sfixed32();case O.SFIXED64:return e.sfixed64();case O.SINT64:return e.sint64();case O.UINT32:return e.uint32();case O.SINT32:return e.sint32()}}function me(e,t,n,i){d(void 0!==t);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let o="enum"==e.kind?O.INT32:e.T;if(r)if(d(Array.isArray(t)),e.packed)!function(e,t,n,i){if(!i.length)return;e.tag(n,F.LengthDelimited).fork();let[,r]=ke(t);for(let t=0;t<i.length;t++)e[r](i[t]);e.join()}(n,o,e.no,t);else for(const i of t)ve(n,o,e.no,i);else ve(n,o,e.no,t);break;case"message":if(r){d(Array.isArray(t));for(const r of t)be(n,i,e,r)}else be(n,i,e,t);break;case"map":d("object"==typeof t&&null!=t);for(const[r,o]of Object.entries(t))ge(n,i,e,r,o)}}function ge(e,t,n,i,r){e.tag(n.no,F.LengthDelimited),e.fork();let o=i;switch(n.K){case O.INT32:case O.FIXED32:case O.UINT32:case O.SFIXED32:case O.SINT32:o=Number.parseInt(i);break;case O.BOOL:d("true"==i||"false"==i),o="true"==i}switch(ve(e,n.K,1,o),n.V.kind){case"scalar":ve(e,n.V.T,2,r);break;case"enum":ve(e,O.INT32,2,r);break;case"message":d(void 0!==r),e.tag(2,F.LengthDelimited).bytes(r.toBinary(t))}e.join()}function be(e,t,n,i){const r=Y(n.T,i);n.delimited?e.tag(n.no,F.StartGroup).raw(r.toBinary(t)).tag(n.no,F.EndGroup):e.tag(n.no,F.LengthDelimited).bytes(r.toBinary(t))}function ve(e,t,n,i){d(void 0!==i);let[r,o]=ke(t);e.tag(n,r)[o](i)}function ke(e){let t=F.Varint;switch(e){case O.BYTES:case O.STRING:t=F.LengthDelimited;break;case O.DOUBLE:case O.FIXED64:case O.SFIXED64:t=F.Bit64;break;case O.FIXED32:case O.SFIXED32:case O.FLOAT:t=F.Bit32}return[t,O[e].toLowerCase()]}function we(e){if(void 0===e)return e;if(H(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function Se(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class Ie{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort(((e,t)=>e.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function Te(e,t){const n=Ne(e);return t?n:Ue(Oe(n))}const Ee=Ne;function Ne(e){let t=!1;const n=[];for(let i=0;i<e.length;i++){let r=e.charAt(i);switch(r){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),t=!1;break;default:t&&(t=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const Ce=new Set(["constructor","toString","toJSON","valueOf"]),Ae=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Le=e=>"".concat(e,"$"),Oe=e=>Ae.has(e)?Le(e):e,Ue=e=>Ce.has(e)?Le(e):e;class Fe{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Te(e,!1)}addField(e){d(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const De=(Re=e=>new Ie(e,(e=>function(e,t){var n,i,r,o,a,s;const c=[];let u;for(const t of"function"==typeof e?e():e){const e=t;if(e.localName=Te(t.name,void 0!==t.oneof),e.jsonName=null!==(n=t.jsonName)&&void 0!==n?n:Ee(t.name),e.repeated=null!==(i=t.repeated)&&void 0!==i&&i,"scalar"==t.kind&&(e.L=null!==(r=t.L)&&void 0!==r?r:U.BIGINT),e.delimited=null!==(o=t.delimited)&&void 0!==o&&o,e.req=null!==(a=t.req)&&void 0!==a&&a,e.opt=null!==(s=t.opt)&&void 0!==s&&s,void 0===t.packed&&(e.packed="enum"==t.kind||"scalar"==t.kind&&t.T!=O.BYTES&&t.T!=O.STRING),void 0!==t.oneof){const n="string"==typeof t.oneof?t.oneof:t.oneof.name;u&&u.name==n||(u=new Fe(n)),e.oneof=u,u.addField(e)}c.push(e)}return c}(e))),xe=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,i=e;if(t.repeated)i[n]=[];else switch(t.kind){case"oneof":i[n]={case:void 0};break;case"enum":i[n]=0;break;case"map":i[n]={};break;case"scalar":i[n]=R(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:function(e){return e?Object.assign(Object.assign({},z),e):z},makeWriteOptions:function(e){return e?Object.assign(Object.assign({},Q),e):Q},readMessage(e,t,n,i){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(e.typeName," from JSON: ").concat(ee(t)));i=null!=i?i:new e;const r=new Map,o=n.typeRegistry;for(const[a,s]of Object.entries(t)){const t=e.fields.findJsonName(a);if(t){if(t.oneof){if(null===s&&"scalar"==t.kind)continue;const n=r.get(t.oneof);if(void 0!==n)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(n,'", "').concat(a,'"'));r.set(t.oneof,a)}te(i,s,t,n,e)}else{let t=!1;if((null==o?void 0:o.findExtension)&&a.startsWith("[")&&a.endsWith("]")){const r=o.findExtension(a.substring(1,a.length-1));if(r&&r.extendee.typeName==e.typeName){t=!0;const[e,o]=_(r);te(e,s,r.field,n,r),G(i,r,o(),n)}}if(!t&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: key "').concat(a,'" is unknown'))}}return i},writeMessage(e,t){const n=e.getType(),i={};let r;try{for(r of n.fields.byNumber()){if(!X(r,e)){if(r.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!oe(r))continue}const n=ae(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t);void 0!==n&&(i[t.useProtoFieldName?r.name:r.jsonName]=n)}const o=t.typeRegistry;if(null==o?void 0:o.findExtensionFor)for(const r of n.runtime.bin.listUnknownFields(e)){const a=o.findExtensionFor(n.typeName,r.no);if(a&&q(e,a)){const n=V(e,a,t),r=ae(a.field,n,t);void 0!==r&&(i[a.field.jsonName]=r)}}}catch(e){const t=r?"cannot encode field ".concat(n.typeName,".").concat(r.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),i=e instanceof Error?e.message:String(e);throw new Error(t+(i.length>0?": ".concat(i):""))}return i},readScalar:(e,t,n)=>ie(e,t,null!=n?n:U.BIGINT,!0),writeScalar(e,t,n){if(void 0!==t)return n||x(e,t)?ce(e,t):void 0},debug:ee},bin:{makeReadOptions:function(e){return e?Object.assign(Object.assign({},de),e):de},makeWriteOptions:function(e){return e?Object.assign(Object.assign({},le),e):le},listUnknownFields(e){var t;return null!==(t=e[ue])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[ue]},writeUnknownFields(e,t){const n=e[ue];if(n)for(const e of n)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,n,i){const r=e;Array.isArray(r[ue])||(r[ue]=[]),r[ue].push({no:t,wireType:n,data:i})},readMessage(e,t,n,i,r){const o=e.getType(),a=r?t.len:t.pos+n;let s,c;for(;t.pos<a&&([s,c]=t.tag(),!0!==r||c!=F.EndGroup);){const n=o.fields.find(s);if(n)he(e,t,n,c,i);else{const n=t.skip(c,s);i.readUnknownFields&&this.onUnknownField(e,s,c,n)}}if(r&&(c!=F.EndGroup||s!==n))throw new Error("invalid end group tag")},readField:he,writeMessage(e,t,n){const i=e.getType();for(const r of i.fields.byNumber())if(X(r,e))me(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t,n);else if(r.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(r.name," to binary: required field not set"));return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,i){void 0!==t&&me(e,t,n,i)}},util:Object.assign(Object.assign({},{setEnumType:y,initPartial(e,t){if(void 0===e)return;const n=t.getType();for(const i of n.fields.byMember()){const n=i.localName,r=t,o=e;if(null!=o[n])switch(i.kind){case"oneof":const e=o[n].case;if(void 0===e)continue;const t=i.findField(e);let a=o[n].value;t&&"message"==t.kind&&!H(a,t.T)?a=new t.T(a):t&&"scalar"===t.kind&&t.T===O.BYTES&&(a=Se(a)),r[n]={case:e,value:a};break;case"scalar":case"enum":let s=o[n];i.T===O.BYTES&&(s=i.repeated?s.map(Se):Se(s)),r[n]=s;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===O.BYTES)for(const[e,t]of Object.entries(o[n]))r[n][e]=Se(t);else Object.assign(r[n],o[n]);break;case"message":const e=i.V.T;for(const t of Object.keys(o[n])){let i=o[n][t];e.fieldWrapper||(i=new e(i)),r[n][t]=i}}break;case"message":const c=i.T;if(i.repeated)r[n]=o[n].map((e=>H(e,c)?e:new c(e)));else{const e=o[n];c.fieldWrapper?"google.protobuf.BytesValue"===c.typeName?r[n]=Se(e):r[n]=e:r[n]=H(e,c)?e:new c(e)}}}},equals:(e,t,n)=>t===n||!(!t||!n)&&e.fields.byMember().every((e=>{const i=t[e.localName],r=n[e.localName];if(e.repeated){if(i.length!==r.length)return!1;switch(e.kind){case"message":return i.every(((t,n)=>e.T.equals(t,r[n])));case"scalar":return i.every(((t,n)=>D(e.T,t,r[n])));case"enum":return i.every(((e,t)=>D(O.INT32,e,r[t])))}throw new Error("repeated cannot contain ".concat(e.kind))}switch(e.kind){case"message":return e.T.equals(i,r);case"enum":return D(O.INT32,i,r);case"scalar":return D(e.T,i,r);case"oneof":if(i.case!==r.case)return!1;const t=e.findField(i.case);if(void 0===t)return!0;switch(t.kind){case"message":return t.T.equals(i.value,r.value);case"enum":return D(O.INT32,i.value,r.value);case"scalar":return D(t.T,i.value,r.value)}throw new Error("oneof cannot contain ".concat(t.kind));case"map":const n=Object.keys(i).concat(Object.keys(r));switch(e.V.kind){case"message":const t=e.V.T;return n.every((e=>t.equals(i[e],r[e])));case"enum":return n.every((e=>D(O.INT32,i[e],r[e])));case"scalar":const o=e.V.T;return n.every((e=>D(o,i[e],r[e])))}}})),clone(e){const t=e.getType(),n=new t,i=n;for(const n of t.fields.byMember()){const t=e[n.localName];let r;if(n.repeated)r=t.map(we);else if("map"==n.kind){r=i[n.localName];for(const[e,n]of Object.entries(t))r[e]=we(n)}else r="oneof"==n.kind?n.findField(t.case)?{case:t.case,value:we(t.value)}:{case:void 0}:we(t);i[n.localName]=r}for(const n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(i,n.no,n.wireType,n.data);return n}}),{newFieldList:Re,initFields:xe}),makeMessageType(e,t,n){return function(e,t,n,i){var r;const o=null!==(r=null==i?void 0:i.localName)&&void 0!==r?r:t.substring(t.lastIndexOf(".")+1),a={[o]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[o];return Object.setPrototypeOf(a.prototype,new b),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary:(e,t)=>(new a).fromBinary(e,t),fromJson:(e,t)=>(new a).fromJson(e,t),fromJsonString:(e,t)=>(new a).fromJsonString(e,t),equals:(t,n)=>e.util.equals(a,t,n)}),a}(this,e,t,n)},makeEnum:function(e,t,n){const i={};for(const e of t){const t=g(e);i[t.localName]=t.no,i[t.no]=t.localName}return y(i,e,t),i},makeEnumType:m,getEnumType:function(e){const t=e[p];return d(t,"missing enum type on enum object"),t},makeExtension(e,t,n){return function(e,t,n,i){let r;return{typeName:t,extendee:n,get field(){if(!r){const n="function"==typeof i?i():i;n.name=t.split(".").pop(),n.jsonName="[".concat(t,"]"),r=e.util.newFieldList([n]).list()[0]}return r},runtime:e}}(this,e,t,n)}});var Re,xe;const Pe=De.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Be=De.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),_e=De.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),Me=/version\/(\d+(\.?_?\d+)+)/i;let Ke;function je(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("undefined"==typeof navigator)return;const n=navigator.userAgent.toLowerCase();if(void 0===Ke||t){const e=Ve.find((e=>{let{test:t}=e;return t.test(n)}));Ke=null==e?void 0:e.describe(n)}return Ke}const Ve=[{test:/firefox|iceweasel|fxios/i,describe:e=>({name:"Firefox",version:Ge(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:qe(e)})},{test:/chrom|crios|crmo/i,describe:e=>({name:"Chrome",version:Ge(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("crios")?"iOS":void 0,osVersion:qe(e)})},{test:/safari|applewebkit/i,describe:e=>({name:"Safari",version:Ge(Me,e),os:e.includes("mobile/")?"iOS":"macOS",osVersion:qe(e)})}];function Ge(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const i=t.match(e);return i&&i.length>=n&&i[n]||""}function qe(e){return e.includes("mac os")?Ge(/\(.+?(\d+_\d+(:?_\d+)?)/,e,1).replace(/_/g,"."):void 0}class Je{constructor(e,t,n,i,r){if("object"==typeof e)this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else{if(void 0===t||void 0===n)throw new TypeError("Unsupported options: provide at least width, height and maxBitrate");this.width=e,this.height=t,this.aspectRatio=e/t,this.encoding={maxBitrate:n,maxFramerate:i,priority:r}}}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}var Xe;!function(e){e.telephone={maxBitrate:12e3},e.speech={maxBitrate:2e4},e.music={maxBitrate:32e3},e.musicStereo={maxBitrate:48e3},e.musicHighQuality={maxBitrate:64e3},e.musicHighQualityStereo={maxBitrate:96e3}}(Xe||(Xe={})),new Je(160,90,9e4,20),new Je(320,180,16e4,20),new Je(384,216,18e4,20),new Je(640,360,45e4,20),new Je(960,540,8e5,25),new Je(1280,720,17e5,30),new Je(1920,1080,3e6,30),new Je(2560,1440,5e6,30),new Je(3840,2160,8e6,30),new Je(160,120,7e4,20),new Je(240,180,125e3,20),new Je(320,240,14e4,20),new Je(480,360,33e4,20),new Je(640,480,5e5,20),new Je(720,540,6e5,25),new Je(960,720,13e5,30),new Je(1440,1080,23e5,30),new Je(1920,1440,38e5,30),new Je(640,360,2e5,3,"medium"),new Je(640,360,4e5,15,"medium"),new Je(1280,720,8e5,5,"medium"),new Je(1280,720,15e5,15,"medium"),new Je(1280,720,2e6,30,"medium"),new Je(1920,1080,25e5,15,"medium"),new Je(1920,1080,5e6,30,"medium"),new Je(0,0,7e6,30,"medium");var We,He,Ye,ze,Qe,$e={exports:{}},Ze=function(){if(We)return $e.exports;We=1;var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}$e.exports=r,$e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}p(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&p(e,"error",t,{once:!0})}(e,r)}))},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var r,o,c,u;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),c=o[t]),void 0===c)c=o[t]=n,++e._eventsCount;else if("function"==typeof c?c=o[t]=i?[n,c]:[c,n]:i?c.unshift(n):c.push(n),(r=s(e))>0&&c.length>r&&!c.warned){c.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=c.length,u=d,console&&console.warn&&console.warn(u)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=u.bind(i);return r.listener=n,i.wrapFn=r,r}function l(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):f(r,r.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function p(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}return Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),r.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},r.prototype.getMaxListeners=function(){return s(this)},r.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,d=f(c,u);for(i=0;i<u;++i)n(d[i],this,t)}return!0},r.prototype.addListener=function(e,t){return c(this,e,t,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(e,t){return c(this,e,t,!0)},r.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},r.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},r.prototype.removeListener=function(e,t){var n,i,r,o,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},r.prototype.listeners=function(e){return l(this,e,!0)},r.prototype.rawListeners=function(e){return l(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},r.prototype.listenerCount=h,r.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},$e.exports}();!function(e){e.Connected="connected",e.Reconnecting="reconnecting",e.SignalReconnecting="signalReconnecting",e.Reconnected="reconnected",e.Disconnected="disconnected",e.ConnectionStateChanged="connectionStateChanged",e.MediaDevicesChanged="mediaDevicesChanged",e.ParticipantConnected="participantConnected",e.ParticipantDisconnected="participantDisconnected",e.TrackPublished="trackPublished",e.TrackSubscribed="trackSubscribed",e.TrackSubscriptionFailed="trackSubscriptionFailed",e.TrackUnpublished="trackUnpublished",e.TrackUnsubscribed="trackUnsubscribed",e.TrackMuted="trackMuted",e.TrackUnmuted="trackUnmuted",e.LocalTrackPublished="localTrackPublished",e.LocalTrackUnpublished="localTrackUnpublished",e.LocalAudioSilenceDetected="localAudioSilenceDetected",e.ActiveSpeakersChanged="activeSpeakersChanged",e.ParticipantMetadataChanged="participantMetadataChanged",e.ParticipantNameChanged="participantNameChanged",e.ParticipantAttributesChanged="participantAttributesChanged",e.RoomMetadataChanged="roomMetadataChanged",e.DataReceived="dataReceived",e.SipDTMFReceived="sipDTMFReceived",e.TranscriptionReceived="transcriptionReceived",e.ConnectionQualityChanged="connectionQualityChanged",e.TrackStreamStateChanged="trackStreamStateChanged",e.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",e.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",e.AudioPlaybackStatusChanged="audioPlaybackChanged",e.VideoPlaybackStatusChanged="videoPlaybackChanged",e.MediaDevicesError="mediaDevicesError",e.ParticipantPermissionsChanged="participantPermissionsChanged",e.SignalConnected="signalConnected",e.RecordingStatusChanged="recordingStatusChanged",e.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",e.EncryptionError="encryptionError",e.DCBufferStatusChanged="dcBufferStatusChanged",e.ActiveDeviceChanged="activeDeviceChanged",e.ChatMessage="chatMessage",e.LocalTrackSubscribed="localTrackSubscribed",e.MetricsReceived="metricsReceived"}(He||(He={})),function(e){e.TrackPublished="trackPublished",e.TrackSubscribed="trackSubscribed",e.TrackSubscriptionFailed="trackSubscriptionFailed",e.TrackUnpublished="trackUnpublished",e.TrackUnsubscribed="trackUnsubscribed",e.TrackMuted="trackMuted",e.TrackUnmuted="trackUnmuted",e.LocalTrackPublished="localTrackPublished",e.LocalTrackUnpublished="localTrackUnpublished",e.ParticipantMetadataChanged="participantMetadataChanged",e.ParticipantNameChanged="participantNameChanged",e.DataReceived="dataReceived",e.SipDTMFReceived="sipDTMFReceived",e.TranscriptionReceived="transcriptionReceived",e.IsSpeakingChanged="isSpeakingChanged",e.ConnectionQualityChanged="connectionQualityChanged",e.TrackStreamStateChanged="trackStreamStateChanged",e.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",e.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",e.MediaDevicesError="mediaDevicesError",e.AudioStreamAcquired="audioStreamAcquired",e.ParticipantPermissionsChanged="participantPermissionsChanged",e.PCTrackAdded="pcTrackAdded",e.AttributesChanged="attributesChanged",e.LocalTrackSubscribed="localTrackSubscribed",e.ChatMessage="chatMessage"}(Ye||(Ye={})),function(e){e.TransportsCreated="transportsCreated",e.Connected="connected",e.Disconnected="disconnected",e.Resuming="resuming",e.Resumed="resumed",e.Restarting="restarting",e.Restarted="restarted",e.SignalResumed="signalResumed",e.SignalRestarted="signalRestarted",e.Closing="closing",e.MediaTrackAdded="mediaTrackAdded",e.ActiveSpeakersUpdate="activeSpeakersUpdate",e.DataPacketReceived="dataPacketReceived",e.RTPVideoMapUpdate="rtpVideoMapUpdate",e.DCBufferStatusChanged="dcBufferStatusChanged",e.ParticipantUpdate="participantUpdate",e.RoomUpdate="roomUpdate",e.SpeakersChanged="speakersChanged",e.StreamStateChanged="streamStateChanged",e.ConnectionQualityUpdate="connectionQualityUpdate",e.SubscriptionError="subscriptionError",e.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",e.RemoteMute="remoteMute",e.SubscribedQualityUpdate="subscribedQualityUpdate",e.LocalTrackUnpublished="localTrackUnpublished",e.LocalTrackSubscribed="localTrackSubscribed",e.Offline="offline",e.SignalRequestResponse="signalRequestResponse"}(ze||(ze={})),function(e){e.Message="message",e.Muted="muted",e.Unmuted="unmuted",e.Restarted="restarted",e.Ended="ended",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed",e.UpdateSettings="updateSettings",e.UpdateSubscription="updateSubscription",e.AudioPlaybackStarted="audioPlaybackStarted",e.AudioPlaybackFailed="audioPlaybackFailed",e.AudioSilenceDetected="audioSilenceDetected",e.VisibilityChanged="visibilityChanged",e.VideoDimensionsChanged="videoDimensionsChanged",e.VideoPlaybackStarted="videoPlaybackStarted",e.VideoPlaybackFailed="videoPlaybackFailed",e.ElementAttached="elementAttached",e.ElementDetached="elementDetached",e.UpstreamPaused="upstreamPaused",e.UpstreamResumed="upstreamResumed",e.SubscriptionPermissionChanged="subscriptionPermissionChanged",e.SubscriptionStatusChanged="subscriptionStatusChanged",e.SubscriptionFailed="subscriptionFailed",e.TrackProcessorUpdate="trackProcessorUpdate",e.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",e.TranscriptionReceived="transcriptionReceived",e.TimeSyncUpdate="timeSyncUpdate"}(Qe||(Qe={}));const et=[];var tt,nt;!function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=1]="MEDIUM",e[e.HIGH=2]="HIGH"}(tt||(tt={}));class it extends Ze.EventEmitter{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var r;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=it.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=s,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),"hidden"===document.visibilityState?this.backgroundTimeout=setTimeout((()=>this.handleAppVisibilityChanged()),5e3):this.handleAppVisibilityChanged()},this.log=c(null!==(r=n.loggerName)&&void 0!==r?r:i.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=t,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=it.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},null===(e=this.loggerContextCb)||void 0===e?void 0:e.call(this)),ot(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let t="audio";this.kind===it.Kind.Video&&(t="video"),0===this.attachedElements.length&&this.kind===it.Kind.Video&&this.addAppVisibilityListener(),e||("audio"===t&&(et.forEach((t=>{null!==t.parentElement||e||(e=t)})),e&&et.splice(et.indexOf(e),1)),e||(e=document.createElement(t))),this.attachedElements.includes(e)||this.attachedElements.push(e),function(e,t){let n,i;var r;n=t.srcObject instanceof MediaStream?t.srcObject:new MediaStream,i="audio"===e.kind?n.getAudioTracks():n.getVideoTracks(),i.includes(e)||(i.forEach((e=>{n.removeTrack(e)})),n.addTrack(e)),at()&&t instanceof HTMLVideoElement||(t.autoplay=!0),t.muted=0===n.getAudioTracks().length,t instanceof HTMLVideoElement&&(t.playsInline=!0),t.srcObject!==n&&(t.srcObject=n,(at()||"Firefox"===(null===(r=je())||void 0===r?void 0:r.name))&&t instanceof HTMLVideoElement&&setTimeout((()=>{t.srcObject=n,t.play().catch((()=>{}))}),0))}(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),i=n.some((e=>"audio"===e.kind));return e.play().then((()=>{this.emit(i?Qe.AudioPlaybackStarted:Qe.VideoPlaybackStarted)})).catch((t=>{"NotAllowedError"===t.name?this.emit(i?Qe.AudioPlaybackFailed:Qe.VideoPlaybackFailed,t):"AbortError"===t.name?s.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):s.warn("could not playback ".concat(i?"audio":"video"),t),i&&e&&n.some((e=>"video"===e.kind))&&"NotAllowedError"===t.name&&(e.muted=!0,e.play().catch((()=>{})))})),this.emit(Qe.ElementAttached,e),e}detach(e){try{if(e){rt(this.mediaStreamTrack,e);const t=this.attachedElements.indexOf(e);return t>=0&&(this.attachedElements.splice(t,1),this.recycleElement(e),this.emit(Qe.ElementDetached,e)),e}const t=[];return this.attachedElements.forEach((e=>{rt(this.mediaStreamTrack,e),t.push(e),this.recycleElement(e),this.emit(Qe.ElementDetached,e)})),this.attachedElements=[],t}finally{0===this.attachedElements.length&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=c(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let t=!0;e.pause(),et.forEach((e=>{e.parentElement||(t=!1)})),t&&et.push(e)}}handleAppVisibilityChanged(){return e(this,void 0,void 0,(function*(){this.isInBackground="hidden"===document.visibilityState,this.isInBackground||this.kind!==it.Kind.Video||setTimeout((()=>this.attachedElements.forEach((e=>e.play().catch((()=>{}))))),0)}))}addAppVisibilityListener(){st()?(this.isInBackground="hidden"===document.visibilityState,document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){st()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function rt(e,t){if(t.srcObject instanceof MediaStream){const n=t.srcObject;n.removeTrack(e),n.getTracks().length>0?t.srcObject=n:t.srcObject=null}}function ot(e){return e instanceof it?{trackID:e.sid,source:e.source,muted:e.isMuted,enabled:e.mediaStreamTrack.enabled,kind:e.kind,streamID:e.mediaStreamID,streamTrackID:e.mediaStreamTrack.id}:{trackID:e.trackSid,enabled:e.isEnabled,muted:e.isMuted,trackInfo:Object.assign({mimeType:e.mimeType,name:e.trackName,encrypted:e.isEncrypted,kind:e.kind,source:e.source},e.track?ot(e.track):{})}}function at(){var e;return"Safari"===(null===(e=je())||void 0===e?void 0:e.name)}function st(){return"undefined"!=typeof document}!function(e){let t,n,i;!function(e){e.Audio="audio",e.Video="video",e.Unknown="unknown"}(t=e.Kind||(e.Kind={})),function(e){e.Camera="camera",e.Microphone="microphone",e.ScreenShare="screen_share",e.ScreenShareAudio="screen_share_audio",e.Unknown="unknown"}(n=e.Source||(e.Source={})),function(e){e.Active="active",e.Paused="paused",e.Unknown="unknown"}(i=e.StreamState||(e.StreamState={})),e.kindToProto=function(e){switch(e){case t.Audio:return Pe.AUDIO;case t.Video:return Pe.VIDEO;default:return Pe.DATA}},e.kindFromProto=function(e){switch(e){case Pe.AUDIO:return t.Audio;case Pe.VIDEO:return t.Video;default:return t.Unknown}},e.sourceToProto=function(e){switch(e){case n.Camera:return Be.CAMERA;case n.Microphone:return Be.MICROPHONE;case n.ScreenShare:return Be.SCREEN_SHARE;case n.ScreenShareAudio:return Be.SCREEN_SHARE_AUDIO;default:return Be.UNKNOWN}},e.sourceFromProto=function(e){switch(e){case Be.CAMERA:return n.Camera;case Be.MICROPHONE:return n.Microphone;case Be.SCREEN_SHARE:return n.ScreenShare;case Be.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}},e.streamStateFromProto=function(e){switch(e){case _e.ACTIVE:return i.Active;case _e.PAUSED:return i.Paused;default:return i.Unknown}}}(it||(it={}));class ct{constructor(){this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){let e;this._locks+=1;const t=new Promise((t=>e=()=>{this._locks-=1,t()})),n=this._locking.then((()=>e));return this._locking=this._locking.then((()=>t)),n}}!function(e){e[e.WAITING=0]="WAITING",e[e.RUNNING=1]="RUNNING",e[e.COMPLETED=2]="COMPLETED"}(nt||(nt={}));const ut="AES-GCM",dt={key:10,delta:3,audio:1,empty:0};class lt extends Error{constructor(e,t){super(t||"an error has occured"),this.code=e}}var ht,ft,pt,yt,mt,gt,bt;!function(e){e[e.NotAllowed=0]="NotAllowed",e[e.ServerUnreachable=1]="ServerUnreachable",e[e.InternalError=2]="InternalError",e[e.Cancelled=3]="Cancelled",e[e.LeaveRequest=4]="LeaveRequest"}(ht||(ht={})),function(e){e.PermissionDenied="PermissionDenied",e.NotFound="NotFound",e.DeviceInUse="DeviceInUse",e.Other="Other"}(ft||(ft={})),function(e){e.getFailure=function(t){if(t&&"name"in t)return"NotFoundError"===t.name||"DevicesNotFoundError"===t.name?e.NotFound:"NotAllowedError"===t.name||"PermissionDeniedError"===t.name?e.PermissionDenied:"NotReadableError"===t.name||"TrackStartError"===t.name?e.DeviceInUse:e.Other}}(ft||(ft={})),function(e){e[e.InvalidKey=0]="InvalidKey",e[e.MissingKey=1]="MissingKey",e[e.InternalError=2]="InternalError"}(pt||(pt={}));class vt extends lt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pt.InternalError,n=arguments.length>2?arguments[2]:void 0;super(40,e),this.reason=t,this.participantIdentity=n}}function kt(e,t){const n=(new TextEncoder).encode(t);switch(e){case"HKDF":return{name:"HKDF",salt:n,hash:"SHA-256",info:new ArrayBuffer(128)};case"PBKDF2":return{name:"PBKDF2",salt:n,hash:"SHA-256",iterations:1e5};default:throw new Error("algorithm ".concat(e," is currently unsupported"))}}function wt(t,n){return e(this,void 0,void 0,(function*(){const e=kt(t.algorithm.name,n),i=yield crypto.subtle.deriveKey(e,t,{name:ut,length:128},!1,["encrypt","decrypt"]);return{material:t,encryptionKey:i}}))}function St(e){for(var t=0;t<e.length-3;t++)if(0==e[t]&&0==e[t+1]&&3==e[t+2])return!0;return!1}function It(e){const t=[];for(var n=e.length,i=0;i<e.length;)n-i>=3&&!e[i]&&!e[i+1]&&3==e[i+2]?(t.push(e[i++]),t.push(e[i++]),i++):t.push(e[i++]);return new Uint8Array(t)}!function(e){e.SetKey="setKey",e.RatchetRequest="ratchetRequest",e.KeyRatcheted="keyRatcheted"}(yt||(yt={})),function(e){e.KeyRatcheted="keyRatcheted"}(mt||(mt={})),function(e){e.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",e.EncryptionError="encryptionError"}(gt||(gt={})),function(e){e.Error="cryptorError"}(bt||(bt={}));class Tt{constructor(){this.consecutiveSifCount=0,this.lastSifReceivedAt=0,this.userFramesSinceSif=0}recordSif(){var e;this.consecutiveSifCount+=1,null!==(e=this.sifSequenceStartedAt)&&void 0!==e||(this.sifSequenceStartedAt=Date.now()),this.lastSifReceivedAt=Date.now()}recordUserFrame(){void 0!==this.sifSequenceStartedAt&&(this.userFramesSinceSif+=1,(this.userFramesSinceSif>this.consecutiveSifCount||Date.now()-this.lastSifReceivedAt>2e3)&&this.reset())}isSifAllowed(){return this.consecutiveSifCount<100&&(void 0===this.sifSequenceStartedAt||Date.now()-this.sifSequenceStartedAt<2e3)}reset(){this.userFramesSinceSif=0,this.consecutiveSifCount=0,this.sifSequenceStartedAt=void 0}}const Et=new Map;class Nt extends Ze.EventEmitter{encodeFunction(e,t){throw Error("not implemented for subclass")}decodeFunction(e,t){throw Error("not implemented for subclass")}}class Ct extends Nt{constructor(e){var t;super(),this.sendCounts=new Map,this.keys=e.keys,this.participantIdentity=e.participantIdentity,this.rtpMap=new Map,this.keyProviderOptions=e.keyProviderOptions,this.sifTrailer=null!==(t=e.sifTrailer)&&void 0!==t?t:Uint8Array.from([]),this.sifGuard=new Tt}get logContext(){return{participant:this.participantIdentity,mediaTrackId:this.trackId,fallbackCodec:this.videoCodec}}setParticipant(e,t){u.debug("setting new participant on cryptor",Object.assign(Object.assign({},this.logContext),{participant:e})),this.participantIdentity&&u.error("cryptor has already a participant set, participant should have been unset before",Object.assign({},this.logContext)),this.participantIdentity=e,this.keys=t,this.sifGuard.reset()}unsetParticipant(){u.debug("unsetting participant",this.logContext),this.participantIdentity=void 0}isEnabled(){return this.participantIdentity?Et.get(this.participantIdentity):void 0}getParticipantIdentity(){return this.participantIdentity}getTrackId(){return this.trackId}setVideoCodec(e){this.videoCodec=e}setRtpMap(e){this.rtpMap=e}setupTransform(e,t,n,i,r){r&&(u.info("setting codec on cryptor to",{codec:r}),this.videoCodec=r),u.debug("Setting up frame cryptor transform",Object.assign({operation:e,passedTrackId:i,codec:r},this.logContext));const o="encode"===e?this.encodeFunction:this.decodeFunction,a=new TransformStream({transform:o.bind(this)});t.pipeThrough(a).pipeTo(n).catch((e=>{u.warn(e),this.emit(bt.Error,e instanceof vt?e:new vt(e.message,void 0,this.participantIdentity))})),this.trackId=i}setSifTrailer(e){u.debug("setting SIF trailer",Object.assign(Object.assign({},this.logContext),{trailer:e})),this.sifTrailer=e}encodeFunction(t,n){return e(this,void 0,void 0,(function*(){var e;if(!this.isEnabled()||0===t.data.byteLength)return n.enqueue(t);const i=this.keys.getKeySet();if(!i)return void this.emit(bt.Error,new vt("key set not found for ".concat(this.participantIdentity," at index ").concat(this.keys.getCurrentKeyIndex()),pt.MissingKey,this.participantIdentity));const{encryptionKey:r}=i,o=this.keys.getCurrentKeyIndex();if(r){const i=this.makeIV(null!==(e=t.getMetadata().synchronizationSource)&&void 0!==e?e:-1,t.timestamp);let s=this.getUnencryptedBytes(t);const c=new Uint8Array(t.data,0,s.unencryptedBytes),d=new Uint8Array(2);d[0]=12,d[1]=o;try{const e=yield crypto.subtle.encrypt({name:ut,iv:i,additionalData:new Uint8Array(t.data,0,c.byteLength)},r,new Uint8Array(t.data,s.unencryptedBytes));let o=new Uint8Array(e.byteLength+i.byteLength+d.byteLength);o.set(new Uint8Array(e)),o.set(new Uint8Array(i),e.byteLength),o.set(d,e.byteLength+i.byteLength),s.isH264&&(o=function(e){const t=[];for(var n=0,i=0;i<e.length;++i){var r=e[i];r<=3&&n>=2&&(t.push(3),n=0),t.push(r),0==r?++n:n=0}return new Uint8Array(t)}(o));var a=new Uint8Array(c.byteLength+o.byteLength);return a.set(c),a.set(o,c.byteLength),t.data=a.buffer,n.enqueue(t)}catch(e){u.error(e)}}else u.debug("failed to encrypt, emitting error",this.logContext),this.emit(bt.Error,new vt("encryption key missing for encoding",pt.MissingKey,this.participantIdentity))}))}decodeFunction(t,n){return e(this,void 0,void 0,(function*(){if(!this.isEnabled()||0===t.data.byteLength)return u.debug("skipping empty frame",this.logContext),this.sifGuard.recordUserFrame(),n.enqueue(t);if(function(e,t){if(0===t.byteLength)return!1;const n=new Uint8Array(e.slice(e.byteLength-t.byteLength));return t.every(((e,t)=>e===n[t]))}(t.data,this.sifTrailer))return u.debug("enqueue SIF",this.logContext),this.sifGuard.recordSif(),this.sifGuard.isSifAllowed()?(t.data=t.data.slice(0,t.data.byteLength-this.sifTrailer.byteLength),n.enqueue(t)):void u.warn("SIF limit reached, dropping frame");this.sifGuard.recordUserFrame();const e=new Uint8Array(t.data)[t.data.byteLength-1];if(!this.keys.hasInvalidKeyAtIndex(e))if(this.keys.getKeySet(e))try{const i=yield this.decryptFrame(t,e);if(this.keys.decryptionSuccess(e),i)return n.enqueue(i)}catch(t){t instanceof vt&&t.reason===pt.InvalidKey?this.keys.hasValidKey&&(this.emit(bt.Error,t),this.keys.decryptionFailure(e)):u.warn("decoding frame failed",{error:t})}else u.warn("skipping decryption due to missing key at index ".concat(e)),this.emit(bt.Error,new vt("missing key at index ".concat(e," for participant ").concat(this.participantIdentity),pt.MissingKey,this.participantIdentity)),this.keys.decryptionFailure(e)}))}decryptFrame(t,n){return e(this,arguments,void 0,(function(e,t){var n=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{ratchetCount:0};return function*(){var o;const a=n.keys.getKeySet(t);if(!r.encryptionKey&&!a)throw new TypeError("no encryption key found for decryption of ".concat(n.participantIdentity));let s=n.getUnencryptedBytes(e);try{const t=new Uint8Array(e.data,0,s.unencryptedBytes);var c=new Uint8Array(e.data,t.length,e.data.byteLength-t.length);if(s.isH264&&St(c)){c=It(c);const n=new Uint8Array(t.byteLength+c.byteLength);n.set(t),n.set(c,t.byteLength),e.data=n.buffer}const n=new Uint8Array(e.data,e.data.byteLength-2,2),i=n[0],u=new Uint8Array(e.data,e.data.byteLength-i-n.byteLength,i),d=t.byteLength,l=e.data.byteLength-(t.byteLength+i+n.byteLength),h=yield crypto.subtle.decrypt({name:ut,iv:u,additionalData:new Uint8Array(e.data,0,t.byteLength)},null!==(o=r.encryptionKey)&&void 0!==o?o:a.encryptionKey,new Uint8Array(e.data,d,l)),f=new ArrayBuffer(t.byteLength+h.byteLength),p=new Uint8Array(f);return p.set(new Uint8Array(e.data,0,t.byteLength)),p.set(new Uint8Array(h),t.byteLength),e.data=f,e}catch(o){if(n.keyProviderOptions.ratchetWindowSize>0){if(r.ratchetCount<n.keyProviderOptions.ratchetWindowSize){let o;if(u.debug("ratcheting key attempt ".concat(r.ratchetCount," of ").concat(n.keyProviderOptions.ratchetWindowSize,", for kind ").concat(e instanceof RTCEncodedAudioFrame?"audio":"video")),(null!=i?i:a)===n.keys.getKeySet(t)){const e=yield n.keys.ratchetKey(t,!1);o=yield wt(e,n.keyProviderOptions.ratchetSalt)}const s=yield n.decryptFrame(e,t,i||a,{ratchetCount:r.ratchetCount+1,encryptionKey:null==o?void 0:o.encryptionKey});return s&&o&&(null!=i?i:a)===n.keys.getKeySet(t)&&(n.keys.setKeySet(o,t,!0),n.keys.setCurrentKeyIndex(t)),s}throw u.warn("maximum ratchet attempts exceeded"),new vt("valid key missing for participant ".concat(n.participantIdentity),pt.InvalidKey,n.participantIdentity)}throw new vt("Decryption failed: ".concat(o.message),pt.InvalidKey,n.participantIdentity)}}()}))}makeIV(e,t){var n;const i=new ArrayBuffer(12),r=new DataView(i);this.sendCounts.has(e)||this.sendCounts.set(e,Math.floor(65535*Math.random()));const o=null!==(n=this.sendCounts.get(e))&&void 0!==n?n:0;return r.setUint32(0,e),r.setUint32(4,t),r.setUint32(8,t-o%65535),this.sendCounts.set(e,o+1),i}getUnencryptedBytes(e){var t,n={unencryptedBytes:0,isH264:!1};if(function(e){return"type"in e}(e)){let i=null!==(t=this.getVideoCodec(e))&&void 0!==t?t:this.videoCodec;if(i!==this.detectedCodec&&(u.debug("detected different codec",Object.assign({detectedCodec:i,oldCodec:this.detectedCodec},this.logContext)),this.detectedCodec=i),"av1"===i)throw new Error("".concat(i," is not yet supported for end to end encryption"));if("vp8"===i)n.unencryptedBytes=dt[e.type];else if("vp9"===i)return n.unencryptedBytes=0,n;const r=new Uint8Array(e.data);try{const e=function(e){const t=[];let n=0,i=0,r=e.length-2;for(;i<r;){for(;i<r&&(0!==e[i]||0!==e[i+1]||1!==e[i+2]);)i++;i>=r&&(i=e.length);let o=i;for(;o>n&&0===e[o-1];)o--;if(0===n){if(o!==n)throw TypeError("byte stream contains leading data")}else t.push(n);n=i+=3}return t}(r);if(n.isH264="h264"===i||e.some((e=>[Ot.SLICE_IDR,Ot.SLICE_NON_IDR].includes(At(r[e])))),n.isH264){for(const t of e)switch(At(r[t])){case Ot.SLICE_IDR:case Ot.SLICE_NON_IDR:return n.unencryptedBytes=t+2,n}throw new TypeError("Could not find NALU")}}catch(e){}return n.unencryptedBytes=dt[e.type],n}return n.unencryptedBytes=dt.audio,n}getVideoCodec(e){if(0===this.rtpMap.size)return;const t=e.getMetadata().payloadType;return t?this.rtpMap.get(t):void 0}}function At(e){return e&Lt}const Lt=31;var Ot;!function(e){e[e.SLICE_NON_IDR=1]="SLICE_NON_IDR",e[e.SLICE_PARTITION_A=2]="SLICE_PARTITION_A",e[e.SLICE_PARTITION_B=3]="SLICE_PARTITION_B",e[e.SLICE_PARTITION_C=4]="SLICE_PARTITION_C",e[e.SLICE_IDR=5]="SLICE_IDR",e[e.SEI=6]="SEI",e[e.SPS=7]="SPS",e[e.PPS=8]="PPS",e[e.AUD=9]="AUD",e[e.END_SEQ=10]="END_SEQ",e[e.END_STREAM=11]="END_STREAM",e[e.FILLER_DATA=12]="FILLER_DATA",e[e.SPS_EXT=13]="SPS_EXT",e[e.PREFIX_NALU=14]="PREFIX_NALU",e[e.SUBSET_SPS=15]="SUBSET_SPS",e[e.DPS=16]="DPS",e[e.SLICE_AUX=19]="SLICE_AUX",e[e.SLICE_EXT=20]="SLICE_EXT",e[e.SLICE_LAYER_EXT=21]="SLICE_LAYER_EXT"}(Ot||(Ot={}));class Ut extends Ze.EventEmitter{get hasValidKey(){return!this.hasInvalidKeyAtIndex(this.currentKeyIndex)}constructor(e,t){if(super(),this.currentKeyIndex=0,t.keyringSize<1||t.keyringSize>256)throw new TypeError("Keyring size needs to be between 1 and 256");this.cryptoKeyRing=new Array(t.keyringSize).fill(void 0),this.decryptionFailureCounts=new Array(t.keyringSize).fill(0),this.keyProviderOptions=t,this.ratchetPromiseMap=new Map,this.participantIdentity=e}hasInvalidKeyAtIndex(e){return this.keyProviderOptions.failureTolerance>=0&&this.decryptionFailureCounts[e]>this.keyProviderOptions.failureTolerance}decryptionFailure(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentKeyIndex;this.keyProviderOptions.failureTolerance<0||(this.decryptionFailureCounts[e]+=1,this.decryptionFailureCounts[e]>this.keyProviderOptions.failureTolerance&&u.warn("key for ".concat(this.participantIdentity," at index ").concat(e," is being marked as invalid")))}decryptionSuccess(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentKeyIndex;this.resetKeyStatus(e)}resetKeyStatus(e){void 0===e?this.decryptionFailureCounts.fill(0):this.decryptionFailureCounts[e]=0}ratchetKey(t){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=null!=t?t:this.getCurrentKeyIndex(),r=this.ratchetPromiseMap.get(i);if(void 0!==r)return r;const o=new Promise(((t,r)=>e(this,void 0,void 0,(function*(){try{const r=this.getKeySet(i);if(!r)throw new TypeError("Cannot ratchet key without a valid keyset of participant ".concat(this.participantIdentity));const o=r.material,a=yield function(t){return e(this,arguments,void 0,(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{name:ut},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"encrypt";return function*(){return crypto.subtle.importKey("raw",e,t,!1,"derive"===n?["deriveBits","deriveKey"]:["encrypt","decrypt"])}()}))}(yield function(t,n){return e(this,void 0,void 0,(function*(){const e=kt(t.algorithm.name,n);return crypto.subtle.deriveBits(e,t,256)}))}(o,this.keyProviderOptions.ratchetSalt),o.algorithm.name,"derive");n&&(yield this.setKeyFromMaterial(a,i,!0),this.emit(mt.KeyRatcheted,a,this.participantIdentity,i)),t(a)}catch(e){r(e)}finally{this.ratchetPromiseMap.delete(i)}}))));return this.ratchetPromiseMap.set(i,o),o}setKey(t){return e(this,arguments,void 0,(function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function*(){yield t.setKeyFromMaterial(e,n),t.resetKeyStatus(n)}()}))}setKeyFromMaterial(t,n){return e(this,arguments,void 0,(function(e,t){var n=this;let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function*(){const r=yield wt(e,n.keyProviderOptions.ratchetSalt),o=t>=0?t%n.cryptoKeyRing.length:n.currentKeyIndex;u.debug("setting new key with index ".concat(t),{usage:e.usages,algorithm:e.algorithm,ratchetSalt:n.keyProviderOptions.ratchetSalt}),n.setKeySet(r,o,i),o>=0&&(n.currentKeyIndex=o)}()}))}setKeySet(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.cryptoKeyRing[t%this.cryptoKeyRing.length]=e,n&&this.emit(mt.KeyRatcheted,e.material,this.participantIdentity,t)}setCurrentKeyIndex(t){return e(this,void 0,void 0,(function*(){this.currentKeyIndex=t%this.cryptoKeyRing.length,this.resetKeyStatus(t)}))}getCurrentKeyIndex(){return this.currentKeyIndex}getKeySet(e){return this.cryptoKeyRing[null!=e?e:this.currentKeyIndex]}}const Ft=[],Dt=new Map;let Rt,xt,Pt=new class{constructor(){this.pendingTasks=new Map,this.taskMutex=new ct,this.nextTaskIndex=0}run(t){return e(this,void 0,void 0,(function*(){const e={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:nt.WAITING};this.pendingTasks.set(e.id,e);const n=yield this.taskMutex.lock();try{return e.executedAt=Date.now(),e.status=nt.RUNNING,yield t()}finally{e.status=nt.COMPLETED,this.pendingTasks.delete(e.id),n()}}))}flush(){return e(this,void 0,void 0,(function*(){return this.run((()=>e(this,void 0,void 0,(function*(){}))))}))}snapshot(){return Array.from(this.pendingTasks.values())}},Bt=!1,_t={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:10,keyringSize:16},Mt=new Map;function Kt(e,t){let n=Ft.filter((e=>e.getTrackId()===t));if(n.length>1){const i=n.map((e=>({participant:e.getParticipantIdentity()}))).join(",");u.error("Found multiple cryptors for the same trackID ".concat(t,". target participant: ").concat(e," "),{participants:i})}let i=n[0];if(i)e!==i.getParticipantIdentity()&&i.setParticipant(e,jt(e));else{if(u.info("creating new cryptor for",{participantIdentity:e}),!_t)throw Error("Missing keyProvider options");i=new Ct({participantIdentity:e,keys:jt(e),keyProviderOptions:_t,sifTrailer:xt}),i.setRtpMap(Mt),function(e){e.on(bt.Error,(e=>{const t={kind:"error",data:{error:new Error("".concat(pt[e.reason],": ").concat(e.message))}};postMessage(t)}))}(i),Ft.push(i)}return i}function jt(e){if(Bt)return Vt();let t=Dt.get(e);return t||(t=new Ut(e,_t),t.on(mt.KeyRatcheted,Gt),Dt.set(e,t)),t}function Vt(){return Rt||(u.debug("creating new shared key handler"),Rt=new Ut("shared-key",_t)),Rt}function Gt(e,t,n){postMessage({kind:"ratchetKey",data:{participantIdentity:t,keyIndex:n,material:e}})}return u.setDefaultLevel("info"),onmessage=t=>{Pt.run((()=>e(void 0,void 0,void 0,(function*(){const{kind:n,data:i}=t.data;switch(n){case"init":u.setLevel(i.loglevel),u.info("worker initialized"),_t=i.keyProviderOptions,Bt=!!i.keyProviderOptions.sharedKey,postMessage({kind:"initAck",data:{enabled:!1}});break;case"enable":o=i.enabled,a=i.participantIdentity,u.debug("setting encryption enabled for all tracks of ".concat(a),{enable:o}),Et.set(a,o),u.info("updated e2ee enabled status for ".concat(i.participantIdentity," to ").concat(i.enabled)),postMessage(t.data);break;case"decode":case"encode":Kt(i.participantIdentity,i.trackId).setupTransform(n,i.readableStream,i.writableStream,i.trackId,i.codec);break;case"setKey":Bt?yield function(t,n){return e(this,void 0,void 0,(function*(){u.info("set shared key",{index:n}),yield Vt().setKey(t,n)}))}(i.key,i.keyIndex):i.participantIdentity?(u.info("set participant sender key ".concat(i.participantIdentity," index ").concat(i.keyIndex)),yield jt(i.participantIdentity).setKey(i.key,i.keyIndex)):u.error("no participant Id was provided and shared key usage is disabled");break;case"removeTransform":!function(e,t){const n=Ft.filter((n=>n.getParticipantIdentity()===t&&n.getTrackId()===e));n.length>1&&u.error("Found multiple cryptors for the same participant and trackID combination",{trackId:e,participantIdentity:t});const i=n[0];i?i.unsetParticipant():u.warn("Could not unset participant on cryptor",{trackId:e,participantIdentity:t})}(i.trackId,i.participantIdentity);break;case"updateCodec":Kt(i.participantIdentity,i.trackId).setVideoCodec(i.codec);break;case"setRTPMap":Mt=i.map,Ft.forEach((e=>{e.getParticipantIdentity()===i.participantIdentity&&e.setRtpMap(i.map)}));break;case"ratchetRequest":!function(t){e(this,void 0,void 0,(function*(){if(Bt){const e=Vt();yield e.ratchetKey(t.keyIndex),e.resetKeyStatus()}else if(t.participantIdentity){const e=jt(t.participantIdentity);yield e.ratchetKey(t.keyIndex),e.resetKeyStatus()}else u.error("no participant Id was provided for ratchet request and shared key usage is disabled")}))}(i);break;case"setSifTrailer":r=i.trailer,xt=r,Ft.forEach((e=>{e.setSifTrailer(r)}))}var r,o,a}))))},self.RTCTransformEvent&&(u.debug("setup transform event"),self.onrtctransform=e=>{const t=e.transformer;u.debug("transformer",t),t.handled=!0;const{kind:n,participantIdentity:i,trackId:r,codec:o}=t.options,a=Kt(i,r);u.debug("transform",{codec:o}),a.setupTransform(n,t.readable,t.writable,r,o)}),{}})()));