@100mslive/roomkit-react 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (459) hide show
  1. package/README.md +1 -0
  2. package/dist/Accordion/Accordion.d.ts +964 -0
  3. package/dist/Accordion/index.d.ts +979 -0
  4. package/dist/ActiveSpeakerView-H3VYXANB.js +39 -0
  5. package/dist/ActiveSpeakerView-H3VYXANB.js.map +7 -0
  6. package/dist/ActiveSpeakerView-REZLWPPI.css +11 -0
  7. package/dist/ActiveSpeakerView-REZLWPPI.css.map +7 -0
  8. package/dist/AudioLevel/AudioLevel.d.ts +8 -0
  9. package/dist/AudioLevel/index.d.ts +1 -0
  10. package/dist/Avatar/Avatar.d.ts +487 -0
  11. package/dist/Avatar/getAvatarBg.d.ts +7 -0
  12. package/dist/Avatar/index.d.ts +1 -0
  13. package/dist/Button/Button.d.ts +488 -0
  14. package/dist/Button/index.d.ts +1 -0
  15. package/dist/Checkbox/Checkbox.d.ts +958 -0
  16. package/dist/Checkbox/index.d.ts +1 -0
  17. package/dist/Collapsible/Collapsible.d.ts +1434 -0
  18. package/dist/Collapsible/index.d.ts +1 -0
  19. package/dist/Divider/Divider.d.ts +958 -0
  20. package/dist/Divider/index.d.ts +1 -0
  21. package/dist/Dropdown/Dropdown.d.ts +5728 -0
  22. package/dist/Dropdown/index.d.ts +1 -0
  23. package/dist/Fieldset/Fieldset.d.ts +477 -0
  24. package/dist/Fieldset/index.d.ts +1 -0
  25. package/dist/Footer/Footer.d.ts +3834 -0
  26. package/dist/Footer/index.d.ts +1 -0
  27. package/dist/HLSView-3RDXRV7Y.js +689 -0
  28. package/dist/HLSView-3RDXRV7Y.js.map +7 -0
  29. package/dist/HLSView-6BVBCQM7.css +11 -0
  30. package/dist/HLSView-6BVBCQM7.css.map +7 -0
  31. package/dist/IconButton/IconButton.d.ts +479 -0
  32. package/dist/IconButton/index.d.ts +1 -0
  33. package/dist/Input/Input.d.ts +2917 -0
  34. package/dist/Input/index.d.ts +1 -0
  35. package/dist/Label/Label.d.ts +479 -0
  36. package/dist/Label/index.d.ts +1 -0
  37. package/dist/Layout/Box.d.ts +477 -0
  38. package/dist/Layout/Flex.d.ts +482 -0
  39. package/dist/Layout/index.d.ts +2 -0
  40. package/dist/Link/Link.d.ts +489 -0
  41. package/dist/Link/index.d.ts +2 -0
  42. package/dist/Loading/Loading.d.ts +14 -0
  43. package/dist/Loading/index.d.ts +1 -0
  44. package/dist/Modal/Dialog.d.ts +3826 -0
  45. package/dist/Modal/DialogContent.d.ts +3343 -0
  46. package/dist/Modal/index.d.ts +1 -0
  47. package/dist/Pagination/StyledPagination.d.ts +1918 -0
  48. package/dist/Pagination/index.d.ts +1 -0
  49. package/dist/PinnedTrackView-453PELNU.js +70 -0
  50. package/dist/PinnedTrackView-453PELNU.js.map +7 -0
  51. package/dist/PinnedTrackView-QQ5FDXJX.css +11 -0
  52. package/dist/PinnedTrackView-QQ5FDXJX.css.map +7 -0
  53. package/dist/Popover/index.d.ts +1436 -0
  54. package/dist/Progress/index.d.ts +957 -0
  55. package/dist/QRCode/QRCode.d.ts +3 -0
  56. package/dist/QRCode/index.d.ts +1 -0
  57. package/dist/RadioGroup/RadioGroup.d.ts +1435 -0
  58. package/dist/RadioGroup/index.d.ts +1 -0
  59. package/dist/ReactSelect/ReactSelect.d.ts +4778 -0
  60. package/dist/ReactSelect/index.d.ts +1 -0
  61. package/dist/Select/Select.d.ts +1437 -0
  62. package/dist/Select/index.d.ts +1 -0
  63. package/dist/Slider/Slider.d.ts +488 -0
  64. package/dist/Slider/index.d.ts +1 -0
  65. package/dist/Stats/Stats.d.ts +19 -0
  66. package/dist/Stats/StyledStats.d.ts +2872 -0
  67. package/dist/Stats/formatBytes.d.ts +1 -0
  68. package/dist/Stats/index.d.ts +1 -0
  69. package/dist/Switch/Switch.d.ts +482 -0
  70. package/dist/Switch/index.d.ts +1 -0
  71. package/dist/Tabs/Tabs.d.ts +1912 -0
  72. package/dist/Tabs/index.d.ts +1 -0
  73. package/dist/Text/Text.d.ts +605 -0
  74. package/dist/Text/index.d.ts +1 -0
  75. package/dist/Theme/ThemeProvider.d.ts +397 -0
  76. package/dist/Theme/base.config.d.ts +417 -0
  77. package/dist/Theme/index.d.ts +3 -0
  78. package/dist/Theme/stitches.config.d.ts +4702 -0
  79. package/dist/Theme/themes.d.ts +64 -0
  80. package/dist/Theme/useSSR.d.ts +6 -0
  81. package/dist/TileMenu/StyledMenuTile.d.ts +3351 -0
  82. package/dist/TileMenu/TileMenu.d.ts +6 -0
  83. package/dist/TileMenu/index.d.ts +1 -0
  84. package/dist/Toast/Toast.d.ts +2881 -0
  85. package/dist/Toast/index.d.ts +1 -0
  86. package/dist/Tooltip/Tooltip.d.ts +14 -0
  87. package/dist/Tooltip/index.d.ts +1 -0
  88. package/dist/Video/Video.d.ts +499 -0
  89. package/dist/Video/index.d.ts +1 -0
  90. package/dist/VideoList/StyledVideoList.d.ts +1438 -0
  91. package/dist/VideoList/index.d.ts +2 -0
  92. package/dist/VideoList/videoListUtils.d.ts +1 -0
  93. package/dist/VideoTile/StyledVideoTile.d.ts +4309 -0
  94. package/dist/VideoTile/index.d.ts +1 -0
  95. package/dist/VirtualBackground-LHYBWUT5.js +158 -0
  96. package/dist/VirtualBackground-LHYBWUT5.js.map +7 -0
  97. package/dist/chunk-7YUYZ64D.js +6843 -0
  98. package/dist/chunk-7YUYZ64D.js.map +7 -0
  99. package/dist/chunk-HCAGFNXW.js +8270 -0
  100. package/dist/chunk-HCAGFNXW.js.map +7 -0
  101. package/dist/chunk-KYYP6ZVK.js +907 -0
  102. package/dist/chunk-KYYP6ZVK.js.map +7 -0
  103. package/dist/chunk-ULXGBUSC.js +65 -0
  104. package/dist/chunk-ULXGBUSC.js.map +7 -0
  105. package/dist/chunk-XRJXE6UO.js +243 -0
  106. package/dist/chunk-XRJXE6UO.js.map +7 -0
  107. package/dist/conference-IDNRO4WK.js +3812 -0
  108. package/dist/conference-IDNRO4WK.js.map +7 -0
  109. package/dist/conference-KN6OKGDU.css +11 -0
  110. package/dist/conference-KN6OKGDU.css.map +7 -0
  111. package/dist/fixtures/chats.d.ts +4 -0
  112. package/dist/fixtures/peers.d.ts +3 -0
  113. package/dist/fixtures/tracks.d.ts +2 -0
  114. package/dist/index.cjs.css +11 -0
  115. package/dist/index.cjs.css.map +7 -0
  116. package/dist/index.cjs.js +22987 -0
  117. package/dist/index.cjs.js.map +7 -0
  118. package/dist/index.css +11 -0
  119. package/dist/index.css.map +7 -0
  120. package/dist/index.d.ts +38 -0
  121. package/dist/index.js +133 -0
  122. package/dist/index.js.map +7 -0
  123. package/dist/meta.cjs.json +13085 -0
  124. package/dist/meta.esbuild.json +13693 -0
  125. package/dist/transcription-BTSB7FZH.js +356 -0
  126. package/dist/transcription-BTSB7FZH.js.map +7 -0
  127. package/dist/utils/animations.d.ts +92 -0
  128. package/dist/utils/index.d.ts +2 -0
  129. package/dist/utils/styles.d.ts +21 -0
  130. package/package.json +116 -0
  131. package/src/Accordion/Accordion.stories.tsx +50 -0
  132. package/src/Accordion/Accordion.tsx +88 -0
  133. package/src/Accordion/index.ts +8 -0
  134. package/src/AudioLevel/AudioLevel.tsx +34 -0
  135. package/src/AudioLevel/index.ts +1 -0
  136. package/src/Avatar/Avatar.stories.tsx +33 -0
  137. package/src/Avatar/Avatar.tsx +55 -0
  138. package/src/Avatar/getAvatarBg.ts +46 -0
  139. package/src/Avatar/index.ts +1 -0
  140. package/src/Button/Button.mdx +43 -0
  141. package/src/Button/Button.stories.tsx +52 -0
  142. package/src/Button/Button.tsx +144 -0
  143. package/src/Button/index.tsx +1 -0
  144. package/src/Chat/Chat.mdx +39 -0
  145. package/src/Chat/Chat.stories.tsx +39 -0
  146. package/src/Checkbox/Checkbox.stories.tsx +61 -0
  147. package/src/Checkbox/Checkbox.tsx +33 -0
  148. package/src/Checkbox/index.tsx +1 -0
  149. package/src/Collapsible/Collapsible.tsx +34 -0
  150. package/src/Collapsible/index.tsx +1 -0
  151. package/src/Divider/Divider.tsx +45 -0
  152. package/src/Divider/HorizontalDivider.stories.tsx +34 -0
  153. package/src/Divider/VerticalDivider.stories.tsx +40 -0
  154. package/src/Divider/index.ts +1 -0
  155. package/src/Dropdown/Dropdown.stories.tsx +94 -0
  156. package/src/Dropdown/Dropdown.tsx +142 -0
  157. package/src/Dropdown/index.tsx +1 -0
  158. package/src/Fieldset/Fieldset.stories.tsx +29 -0
  159. package/src/Fieldset/Fieldset.tsx +11 -0
  160. package/src/Fieldset/index.tsx +1 -0
  161. package/src/Footer/Footer.stories.tsx +61 -0
  162. package/src/Footer/Footer.tsx +47 -0
  163. package/src/Footer/index.tsx +1 -0
  164. package/src/IconButton/IconButton.tsx +45 -0
  165. package/src/IconButton/index.tsx +1 -0
  166. package/src/Icons/Icons.stories.mdx +10 -0
  167. package/src/Icons/IconsList.jsx +17 -0
  168. package/src/Input/Input.stories.tsx +25 -0
  169. package/src/Input/Input.tsx +105 -0
  170. package/src/Input/PasswordInput.stories.tsx +53 -0
  171. package/src/Input/index.tsx +1 -0
  172. package/src/Introduction/Integrating.stories.mdx +100 -0
  173. package/src/Introduction/Introduction.stories.mdx +9 -0
  174. package/src/Label/Label.tsx +8 -0
  175. package/src/Label/index.ts +1 -0
  176. package/src/Layout/Box.tsx +3 -0
  177. package/src/Layout/Flex.tsx +76 -0
  178. package/src/Layout/index.tsx +2 -0
  179. package/src/Link/Link.stories.tsx +18 -0
  180. package/src/Link/Link.tsx +54 -0
  181. package/src/Link/index.tsx +2 -0
  182. package/src/Loading/Loading.mdx +15 -0
  183. package/src/Loading/Loading.stories.tsx +37 -0
  184. package/src/Loading/Loading.tsx +33 -0
  185. package/src/Loading/index.ts +1 -0
  186. package/src/Modal/Dialog.mdx +19 -0
  187. package/src/Modal/Dialog.stories.tsx +68 -0
  188. package/src/Modal/Dialog.tsx +26 -0
  189. package/src/Modal/DialogContent.tsx +63 -0
  190. package/src/Modal/index.ts +1 -0
  191. package/src/Pagination/StyledPagination.stories.tsx +80 -0
  192. package/src/Pagination/StyledPagination.tsx +68 -0
  193. package/src/Pagination/index.tsx +1 -0
  194. package/src/Popover/Popover.mdx +9 -0
  195. package/src/Popover/Popover.stories.tsx +95 -0
  196. package/src/Popover/index.tsx +26 -0
  197. package/src/Prebuilt/App.jsx +273 -0
  198. package/src/Prebuilt/AppContext.jsx +21 -0
  199. package/src/Prebuilt/IconButton.jsx +19 -0
  200. package/src/Prebuilt/Prebuilt.stories.tsx +20 -0
  201. package/src/Prebuilt/common/PeersSorter.js +89 -0
  202. package/src/Prebuilt/common/constants.js +208 -0
  203. package/src/Prebuilt/common/hooks.js +47 -0
  204. package/src/Prebuilt/common/roles.js +4 -0
  205. package/src/Prebuilt/common/useSortedPeers.js +28 -0
  206. package/src/Prebuilt/common/utils.js +91 -0
  207. package/src/Prebuilt/components/AppData/AppData.jsx +189 -0
  208. package/src/Prebuilt/components/AppData/useAppConfig.js +7 -0
  209. package/src/Prebuilt/components/AppData/useAppLayout.js +6 -0
  210. package/src/Prebuilt/components/AppData/useChatState.js +18 -0
  211. package/src/Prebuilt/components/AppData/useSidepane.js +49 -0
  212. package/src/Prebuilt/components/AppData/useUISettings.js +164 -0
  213. package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +16 -0
  214. package/src/Prebuilt/components/AudioVideoToggle.jsx +67 -0
  215. package/src/Prebuilt/components/AuthToken.jsx +133 -0
  216. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +96 -0
  217. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +46 -0
  218. package/src/Prebuilt/components/Chat/Chat.jsx +155 -0
  219. package/src/Prebuilt/components/Chat/ChatBody.jsx +370 -0
  220. package/src/Prebuilt/components/Chat/ChatFooter.jsx +150 -0
  221. package/src/Prebuilt/components/Chat/ChatHeader.jsx +67 -0
  222. package/src/Prebuilt/components/Chat/ChatSelector.jsx +162 -0
  223. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +30 -0
  224. package/src/Prebuilt/components/Chat/useUnreadCount.js +17 -0
  225. package/src/Prebuilt/components/Connection/ConnectionIndicator.jsx +80 -0
  226. package/src/Prebuilt/components/Connection/TileConnection.jsx +40 -0
  227. package/src/Prebuilt/components/Connection/connectionQualityUtils.js +39 -0
  228. package/src/Prebuilt/components/EmojiReaction.jsx +138 -0
  229. package/src/Prebuilt/components/ErrorBoundary.jsx +105 -0
  230. package/src/Prebuilt/components/FirstPersonDisplay.jsx +50 -0
  231. package/src/Prebuilt/components/Footer/ChatToggle.jsx +27 -0
  232. package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +104 -0
  233. package/src/Prebuilt/components/Footer/StreamingFooter.jsx +71 -0
  234. package/src/Prebuilt/components/Footer.jsx +8 -0
  235. package/src/Prebuilt/components/FullPageProgress.jsx +11 -0
  236. package/src/Prebuilt/components/GoLiveButton.jsx +45 -0
  237. package/src/Prebuilt/components/HMSVideo/Controls.jsx +21 -0
  238. package/src/Prebuilt/components/HMSVideo/FullscreenButton.jsx +18 -0
  239. package/src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.jsx +35 -0
  240. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +82 -0
  241. package/src/Prebuilt/components/HMSVideo/HMSVIdeoUtils.js +27 -0
  242. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +11 -0
  243. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +13 -0
  244. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +77 -0
  245. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +31 -0
  246. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +39 -0
  247. package/src/Prebuilt/components/HMSVideo/index.js +19 -0
  248. package/src/Prebuilt/components/Header/AdditionalRoomState.jsx +217 -0
  249. package/src/Prebuilt/components/Header/AmbientMusic.jsx +88 -0
  250. package/src/Prebuilt/components/Header/ConferencingHeader.jsx +29 -0
  251. package/src/Prebuilt/components/Header/Header.jsx +8 -0
  252. package/src/Prebuilt/components/Header/HeaderComponents.jsx +41 -0
  253. package/src/Prebuilt/components/Header/ParticipantFilter.jsx +91 -0
  254. package/src/Prebuilt/components/Header/ParticipantList.jsx +337 -0
  255. package/src/Prebuilt/components/Header/StreamActions.jsx +225 -0
  256. package/src/Prebuilt/components/Header/StreamingHeader.jsx +55 -0
  257. package/src/Prebuilt/components/Header/index.jsx +1 -0
  258. package/src/Prebuilt/components/HlsStatsOverlay.jsx +101 -0
  259. package/src/Prebuilt/components/Image.jsx +7 -0
  260. package/src/Prebuilt/components/Input/KeyboardInputManager.js +107 -0
  261. package/src/Prebuilt/components/LeaveRoom.jsx +202 -0
  262. package/src/Prebuilt/components/MetaActions.jsx +45 -0
  263. package/src/Prebuilt/components/MoreSettings/BulkRoleChangeModal.jsx +139 -0
  264. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +92 -0
  265. package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +67 -0
  266. package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +106 -0
  267. package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +29 -0
  268. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +225 -0
  269. package/src/Prebuilt/components/MoreSettings/MuteAllModal.jsx +90 -0
  270. package/src/Prebuilt/components/Notifications/AutoplayBlockedModal.jsx +38 -0
  271. package/src/Prebuilt/components/Notifications/InitErrorModal.jsx +39 -0
  272. package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +25 -0
  273. package/src/Prebuilt/components/Notifications/Notifications.jsx +151 -0
  274. package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +45 -0
  275. package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +67 -0
  276. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +69 -0
  277. package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.jsx +51 -0
  278. package/src/Prebuilt/components/Notifications/TrackNotifications.jsx +19 -0
  279. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.jsx +49 -0
  280. package/src/Prebuilt/components/Notifications/index.jsx +1 -0
  281. package/src/Prebuilt/components/PIP/PIPComponent.jsx +82 -0
  282. package/src/Prebuilt/components/PIP/PIPManager.js +296 -0
  283. package/src/Prebuilt/components/PIP/SetupMediaSession.js +60 -0
  284. package/src/Prebuilt/components/PIP/index.jsx +11 -0
  285. package/src/Prebuilt/components/PIP/pip.test.js +72 -0
  286. package/src/Prebuilt/components/PIP/pipUtils.js +183 -0
  287. package/src/Prebuilt/components/Pagination.jsx +29 -0
  288. package/src/Prebuilt/components/Playlist/Playlist.jsx +129 -0
  289. package/src/Prebuilt/components/Playlist/PlaylistControls.jsx +172 -0
  290. package/src/Prebuilt/components/Playlist/PlaylistItem.jsx +51 -0
  291. package/src/Prebuilt/components/Playlist/VideoPlayer.jsx +95 -0
  292. package/src/Prebuilt/components/PostLeave.jsx +76 -0
  293. package/src/Prebuilt/components/Preview/PreviewContainer.jsx +51 -0
  294. package/src/Prebuilt/components/Preview/PreviewJoin.jsx +196 -0
  295. package/src/Prebuilt/components/Preview/PreviewName.jsx +37 -0
  296. package/src/Prebuilt/components/RoleChangeModal.jsx +185 -0
  297. package/src/Prebuilt/components/RoleChangeRequestModal.jsx +26 -0
  298. package/src/Prebuilt/components/ScreenShare.jsx +45 -0
  299. package/src/Prebuilt/components/ScreenshareDisplay.jsx +45 -0
  300. package/src/Prebuilt/components/ScreenshareHintModal.jsx +37 -0
  301. package/src/Prebuilt/components/ScreenshareTile.jsx +91 -0
  302. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +220 -0
  303. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +91 -0
  304. package/src/Prebuilt/components/Settings/NotificationSettings.jsx +61 -0
  305. package/src/Prebuilt/components/Settings/SettingsModal.jsx +171 -0
  306. package/src/Prebuilt/components/Settings/StartRecording.jsx +130 -0
  307. package/src/Prebuilt/components/Settings/SwitchWithLabel.jsx +40 -0
  308. package/src/Prebuilt/components/Settings/common.js +15 -0
  309. package/src/Prebuilt/components/ShareMenuIcon.jsx +26 -0
  310. package/src/Prebuilt/components/StatsForNerds.jsx +250 -0
  311. package/src/Prebuilt/components/Streaming/Common.jsx +132 -0
  312. package/src/Prebuilt/components/Streaming/HLSStreaming.jsx +226 -0
  313. package/src/Prebuilt/components/Streaming/RTMPIcon.jsx +24 -0
  314. package/src/Prebuilt/components/Streaming/RTMPStreaming.jsx +336 -0
  315. package/src/Prebuilt/components/Streaming/ResolutionInput.jsx +88 -0
  316. package/src/Prebuilt/components/Streaming/StreamingLanding.jsx +76 -0
  317. package/src/Prebuilt/components/TileMenu.jsx +275 -0
  318. package/src/Prebuilt/components/Toast/Toast.jsx +17 -0
  319. package/src/Prebuilt/components/Toast/ToastBatcher.js +57 -0
  320. package/src/Prebuilt/components/Toast/ToastConfig.jsx +134 -0
  321. package/src/Prebuilt/components/Toast/ToastContainer.jsx +30 -0
  322. package/src/Prebuilt/components/Toast/ToastManager.js +44 -0
  323. package/src/Prebuilt/components/VideoList.jsx +101 -0
  324. package/src/Prebuilt/components/VideoTile.jsx +177 -0
  325. package/src/Prebuilt/components/conference.jsx +164 -0
  326. package/src/Prebuilt/components/gridView.jsx +85 -0
  327. package/src/Prebuilt/components/hooks/useDropdownList.jsx +23 -0
  328. package/src/Prebuilt/components/hooks/useDropdownSelection.jsx +6 -0
  329. package/src/Prebuilt/components/hooks/useFeatures.js +22 -0
  330. package/src/Prebuilt/components/hooks/useFullscreen.js +43 -0
  331. package/src/Prebuilt/components/hooks/useMetadata.jsx +52 -0
  332. package/src/Prebuilt/components/hooks/useNavigation.js +19 -0
  333. package/src/Prebuilt/components/hooks/usePlaylist.js +25 -0
  334. package/src/Prebuilt/components/hooks/usePlaylistMusic.js +35 -0
  335. package/src/Prebuilt/components/hooks/useScreenshareAudio.js +28 -0
  336. package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +38 -0
  337. package/src/Prebuilt/components/hooks/useSkipPreview.jsx +20 -0
  338. package/src/Prebuilt/components/hooks/useUserPreferences.jsx +25 -0
  339. package/src/Prebuilt/components/init/Init.jsx +58 -0
  340. package/src/Prebuilt/components/init/initUtils.js +90 -0
  341. package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +29 -0
  342. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +108 -0
  343. package/src/Prebuilt/components/pdfAnnotator/pdfHeader.jsx +31 -0
  344. package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +32 -0
  345. package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +233 -0
  346. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +89 -0
  347. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +85 -0
  348. package/src/Prebuilt/components/peerTileUtils.jsx +27 -0
  349. package/src/Prebuilt/hms.js +7 -0
  350. package/src/Prebuilt/images/first_person.png +0 -0
  351. package/src/Prebuilt/index.d.ts +15 -0
  352. package/src/Prebuilt/index.js +2 -0
  353. package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +34 -0
  354. package/src/Prebuilt/layouts/EmbedView.jsx +141 -0
  355. package/src/Prebuilt/layouts/HLSView.jsx +290 -0
  356. package/src/Prebuilt/layouts/InsetView.jsx +222 -0
  357. package/src/Prebuilt/layouts/NonPublisherView.jsx +51 -0
  358. package/src/Prebuilt/layouts/PDFView.jsx +122 -0
  359. package/src/Prebuilt/layouts/PinnedTrackView.jsx +59 -0
  360. package/src/Prebuilt/layouts/SidePane.jsx +51 -0
  361. package/src/Prebuilt/layouts/WaitingView.jsx +51 -0
  362. package/src/Prebuilt/layouts/WhiteboardView.jsx +66 -0
  363. package/src/Prebuilt/layouts/mainGridView.jsx +98 -0
  364. package/src/Prebuilt/layouts/mainView.jsx +113 -0
  365. package/src/Prebuilt/layouts/screenShareView.jsx +185 -0
  366. package/src/Prebuilt/plugins/FlyingEmoji.jsx +132 -0
  367. package/src/Prebuilt/plugins/RemoteStopScreenshare.jsx +18 -0
  368. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +90 -0
  369. package/src/Prebuilt/plugins/VirtualBackground/vbutils.js +66 -0
  370. package/src/Prebuilt/plugins/confetti.jsx +60 -0
  371. package/src/Prebuilt/plugins/transcription/Transcriber.js +216 -0
  372. package/src/Prebuilt/plugins/transcription/TranscriptionButton.jsx +138 -0
  373. package/src/Prebuilt/plugins/transcription/index.jsx +1 -0
  374. package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +110 -0
  375. package/src/Prebuilt/plugins/whiteboard/README.md +29 -0
  376. package/src/Prebuilt/plugins/whiteboard/ToggleWhiteboard.jsx +43 -0
  377. package/src/Prebuilt/plugins/whiteboard/Whiteboard.css +12 -0
  378. package/src/Prebuilt/plugins/whiteboard/Whiteboard.jsx +11 -0
  379. package/src/Prebuilt/plugins/whiteboard/WhiteboardEvents.js +8 -0
  380. package/src/Prebuilt/plugins/whiteboard/index.js +3 -0
  381. package/src/Prebuilt/plugins/whiteboard/useMultiplayerState.js +212 -0
  382. package/src/Prebuilt/plugins/whiteboard/useWhiteboardMetadata.js +47 -0
  383. package/src/Prebuilt/primitives/DialogContent.jsx +280 -0
  384. package/src/Prebuilt/primitives/DropdownTrigger.jsx +46 -0
  385. package/src/Prebuilt/services/FeatureFlags.jsx +47 -0
  386. package/src/Prebuilt/services/tokenService.js +49 -0
  387. package/src/Progress/index.tsx +17 -0
  388. package/src/QRCode/QRCode.mdx +9 -0
  389. package/src/QRCode/QRCode.stories.tsx +29 -0
  390. package/src/QRCode/QRCode.tsx +6 -0
  391. package/src/QRCode/index.tsx +1 -0
  392. package/src/RadioGroup/RadioGroup.stories.tsx +32 -0
  393. package/src/RadioGroup/RadioGroup.tsx +33 -0
  394. package/src/RadioGroup/index.tsx +1 -0
  395. package/src/ReactSelect/ReactSelect.stories.tsx +83 -0
  396. package/src/ReactSelect/ReactSelect.tsx +97 -0
  397. package/src/ReactSelect/index.ts +1 -0
  398. package/src/Select/Select.stories.tsx +33 -0
  399. package/src/Select/Select.tsx +63 -0
  400. package/src/Select/index.ts +1 -0
  401. package/src/Slider/Slider.stories.tsx +21 -0
  402. package/src/Slider/Slider.tsx +70 -0
  403. package/src/Slider/index.ts +1 -0
  404. package/src/Stats/Stats.tsx +211 -0
  405. package/src/Stats/StyledStats.tsx +57 -0
  406. package/src/Stats/formatBytes.ts +19 -0
  407. package/src/Stats/index.tsx +1 -0
  408. package/src/Switch/Switch.mdx +11 -0
  409. package/src/Switch/Switch.stories.tsx +46 -0
  410. package/src/Switch/Switch.tsx +52 -0
  411. package/src/Switch/index.ts +1 -0
  412. package/src/Tabs/Tabs.stories.tsx +77 -0
  413. package/src/Tabs/Tabs.tsx +41 -0
  414. package/src/Tabs/index.tsx +1 -0
  415. package/src/Text/Text.stories.tsx +21 -0
  416. package/src/Text/Text.tsx +149 -0
  417. package/src/Text/index.tsx +1 -0
  418. package/src/Theme/Theme.stories.mdx +8 -0
  419. package/src/Theme/ThemeProvider.tsx +104 -0
  420. package/src/Theme/ThemeStory.jsx +58 -0
  421. package/src/Theme/base.config.ts +264 -0
  422. package/src/Theme/index.tsx +3 -0
  423. package/src/Theme/stitches.config.ts +100 -0
  424. package/src/Theme/themes.ts +70 -0
  425. package/src/Theme/useSSR.tsx +24 -0
  426. package/src/TileMenu/StyledMenuTile.tsx +101 -0
  427. package/src/TileMenu/TileMenu.tsx +96 -0
  428. package/src/TileMenu/index.tsx +1 -0
  429. package/src/Toast/AppToast.stories.tsx +56 -0
  430. package/src/Toast/Toast.mdx +19 -0
  431. package/src/Toast/Toast.stories.tsx +57 -0
  432. package/src/Toast/Toast.tsx +168 -0
  433. package/src/Toast/index.tsx +1 -0
  434. package/src/Tooltip/Tooltip.stories.tsx +62 -0
  435. package/src/Tooltip/Tooltip.tsx +79 -0
  436. package/src/Tooltip/index.ts +1 -0
  437. package/src/Video/UseVideo.mdx +22 -0
  438. package/src/Video/UseVideo.stories.tsx +26 -0
  439. package/src/Video/Video.mdx +24 -0
  440. package/src/Video/Video.stories.tsx +27 -0
  441. package/src/Video/Video.tsx +61 -0
  442. package/src/Video/index.tsx +1 -0
  443. package/src/VideoList/StyledVideoList.tsx +39 -0
  444. package/src/VideoList/VideoList.stories.tsx +92 -0
  445. package/src/VideoList/index.tsx +2 -0
  446. package/src/VideoList/videoListUtils.tsx +20 -0
  447. package/src/VideoTile/StyledVideoTile.tsx +148 -0
  448. package/src/VideoTile/VideoTile.mdx +28 -0
  449. package/src/VideoTile/VideoTile.stories.tsx +32 -0
  450. package/src/VideoTile/index.tsx +1 -0
  451. package/src/fixtures/chats.ts +25 -0
  452. package/src/fixtures/peers.ts +24 -0
  453. package/src/fixtures/tracks.ts +11 -0
  454. package/src/index.ts +38 -0
  455. package/src/store/SetupFakeStore.ts +33 -0
  456. package/src/store/StorybookSDK.ts +229 -0
  457. package/src/utils/animations.ts +90 -0
  458. package/src/utils/index.ts +2 -0
  459. package/src/utils/styles.ts +22 -0
@@ -0,0 +1,3812 @@
1
+ import {
2
+ FirstPersonDisplay,
3
+ GridCenterView,
4
+ GridSidePaneView,
5
+ ScreenshareTile_default,
6
+ VideoList_default,
7
+ VideoTile_default,
8
+ useAppConfig
9
+ } from "./chunk-7YUYZ64D.js";
10
+ import {
11
+ AudioVideoToggle,
12
+ Button,
13
+ Checkbox,
14
+ Dialog,
15
+ DialogCol,
16
+ DialogContent,
17
+ DialogDropdownTrigger,
18
+ DialogInput,
19
+ DialogInputFile,
20
+ DialogRow,
21
+ DialogSelect,
22
+ Dropdown,
23
+ EmojiReaction,
24
+ FeatureFlags,
25
+ Footer,
26
+ FullPageProgress_default,
27
+ Header,
28
+ HorizontalDivider,
29
+ Input,
30
+ Label,
31
+ LeaveRoom,
32
+ MetaActions_default,
33
+ RadioGroup,
34
+ RequestDialog,
35
+ ResolutionInput,
36
+ RoleChangeModal,
37
+ SettingsModal_default,
38
+ SidePane_default,
39
+ Slider,
40
+ StreamActions,
41
+ Switch,
42
+ ToastManager,
43
+ UserPreferencesKeys,
44
+ Video,
45
+ VideoTileStats,
46
+ arrayIntersection,
47
+ getResolution,
48
+ isScreenshareSupported,
49
+ isStreamingKit,
50
+ useAuthToken,
51
+ useDropdownList,
52
+ useDropdownSelection,
53
+ useFilteredRoles,
54
+ useHLSViewerRole,
55
+ useHMSPrebuiltContext,
56
+ useIsHeadless,
57
+ useIsSidepaneTypeOpen,
58
+ useNavigation,
59
+ usePDFAnnotator,
60
+ usePinnedTrack,
61
+ useSetAppDataByKey,
62
+ useSetUiSettings,
63
+ useSidepaneToggle,
64
+ useSkipPreview,
65
+ useTheme,
66
+ useUISettings,
67
+ useUrlToEmbed,
68
+ useUserPreferences,
69
+ useWaitingViewerRole,
70
+ useWhiteboardMetadata
71
+ } from "./chunk-HCAGFNXW.js";
72
+ import {
73
+ Loading,
74
+ useIsFeatureEnabled,
75
+ useRolePreference
76
+ } from "./chunk-ULXGBUSC.js";
77
+ import {
78
+ Box,
79
+ Flex,
80
+ Text
81
+ } from "./chunk-XRJXE6UO.js";
82
+ import {
83
+ APP_DATA,
84
+ DEFAULT_HLS_VIEWER_ROLE,
85
+ EMOJI_REACTION_TYPE,
86
+ FEATURE_LIST,
87
+ IconButton,
88
+ IconButton_default,
89
+ RTMP_RECORD_DEFAULT_RESOLUTION,
90
+ SESSION_STORE_KEY,
91
+ SIDE_PANE_OPTIONS,
92
+ Tooltip,
93
+ UI_MODE_ACTIVE_SPEAKER,
94
+ UI_SETTINGS,
95
+ __async,
96
+ __publicField,
97
+ __spreadProps,
98
+ __spreadValues,
99
+ config,
100
+ define_process_env_default,
101
+ init_define_process_env,
102
+ isAndroid,
103
+ isChrome,
104
+ isIOS,
105
+ isIPadOS,
106
+ isMacOS,
107
+ isSafari,
108
+ styled
109
+ } from "./chunk-KYYP6ZVK.js";
110
+
111
+ // src/Prebuilt/components/conference.jsx
112
+ init_define_process_env();
113
+ import React39, { useEffect as useEffect9, useRef as useRef7, useState as useState17 } from "react";
114
+ import { useParams } from "react-router-dom";
115
+ import { usePrevious } from "react-use";
116
+ import {
117
+ HMSRoomState,
118
+ selectAppData as selectAppData4,
119
+ selectIsConnectedToRoom as selectIsConnectedToRoom2,
120
+ selectRoomState,
121
+ useHMSActions as useHMSActions15,
122
+ useHMSStore as useHMSStore21
123
+ } from "@100mslive/react-sdk";
124
+
125
+ // src/Prebuilt/layouts/mainView.jsx
126
+ init_define_process_env();
127
+ import React11, { Suspense, useEffect as useEffect5 } from "react";
128
+ import {
129
+ selectIsConnectedToRoom,
130
+ selectLocalPeerRoleName as selectLocalPeerRoleName3,
131
+ selectPeerScreenSharing as selectPeerScreenSharing3,
132
+ selectPeerSharingAudio,
133
+ selectPeerSharingVideoPlaylist as selectPeerSharingVideoPlaylist3,
134
+ selectTemplateAppData,
135
+ useHMSActions as useHMSActions5,
136
+ useHMSStore as useHMSStore9
137
+ } from "@100mslive/react-sdk";
138
+
139
+ // src/Prebuilt/layouts/EmbedView.jsx
140
+ init_define_process_env();
141
+ import React5, { useCallback as useCallback2, useEffect, useMemo as useMemo2, useRef as useRef2, useState } from "react";
142
+ import { useMedia as useMedia2 } from "react-use";
143
+ import {
144
+ selectLocalPeerID as selectLocalPeerID2,
145
+ selectLocalPeerRoleName as selectLocalPeerRoleName2,
146
+ selectPeers as selectPeers2,
147
+ selectPeerScreenSharing as selectPeerScreenSharing2,
148
+ throwErrorHandler,
149
+ useHMSStore as useHMSStore5,
150
+ useScreenShare
151
+ } from "@100mslive/react-sdk";
152
+
153
+ // src/Prebuilt/layouts/screenShareView.jsx
154
+ init_define_process_env();
155
+ import React4, { Fragment, useCallback, useMemo } from "react";
156
+ import { useMedia } from "react-use";
157
+ import {
158
+ selectLocalPeerID,
159
+ selectLocalPeerRoleName,
160
+ selectPeers,
161
+ selectPeerScreenSharing,
162
+ selectPeerSharingVideoPlaylist as selectPeerSharingVideoPlaylist2,
163
+ selectScreenShareByPeerID,
164
+ useHMSStore as useHMSStore4
165
+ } from "@100mslive/react-sdk";
166
+
167
+ // src/Prebuilt/components/Playlist/VideoPlayer.jsx
168
+ init_define_process_env();
169
+ import React2, { useRef } from "react";
170
+ import { useFullscreen, useToggle } from "react-use";
171
+ import screenfull from "screenfull";
172
+ import {
173
+ selectVideoPlaylist as selectVideoPlaylist3,
174
+ selectVideoPlaylistAudioTrackByPeerID as selectVideoPlaylistAudioTrackByPeerID2,
175
+ selectVideoPlaylistVideoTrackByPeerID,
176
+ useHMSActions as useHMSActions3,
177
+ useHMSStore as useHMSStore3
178
+ } from "@100mslive/react-sdk";
179
+ import { CrossIcon, ExpandIcon, ShrinkIcon } from "@100mslive/react-icons";
180
+
181
+ // src/Prebuilt/components/Playlist/PlaylistControls.jsx
182
+ init_define_process_env();
183
+ import React from "react";
184
+ import {
185
+ HMSPlaylistType as HMSPlaylistType2,
186
+ selectAudioPlaylist as selectAudioPlaylist2,
187
+ selectAudioTrackVolume,
188
+ selectPeerSharingVideoPlaylist,
189
+ selectVideoPlaylist as selectVideoPlaylist2,
190
+ selectVideoPlaylistAudioTrackByPeerID,
191
+ useHMSActions as useHMSActions2,
192
+ useHMSStore as useHMSStore2
193
+ } from "@100mslive/react-sdk";
194
+ import { NextIcon, PauseIcon, PlayIcon, PlaylistIcon, PrevIcon, SpeakerIcon } from "@100mslive/react-icons";
195
+
196
+ // src/Prebuilt/components/hooks/usePlaylist.js
197
+ init_define_process_env();
198
+ import {
199
+ HMSPlaylistType,
200
+ selectAudioPlaylist,
201
+ selectVideoPlaylist,
202
+ useHMSActions,
203
+ useHMSStore
204
+ } from "@100mslive/react-sdk";
205
+ var usePlaylist = (type) => {
206
+ const isAudioPlaylist = type === HMSPlaylistType.audio;
207
+ const selector = isAudioPlaylist ? selectAudioPlaylist : selectVideoPlaylist;
208
+ const active = useHMSStore(selector.selectedItem);
209
+ const selection = useHMSStore(selector.selection);
210
+ const playlist = useHMSStore(selector.list);
211
+ const hmsActions = useHMSActions();
212
+ const playlistAction = isAudioPlaylist ? hmsActions.audioPlaylist : hmsActions.videoPlaylist;
213
+ return {
214
+ active,
215
+ hasNext: selection.hasNext,
216
+ hasPrevious: selection.hasPrevious,
217
+ actions: playlistAction,
218
+ list: playlist
219
+ };
220
+ };
221
+
222
+ // src/Prebuilt/components/Playlist/PlaylistControls.jsx
223
+ var Progress = ({ type, duration }) => {
224
+ const selectPlaylist = type === HMSPlaylistType2.audio ? selectAudioPlaylist2 : selectVideoPlaylist2;
225
+ const progress = useHMSStore2(selectPlaylist.progress);
226
+ const hmsActions = useHMSActions2();
227
+ const playlistAction = type === HMSPlaylistType2.audio ? hmsActions.audioPlaylist : hmsActions.videoPlaylist;
228
+ if (!duration) {
229
+ return null;
230
+ }
231
+ return /* @__PURE__ */ React.createElement(
232
+ Slider,
233
+ {
234
+ step: 1,
235
+ value: [progress],
236
+ onValueChange: (e) => {
237
+ playlistAction.seekTo(e[0] * 0.01 * duration);
238
+ }
239
+ }
240
+ );
241
+ };
242
+ var PlaylistActive = ({ type, onToggle }) => {
243
+ var _a, _b;
244
+ const isAudioPlaylist = type === HMSPlaylistType2.audio;
245
+ const selector = isAudioPlaylist ? selectAudioPlaylist2 : selectVideoPlaylist2;
246
+ const active = useHMSStore2(selector.selectedItem);
247
+ if (!active) {
248
+ return null;
249
+ }
250
+ return /* @__PURE__ */ React.createElement(Box, { css: { mt: "$8" } }, /* @__PURE__ */ React.createElement(Flex, { justify: "between", css: { w: "100%" } }, /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { variant: "md" }, active.name), ((_a = active.metadata) == null ? void 0 : _a.description) && /* @__PURE__ */ React.createElement(Text, { variant: "xs" }, (_b = active.metadata) == null ? void 0 : _b.description)), /* @__PURE__ */ React.createElement(IconButton, { onClick: onToggle, css: { alignSelf: "center" }, "data-testid": "playlist_collapse_btn" }, /* @__PURE__ */ React.createElement(PlaylistIcon, null))));
251
+ };
252
+ var Controls = ({ type, css = {} }) => {
253
+ const { active, hasNext, hasPrevious, actions } = usePlaylist(type);
254
+ if (!active) {
255
+ return null;
256
+ }
257
+ return /* @__PURE__ */ React.createElement(Flex, { justify: "center", css }, /* @__PURE__ */ React.createElement(
258
+ IconButton,
259
+ {
260
+ disabled: !hasPrevious,
261
+ onClick: () => {
262
+ actions.playPrevious();
263
+ },
264
+ "data-testid": "playlist_prev_btn"
265
+ },
266
+ /* @__PURE__ */ React.createElement(PrevIcon, null)
267
+ ), /* @__PURE__ */ React.createElement(
268
+ IconButton,
269
+ {
270
+ onClick: () => {
271
+ active.playing ? actions.pause() : actions.play(active.id);
272
+ },
273
+ "data-testid": "playlist_play_pause_btn"
274
+ },
275
+ active.playing ? /* @__PURE__ */ React.createElement(PauseIcon, { width: 32, height: 32 }) : /* @__PURE__ */ React.createElement(PlayIcon, { width: 32, height: 32 })
276
+ ), /* @__PURE__ */ React.createElement(
277
+ IconButton,
278
+ {
279
+ disabled: !hasNext,
280
+ onClick: () => {
281
+ actions.playNext();
282
+ },
283
+ "data-testid": "playlist_next_btn"
284
+ },
285
+ /* @__PURE__ */ React.createElement(NextIcon, null)
286
+ ));
287
+ };
288
+ var VolumeControl = () => {
289
+ const hmsActions = useHMSActions2();
290
+ const volume = useHMSStore2(selectVideoPlaylist2.volume);
291
+ const active = useHMSStore2(selectVideoPlaylist2.selectedItem);
292
+ const peerSharingPlaylist = useHMSStore2(selectPeerSharingVideoPlaylist);
293
+ const audioTrack = useHMSStore2(selectVideoPlaylistAudioTrackByPeerID(peerSharingPlaylist == null ? void 0 : peerSharingPlaylist.id));
294
+ const audioTrackVolume = useHMSStore2(selectAudioTrackVolume(audioTrack == null ? void 0 : audioTrack.id));
295
+ const sliderVolume = active ? volume : audioTrackVolume;
296
+ return /* @__PURE__ */ React.createElement(Flex, { align: "center", css: { color: "$white" } }, /* @__PURE__ */ React.createElement(SpeakerIcon, null), /* @__PURE__ */ React.createElement(
297
+ Slider,
298
+ {
299
+ css: { mx: "$4", w: "$20" },
300
+ min: 0,
301
+ max: 100,
302
+ step: 1,
303
+ value: [Math.floor(sliderVolume != null ? sliderVolume : 100)],
304
+ onValueChange: (e) => {
305
+ const value = e[0];
306
+ if (active) {
307
+ hmsActions.videoPlaylist.setVolume(value);
308
+ } else if (audioTrack) {
309
+ hmsActions.setVolume(value, audioTrack.id);
310
+ }
311
+ },
312
+ thumbStyles: { w: "$6", h: "$6" }
313
+ }
314
+ ));
315
+ };
316
+ var AudioPlaylistControls = ({ onToggle }) => {
317
+ const { active } = usePlaylist(HMSPlaylistType2.audio);
318
+ if (!active) {
319
+ return null;
320
+ }
321
+ return /* @__PURE__ */ React.createElement(
322
+ Box,
323
+ {
324
+ css: {
325
+ p: "$8",
326
+ borderTop: "1px solid $borderLight",
327
+ bg: "$menuBg"
328
+ }
329
+ },
330
+ /* @__PURE__ */ React.createElement(Controls, { type: HMSPlaylistType2.audio }),
331
+ /* @__PURE__ */ React.createElement(Progress, { type: HMSPlaylistType2.audio, duration: active.duration }),
332
+ /* @__PURE__ */ React.createElement(PlaylistActive, { type: HMSPlaylistType2.audio, onToggle })
333
+ );
334
+ };
335
+ var VideoPlaylistControls = ({ children }) => {
336
+ const { active } = usePlaylist(HMSPlaylistType2.video);
337
+ return /* @__PURE__ */ React.createElement(
338
+ Box,
339
+ {
340
+ css: {
341
+ p: "$8",
342
+ mt: "-$24",
343
+ w: "100%",
344
+ zIndex: 1,
345
+ "@lg": {
346
+ mt: 0,
347
+ p: "$6"
348
+ }
349
+ }
350
+ },
351
+ active && /* @__PURE__ */ React.createElement(Progress, { type: HMSPlaylistType2.video, duration: active.duration }),
352
+ /* @__PURE__ */ React.createElement(Flex, { align: "center", justify: "between" }, /* @__PURE__ */ React.createElement(VolumeControl, null), active && /* @__PURE__ */ React.createElement(Controls, { css: { flex: "1 1 0" } }), children)
353
+ );
354
+ };
355
+
356
+ // src/Prebuilt/components/Playlist/VideoPlayer.jsx
357
+ var VideoPlayer = React2.memo(({ peerId }) => {
358
+ const videoTrack = useHMSStore3(selectVideoPlaylistVideoTrackByPeerID(peerId));
359
+ const audioTrack = useHMSStore3(selectVideoPlaylistAudioTrackByPeerID2(peerId));
360
+ const active = useHMSStore3(selectVideoPlaylist3.selectedItem);
361
+ const isAudioOnly = useUISettings(UI_SETTINGS.isAudioOnly);
362
+ const hmsActions = useHMSActions3();
363
+ const ref = useRef(null);
364
+ const [show, toggle] = useToggle(false);
365
+ const isFullscreen = useFullscreen(ref, show, {
366
+ onClose: () => toggle(false)
367
+ });
368
+ const showStatsOnTiles = useUISettings(UI_SETTINGS.showStatsOnTiles);
369
+ return /* @__PURE__ */ React2.createElement(Flex, { direction: "column", justify: "center", css: { w: "100%", h: "100%" }, ref }, active && /* @__PURE__ */ React2.createElement(
370
+ Flex,
371
+ {
372
+ justify: "between",
373
+ align: "center",
374
+ css: {
375
+ bg: "$menuBg",
376
+ p: "$2 $2 $2 $6",
377
+ borderTopLeftRadius: "$1",
378
+ borderTopRightRadius: "$1"
379
+ }
380
+ },
381
+ /* @__PURE__ */ React2.createElement(Text, { css: { color: "$textPrimary" } }, active.name),
382
+ /* @__PURE__ */ React2.createElement(
383
+ IconButton,
384
+ {
385
+ css: {
386
+ color: "$white"
387
+ },
388
+ onClick: () => {
389
+ hmsActions.videoPlaylist.stop();
390
+ },
391
+ "data-testid": "videoplaylist_cross_btn"
392
+ },
393
+ /* @__PURE__ */ React2.createElement(CrossIcon, null)
394
+ )
395
+ ), showStatsOnTiles ? /* @__PURE__ */ React2.createElement(Box, { css: { "& > div": { top: "$14", left: "$8" } } }, /* @__PURE__ */ React2.createElement(
396
+ VideoTileStats,
397
+ {
398
+ audioTrackID: audioTrack == null ? void 0 : audioTrack.id,
399
+ videoTrackID: videoTrack == null ? void 0 : videoTrack.id,
400
+ peerID: peerId,
401
+ isLocal: active
402
+ }
403
+ )) : null, /* @__PURE__ */ React2.createElement(
404
+ Video,
405
+ {
406
+ trackId: videoTrack == null ? void 0 : videoTrack.id,
407
+ attach: !isAudioOnly,
408
+ css: {
409
+ objectFit: "contain",
410
+ h: "auto",
411
+ r: "$1",
412
+ borderTopLeftRadius: 0,
413
+ borderTopRightRadius: 0
414
+ }
415
+ }
416
+ ), /* @__PURE__ */ React2.createElement(VideoPlaylistControls, null, screenfull.enabled && /* @__PURE__ */ React2.createElement(
417
+ IconButton,
418
+ {
419
+ onClick: () => toggle(),
420
+ css: {
421
+ color: "$white",
422
+ height: "max-content",
423
+ alignSelf: "center",
424
+ cursor: "pointer"
425
+ }
426
+ },
427
+ isFullscreen ? /* @__PURE__ */ React2.createElement(ShrinkIcon, null) : /* @__PURE__ */ React2.createElement(ExpandIcon, null)
428
+ )));
429
+ });
430
+
431
+ // src/Prebuilt/components/ScreenshareDisplay.jsx
432
+ init_define_process_env();
433
+ import React3 from "react";
434
+ import { useHMSActions as useHMSActions4 } from "@100mslive/react-sdk";
435
+ import { CrossIcon as CrossIcon2, ShareScreenIcon } from "@100mslive/react-icons";
436
+ var ScreenshareDisplay = () => {
437
+ const hmsActions = useHMSActions4();
438
+ return /* @__PURE__ */ React3.createElement(
439
+ Flex,
440
+ {
441
+ direction: "column",
442
+ align: "center",
443
+ justify: "center",
444
+ css: {
445
+ position: "relative",
446
+ overflow: "hidden",
447
+ w: "37.5rem",
448
+ maxWidth: "80%",
449
+ h: "100%",
450
+ r: "$3",
451
+ m: "0 auto",
452
+ color: "$textPrimary",
453
+ bg: "$surfaceDefault",
454
+ textAlign: "center"
455
+ }
456
+ },
457
+ /* @__PURE__ */ React3.createElement(ShareScreenIcon, { width: 48, height: 48 }),
458
+ /* @__PURE__ */ React3.createElement(Text, { variant: "h5", css: { m: "$8 0" } }, "You are sharing your screen"),
459
+ /* @__PURE__ */ React3.createElement(
460
+ Button,
461
+ {
462
+ variant: "danger",
463
+ onClick: () => __async(void 0, null, function* () {
464
+ yield hmsActions.setScreenShareEnabled(false);
465
+ }),
466
+ "data-testid": "stop_screen_share_btn"
467
+ },
468
+ /* @__PURE__ */ React3.createElement(CrossIcon2, { width: 18, height: 18 }),
469
+ "\xA0 Stop screen share"
470
+ )
471
+ );
472
+ };
473
+
474
+ // src/Prebuilt/layouts/screenShareView.jsx
475
+ var ScreenShareView = () => {
476
+ var _a;
477
+ const mediaQueryLg = config.media.xl;
478
+ const showSidebarInBottom = useMedia(mediaQueryLg);
479
+ const peers = useHMSStore4(selectPeers);
480
+ const localPeerID = useHMSStore4(selectLocalPeerID);
481
+ const localPeerRole = useHMSStore4(selectLocalPeerRoleName);
482
+ const peerPresenting = useHMSStore4(selectPeerScreenSharing);
483
+ const peerSharingPlaylist = useHMSStore4(selectPeerSharingVideoPlaylist2);
484
+ const isPresenterFromMyRole = ((_a = peerPresenting == null ? void 0 : peerPresenting.roleName) == null ? void 0 : _a.toLowerCase()) === (localPeerRole == null ? void 0 : localPeerRole.toLowerCase());
485
+ const amIPresenting = localPeerID === (peerPresenting == null ? void 0 : peerPresenting.id);
486
+ const showPresenterInSmallTile = showSidebarInBottom || amIPresenting || isPresenterFromMyRole;
487
+ const smallTilePeers = useMemo(() => {
488
+ const smallTilePeers2 = peers.filter((peer) => peer.id !== (peerPresenting == null ? void 0 : peerPresenting.id));
489
+ if (showPresenterInSmallTile && peerPresenting) {
490
+ smallTilePeers2.unshift(peerPresenting);
491
+ }
492
+ return smallTilePeers2;
493
+ }, [peers, peerPresenting, showPresenterInSmallTile]);
494
+ return /* @__PURE__ */ React4.createElement(
495
+ Flex,
496
+ {
497
+ css: {
498
+ size: "100%"
499
+ },
500
+ direction: showSidebarInBottom ? "column" : "row"
501
+ },
502
+ /* @__PURE__ */ React4.createElement(
503
+ ScreenShareComponent,
504
+ {
505
+ amIPresenting,
506
+ peerPresenting,
507
+ peerSharingPlaylist
508
+ }
509
+ ),
510
+ /* @__PURE__ */ React4.createElement(
511
+ Flex,
512
+ {
513
+ direction: { "@initial": "column", "@lg": "row" },
514
+ css: {
515
+ overflow: "hidden",
516
+ p: "$4 $8",
517
+ flex: "0 0 20%",
518
+ "@xl": {
519
+ flex: "1 1 0"
520
+ }
521
+ }
522
+ },
523
+ /* @__PURE__ */ React4.createElement(
524
+ SidePane,
525
+ {
526
+ showSidebarInBottom,
527
+ peerScreenSharing: peerPresenting,
528
+ isPresenterInSmallTiles: showPresenterInSmallTile,
529
+ smallTilePeers,
530
+ totalPeers: peers.length
531
+ }
532
+ )
533
+ )
534
+ );
535
+ };
536
+ var SidePane = ({
537
+ isPresenterInSmallTiles,
538
+ peerScreenSharing,
539
+ // the peer who is screensharing
540
+ smallTilePeers,
541
+ showSidebarInBottom
542
+ }) => {
543
+ const shouldShowScreenFn = useCallback(
544
+ (peer) => peerScreenSharing && peer.id !== peerScreenSharing.id,
545
+ [peerScreenSharing]
546
+ );
547
+ return /* @__PURE__ */ React4.createElement(Fragment, null, !isPresenterInSmallTiles && /* @__PURE__ */ React4.createElement(LargeTilePeerView, { peerScreenSharing }), /* @__PURE__ */ React4.createElement(
548
+ SmallTilePeersView,
549
+ {
550
+ showSidebarInBottom,
551
+ smallTilePeers,
552
+ shouldShowScreenFn
553
+ }
554
+ ));
555
+ };
556
+ var ScreenShareComponent = ({ amIPresenting, peerPresenting, peerSharingPlaylist }) => {
557
+ const screenshareTrack = useHMSStore4(selectScreenShareByPeerID(peerPresenting == null ? void 0 : peerPresenting.id));
558
+ if (peerSharingPlaylist) {
559
+ return /* @__PURE__ */ React4.createElement(
560
+ Box,
561
+ {
562
+ css: {
563
+ mx: "$8",
564
+ flex: "3 1 0",
565
+ "@xl": {
566
+ flex: "2 1 0",
567
+ display: "flex",
568
+ alignItems: "center"
569
+ }
570
+ }
571
+ },
572
+ /* @__PURE__ */ React4.createElement(VideoPlayer, { peerId: peerSharingPlaylist.id })
573
+ );
574
+ }
575
+ return /* @__PURE__ */ React4.createElement(
576
+ Box,
577
+ {
578
+ css: {
579
+ flex: "3 1 0",
580
+ mx: "$8",
581
+ "@xl": { ml: "$4", maxHeight: "80%", minHeight: 0 }
582
+ }
583
+ },
584
+ peerPresenting && (amIPresenting && !["browser", "window", "application"].includes(screenshareTrack == null ? void 0 : screenshareTrack.displaySurface) ? /* @__PURE__ */ React4.createElement(Box, { css: { objectFit: "contain", h: "100%" } }, /* @__PURE__ */ React4.createElement(ScreenshareDisplay, null)) : /* @__PURE__ */ React4.createElement(ScreenshareTile_default, { peerId: peerPresenting == null ? void 0 : peerPresenting.id }))
585
+ );
586
+ };
587
+ var SmallTilePeersView = ({ smallTilePeers, shouldShowScreenFn, showSidebarInBottom }) => {
588
+ return /* @__PURE__ */ React4.createElement(
589
+ Flex,
590
+ {
591
+ css: {
592
+ flex: "2 1 0"
593
+ }
594
+ },
595
+ smallTilePeers && smallTilePeers.length > 0 && /* @__PURE__ */ React4.createElement(
596
+ VideoList_default,
597
+ {
598
+ peers: smallTilePeers,
599
+ maxColCount: showSidebarInBottom ? void 0 : 1,
600
+ maxRowCount: showSidebarInBottom ? 1 : void 0,
601
+ includeScreenShareForPeer: shouldShowScreenFn
602
+ }
603
+ )
604
+ );
605
+ };
606
+ var LargeTilePeerView = ({ peerScreenSharing, showStatsOnTiles }) => {
607
+ return peerScreenSharing ? /* @__PURE__ */ React4.createElement(
608
+ Box,
609
+ {
610
+ css: {
611
+ flex: "1 1 0",
612
+ minHeight: "25%",
613
+ py: "$4",
614
+ "@lg": {
615
+ mr: "$4",
616
+ minHeight: "unset",
617
+ py: 0
618
+ },
619
+ "@sm": {
620
+ height: "100%",
621
+ maxHeight: "75%",
622
+ alignSelf: "center"
623
+ }
624
+ }
625
+ },
626
+ /* @__PURE__ */ React4.createElement(VideoTile_default, { showStatsOnTiles, width: "100%", height: "100%", peerId: peerScreenSharing.id })
627
+ ) : null;
628
+ };
629
+ var screenShareView_default = ScreenShareView;
630
+
631
+ // src/Prebuilt/layouts/EmbedView.jsx
632
+ var EmbedView = () => {
633
+ return /* @__PURE__ */ React5.createElement(EmbebScreenShareView, null, /* @__PURE__ */ React5.createElement(EmbedComponent, null));
634
+ };
635
+ var EmbebScreenShareView = ({ children }) => {
636
+ var _a;
637
+ const peers = useHMSStore5(selectPeers2);
638
+ const mediaQueryLg = config.media.xl;
639
+ const showSidebarInBottom = useMedia2(mediaQueryLg);
640
+ const localPeerID = useHMSStore5(selectLocalPeerID2);
641
+ const localPeerRole = useHMSStore5(selectLocalPeerRoleName2);
642
+ const peerPresenting = useHMSStore5(selectPeerScreenSharing2);
643
+ const isPresenterFromMyRole = ((_a = peerPresenting == null ? void 0 : peerPresenting.roleName) == null ? void 0 : _a.toLowerCase()) === (localPeerRole == null ? void 0 : localPeerRole.toLowerCase());
644
+ const amIPresenting = localPeerID === (peerPresenting == null ? void 0 : peerPresenting.id);
645
+ const showPresenterInSmallTile = showSidebarInBottom || amIPresenting || isPresenterFromMyRole;
646
+ const smallTilePeers = useMemo2(() => {
647
+ const smallTilePeers2 = peers.filter((peer) => peer.id !== (peerPresenting == null ? void 0 : peerPresenting.id));
648
+ if (showPresenterInSmallTile && peerPresenting) {
649
+ smallTilePeers2.unshift(peerPresenting);
650
+ }
651
+ return smallTilePeers2;
652
+ }, [peers, peerPresenting, showPresenterInSmallTile]);
653
+ return /* @__PURE__ */ React5.createElement(Flex, { css: { size: "100%" }, direction: showSidebarInBottom ? "column" : "row" }, children, /* @__PURE__ */ React5.createElement(
654
+ Flex,
655
+ {
656
+ direction: { "@initial": "column", "@lg": "row" },
657
+ css: {
658
+ overflow: "hidden",
659
+ p: "$4 $8",
660
+ flex: "0 0 20%",
661
+ "@xl": {
662
+ flex: "1 1 0"
663
+ }
664
+ }
665
+ },
666
+ /* @__PURE__ */ React5.createElement(
667
+ SidePane,
668
+ {
669
+ showSidebarInBottom,
670
+ peerScreenSharing: peerPresenting,
671
+ isPresenterInSmallTiles: showPresenterInSmallTile,
672
+ smallTilePeers,
673
+ totalPeers: peers.length
674
+ }
675
+ )
676
+ ));
677
+ };
678
+ var EmbedComponent = () => {
679
+ const { amIScreenSharing, toggleScreenShare } = useScreenShare(throwErrorHandler);
680
+ const [embedConfig, setEmbedConfig] = useSetAppDataByKey(APP_DATA.embedConfig);
681
+ const [wasScreenShared, setWasScreenShared] = useState(false);
682
+ const screenShareAttemptInProgress = useRef2(false);
683
+ const src = embedConfig.url;
684
+ const iframeRef = useRef2();
685
+ const resetEmbedConfig = useCallback2(() => {
686
+ if (src) {
687
+ setEmbedConfig({ url: "" });
688
+ }
689
+ }, [src, setEmbedConfig]);
690
+ useEffect(() => {
691
+ if (embedConfig.shareScreen && !amIScreenSharing && !wasScreenShared && !screenShareAttemptInProgress.current) {
692
+ screenShareAttemptInProgress.current = true;
693
+ toggleScreenShare({
694
+ forceCurrentTab: true,
695
+ cropElement: iframeRef.current
696
+ }).then(() => {
697
+ setWasScreenShared(true);
698
+ }).catch(resetEmbedConfig).finally(() => {
699
+ screenShareAttemptInProgress.current = false;
700
+ });
701
+ }
702
+ }, []);
703
+ useEffect(() => {
704
+ if (wasScreenShared && !amIScreenSharing) {
705
+ resetEmbedConfig();
706
+ }
707
+ return () => {
708
+ if (wasScreenShared && amIScreenSharing) {
709
+ resetEmbedConfig();
710
+ toggleScreenShare();
711
+ }
712
+ };
713
+ }, [wasScreenShared, amIScreenSharing, resetEmbedConfig, toggleScreenShare]);
714
+ return /* @__PURE__ */ React5.createElement(
715
+ Box,
716
+ {
717
+ ref: iframeRef,
718
+ css: {
719
+ mx: "$8",
720
+ flex: "3 1 0",
721
+ "@lg": {
722
+ flex: "2 1 0",
723
+ display: "flex",
724
+ alignItems: "center"
725
+ }
726
+ }
727
+ },
728
+ /* @__PURE__ */ React5.createElement(
729
+ "iframe",
730
+ {
731
+ src,
732
+ title: src,
733
+ style: { width: "100%", height: "100%", border: 0 },
734
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture fullscreen",
735
+ referrerPolicy: "no-referrer"
736
+ }
737
+ )
738
+ );
739
+ };
740
+
741
+ // src/Prebuilt/layouts/InsetView.jsx
742
+ init_define_process_env();
743
+ import React6, { Fragment as Fragment2, useEffect as useEffect2, useRef as useRef3 } from "react";
744
+ import Draggable from "react-draggable";
745
+ import { useMedia as useMedia3 } from "react-use";
746
+ import { selectAppData, selectLocalPeer, selectRemotePeers, selectRolesMap, useHMSStore as useHMSStore6 } from "@100mslive/react-sdk";
747
+ var getAspectRatio = ({ roleMap, roleName, isMobile }) => {
748
+ const role = roleMap[roleName];
749
+ const { width, height } = role.publishParams.video;
750
+ return isMobile ? height / width : width / height;
751
+ };
752
+ function InsetView() {
753
+ var _a;
754
+ const remotePeers = useHMSStore6(selectRemotePeers);
755
+ const localPeer = useHMSStore6(selectLocalPeer);
756
+ const isMobile = useMedia3(config.media.md);
757
+ const isLandscape = useMedia3(config.media.ls);
758
+ const roleMap = useHMSStore6(selectRolesMap);
759
+ const rolePreference = useRolePreference();
760
+ let centerPeers = [];
761
+ let sidepanePeers = [];
762
+ if (rolePreference) {
763
+ const center = ((_a = rolePreference[localPeer.roleName]) == null ? void 0 : _a.split(",")) || [];
764
+ for (const peer of remotePeers) {
765
+ if (center.includes(peer.roleName)) {
766
+ centerPeers.push(peer);
767
+ } else {
768
+ sidepanePeers.push(peer);
769
+ }
770
+ }
771
+ if (centerPeers.length === 0 && sidepanePeers.length > 0) {
772
+ centerPeers = sidepanePeers;
773
+ sidepanePeers = [];
774
+ }
775
+ } else {
776
+ centerPeers = remotePeers;
777
+ }
778
+ const hideInset = sidepanePeers.length > 0 && (isMobile || isLandscape);
779
+ return /* @__PURE__ */ React6.createElement(Fragment2, null, /* @__PURE__ */ React6.createElement(
780
+ Box,
781
+ {
782
+ css: {
783
+ display: "grid",
784
+ gridTemplateColumns: sidepanePeers.length > 0 ? "3fr 1fr" : "100%",
785
+ gridTemplateRows: "1fr",
786
+ gap: "$8",
787
+ px: "$10",
788
+ size: "100%",
789
+ "@md": {
790
+ gridTemplateColumns: "1fr",
791
+ gridTemplateRows: sidepanePeers.length > 0 ? `3fr 1fr` : "100%"
792
+ }
793
+ }
794
+ },
795
+ /* @__PURE__ */ React6.createElement(
796
+ Flex,
797
+ {
798
+ align: "center",
799
+ justify: "center",
800
+ css: {
801
+ size: "100%",
802
+ gap: "$8",
803
+ flexWrap: "wrap",
804
+ placeContent: "center",
805
+ minHeight: 0,
806
+ minWidth: 0,
807
+ "@lg": { flexFlow: "column" },
808
+ "@ls": { flexFlow: "row" }
809
+ }
810
+ },
811
+ centerPeers.length > 0 ? centerPeers.map((peer) => /* @__PURE__ */ React6.createElement(
812
+ VideoTile_default,
813
+ {
814
+ key: peer.videoTrack || peer.id,
815
+ peerId: peer.id,
816
+ trackId: peer.videoTrack,
817
+ rootCSS: {
818
+ aspectRatio: getAspectRatio({
819
+ roleMap,
820
+ roleName: peer.roleName,
821
+ isMobile
822
+ }),
823
+ padding: 0,
824
+ height: "100%",
825
+ maxWidth: "100%",
826
+ minWidth: 0,
827
+ minHeight: 0,
828
+ flex: remotePeers.length === 1 ? void 0 : "1 1 0",
829
+ display: "flex",
830
+ alignItems: "center",
831
+ "@lg": {
832
+ display: "block",
833
+ padding: "0 !important",
834
+ width: "100%"
835
+ }
836
+ },
837
+ objectFit: "contain"
838
+ }
839
+ )) : /* @__PURE__ */ React6.createElement(FirstPersonDisplay, null)
840
+ ),
841
+ sidepanePeers.length > 0 && /* @__PURE__ */ React6.createElement(
842
+ Flex,
843
+ {
844
+ align: "center",
845
+ justify: "center",
846
+ css: {
847
+ size: "100%",
848
+ gap: "$4",
849
+ flexFlow: "row wrap",
850
+ placeContent: "center"
851
+ }
852
+ },
853
+ (hideInset ? [...sidepanePeers, localPeer] : sidepanePeers).map((peer, _, arr) => /* @__PURE__ */ React6.createElement(
854
+ VideoTile_default,
855
+ {
856
+ key: peer.videoTrack || peer.id,
857
+ peerId: peer.id,
858
+ trackId: peer.videoTrack,
859
+ rootCSS: {
860
+ aspectRatio: getAspectRatio({
861
+ roleMap,
862
+ roleName: peer.roleName,
863
+ isMobile: false
864
+ }),
865
+ flexBasis: "100%",
866
+ "@ls": {
867
+ aspectRatio: 1,
868
+ flexBasis: "calc(50% - $4)"
869
+ },
870
+ "@md": {
871
+ aspectRatio: 1,
872
+ flexBasis: arr.length < 4 ? "calc(50% - $4)" : "calc(33% - $4)"
873
+ },
874
+ "@sm": {
875
+ flexBasis: arr.length <= 4 ? "calc(50% - $4)" : "calc(33% - $4)"
876
+ },
877
+ padding: 0
878
+ },
879
+ objectFit: "contain"
880
+ }
881
+ ))
882
+ )
883
+ ), !hideInset && /* @__PURE__ */ React6.createElement(InsetTile, { roleMap, isMobile, isLandscape }));
884
+ }
885
+ var InsetTile = ({ isMobile, roleMap, isLandscape }) => {
886
+ const localPeer = useHMSStore6(selectLocalPeer);
887
+ const sidepane = useHMSStore6(selectAppData(APP_DATA.sidePane));
888
+ const aspectRatio = getAspectRatio({
889
+ roleMap,
890
+ roleName: localPeer.roleName,
891
+ isMobile
892
+ });
893
+ let height = 180;
894
+ let width = height * aspectRatio;
895
+ if (isLandscape && width > 240) {
896
+ width = 240;
897
+ height = width / aspectRatio;
898
+ }
899
+ const nodeRef = useRef3(null);
900
+ useEffect2(() => {
901
+ if (!nodeRef.current || !window.ResizeObserver) {
902
+ return;
903
+ }
904
+ const node = nodeRef.current;
905
+ const resizeObserver = new ResizeObserver((entries) => {
906
+ entries.forEach((entry) => {
907
+ if (entry.target === node.parentElement) {
908
+ node.style.transform = `translate(0,0)`;
909
+ }
910
+ });
911
+ });
912
+ resizeObserver.observe(node.parentElement);
913
+ return () => {
914
+ (node == null ? void 0 : node.parentElement) && (resizeObserver == null ? void 0 : resizeObserver.unobserve(node.parentElement));
915
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
916
+ };
917
+ }, []);
918
+ return /* @__PURE__ */ React6.createElement(Draggable, { bounds: "parent", nodeRef }, /* @__PURE__ */ React6.createElement(
919
+ Box,
920
+ {
921
+ ref: nodeRef,
922
+ css: {
923
+ position: "absolute",
924
+ bottom: 0,
925
+ right: sidepane ? "$100" : "$10",
926
+ mr: sidepane ? "$14" : 0,
927
+ boxShadow: "0 0 8px 0 rgba(0,0,0,0.3)",
928
+ zIndex: 10,
929
+ aspectRatio,
930
+ h: height
931
+ }
932
+ },
933
+ /* @__PURE__ */ React6.createElement(
934
+ VideoTile_default,
935
+ {
936
+ peerId: localPeer.id,
937
+ trackid: localPeer.videoTrack,
938
+ rootCSS: {
939
+ size: "100%",
940
+ padding: 0
941
+ },
942
+ containerCSS: {
943
+ bg: "$surfaceDefault"
944
+ },
945
+ width,
946
+ height
947
+ }
948
+ )
949
+ ));
950
+ };
951
+
952
+ // src/Prebuilt/layouts/mainGridView.jsx
953
+ init_define_process_env();
954
+ import React8, { useEffect as useEffect3, useState as useState2 } from "react";
955
+ import {
956
+ selectLocalPeerID as selectLocalPeerID3,
957
+ selectLocalPeerRole,
958
+ selectPeers as selectPeers3,
959
+ selectPeersByRoles,
960
+ selectRolesMap as selectRolesMap2,
961
+ useHMSStore as useHMSStore8
962
+ } from "@100mslive/react-sdk";
963
+
964
+ // src/Prebuilt/layouts/NonPublisherView.jsx
965
+ init_define_process_env();
966
+ import React7 from "react";
967
+ import { ShieldAlertIcon } from "@100mslive/react-icons";
968
+ var NonPublisherView = React7.memo(({ message }) => {
969
+ return /* @__PURE__ */ React7.createElement(
970
+ Box,
971
+ {
972
+ css: {
973
+ overflow: "hidden",
974
+ w: "96%",
975
+ maxWidth: "96%",
976
+ h: "100%",
977
+ m: "auto",
978
+ background: "$surfaceDefault",
979
+ borderRadius: "$3"
980
+ },
981
+ "data-testid": "non_publisher_view"
982
+ },
983
+ /* @__PURE__ */ React7.createElement(
984
+ Flex,
985
+ {
986
+ align: "center",
987
+ direction: "column",
988
+ css: {
989
+ w: "$96",
990
+ textAlign: "center",
991
+ margin: "auto",
992
+ h: "100%",
993
+ justifyContent: "center",
994
+ gap: "$8"
995
+ }
996
+ },
997
+ /* @__PURE__ */ React7.createElement(ShieldAlertIcon, { color: "#C3D0E5", width: "80px", height: "80px" }),
998
+ /* @__PURE__ */ React7.createElement(
999
+ Flex,
1000
+ {
1001
+ direction: "column",
1002
+ css: {
1003
+ w: "$80",
1004
+ p: "$1",
1005
+ gap: "$4"
1006
+ }
1007
+ },
1008
+ /* @__PURE__ */ React7.createElement(Text, { color: "white", variant: "h6", css: { "@md": { fontSize: "$md" } } }, message),
1009
+ /* @__PURE__ */ React7.createElement(Text, { color: "$textMedEmp", css: { mt: "$4", "@md": { fontSize: "$sm" } } }, "Please go to dashboard and reconfigure role settings or contact the role admin.")
1010
+ )
1011
+ )
1012
+ );
1013
+ });
1014
+
1015
+ // src/Prebuilt/components/AppData/useAppLayout.js
1016
+ init_define_process_env();
1017
+ import { selectAppDataByPath, useHMSStore as useHMSStore7 } from "@100mslive/react-sdk";
1018
+ var useAppLayout = (path) => {
1019
+ return useHMSStore7(selectAppDataByPath(APP_DATA.appLayout, path));
1020
+ };
1021
+
1022
+ // src/Prebuilt/layouts/mainGridView.jsx
1023
+ var MainGridView = () => {
1024
+ var _a;
1025
+ const centerRoles = useAppLayout("center") || [];
1026
+ const sidepaneRoles = useAppLayout("sidepane") || [];
1027
+ const maxTileCount = useUISettings(UI_SETTINGS.maxTileCount);
1028
+ const peers = useHMSStore8(selectPeers3);
1029
+ const roles = useHMSStore8(selectRolesMap2);
1030
+ const localPeerId = useHMSStore8(selectLocalPeerID3);
1031
+ const centerPeers = peers.filter((peer) => centerRoles.includes(peer.roleName));
1032
+ const sidebarPeers = peers.filter((peer) => sidepaneRoles.includes(peer.roleName));
1033
+ const localRole = useHMSStore8(selectLocalPeerRole);
1034
+ const peersByRoles = useHMSStore8(selectPeersByRoles(localRole.subscribeParams.subscribeToRoles || []));
1035
+ const [placeholder, setPlaceholder] = useState2("");
1036
+ useEffect3(() => {
1037
+ var _a2;
1038
+ const hasPublishingPeers = peers.some((peer) => {
1039
+ var _a3;
1040
+ if (peer.roleName && roles[peer.roleName]) {
1041
+ return !!((_a3 = roles[peer.roleName].publishParams) == null ? void 0 : _a3.allowed.length);
1042
+ }
1043
+ return true;
1044
+ });
1045
+ const hasSubscribedRolePublishing = peersByRoles.some((peer) => {
1046
+ var _a3;
1047
+ if (peer.roleName && roles[peer.roleName]) {
1048
+ return !!((_a3 = roles[peer.roleName].publishParams) == null ? void 0 : _a3.allowed.length);
1049
+ }
1050
+ return true;
1051
+ });
1052
+ if (!hasPublishingPeers) {
1053
+ setPlaceholder("None of the roles can publish video, audio or screen");
1054
+ } else if (!((_a2 = localRole.subscribeParams.subscribeToRoles) == null ? void 0 : _a2.length)) {
1055
+ setPlaceholder("This role isn't subscribed to any role");
1056
+ } else if (!hasSubscribedRolePublishing) {
1057
+ setPlaceholder("This role subscribed to roles is not publishing");
1058
+ } else {
1059
+ setPlaceholder("");
1060
+ }
1061
+ }, [(_a = localRole.subscribeParams.subscribeToRoles) == null ? void 0 : _a.length, peers, peersByRoles, roles]);
1062
+ let showSidePane = centerPeers.length > 0 && sidebarPeers.length > 0;
1063
+ if (centerPeers.length === 0) {
1064
+ const itsOnlyMeInTheRoom = peers.length === 1 && peers[0].id === localPeerId;
1065
+ const nooneIsPublishing = sidebarPeers.length === 0;
1066
+ showSidePane = itsOnlyMeInTheRoom || nooneIsPublishing;
1067
+ }
1068
+ return /* @__PURE__ */ React8.createElement(
1069
+ Flex,
1070
+ {
1071
+ css: {
1072
+ size: "100%"
1073
+ },
1074
+ direction: {
1075
+ "@initial": "row",
1076
+ "@md": "column"
1077
+ }
1078
+ },
1079
+ placeholder ? /* @__PURE__ */ React8.createElement(NonPublisherView, { message: placeholder }) : /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
1080
+ GridCenterView,
1081
+ {
1082
+ peers: showSidePane ? centerPeers : peers,
1083
+ maxTileCount,
1084
+ allowRemoteMute: false,
1085
+ hideSidePane: !showSidePane,
1086
+ totalPeers: peers.length
1087
+ }
1088
+ ), showSidePane && /* @__PURE__ */ React8.createElement(GridSidePaneView, { peers: sidebarPeers, totalPeers: peers.length }))
1089
+ );
1090
+ };
1091
+
1092
+ // src/Prebuilt/layouts/PDFView.jsx
1093
+ init_define_process_env();
1094
+ import React9, { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
1095
+ import { throwErrorHandler as throwErrorHandler2, useScreenShare as useScreenShare2 } from "@100mslive/react-sdk";
1096
+ var PDFView = () => {
1097
+ return /* @__PURE__ */ React9.createElement(EmbebScreenShareView, null, /* @__PURE__ */ React9.createElement(PDFEmbedComponent, null));
1098
+ };
1099
+ var PDFEmbedComponent = () => {
1100
+ const ref = useRef4();
1101
+ const themeType = useTheme().themeType;
1102
+ const [isPDFLoaded, setIsPDFLoaded] = useState3(false);
1103
+ let pdfJSURL = define_process_env_default.REACT_APP_PDFJS_IFRAME_URL;
1104
+ const { amIScreenSharing, toggleScreenShare } = useScreenShare2(throwErrorHandler2);
1105
+ const [pdfConfig, setPDFConfig] = useSetAppDataByKey(APP_DATA.pdfConfig);
1106
+ if (pdfConfig.url && !pdfConfig.file) {
1107
+ pdfJSURL = pdfJSURL + "?file=" + encodeURIComponent(pdfConfig.url);
1108
+ }
1109
+ const [wasScreenShared, setWasScreenShared] = useState3(false);
1110
+ const screenShareAttemptInProgress = useRef4(false);
1111
+ const iframeRef = useRef4();
1112
+ const resetEmbedConfig = useCallback3(() => {
1113
+ setPDFConfig({ state: false });
1114
+ }, [setPDFConfig]);
1115
+ useEffect4(() => {
1116
+ if (isPDFLoaded && ref.current) {
1117
+ ref.current.contentWindow.postMessage(
1118
+ {
1119
+ theme: themeType === "dark" /* dark */ ? 2 : 1
1120
+ },
1121
+ "*"
1122
+ );
1123
+ }
1124
+ }, [isPDFLoaded, themeType]);
1125
+ useEffect4(() => {
1126
+ if (!amIScreenSharing && !wasScreenShared && !screenShareAttemptInProgress.current) {
1127
+ screenShareAttemptInProgress.current = true;
1128
+ toggleScreenShare({
1129
+ forceCurrentTab: isChrome,
1130
+ cropElement: iframeRef.current,
1131
+ preferCurrentTab: isChrome
1132
+ }).then(() => {
1133
+ setWasScreenShared(true);
1134
+ }).catch(resetEmbedConfig).finally(() => {
1135
+ screenShareAttemptInProgress.current = false;
1136
+ });
1137
+ }
1138
+ }, []);
1139
+ useEffect4(() => {
1140
+ if (wasScreenShared && !amIScreenSharing) {
1141
+ resetEmbedConfig();
1142
+ }
1143
+ return () => {
1144
+ if (wasScreenShared && amIScreenSharing) {
1145
+ resetEmbedConfig();
1146
+ toggleScreenShare();
1147
+ }
1148
+ };
1149
+ }, [wasScreenShared, amIScreenSharing, resetEmbedConfig, toggleScreenShare]);
1150
+ return /* @__PURE__ */ React9.createElement(
1151
+ Box,
1152
+ {
1153
+ ref: iframeRef,
1154
+ css: {
1155
+ mx: "$8",
1156
+ flex: "3 1 0",
1157
+ "@lg": {
1158
+ flex: "2 1 0",
1159
+ display: "flex",
1160
+ alignItems: "center"
1161
+ }
1162
+ }
1163
+ },
1164
+ /* @__PURE__ */ React9.createElement(
1165
+ "iframe",
1166
+ {
1167
+ src: pdfJSURL,
1168
+ title: "PDF Annotator",
1169
+ ref,
1170
+ style: {
1171
+ width: "100%",
1172
+ height: "100%",
1173
+ border: 0,
1174
+ borderRadius: "0.75rem"
1175
+ },
1176
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture fullscreen",
1177
+ referrerPolicy: "no-referrer",
1178
+ onLoad: () => {
1179
+ if (ref.current && pdfConfig.file) {
1180
+ requestAnimationFrame(() => {
1181
+ ref.current.contentWindow.postMessage(
1182
+ {
1183
+ file: pdfConfig.file,
1184
+ theme: themeType === "dark" /* dark */ ? 2 : 1
1185
+ },
1186
+ "*"
1187
+ );
1188
+ setIsPDFLoaded(true);
1189
+ }, 1e3);
1190
+ }
1191
+ }
1192
+ }
1193
+ )
1194
+ );
1195
+ };
1196
+
1197
+ // src/Prebuilt/layouts/WaitingView.jsx
1198
+ init_define_process_env();
1199
+ import React10 from "react";
1200
+ import { ColoredTimeIcon } from "@100mslive/react-icons";
1201
+ var WaitingView = React10.memo(() => {
1202
+ return /* @__PURE__ */ React10.createElement(
1203
+ Box,
1204
+ {
1205
+ css: {
1206
+ overflow: "hidden",
1207
+ w: "96%",
1208
+ maxWidth: "96%",
1209
+ h: "100%",
1210
+ m: "auto",
1211
+ background: "$surfaceDefault",
1212
+ borderRadius: "$3"
1213
+ },
1214
+ "data-testid": "waiting_view"
1215
+ },
1216
+ /* @__PURE__ */ React10.createElement(
1217
+ Flex,
1218
+ {
1219
+ align: "center",
1220
+ direction: "column",
1221
+ css: {
1222
+ w: "$96",
1223
+ textAlign: "center",
1224
+ margin: "auto",
1225
+ h: "100%",
1226
+ justifyContent: "center",
1227
+ gap: "$8"
1228
+ }
1229
+ },
1230
+ /* @__PURE__ */ React10.createElement(ColoredTimeIcon, { width: "80px", height: "80px" }),
1231
+ /* @__PURE__ */ React10.createElement(
1232
+ Flex,
1233
+ {
1234
+ direction: "column",
1235
+ css: {
1236
+ w: "$80",
1237
+ p: "$1",
1238
+ gap: "$4"
1239
+ }
1240
+ },
1241
+ /* @__PURE__ */ React10.createElement(Text, { color: "white", variant: "h6", css: { "@md": { fontSize: "$md" } } }, "Please wait"),
1242
+ /* @__PURE__ */ React10.createElement(Text, { color: "$textMedEmp", css: { mt: "$4", "@md": { fontSize: "$sm" } } }, "Sit back and relax till others let you join.")
1243
+ )
1244
+ )
1245
+ );
1246
+ });
1247
+
1248
+ // src/Prebuilt/plugins/whiteboard/index.js
1249
+ init_define_process_env();
1250
+
1251
+ // src/Prebuilt/layouts/mainView.jsx
1252
+ var HLSView = React11.lazy(() => import("./HLSView-3RDXRV7Y.js"));
1253
+ var ActiveSpeakerView = React11.lazy(() => import("./ActiveSpeakerView-H3VYXANB.js"));
1254
+ var PinnedTrackView = React11.lazy(() => import("./PinnedTrackView-453PELNU.js"));
1255
+ var ConferenceMainView = () => {
1256
+ const localPeerRole = useHMSStore9(selectLocalPeerRoleName3);
1257
+ const pinnedTrack = usePinnedTrack();
1258
+ const peerSharing = useHMSStore9(selectPeerScreenSharing3);
1259
+ const peerSharingAudio = useHMSStore9(selectPeerSharingAudio);
1260
+ const peerSharingPlaylist = useHMSStore9(selectPeerSharingVideoPlaylist3);
1261
+ const { whiteboardOwner: whiteboardShared } = useWhiteboardMetadata();
1262
+ const isConnected = useHMSStore9(selectIsConnectedToRoom);
1263
+ const uiMode = useHMSStore9(selectTemplateAppData).uiMode;
1264
+ const hmsActions = useHMSActions5();
1265
+ const isHeadless = useIsHeadless();
1266
+ const headlessUIMode = useAppConfig("headlessConfig", "uiMode");
1267
+ const { uiViewMode, isAudioOnly } = useUISettings();
1268
+ const hlsViewerRole = useHLSViewerRole();
1269
+ const waitingViewerRole = useWaitingViewerRole();
1270
+ const urlToIframe = useUrlToEmbed();
1271
+ const pdfAnntatorActive = usePDFAnnotator();
1272
+ useEffect5(() => {
1273
+ if (!isConnected) {
1274
+ return;
1275
+ }
1276
+ const audioPlaylist = JSON.parse(define_process_env_default.REACT_APP_AUDIO_PLAYLIST || "[]");
1277
+ const videoPlaylist = JSON.parse(define_process_env_default.REACT_APP_VIDEO_PLAYLIST || "[]");
1278
+ if (videoPlaylist.length > 0) {
1279
+ hmsActions.videoPlaylist.setList(videoPlaylist);
1280
+ }
1281
+ if (audioPlaylist.length > 0) {
1282
+ hmsActions.audioPlaylist.setList(audioPlaylist);
1283
+ }
1284
+ hmsActions.sessionStore.observe([SESSION_STORE_KEY.PINNED_MESSAGE, SESSION_STORE_KEY.SPOTLIGHT]);
1285
+ }, [isConnected, hmsActions]);
1286
+ if (!localPeerRole) {
1287
+ return null;
1288
+ }
1289
+ let ViewComponent;
1290
+ if (localPeerRole === hlsViewerRole) {
1291
+ ViewComponent = HLSView;
1292
+ } else if (localPeerRole === waitingViewerRole) {
1293
+ ViewComponent = WaitingView;
1294
+ } else if (pdfAnntatorActive) {
1295
+ ViewComponent = PDFView;
1296
+ } else if (urlToIframe) {
1297
+ ViewComponent = EmbedView;
1298
+ } else if (whiteboardShared) {
1299
+ } else if (uiMode === "inset") {
1300
+ ViewComponent = InsetView;
1301
+ } else if ((peerSharing && peerSharing.id !== (peerSharingAudio == null ? void 0 : peerSharingAudio.id) || peerSharingPlaylist) && !isAudioOnly) {
1302
+ ViewComponent = screenShareView_default;
1303
+ } else if (pinnedTrack) {
1304
+ ViewComponent = PinnedTrackView;
1305
+ } else if (uiViewMode === UI_MODE_ACTIVE_SPEAKER || isHeadless && headlessUIMode === UI_MODE_ACTIVE_SPEAKER) {
1306
+ ViewComponent = ActiveSpeakerView;
1307
+ } else {
1308
+ ViewComponent = MainGridView;
1309
+ }
1310
+ return /* @__PURE__ */ React11.createElement(Suspense, { fallback: /* @__PURE__ */ React11.createElement(FullPageProgress_default, null) }, /* @__PURE__ */ React11.createElement(
1311
+ Flex,
1312
+ {
1313
+ css: {
1314
+ size: "100%",
1315
+ position: "relative"
1316
+ }
1317
+ },
1318
+ /* @__PURE__ */ React11.createElement(ViewComponent, null),
1319
+ /* @__PURE__ */ React11.createElement(SidePane_default, null)
1320
+ ));
1321
+ };
1322
+
1323
+ // src/Prebuilt/components/Footer.jsx
1324
+ init_define_process_env();
1325
+ import React37 from "react";
1326
+
1327
+ // src/Prebuilt/components/Footer/ConferencingFooter.jsx
1328
+ init_define_process_env();
1329
+ import React35, { Fragment as Fragment7, Suspense as Suspense2, useState as useState16 } from "react";
1330
+ import { useMedia as useMedia6 } from "react-use";
1331
+ import { HMSPlaylistType as HMSPlaylistType4, selectIsAllowedToPublish as selectIsAllowedToPublish4, useHMSStore as useHMSStore19, useScreenShare as useScreenShare5 } from "@100mslive/react-sdk";
1332
+ import { MusicIcon } from "@100mslive/react-icons";
1333
+
1334
+ // src/Prebuilt/components/Playlist/Playlist.jsx
1335
+ init_define_process_env();
1336
+ import React13, { Fragment as Fragment3, useState as useState4 } from "react";
1337
+ import { HMSPlaylistType as HMSPlaylistType3, selectIsAllowedToPublish, useHMSStore as useHMSStore10 } from "@100mslive/react-sdk";
1338
+ import { AudioPlayerIcon, CrossIcon as CrossIcon3, VideoPlayerIcon } from "@100mslive/react-icons";
1339
+
1340
+ // src/Prebuilt/components/Playlist/PlaylistItem.jsx
1341
+ init_define_process_env();
1342
+ import React12 from "react";
1343
+ function formatDuration(duration) {
1344
+ if (!duration) {
1345
+ return "";
1346
+ }
1347
+ let mins = Math.floor(duration / 60);
1348
+ if (mins < 10) {
1349
+ mins = `0${String(mins)}`;
1350
+ }
1351
+ let secs = Math.floor(duration % 60);
1352
+ if (secs < 10) {
1353
+ secs = `0${String(secs)}`;
1354
+ }
1355
+ return `${mins}:${secs}`;
1356
+ }
1357
+ var PlaylistItem = React12.memo(({ name, metadata, duration, selected, onClick }) => {
1358
+ return /* @__PURE__ */ React12.createElement(
1359
+ Dropdown.Item,
1360
+ {
1361
+ css: {
1362
+ flexDirection: "column",
1363
+ alignItems: "flex-start",
1364
+ h: "$18",
1365
+ p: "$8",
1366
+ "&:hover": {
1367
+ cursor: "pointer",
1368
+ bg: "$menuBg"
1369
+ },
1370
+ "&:focus-visible": {
1371
+ bg: "$menuBg"
1372
+ }
1373
+ },
1374
+ onClick
1375
+ },
1376
+ /* @__PURE__ */ React12.createElement(Flex, { align: "center", justify: "between", css: { width: "100%", minHeight: 0 } }, /* @__PURE__ */ React12.createElement(Text, { variant: "md", css: { color: selected ? "$brandDefault" : "$textPrimary" } }, name), /* @__PURE__ */ React12.createElement(Text, { variant: "xs" }, formatDuration(duration))),
1377
+ (metadata == null ? void 0 : metadata.description) && /* @__PURE__ */ React12.createElement(Text, { variant: "xs", css: { mt: "$4" } }, metadata == null ? void 0 : metadata.description)
1378
+ );
1379
+ });
1380
+
1381
+ // src/Prebuilt/components/Playlist/Playlist.jsx
1382
+ var BrowseAndPlayFromLocal = ({ type, actions }) => {
1383
+ return /* @__PURE__ */ React13.createElement(Fragment3, null, /* @__PURE__ */ React13.createElement(Text, { as: "label", htmlFor: `${type}PlaylistBrowse`, variant: "sm", css: { cursor: "pointer", mr: "$2" } }, "Browse"), /* @__PURE__ */ React13.createElement(
1384
+ "input",
1385
+ {
1386
+ type: "file",
1387
+ id: `${type}PlaylistBrowse`,
1388
+ accept: type === HMSPlaylistType3.audio ? "audio/*" : "video/*",
1389
+ onChange: (e) => {
1390
+ const file = e.target.files[0];
1391
+ const id = file.lastModified;
1392
+ actions.setList([
1393
+ {
1394
+ type,
1395
+ id,
1396
+ name: file.name,
1397
+ url: URL.createObjectURL(file)
1398
+ }
1399
+ ]);
1400
+ actions.play(id);
1401
+ },
1402
+ style: { display: "none" }
1403
+ }
1404
+ ));
1405
+ };
1406
+ var Playlist = ({ type }) => {
1407
+ const isAudioPlaylist = type === HMSPlaylistType3.audio;
1408
+ const { active, list: playlist, actions } = usePlaylist(type);
1409
+ const [open, setOpen] = useState4(false);
1410
+ const [collapse, setCollapse] = useState4(false);
1411
+ const isAllowedToPublish = useHMSStore10(selectIsAllowedToPublish);
1412
+ const isFeatureEnabled = useIsFeatureEnabled(
1413
+ isAudioPlaylist ? FEATURE_LIST.AUDIO_PLAYLIST : FEATURE_LIST.VIDEO_PLAYLIST
1414
+ );
1415
+ if (!isAllowedToPublish.screen || playlist.length === 0 || !isFeatureEnabled) {
1416
+ return null;
1417
+ }
1418
+ return /* @__PURE__ */ React13.createElement(Fragment3, null, /* @__PURE__ */ React13.createElement(Dropdown.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React13.createElement(Dropdown.Trigger, { asChild: true, "data-testid": type === HMSPlaylistType3.audio ? "audio_playlist" : "video_playlist" }, /* @__PURE__ */ React13.createElement(IconButton_default, { active: !active }, /* @__PURE__ */ React13.createElement(Tooltip, { title: isAudioPlaylist ? "Audio Playlist" : "Video Playlist" }, /* @__PURE__ */ React13.createElement(Box, null, isAudioPlaylist ? /* @__PURE__ */ React13.createElement(AudioPlayerIcon, null) : /* @__PURE__ */ React13.createElement(VideoPlayerIcon, null))))), /* @__PURE__ */ React13.createElement(
1419
+ Dropdown.Content,
1420
+ {
1421
+ sideOffset: 5,
1422
+ align: "center",
1423
+ css: {
1424
+ maxHeight: "unset",
1425
+ width: "$60",
1426
+ p: "$0",
1427
+ bg: "$bgSecondary",
1428
+ border: "1px solid $menuBg"
1429
+ }
1430
+ },
1431
+ /* @__PURE__ */ React13.createElement(
1432
+ Flex,
1433
+ {
1434
+ align: "center",
1435
+ css: {
1436
+ p: "$4 $8",
1437
+ borderBottom: "1px solid $borderLight",
1438
+ bg: "$menuBg"
1439
+ }
1440
+ },
1441
+ /* @__PURE__ */ React13.createElement(Text, { variant: "md", css: { flex: "1 1 0" } }, isAudioPlaylist ? "Audio Player" : "Video Playlist"),
1442
+ /* @__PURE__ */ React13.createElement(BrowseAndPlayFromLocal, { type, actions }),
1443
+ /* @__PURE__ */ React13.createElement(
1444
+ IconButton_default,
1445
+ {
1446
+ css: { mr: "-$4" },
1447
+ onClick: () => __async(void 0, null, function* () {
1448
+ if (active) {
1449
+ yield actions.stop();
1450
+ }
1451
+ setOpen(false);
1452
+ setCollapse(false);
1453
+ })
1454
+ },
1455
+ /* @__PURE__ */ React13.createElement(CrossIcon3, { width: 24, height: 24 })
1456
+ )
1457
+ ),
1458
+ !collapse && /* @__PURE__ */ React13.createElement(Box, { css: { maxHeight: "$96", overflowY: "auto" } }, playlist.map((playlistItem) => {
1459
+ return /* @__PURE__ */ React13.createElement(
1460
+ PlaylistItem,
1461
+ __spreadProps(__spreadValues({
1462
+ key: playlistItem.id
1463
+ }, playlistItem), {
1464
+ onClick: (e) => __async(void 0, null, function* () {
1465
+ e.preventDefault();
1466
+ try {
1467
+ yield actions.play(playlistItem.id);
1468
+ } catch (e2) {
1469
+ }
1470
+ if (!isAudioPlaylist) {
1471
+ setOpen(false);
1472
+ }
1473
+ })
1474
+ })
1475
+ );
1476
+ })),
1477
+ isAudioPlaylist && /* @__PURE__ */ React13.createElement(AudioPlaylistControls, { onToggle: () => setCollapse((value) => !value) })
1478
+ )));
1479
+ };
1480
+
1481
+ // src/Prebuilt/components/MoreSettings/MoreSettings.jsx
1482
+ init_define_process_env();
1483
+ import React22, { Fragment as Fragment4, useState as useState12 } from "react";
1484
+ import { useMedia as useMedia5 } from "react-use";
1485
+ import Hls from "hls.js";
1486
+ import {
1487
+ selectAppData as selectAppData3,
1488
+ selectIsAllowedToPublish as selectIsAllowedToPublish2,
1489
+ selectLocalPeerID as selectLocalPeerID6,
1490
+ selectLocalPeerRoleName as selectLocalPeerRoleName5,
1491
+ selectPermissions as selectPermissions3,
1492
+ useHMSActions as useHMSActions11,
1493
+ useHMSStore as useHMSStore15,
1494
+ useRecordingStreaming as useRecordingStreaming2
1495
+ } from "@100mslive/react-sdk";
1496
+ import {
1497
+ ChangeRoleIcon as ChangeRoleIcon2,
1498
+ CheckIcon as CheckIcon3,
1499
+ InfoIcon,
1500
+ MicOffIcon as MicOffIcon2,
1501
+ PencilIcon,
1502
+ RecordIcon,
1503
+ SettingsIcon,
1504
+ VerticalMenuIcon
1505
+ } from "@100mslive/react-icons";
1506
+
1507
+ // src/Prebuilt/components/Settings/StartRecording.jsx
1508
+ init_define_process_env();
1509
+ import React14, { useState as useState5 } from "react";
1510
+ import {
1511
+ selectAppData as selectAppData2,
1512
+ selectPermissions,
1513
+ useHMSActions as useHMSActions6,
1514
+ useHMSStore as useHMSStore11,
1515
+ useRecordingStreaming
1516
+ } from "@100mslive/react-sdk";
1517
+ import { AlertTriangleIcon } from "@100mslive/react-icons";
1518
+ var StartRecording = ({ open, onOpenChange }) => {
1519
+ const permissions = useHMSStore11(selectPermissions);
1520
+ const recordingUrl = useHMSStore11(selectAppData2(APP_DATA.recordingUrl));
1521
+ const [resolution, setResolution] = useState5(RTMP_RECORD_DEFAULT_RESOLUTION);
1522
+ const [recordingStarted, setRecordingState] = useSetAppDataByKey(APP_DATA.recordingStarted);
1523
+ const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
1524
+ const hmsActions = useHMSActions6();
1525
+ if (!(permissions == null ? void 0 : permissions.browserRecording) || isHLSRunning) {
1526
+ return null;
1527
+ }
1528
+ if (isBrowserRecordingOn) {
1529
+ return /* @__PURE__ */ React14.createElement(Dialog.Root, { open, onOpenChange }, /* @__PURE__ */ React14.createElement(Dialog.Portal, null, /* @__PURE__ */ React14.createElement(
1530
+ Dialog.Content,
1531
+ {
1532
+ css: {
1533
+ width: "min(400px,80%)",
1534
+ p: "$10",
1535
+ bg: "#201617"
1536
+ }
1537
+ },
1538
+ /* @__PURE__ */ React14.createElement(Dialog.Title, null, /* @__PURE__ */ React14.createElement(Flex, { gap: 2, css: { c: "$error" } }, /* @__PURE__ */ React14.createElement(AlertTriangleIcon, null), /* @__PURE__ */ React14.createElement(Text, { css: { c: "inherit" }, variant: "h6" }, "End Recording"))),
1539
+ /* @__PURE__ */ React14.createElement(Text, { variant: "sm", css: { c: "$textMedEmp", my: "$8" } }, "Are you sure you want to end recording? You can\u2019t undo this action."),
1540
+ /* @__PURE__ */ React14.createElement(Flex, { justify: "end", css: { mt: "$12" } }, /* @__PURE__ */ React14.createElement(Dialog.Close, { asChild: true }, /* @__PURE__ */ React14.createElement(Button, { outlined: true, css: { borderColor: "$secondaryLight", mr: "$4" } }, "Don't end")), /* @__PURE__ */ React14.createElement(
1541
+ Button,
1542
+ {
1543
+ "data-testid": "stop_recording_confirm_mobile",
1544
+ variant: "danger",
1545
+ icon: true,
1546
+ onClick: () => __async(void 0, null, function* () {
1547
+ try {
1548
+ yield hmsActions.stopRTMPAndRecording();
1549
+ } catch (error) {
1550
+ ToastManager.addToast({
1551
+ title: error.message,
1552
+ variant: "error"
1553
+ });
1554
+ }
1555
+ onOpenChange(false);
1556
+ })
1557
+ },
1558
+ "End recording"
1559
+ ))
1560
+ )));
1561
+ }
1562
+ return /* @__PURE__ */ React14.createElement(Dialog.Root, { open, onOpenChange }, /* @__PURE__ */ React14.createElement(Dialog.Content, { css: { width: "min(400px,80%)", p: "$10" } }, /* @__PURE__ */ React14.createElement(Dialog.Title, null, /* @__PURE__ */ React14.createElement(Text, { variant: "h6" }, "Start Recording")), /* @__PURE__ */ React14.createElement(
1563
+ ResolutionInput,
1564
+ {
1565
+ testId: "recording_resolution_mobile",
1566
+ css: { flexDirection: "column", alignItems: "start" },
1567
+ onResolutionChange: setResolution
1568
+ }
1569
+ ), /* @__PURE__ */ React14.createElement(
1570
+ Button,
1571
+ {
1572
+ "data-testid": "start_recording_confirm_mobile",
1573
+ variant: "primary",
1574
+ icon: true,
1575
+ css: { ml: "auto" },
1576
+ type: "submit",
1577
+ disabled: recordingStarted || isStreamingOn,
1578
+ onClick: () => __async(void 0, null, function* () {
1579
+ try {
1580
+ setRecordingState(true);
1581
+ yield hmsActions.startRTMPOrRecording({
1582
+ meetingURL: recordingUrl,
1583
+ resolution: getResolution(resolution),
1584
+ record: true
1585
+ });
1586
+ } catch (error) {
1587
+ if (error.message.includes("stream already running")) {
1588
+ ToastManager.addToast({
1589
+ title: "Recording already running",
1590
+ variant: "error"
1591
+ });
1592
+ } else {
1593
+ ToastManager.addToast({
1594
+ title: error.message,
1595
+ variant: "error"
1596
+ });
1597
+ }
1598
+ setRecordingState(false);
1599
+ }
1600
+ onOpenChange(false);
1601
+ })
1602
+ },
1603
+ "Start"
1604
+ )));
1605
+ };
1606
+ var StartRecording_default = StartRecording;
1607
+
1608
+ // src/Prebuilt/components/StatsForNerds.jsx
1609
+ init_define_process_env();
1610
+ import React15, { useEffect as useEffect6, useMemo as useMemo3, useRef as useRef5, useState as useState6 } from "react";
1611
+ import {
1612
+ selectHMSStats,
1613
+ selectLocalPeerID as selectLocalPeerID4,
1614
+ selectPeersMap,
1615
+ selectTracksMap,
1616
+ useHMSStatsStore,
1617
+ useHMSStore as useHMSStore12
1618
+ } from "@100mslive/react-sdk";
1619
+ var StatsForNerds = ({ onOpenChange }) => {
1620
+ var _a;
1621
+ const tracksWithLabels = useTracksWithLabel();
1622
+ const statsOptions = useMemo3(
1623
+ () => [{ id: "local-peer", label: "Local Peer Stats" }, ...tracksWithLabels],
1624
+ [tracksWithLabels]
1625
+ );
1626
+ const [selectedStat, setSelectedStat] = useState6(statsOptions[0]);
1627
+ const [showStatsOnTiles, setShowStatsOnTiles] = useSetUiSettings(UI_SETTINGS.showStatsOnTiles);
1628
+ const [open, setOpen] = useState6(false);
1629
+ const ref = useRef5();
1630
+ const selectionBg = useDropdownSelection();
1631
+ useEffect6(() => {
1632
+ if (selectedStat.id !== "local-peer" && !tracksWithLabels.find((track) => track.id === selectedStat.id)) {
1633
+ setSelectedStat("local-peer");
1634
+ }
1635
+ }, [tracksWithLabels, selectedStat]);
1636
+ return /* @__PURE__ */ React15.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React15.createElement(Dialog.Portal, null, /* @__PURE__ */ React15.createElement(Dialog.Overlay, null), /* @__PURE__ */ React15.createElement(
1637
+ Dialog.Content,
1638
+ {
1639
+ css: {
1640
+ width: "min(500px, 95%)",
1641
+ maxHeight: "100%",
1642
+ overflowY: "auto"
1643
+ }
1644
+ },
1645
+ /* @__PURE__ */ React15.createElement(Dialog.Title, { css: { p: "$4 0" } }, /* @__PURE__ */ React15.createElement(Flex, { justify: "between" }, /* @__PURE__ */ React15.createElement(Flex, { align: "center", css: { mb: "$1" } }, /* @__PURE__ */ React15.createElement(Text, { variant: "h6", inline: true }, "Stats For Nerds")), /* @__PURE__ */ React15.createElement(Dialog.DefaultClose, { "data-testid": "stats_dialog_close_icon" }))),
1646
+ /* @__PURE__ */ React15.createElement(HorizontalDivider, { css: { mt: "0.8rem" } }),
1647
+ /* @__PURE__ */ React15.createElement(Flex, { justify: "start", gap: 4, css: { m: "$10 0" } }, /* @__PURE__ */ React15.createElement(Switch, { checked: showStatsOnTiles, onCheckedChange: setShowStatsOnTiles }), /* @__PURE__ */ React15.createElement(Text, { variant: "body2", css: { fontWeight: "$semiBold" } }, "Show Stats on Tiles")),
1648
+ /* @__PURE__ */ React15.createElement(
1649
+ Flex,
1650
+ {
1651
+ direction: "column",
1652
+ css: {
1653
+ mb: "$12",
1654
+ position: "relative",
1655
+ minWidth: 0
1656
+ }
1657
+ },
1658
+ /* @__PURE__ */ React15.createElement(Label, { variant: "body2" }, "Stats For"),
1659
+ /* @__PURE__ */ React15.createElement(Dropdown.Root, { "data-testid": "dialog_select_Stats For", open, onOpenChange: setOpen }, /* @__PURE__ */ React15.createElement(
1660
+ DialogDropdownTrigger,
1661
+ {
1662
+ title: selectedStat.label || "Select Stats",
1663
+ css: { mt: "$4" },
1664
+ titleCSS: { mx: 0 },
1665
+ open,
1666
+ ref
1667
+ }
1668
+ ), /* @__PURE__ */ React15.createElement(Dropdown.Portal, null, /* @__PURE__ */ React15.createElement(Dropdown.Content, { align: "start", sideOffset: 8, css: { w: (_a = ref.current) == null ? void 0 : _a.clientWidth, zIndex: 1e3 } }, statsOptions.map((option) => {
1669
+ const isSelected = option.id === selectedStat.id && option.layer === selectedStat.layer;
1670
+ return /* @__PURE__ */ React15.createElement(
1671
+ Dropdown.Item,
1672
+ {
1673
+ key: `${option.id}-${option.layer || ""}`,
1674
+ onClick: () => {
1675
+ setSelectedStat(option);
1676
+ },
1677
+ css: {
1678
+ px: "$9",
1679
+ bg: isSelected ? selectionBg : void 0,
1680
+ c: isSelected ? "$white" : "$textPrimary"
1681
+ }
1682
+ },
1683
+ option.label
1684
+ );
1685
+ }))))
1686
+ ),
1687
+ selectedStat.id === "local-peer" ? /* @__PURE__ */ React15.createElement(LocalPeerStats, null) : /* @__PURE__ */ React15.createElement(TrackStats, { trackID: selectedStat.id, layer: selectedStat.layer, local: selectedStat.local })
1688
+ )));
1689
+ };
1690
+ var useTracksWithLabel = () => {
1691
+ const tracksMap = useHMSStore12(selectTracksMap);
1692
+ const peersMap = useHMSStore12(selectPeersMap);
1693
+ const localPeerID = useHMSStore12(selectLocalPeerID4);
1694
+ const tracksWithLabels = useMemo3(
1695
+ () => Object.values(tracksMap).reduce((res, track) => {
1696
+ var _a, _b;
1697
+ const peerName = (_a = peersMap[track.peerId]) == null ? void 0 : _a.name;
1698
+ const isLocalTrack = track.peerId === localPeerID;
1699
+ if (isLocalTrack && ((_b = track.layerDefinitions) == null ? void 0 : _b.length)) {
1700
+ res = res.concat(
1701
+ track.layerDefinitions.map(({ layer }) => {
1702
+ return {
1703
+ id: track.id,
1704
+ layer,
1705
+ local: true,
1706
+ label: `${peerName} ${track.source} ${track.type} - ${layer}`
1707
+ };
1708
+ })
1709
+ );
1710
+ return res;
1711
+ }
1712
+ res.push({
1713
+ id: track.id,
1714
+ local: isLocalTrack,
1715
+ label: `${peerName} ${track.source} ${track.type}`
1716
+ });
1717
+ return res;
1718
+ }, []),
1719
+ [tracksMap, peersMap, localPeerID]
1720
+ );
1721
+ return tracksWithLabels;
1722
+ };
1723
+ var LocalPeerStats = () => {
1724
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1725
+ const stats = useHMSStatsStore(selectHMSStats.localPeerStats);
1726
+ if (!stats) {
1727
+ return null;
1728
+ }
1729
+ return /* @__PURE__ */ React15.createElement(Flex, { css: { flexWrap: "wrap", gap: "$10" } }, /* @__PURE__ */ React15.createElement(StatsRow, { label: "Packets Lost", value: (_a = stats.subscribe) == null ? void 0 : _a.packetsLost }), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Jitter", value: (_b = stats.subscribe) == null ? void 0 : _b.jitter }), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Publish Bitrate", value: formatBytes((_c = stats.publish) == null ? void 0 : _c.bitrate, "b/s") }), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Subscribe Bitrate", value: formatBytes((_d = stats.subscribe) == null ? void 0 : _d.bitrate, "b/s") }), /* @__PURE__ */ React15.createElement(
1730
+ StatsRow,
1731
+ {
1732
+ label: "Available Outgoing Bitrate",
1733
+ value: formatBytes((_e = stats.publish) == null ? void 0 : _e.availableOutgoingBitrate, "b/s")
1734
+ }
1735
+ ), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Total Bytes Sent", value: formatBytes((_f = stats.publish) == null ? void 0 : _f.bytesSent) }), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Total Bytes Received", value: formatBytes((_g = stats.subscribe) == null ? void 0 : _g.bytesReceived) }), /* @__PURE__ */ React15.createElement(
1736
+ StatsRow,
1737
+ {
1738
+ label: "Round Trip Time",
1739
+ value: `${(((((_h = stats.publish) == null ? void 0 : _h.currentRoundTripTime) || 0) + (((_i = stats.subscribe) == null ? void 0 : _i.currentRoundTripTime) || 0)) / 2).toFixed(3) * 1e3} ms`
1740
+ }
1741
+ ));
1742
+ };
1743
+ var TrackStats = ({ trackID, layer, local }) => {
1744
+ var _a;
1745
+ const selector = layer ? selectHMSStats.localVideoTrackStatsByLayer(layer)(trackID) : local ? selectHMSStats.localAudioTrackStatsByID(trackID) : selectHMSStats.trackStatsByID(trackID);
1746
+ const stats = useHMSStatsStore(selector);
1747
+ if (!stats) {
1748
+ return null;
1749
+ }
1750
+ const inbound = stats.type.includes("inbound");
1751
+ return /* @__PURE__ */ React15.createElement(Flex, { css: { flexWrap: "wrap", gap: "$10" } }, /* @__PURE__ */ React15.createElement(StatsRow, { label: "Type", value: stats.type + " " + stats.kind }), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Bitrate", value: formatBytes(stats.bitrate, "b/s") }), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Packets Lost", value: stats.packetsLost }), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Jitter", value: (_a = stats.jitter) == null ? void 0 : _a.toFixed(3) }), /* @__PURE__ */ React15.createElement(
1752
+ StatsRow,
1753
+ {
1754
+ label: inbound ? "Bytes Received" : "Bytes Sent",
1755
+ value: formatBytes(inbound ? stats.bytesReceived : stats.bytesSent)
1756
+ }
1757
+ ), stats.kind === "video" && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(StatsRow, { label: "Framerate", value: stats.framesPerSecond }), !inbound && /* @__PURE__ */ React15.createElement(StatsRow, { label: "Quality Limitation Reason", value: stats.qualityLimitationReason })), /* @__PURE__ */ React15.createElement(StatsRow, { label: "Round Trip Time", value: stats.roundTripTime ? `${stats.roundTripTime * 1e3} ms` : "-" }));
1758
+ };
1759
+ var StatsRow = React15.memo(({ label, value }) => /* @__PURE__ */ React15.createElement(Box, { css: { bg: "$surfaceLight", w: "calc(50% - $6)", p: "$8", r: "$3" } }, /* @__PURE__ */ React15.createElement(
1760
+ Text,
1761
+ {
1762
+ variant: "overline",
1763
+ css: {
1764
+ fontWeight: "$semiBold",
1765
+ color: "$textMedEmp",
1766
+ textTransform: "uppercase"
1767
+ }
1768
+ },
1769
+ label,
1770
+ " "
1771
+ ), /* @__PURE__ */ React15.createElement(Text, { variant: "sub1", css: { fontWeight: "$semiBold", color: "$textHighEmp" } }, value || "-")));
1772
+ var formatBytes = (bytes, unit = "B", decimals = 2) => {
1773
+ if (bytes === void 0)
1774
+ return "-";
1775
+ if (bytes === 0)
1776
+ return "0 " + unit;
1777
+ const k = 1024;
1778
+ const dm = decimals < 0 ? 0 : decimals;
1779
+ const sizes = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"].map((size) => size + unit);
1780
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1781
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
1782
+ };
1783
+
1784
+ // src/Prebuilt/components/MoreSettings/BulkRoleChangeModal.jsx
1785
+ init_define_process_env();
1786
+ import React16, { useCallback as useCallback4, useRef as useRef6, useState as useState7 } from "react";
1787
+ import { useHMSActions as useHMSActions7 } from "@100mslive/react-sdk";
1788
+ import { AlertTriangleIcon as AlertTriangleIcon2, ChangeRoleIcon, CheckIcon } from "@100mslive/react-icons";
1789
+ var BulkRoleChangeModal = ({ onOpenChange }) => {
1790
+ var _a, _b;
1791
+ const roles = useFilteredRoles();
1792
+ const hmsActions = useHMSActions7();
1793
+ const ref = useRef6(null);
1794
+ const roleRef = useRef6(null);
1795
+ const [selectedBulkRole, setBulkRole] = useState7([]);
1796
+ const [selectedRole, setRole] = useState7("");
1797
+ const [bulkRoleDialog, setBulkRoleDialog] = useState7(false);
1798
+ const [roleDialog, setRoleDialog] = useState7(false);
1799
+ const [errorMessage, setErrorMessage] = useState7("");
1800
+ const [isSubmiting, setIsSubmiting] = useState7(false);
1801
+ const changeBulkRole = useCallback4(() => __async(void 0, null, function* () {
1802
+ if (selectedBulkRole.length > 0 && selectedRole) {
1803
+ try {
1804
+ setIsSubmiting(true);
1805
+ yield hmsActions.changeRoleOfPeersWithRoles(selectedBulkRole, selectedRole);
1806
+ setIsSubmiting(false);
1807
+ setErrorMessage("");
1808
+ onOpenChange(false);
1809
+ } catch (err) {
1810
+ setErrorMessage((err == null ? void 0 : err.message) ? err == null ? void 0 : err.message : "Unknown error");
1811
+ setIsSubmiting(false);
1812
+ }
1813
+ }
1814
+ }), [selectedBulkRole, selectedRole, hmsActions, onOpenChange]);
1815
+ return /* @__PURE__ */ React16.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React16.createElement(DialogContent, { title: "Bulk Role Change", Icon: ChangeRoleIcon }, /* @__PURE__ */ React16.createElement(DialogRow, null, /* @__PURE__ */ React16.createElement(Text, null, "For Roles: "), /* @__PURE__ */ React16.createElement(
1816
+ Dropdown.Root,
1817
+ {
1818
+ open: bulkRoleDialog,
1819
+ onOpenChange: (value) => {
1820
+ if (value) {
1821
+ setBulkRoleDialog(value);
1822
+ }
1823
+ },
1824
+ modal: false
1825
+ },
1826
+ /* @__PURE__ */ React16.createElement(
1827
+ DialogDropdownTrigger,
1828
+ {
1829
+ ref,
1830
+ title: selectedBulkRole.length === 0 ? "Select Multiple Roles" : selectedBulkRole.toString(),
1831
+ css: {
1832
+ w: "70%",
1833
+ p: "$8"
1834
+ },
1835
+ open: bulkRoleDialog
1836
+ }
1837
+ ),
1838
+ /* @__PURE__ */ React16.createElement(
1839
+ Dropdown.Content,
1840
+ {
1841
+ css: { w: (_a = ref.current) == null ? void 0 : _a.clientWidth, zIndex: 1e3 },
1842
+ onInteractOutside: () => {
1843
+ if (bulkRoleDialog) {
1844
+ setBulkRoleDialog(false);
1845
+ }
1846
+ }
1847
+ },
1848
+ roles && roles.map((role) => {
1849
+ return /* @__PURE__ */ React16.createElement(
1850
+ Dropdown.CheckboxItem,
1851
+ {
1852
+ key: role,
1853
+ checked: selectedBulkRole.includes(role),
1854
+ onCheckedChange: (value) => {
1855
+ setBulkRole((selection) => {
1856
+ return value ? [...selection, role] : selection.filter((selectedRole2) => selectedRole2 !== role);
1857
+ });
1858
+ setErrorMessage("");
1859
+ }
1860
+ },
1861
+ /* @__PURE__ */ React16.createElement(Checkbox.Root, { css: { margin: "$2" }, checked: selectedBulkRole.includes(role) }, /* @__PURE__ */ React16.createElement(Checkbox.Indicator, null, /* @__PURE__ */ React16.createElement(CheckIcon, { width: 16, height: 16 }))),
1862
+ role
1863
+ );
1864
+ })
1865
+ )
1866
+ )), /* @__PURE__ */ React16.createElement(DialogRow, null, /* @__PURE__ */ React16.createElement(Text, null, "To Role: "), /* @__PURE__ */ React16.createElement(Dropdown.Root, { open: roleDialog, onOpenChange: (value) => setRoleDialog(value) }, /* @__PURE__ */ React16.createElement(
1867
+ DialogDropdownTrigger,
1868
+ {
1869
+ ref: roleRef,
1870
+ title: selectedRole || "Select Role",
1871
+ css: {
1872
+ w: "70%",
1873
+ p: "$8"
1874
+ },
1875
+ open: roleDialog
1876
+ }
1877
+ ), /* @__PURE__ */ React16.createElement(Dropdown.Content, { css: { w: (_b = roleRef.current) == null ? void 0 : _b.clientWidth, zIndex: 1e3 } }, roles && roles.map((role) => {
1878
+ return /* @__PURE__ */ React16.createElement(
1879
+ Dropdown.Item,
1880
+ {
1881
+ key: role,
1882
+ onSelect: () => {
1883
+ setRole(role);
1884
+ setErrorMessage("");
1885
+ }
1886
+ },
1887
+ role
1888
+ );
1889
+ })))), /* @__PURE__ */ React16.createElement(DialogRow, null, errorMessage && /* @__PURE__ */ React16.createElement(Flex, { gap: 2, css: { c: "$error", w: "70%", ml: "auto" } }, /* @__PURE__ */ React16.createElement(AlertTriangleIcon2, null), /* @__PURE__ */ React16.createElement(Text, { css: { c: "inherit" } }, errorMessage))), /* @__PURE__ */ React16.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React16.createElement(Button, { variant: "primary", onClick: changeBulkRole, disabled: !(selectedRole && selectedBulkRole.length > 0) }, isSubmiting && /* @__PURE__ */ React16.createElement(Loading, { css: { color: "$textSecondary" } }), "Apply"))));
1890
+ };
1891
+
1892
+ // src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx
1893
+ init_define_process_env();
1894
+ import React17, { useState as useState8 } from "react";
1895
+ import { selectLocalPeerName, useHMSActions as useHMSActions8, useHMSStore as useHMSStore13 } from "@100mslive/react-sdk";
1896
+ var ChangeNameModal = ({ onOpenChange }) => {
1897
+ const [previewPreference, setPreviewPreference] = useUserPreferences(UserPreferencesKeys.PREVIEW);
1898
+ const hmsActions = useHMSActions8();
1899
+ const localPeerName = useHMSStore13(selectLocalPeerName);
1900
+ const [currentName, setCurrentName] = useState8(localPeerName);
1901
+ const changeName = () => __async(void 0, null, function* () {
1902
+ const name = currentName.trim();
1903
+ if (!name || name === localPeerName) {
1904
+ return;
1905
+ }
1906
+ try {
1907
+ yield hmsActions.changeName(name);
1908
+ setPreviewPreference(__spreadProps(__spreadValues({}, previewPreference || {}), {
1909
+ name
1910
+ }));
1911
+ } catch (error) {
1912
+ console.error("failed to update name", error);
1913
+ ToastManager.addToast({ title: error.message });
1914
+ } finally {
1915
+ onOpenChange(false);
1916
+ }
1917
+ });
1918
+ return /* @__PURE__ */ React17.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React17.createElement(Dialog.Portal, null, /* @__PURE__ */ React17.createElement(Dialog.Overlay, null), /* @__PURE__ */ React17.createElement(Dialog.Content, { css: { width: "min(400px,80%)", p: "$10" } }, /* @__PURE__ */ React17.createElement(Dialog.Title, { css: { p: "0 $4" } }, /* @__PURE__ */ React17.createElement(Text, { variant: "h6" }, " Change Name")), /* @__PURE__ */ React17.createElement(
1919
+ "form",
1920
+ {
1921
+ onSubmit: (e) => __async(void 0, null, function* () {
1922
+ e.preventDefault();
1923
+ yield changeName();
1924
+ })
1925
+ },
1926
+ /* @__PURE__ */ React17.createElement(Flex, { justify: "center", align: "center", css: { my: "$8", w: "100%" } }, /* @__PURE__ */ React17.createElement(
1927
+ Input,
1928
+ {
1929
+ css: { width: "100%" },
1930
+ value: currentName,
1931
+ onChange: (e) => {
1932
+ setCurrentName(e.target.value);
1933
+ },
1934
+ autoComplete: "name",
1935
+ required: true,
1936
+ "data-testid": "change_name_field"
1937
+ }
1938
+ )),
1939
+ /* @__PURE__ */ React17.createElement(
1940
+ Flex,
1941
+ {
1942
+ justify: "between",
1943
+ align: "center",
1944
+ css: {
1945
+ width: "100%",
1946
+ gap: "$md",
1947
+ mt: "$10"
1948
+ }
1949
+ },
1950
+ /* @__PURE__ */ React17.createElement(Box, { css: { w: "50%" } }, /* @__PURE__ */ React17.createElement(Dialog.Close, { css: { w: "100%" } }, /* @__PURE__ */ React17.createElement(Button, { variant: "standard", css: { w: "100%" }, outlined: true, type: "submit", disabled: !localPeerName }, "Cancel"))),
1951
+ /* @__PURE__ */ React17.createElement(Box, { css: { w: "50%" } }, /* @__PURE__ */ React17.createElement(
1952
+ Button,
1953
+ {
1954
+ variant: "primary",
1955
+ css: { width: "100%" },
1956
+ type: "submit",
1957
+ disabled: !currentName.trim() || currentName.trim() === localPeerName,
1958
+ "data-testid": "popup_change_btn"
1959
+ },
1960
+ "Change"
1961
+ ))
1962
+ )
1963
+ ))));
1964
+ };
1965
+
1966
+ // src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx
1967
+ init_define_process_env();
1968
+ import React18, { useMemo as useMemo4 } from "react";
1969
+ import { useMedia as useMedia4 } from "react-use";
1970
+ import {
1971
+ selectLocalPeerID as selectLocalPeerID5,
1972
+ selectLocalPeerRoleName as selectLocalPeerRoleName4,
1973
+ selectPermissions as selectPermissions2,
1974
+ useHMSActions as useHMSActions9,
1975
+ useHMSStore as useHMSStore14
1976
+ } from "@100mslive/react-sdk";
1977
+ import { ArrowRightIcon, CheckIcon as CheckIcon2, PersonIcon } from "@100mslive/react-icons";
1978
+ var ChangeSelfRole = ({ onClick }) => {
1979
+ const roles = useFilteredRoles();
1980
+ const permissions = useHMSStore14(selectPermissions2);
1981
+ const localPeerId = useHMSStore14(selectLocalPeerID5);
1982
+ const localPeerRole = useHMSStore14(selectLocalPeerRoleName4);
1983
+ const hmsActions = useHMSActions9();
1984
+ const hideTriggerItem = useMedia4(config.media.sm);
1985
+ const selfRoleChangeTo = useAppLayout("selfRoleChangeTo");
1986
+ const availableSelfChangeRoles = useMemo4(() => arrayIntersection(selfRoleChangeTo, roles), [roles, selfRoleChangeTo]);
1987
+ if (!permissions.changeRole) {
1988
+ return null;
1989
+ }
1990
+ return hideTriggerItem ? /* @__PURE__ */ React18.createElement(Dropdown.Item, { onClick }, /* @__PURE__ */ React18.createElement(PersonIcon, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { mx: "$4" } }, "Change My Role")) : /* @__PURE__ */ React18.createElement(Dropdown.SubMenu, null, /* @__PURE__ */ React18.createElement(Dropdown.TriggerItem, { "data-testid": "change_my_role_btn" }, /* @__PURE__ */ React18.createElement(PersonIcon, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { flex: "1 1 0", mx: "$4" } }, "Change My Role"), /* @__PURE__ */ React18.createElement(ArrowRightIcon, null)), /* @__PURE__ */ React18.createElement(Dropdown.SubMenuContent, { sideOffset: 8, alignOffset: -5, css: { "@md": { w: "$64" } } }, availableSelfChangeRoles.map((role) => /* @__PURE__ */ React18.createElement(
1991
+ Dropdown.Item,
1992
+ {
1993
+ key: role,
1994
+ css: { justifyContent: "space-between" },
1995
+ onClick: () => __async(void 0, null, function* () {
1996
+ try {
1997
+ yield hmsActions.changeRole(localPeerId, role, true);
1998
+ } catch (error) {
1999
+ ToastManager.addToast({ title: error.message });
2000
+ }
2001
+ }),
2002
+ "data-testid": "change_to_role_" + role
2003
+ },
2004
+ /* @__PURE__ */ React18.createElement(Text, { variant: "sm" }, role),
2005
+ localPeerRole === role && /* @__PURE__ */ React18.createElement(CheckIcon2, { width: 16, height: 16 })
2006
+ ))));
2007
+ };
2008
+
2009
+ // src/Prebuilt/components/MoreSettings/EmbedUrl.jsx
2010
+ init_define_process_env();
2011
+ import React19, { useState as useState9 } from "react";
2012
+ import { ViewIcon } from "@100mslive/react-icons";
2013
+ var EmbedUrl = ({ setShowOpenUrl }) => {
2014
+ if (!window.CropTarget) {
2015
+ return null;
2016
+ }
2017
+ return /* @__PURE__ */ React19.createElement(
2018
+ Dropdown.Item,
2019
+ {
2020
+ onClick: () => {
2021
+ setShowOpenUrl(true);
2022
+ },
2023
+ "data-testid": "embed_url_btn"
2024
+ },
2025
+ /* @__PURE__ */ React19.createElement(ViewIcon, null),
2026
+ /* @__PURE__ */ React19.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Embed URL")
2027
+ );
2028
+ };
2029
+ function EmbedUrlModal({ onOpenChange }) {
2030
+ const [embedConfig, setEmbedConfig] = useSetAppDataByKey(APP_DATA.embedConfig);
2031
+ const [url, setUrl] = useState9((embedConfig == null ? void 0 : embedConfig.url) || "");
2032
+ const isAnythingEmbedded = !!(embedConfig == null ? void 0 : embedConfig.url);
2033
+ const isModifying = isAnythingEmbedded && url && url !== embedConfig.url;
2034
+ return /* @__PURE__ */ React19.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React19.createElement(DialogContent, { title: "Embed URL", Icon: ViewIcon }, /* @__PURE__ */ React19.createElement(DialogInput, { title: "URL", value: url, onChange: setUrl, placeholder: "https://www.tldraw.com/", type: "url" }), /* @__PURE__ */ React19.createElement(DialogRow, null, /* @__PURE__ */ React19.createElement(Text, null, "Embed a url and share with everyone in the room. Ensure that you're sharing the current tab when the prompt opens. Note that not all websites support being embedded.")), /* @__PURE__ */ React19.createElement(DialogRow, { justify: "end" }, isAnythingEmbedded ? /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
2035
+ Button,
2036
+ {
2037
+ variant: "primary",
2038
+ type: "submit",
2039
+ disabled: !isModifying,
2040
+ onClick: () => {
2041
+ setEmbedConfig({ url, shareScreen: embedConfig.shareScreen });
2042
+ onOpenChange(false);
2043
+ },
2044
+ "data-testid": "embed_url_btn",
2045
+ css: { mr: "$4" }
2046
+ },
2047
+ "Update Embed"
2048
+ ), /* @__PURE__ */ React19.createElement(
2049
+ Button,
2050
+ {
2051
+ variant: "danger",
2052
+ type: "submit",
2053
+ onClick: () => {
2054
+ setEmbedConfig({ url: "" });
2055
+ onOpenChange(false);
2056
+ },
2057
+ "data-testid": "embed_url_btn"
2058
+ },
2059
+ "Stop Embed"
2060
+ )) : /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
2061
+ Button,
2062
+ {
2063
+ variant: "primary",
2064
+ type: "submit",
2065
+ disabled: !url.trim(),
2066
+ onClick: () => {
2067
+ setEmbedConfig({ url });
2068
+ onOpenChange(false);
2069
+ },
2070
+ "data-testid": "embed_url_btn",
2071
+ css: { mr: "$4" }
2072
+ },
2073
+ "Just Embed"
2074
+ ), /* @__PURE__ */ React19.createElement(
2075
+ Button,
2076
+ {
2077
+ variant: "primary",
2078
+ type: "submit",
2079
+ disabled: !url.trim(),
2080
+ onClick: () => {
2081
+ setEmbedConfig({ url, shareScreen: true });
2082
+ onOpenChange(false);
2083
+ },
2084
+ "data-testid": "embed_url_btn"
2085
+ },
2086
+ "Embed and Share"
2087
+ )))));
2088
+ }
2089
+
2090
+ // src/Prebuilt/components/MoreSettings/FullScreenItem.jsx
2091
+ init_define_process_env();
2092
+ import React20 from "react";
2093
+ import { ExpandIcon as ExpandIcon2 } from "@100mslive/react-icons";
2094
+
2095
+ // src/Prebuilt/components/hooks/useFullscreen.js
2096
+ init_define_process_env();
2097
+ import { useCallback as useCallback5, useEffect as useEffect7, useState as useState10 } from "react";
2098
+ import screenfull2 from "screenfull";
2099
+ var useFullscreen2 = () => {
2100
+ const [isFullScreenEnabled, setIsFullScreenEnabled] = useState10(screenfull2.isFullscreen);
2101
+ const toggle = useCallback5(() => __async(void 0, null, function* () {
2102
+ if (!screenfull2.isEnabled) {
2103
+ ToastManager.addToast({ title: "Fullscreen feature not supported" });
2104
+ return;
2105
+ }
2106
+ try {
2107
+ if (isFullScreenEnabled) {
2108
+ yield screenfull2.exit();
2109
+ } else {
2110
+ yield screenfull2.request();
2111
+ }
2112
+ } catch (err) {
2113
+ ToastManager.addToast({ title: err.message });
2114
+ }
2115
+ }), [isFullScreenEnabled]);
2116
+ useEffect7(() => {
2117
+ const onChange = () => {
2118
+ setIsFullScreenEnabled(screenfull2.isFullscreen);
2119
+ };
2120
+ if (screenfull2.isEnabled) {
2121
+ screenfull2.on("change", onChange);
2122
+ }
2123
+ return () => {
2124
+ if (screenfull2.isEnabled) {
2125
+ screenfull2.off("change", onChange);
2126
+ }
2127
+ };
2128
+ }, []);
2129
+ return {
2130
+ allowed: screenfull2.isEnabled,
2131
+ isFullscreen: isFullScreenEnabled,
2132
+ toggleFullscreen: toggle
2133
+ };
2134
+ };
2135
+
2136
+ // src/Prebuilt/components/MoreSettings/FullScreenItem.jsx
2137
+ var FullScreenItem = () => {
2138
+ const { allowed, isFullscreen, toggleFullscreen } = useFullscreen2();
2139
+ const isFullscreenEnabled = useIsFeatureEnabled(FEATURE_LIST.FULLSCREEN);
2140
+ if (!isFullscreenEnabled || !allowed) {
2141
+ return null;
2142
+ }
2143
+ return /* @__PURE__ */ React20.createElement(
2144
+ Dropdown.Item,
2145
+ {
2146
+ onClick: () => {
2147
+ toggleFullscreen();
2148
+ },
2149
+ "data-testid": "full_screen_btn"
2150
+ },
2151
+ /* @__PURE__ */ React20.createElement(ExpandIcon2, null),
2152
+ /* @__PURE__ */ React20.createElement(Text, { variant: "sm", css: { ml: "$4" } }, isFullscreen ? "Exit " : "Go ", "Fullscreen")
2153
+ );
2154
+ };
2155
+
2156
+ // src/Prebuilt/components/MoreSettings/MuteAllModal.jsx
2157
+ init_define_process_env();
2158
+ import React21, { useCallback as useCallback6, useState as useState11 } from "react";
2159
+ import { useHMSActions as useHMSActions10 } from "@100mslive/react-sdk";
2160
+ import { MicOffIcon } from "@100mslive/react-icons";
2161
+ var trackSourceOptions = [
2162
+ { label: "All Track Sources", value: "" },
2163
+ { label: "regular", value: "regular" },
2164
+ { label: "screen", value: "screen" },
2165
+ { label: "audioplaylist", value: "audioplaylist" },
2166
+ { label: "videoplaylist", value: "videoplaylist" }
2167
+ ];
2168
+ var trackTypeOptions = [
2169
+ { label: "All Track Types", value: "" },
2170
+ { label: "audio", value: "audio" },
2171
+ { label: "video", value: "video" }
2172
+ ];
2173
+ var MuteAllModal = ({ onOpenChange }) => {
2174
+ const roles = useFilteredRoles();
2175
+ const hmsActions = useHMSActions10();
2176
+ const [enabled, setEnabled] = useState11(false);
2177
+ const [trackType, setTrackType] = useState11();
2178
+ const [selectedRole, setRole] = useState11();
2179
+ const [selectedSource, setSource] = useState11();
2180
+ const muteAll = useCallback6(() => __async(void 0, null, function* () {
2181
+ yield hmsActions.setRemoteTracksEnabled({
2182
+ enabled,
2183
+ type: trackType,
2184
+ source: selectedSource,
2185
+ roles: selectedRole ? [selectedRole] : void 0
2186
+ });
2187
+ onOpenChange(false);
2188
+ }), [selectedRole, enabled, trackType, selectedSource, hmsActions, onOpenChange]);
2189
+ return /* @__PURE__ */ React21.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React21.createElement(DialogContent, { title: "Mute/Unmute Remote Tracks", Icon: MicOffIcon }, /* @__PURE__ */ React21.createElement(
2190
+ DialogSelect,
2191
+ {
2192
+ title: "Role",
2193
+ options: [{ label: "All Roles", value: "" }, ...roles.map((role) => ({ label: role, value: role }))],
2194
+ selected: selectedRole,
2195
+ keyField: "value",
2196
+ labelField: "label",
2197
+ onChange: setRole
2198
+ }
2199
+ ), /* @__PURE__ */ React21.createElement(
2200
+ DialogSelect,
2201
+ {
2202
+ title: "Track type",
2203
+ options: trackTypeOptions,
2204
+ selected: trackType,
2205
+ onChange: setTrackType,
2206
+ keyField: "value",
2207
+ labelField: "label"
2208
+ }
2209
+ ), /* @__PURE__ */ React21.createElement(
2210
+ DialogSelect,
2211
+ {
2212
+ title: "Track source",
2213
+ options: trackSourceOptions,
2214
+ selected: selectedSource,
2215
+ onChange: setSource,
2216
+ keyField: "value",
2217
+ labelField: "label"
2218
+ }
2219
+ ), /* @__PURE__ */ React21.createElement(DialogRow, null, /* @__PURE__ */ React21.createElement(Text, { variant: "md" }, "Track status"), /* @__PURE__ */ React21.createElement(RadioGroup.Root, { value: enabled, onValueChange: setEnabled }, /* @__PURE__ */ React21.createElement(Flex, { align: "center", css: { mr: "$8" } }, /* @__PURE__ */ React21.createElement(RadioGroup.Item, { value: false, id: "trackDisableRadio", css: { mr: "$4" } }, /* @__PURE__ */ React21.createElement(RadioGroup.Indicator, null)), /* @__PURE__ */ React21.createElement(Label, { htmlFor: "trackDisableRadio" }, "Mute")), /* @__PURE__ */ React21.createElement(Flex, { align: "center", css: { cursor: "pointer" } }, /* @__PURE__ */ React21.createElement(RadioGroup.Item, { value: true, id: "trackEnableRadio", css: { mr: "$4" } }, /* @__PURE__ */ React21.createElement(RadioGroup.Indicator, null)), /* @__PURE__ */ React21.createElement(Label, { htmlFor: "trackEnableRadio" }, "Request Unmute")))), /* @__PURE__ */ React21.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React21.createElement(Button, { variant: "primary", onClick: muteAll }, "Apply"))));
2220
+ };
2221
+
2222
+ // src/Prebuilt/components/MoreSettings/MoreSettings.jsx
2223
+ var isMobileOS = isAndroid || isIOS;
2224
+ var MODALS = {
2225
+ CHANGE_NAME: "changeName",
2226
+ SELF_ROLE_CHANGE: "selfRoleChange",
2227
+ MORE_SETTINGS: "moreSettings",
2228
+ START_RECORDING: "startRecording",
2229
+ DEVICE_SETTINGS: "deviceSettings",
2230
+ STATS_FOR_NERDS: "statsForNerds",
2231
+ BULK_ROLE_CHANGE: "bulkRoleChange",
2232
+ MUTE_ALL: "muteAll",
2233
+ EMBED_URL: "embedUrl"
2234
+ };
2235
+ var MoreSettings = () => {
2236
+ const permissions = useHMSStore15(selectPermissions3);
2237
+ const isAllowedToPublish = useHMSStore15(selectIsAllowedToPublish2);
2238
+ const localPeerId = useHMSStore15(selectLocalPeerID6);
2239
+ const localPeerRole = useHMSStore15(selectLocalPeerRoleName5);
2240
+ const hmsActions = useHMSActions11();
2241
+ const enablHlsStats = useHMSStore15(selectAppData3(APP_DATA.hlsStats));
2242
+ const isMobile = useMedia5(config.media.md);
2243
+ const { isBrowserRecordingOn } = useRecordingStreaming2();
2244
+ const isChangeNameEnabled = useIsFeatureEnabled(FEATURE_LIST.CHANGE_NAME);
2245
+ const isEmbedEnabled = useIsFeatureEnabled(FEATURE_LIST.EMBED_URL);
2246
+ const isSFNEnabled = useIsFeatureEnabled(FEATURE_LIST.STARTS_FOR_NERDS);
2247
+ const [openModals, setOpenModals] = useState12(/* @__PURE__ */ new Set());
2248
+ useDropdownList({ open: openModals.size > 0, name: "MoreSettings" });
2249
+ const updateState = (modalName, value) => {
2250
+ setOpenModals((modals) => {
2251
+ const copy = new Set(modals);
2252
+ if (value) {
2253
+ copy.add(modalName);
2254
+ } else {
2255
+ copy.delete(modalName);
2256
+ }
2257
+ return copy;
2258
+ });
2259
+ };
2260
+ return /* @__PURE__ */ React22.createElement(Fragment4, null, /* @__PURE__ */ React22.createElement(
2261
+ Dropdown.Root,
2262
+ {
2263
+ open: openModals.has(MODALS.MORE_SETTINGS),
2264
+ onOpenChange: (value) => updateState(MODALS.MORE_SETTINGS, value)
2265
+ },
2266
+ /* @__PURE__ */ React22.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "more_settings_btn" }, /* @__PURE__ */ React22.createElement(IconButton_default, null, /* @__PURE__ */ React22.createElement(Tooltip, { title: "More options" }, /* @__PURE__ */ React22.createElement(Box, null, /* @__PURE__ */ React22.createElement(VerticalMenuIcon, null))))),
2267
+ /* @__PURE__ */ React22.createElement(
2268
+ Dropdown.Content,
2269
+ {
2270
+ sideOffset: 5,
2271
+ align: "center",
2272
+ css: {
2273
+ maxHeight: "$96",
2274
+ "@md": { w: "$64" },
2275
+ "div[role='separator']:first-child": {
2276
+ display: "none"
2277
+ }
2278
+ }
2279
+ },
2280
+ isMobile && (permissions == null ? void 0 : permissions.browserRecording) ? /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(Dropdown.Item, { onClick: () => updateState(MODALS.START_RECORDING, true) }, /* @__PURE__ */ React22.createElement(RecordIcon, null), /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, isBrowserRecordingOn ? "Stop" : "Start", " Recording")), /* @__PURE__ */ React22.createElement(Dropdown.ItemSeparator, null)) : null,
2281
+ isChangeNameEnabled && /* @__PURE__ */ React22.createElement(Dropdown.Item, { onClick: () => updateState(MODALS.CHANGE_NAME, true), "data-testid": "change_name_btn" }, /* @__PURE__ */ React22.createElement(PencilIcon, null), /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Change Name")),
2282
+ /* @__PURE__ */ React22.createElement(ChangeSelfRole, { onClick: () => updateState(MODALS.SELF_ROLE_CHANGE, true) }),
2283
+ (permissions == null ? void 0 : permissions.changeRole) && /* @__PURE__ */ React22.createElement(
2284
+ Dropdown.Item,
2285
+ {
2286
+ onClick: () => updateState(MODALS.BULK_ROLE_CHANGE, true),
2287
+ "data-testid": "bulk_role_change_btn"
2288
+ },
2289
+ /* @__PURE__ */ React22.createElement(ChangeRoleIcon2, null),
2290
+ /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Bulk Role Change")
2291
+ ),
2292
+ /* @__PURE__ */ React22.createElement(FullScreenItem, null),
2293
+ isAllowedToPublish.screen && isEmbedEnabled && /* @__PURE__ */ React22.createElement(EmbedUrl, { setShowOpenUrl: () => updateState(MODALS.EMBED_URL, true) }),
2294
+ permissions.mute && /* @__PURE__ */ React22.createElement(Dropdown.Item, { onClick: () => updateState(MODALS.MUTE_ALL, true), "data-testid": "mute_all_btn" }, /* @__PURE__ */ React22.createElement(MicOffIcon2, null), /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Mute All")),
2295
+ /* @__PURE__ */ React22.createElement(Dropdown.ItemSeparator, null),
2296
+ /* @__PURE__ */ React22.createElement(Dropdown.Item, { onClick: () => updateState(MODALS.DEVICE_SETTINGS, true), "data-testid": "device_settings_btn" }, /* @__PURE__ */ React22.createElement(SettingsIcon, null), /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Settings")),
2297
+ FeatureFlags.enableStatsForNerds && isSFNEnabled && (localPeerRole === "hls-viewer" ? Hls.isSupported() ? /* @__PURE__ */ React22.createElement(
2298
+ Dropdown.Item,
2299
+ {
2300
+ onClick: () => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats),
2301
+ "data-testid": "hls_stats"
2302
+ },
2303
+ /* @__PURE__ */ React22.createElement(
2304
+ Checkbox.Root,
2305
+ {
2306
+ css: { margin: "$2" },
2307
+ checked: enablHlsStats,
2308
+ onCheckedChange: () => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats)
2309
+ },
2310
+ /* @__PURE__ */ React22.createElement(Checkbox.Indicator, null, /* @__PURE__ */ React22.createElement(CheckIcon3, { width: 16, height: 16 }))
2311
+ ),
2312
+ /* @__PURE__ */ React22.createElement(Flex, { justify: "between", css: { width: "100%" } }, /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Show HLS Stats"), !isMobileOS ? /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, `${isMacOS ? "\u2318" : "ctrl"} + ]`) : null)
2313
+ ) : null : /* @__PURE__ */ React22.createElement(
2314
+ Dropdown.Item,
2315
+ {
2316
+ onClick: () => updateState(MODALS.STATS_FOR_NERDS, true),
2317
+ "data-testid": "stats_for_nreds_btn"
2318
+ },
2319
+ /* @__PURE__ */ React22.createElement(InfoIcon, null),
2320
+ /* @__PURE__ */ React22.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Stats for Nerds")
2321
+ ))
2322
+ )
2323
+ ), openModals.has(MODALS.BULK_ROLE_CHANGE) && /* @__PURE__ */ React22.createElement(BulkRoleChangeModal, { onOpenChange: (value) => updateState(MODALS.BULK_ROLE_CHANGE, value) }), openModals.has(MODALS.MUTE_ALL) && /* @__PURE__ */ React22.createElement(MuteAllModal, { onOpenChange: (value) => updateState(MODALS.MUTE_ALL, value) }), openModals.has(MODALS.CHANGE_NAME) && /* @__PURE__ */ React22.createElement(ChangeNameModal, { onOpenChange: (value) => updateState(MODALS.CHANGE_NAME, value) }), openModals.has(MODALS.DEVICE_SETTINGS) && /* @__PURE__ */ React22.createElement(SettingsModal_default, { open: true, onOpenChange: (value) => updateState(MODALS.DEVICE_SETTINGS, value) }), FeatureFlags.enableStatsForNerds && openModals.has(MODALS.STATS_FOR_NERDS) && /* @__PURE__ */ React22.createElement(StatsForNerds, { open: true, onOpenChange: (value) => updateState(MODALS.STATS_FOR_NERDS, value) }), openModals.has(MODALS.SELF_ROLE_CHANGE) && /* @__PURE__ */ React22.createElement(RoleChangeModal, { peerId: localPeerId, onOpenChange: (value) => updateState(MODALS.SELF_ROLE_CHANGE, value) }), openModals.has(MODALS.START_RECORDING) && /* @__PURE__ */ React22.createElement(StartRecording_default, { open: true, onOpenChange: (value) => updateState(MODALS.START_RECORDING, value) }), openModals.has(MODALS.EMBED_URL) && /* @__PURE__ */ React22.createElement(EmbedUrlModal, { onOpenChange: (value) => updateState(MODALS.EMBED_URL, value) }));
2324
+ };
2325
+
2326
+ // src/Prebuilt/components/PIP/index.jsx
2327
+ init_define_process_env();
2328
+ import React24 from "react";
2329
+
2330
+ // src/Prebuilt/components/PIP/PIPComponent.jsx
2331
+ init_define_process_env();
2332
+ import React23, { useCallback as useCallback7, useEffect as useEffect8, useState as useState13 } from "react";
2333
+ import {
2334
+ selectLocalPeerRoleName as selectLocalPeerRoleName6,
2335
+ selectPeers as selectPeers4,
2336
+ selectRemotePeers as selectRemotePeers2,
2337
+ selectTracksMap as selectTracksMap2,
2338
+ useHMSActions as useHMSActions12,
2339
+ useHMSStore as useHMSStore16,
2340
+ useHMSVanillaStore
2341
+ } from "@100mslive/react-sdk";
2342
+ import { PipIcon } from "@100mslive/react-icons";
2343
+
2344
+ // src/Prebuilt/components/PIP/PIPManager.js
2345
+ init_define_process_env();
2346
+ import * as workerTimers from "worker-timers";
2347
+
2348
+ // src/Prebuilt/components/PIP/pipUtils.js
2349
+ init_define_process_env();
2350
+ var CANVAS_FILL_COLOR;
2351
+ var CANVAS_STROKE_COLOR;
2352
+ function setPIPCanvasColors() {
2353
+ if (!CANVAS_FILL_COLOR) {
2354
+ CANVAS_FILL_COLOR = window.getComputedStyle(document.documentElement).getPropertyValue("--hms-ui-colors-surfaceLight");
2355
+ }
2356
+ if (!CANVAS_STROKE_COLOR) {
2357
+ CANVAS_STROKE_COLOR = window.getComputedStyle(document.documentElement).getPropertyValue("--hms-ui-colors-borderLight");
2358
+ }
2359
+ }
2360
+ function resetPIPCanvasColors() {
2361
+ CANVAS_FILL_COLOR = "";
2362
+ CANVAS_STROKE_COLOR = "";
2363
+ }
2364
+ function drawVideoElementsOnCanvas(videoElements, canvas) {
2365
+ let videoTiles = videoElements.filter((videoElement) => videoElement.srcObject !== null);
2366
+ const ctx = canvas.getContext("2d");
2367
+ setPIPCanvasColors();
2368
+ ctx.fillStyle = CANVAS_FILL_COLOR;
2369
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
2370
+ if (videoTiles.length === 0) {
2371
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2372
+ return;
2373
+ }
2374
+ fillGridTiles(videoTiles.slice(0, 4), ctx, canvas);
2375
+ }
2376
+ function dummyChangeInCanvas(canvas) {
2377
+ const ctx = canvas.getContext("2d");
2378
+ setPIPCanvasColors();
2379
+ ctx.fillStyle = CANVAS_FILL_COLOR;
2380
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2381
+ }
2382
+ function fillGridTiles(videoElements, ctx, canvas) {
2383
+ const offset = 8;
2384
+ canvas.width = 480;
2385
+ canvas.height = 320;
2386
+ ctx.fillStyle = CANVAS_FILL_COLOR;
2387
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2388
+ if (videoElements.length > 0) {
2389
+ ctx.strokeStyle = CANVAS_STROKE_COLOR;
2390
+ ctx.lineWidth = offset / 2;
2391
+ ctx.strokeRect(0, 0, canvas.width, canvas.height);
2392
+ }
2393
+ if (videoElements.length === 1) {
2394
+ const video = videoElements[0];
2395
+ const { width, height } = getRenderDimensions(video, canvas.width - offset, canvas.height - offset);
2396
+ const xOffset = (canvas.width - width) / 2;
2397
+ const yOffset = (canvas.height - height) / 2;
2398
+ ctx.drawImage(video, xOffset, yOffset, width, height);
2399
+ }
2400
+ if (videoElements.length === 2) {
2401
+ videoElements.forEach((video, index) => {
2402
+ const { width, height } = getRenderDimensions(
2403
+ video,
2404
+ canvas.width / 2 - offset,
2405
+ // This will be the max available width for each tile
2406
+ canvas.height - offset
2407
+ );
2408
+ const xOffset = (canvas.width / 2 - width) / 2 + canvas.width / 2 * index;
2409
+ const yOffset = (canvas.height - height) / 2;
2410
+ ctx.drawImage(video, xOffset, yOffset, width, height);
2411
+ });
2412
+ const path = new Path2D();
2413
+ path.moveTo(canvas.width / 2, 0);
2414
+ path.lineTo(canvas.width / 2, canvas.height);
2415
+ ctx.stroke(path);
2416
+ }
2417
+ if (videoElements.length === 3) {
2418
+ videoElements.forEach((video, index) => {
2419
+ const { width, height } = getRenderDimensions(video, canvas.width / 2 - offset, canvas.height / 2 - offset);
2420
+ const xOffset = index < 2 ? (canvas.width / 2 - width) / 2 + canvas.width / 2 * index : canvas.width / 2 - width / 2;
2421
+ const yOffset = (index < 2 ? 0 : canvas.height / 2) + (canvas.height / 2 - height) / 2;
2422
+ ctx.drawImage(video, xOffset, yOffset, width, height);
2423
+ });
2424
+ const path = new Path2D();
2425
+ path.moveTo(canvas.width / 2, 0);
2426
+ path.lineTo(canvas.width / 2, canvas.height / 2);
2427
+ ctx.stroke(path);
2428
+ path.moveTo(0, canvas.height / 2);
2429
+ path.lineTo(canvas.width, canvas.height / 2);
2430
+ ctx.stroke(path);
2431
+ }
2432
+ if (videoElements.length === 4) {
2433
+ videoElements.forEach((video, index) => {
2434
+ const { width, height } = getRenderDimensions(video, canvas.width / 2 - offset, canvas.height / 2 - offset);
2435
+ const xOffset = (canvas.width / 2 - width) / 2 + canvas.width / 2 * (index % 2);
2436
+ const yOffset = (index < 2 ? 0 : canvas.height / 2) + (canvas.height / 2 - height) / 2;
2437
+ ctx.drawImage(video, xOffset, yOffset, width, height);
2438
+ });
2439
+ const path = new Path2D();
2440
+ path.moveTo(canvas.width / 2, 0);
2441
+ path.lineTo(canvas.width / 2, canvas.height);
2442
+ ctx.stroke(path);
2443
+ path.moveTo(0, canvas.height / 2);
2444
+ path.lineTo(canvas.width, canvas.height / 2);
2445
+ ctx.stroke(path);
2446
+ }
2447
+ }
2448
+ function getRenderDimensions(video, width, height) {
2449
+ let finalWidth = video.videoWidth / video.videoHeight * height;
2450
+ let finalHeight = height;
2451
+ if (finalWidth > width) {
2452
+ finalWidth = width;
2453
+ finalHeight = video.videoHeight / video.videoWidth * width;
2454
+ }
2455
+ return { width: finalWidth, height: finalHeight };
2456
+ }
2457
+
2458
+ // src/Prebuilt/components/PIP/PIPManager.js
2459
+ var MAX_NUMBER_OF_TILES_IN_PIP = 4;
2460
+ var DEFAULT_FPS = 30;
2461
+ var DEFAULT_CANVAS_WIDTH = 480;
2462
+ var DEFAULT_CANVAS_HEIGHT = 320;
2463
+ var LEAVE_EVENT_NAME = "leavepictureinpicture";
2464
+ var PIPStates = {
2465
+ starting: "starting",
2466
+ started: "started",
2467
+ stopping: "stopping",
2468
+ stopped: "stopped"
2469
+ };
2470
+ var PipManager = class {
2471
+ constructor() {
2472
+ __publicField(this, "stop", () => __async(this, null, function* () {
2473
+ var _a;
2474
+ if (this.state === PIPStates.stopped) {
2475
+ return;
2476
+ }
2477
+ this.state = PIPStates.stopping;
2478
+ (_a = this.pipVideo) == null ? void 0 : _a.removeEventListener(LEAVE_EVENT_NAME, this.stop);
2479
+ if (this.timeoutRef) {
2480
+ workerTimers.clearTimeout(this.timeoutRef);
2481
+ }
2482
+ if (this.isOn()) {
2483
+ this.exitPIP();
2484
+ }
2485
+ yield this.detachOldAttachNewTracks(this.tracksToShow, []);
2486
+ this.onStateChange(false);
2487
+ this.reset();
2488
+ this.state = PIPStates.stopped;
2489
+ }));
2490
+ this.reset();
2491
+ }
2492
+ /**
2493
+ * @private
2494
+ */
2495
+ reset() {
2496
+ console.debug("resetting PIP state");
2497
+ resetPIPCanvasColors();
2498
+ this.canvas = null;
2499
+ this.pipVideo = null;
2500
+ this.timeoutRef = null;
2501
+ this.hmsActions = null;
2502
+ this.videoElements = [];
2503
+ this.tracksToShow = [];
2504
+ this.onStateChange = () => {
2505
+ };
2506
+ this.state = PIPStates.stopped;
2507
+ }
2508
+ /**
2509
+ * check if PIP is supported in this browser env
2510
+ */
2511
+ isSupported() {
2512
+ return !!document.pictureInPictureEnabled && !isIOS && !(isMacOS && isSafari);
2513
+ }
2514
+ /**
2515
+ * check if pip is currently turned on
2516
+ */
2517
+ isOn() {
2518
+ return !!document.pictureInPictureElement;
2519
+ }
2520
+ /**
2521
+ * request browser to start pip and start the render loop updating the pip
2522
+ * video element with peer tracks.
2523
+ * @param hmsActions
2524
+ * @param onStateChangeFn {function(bool):void} callback called to notify change in pip state
2525
+ */
2526
+ start(hmsActions, onStateChangeFn) {
2527
+ return __async(this, null, function* () {
2528
+ if (!this.isSupported()) {
2529
+ throw new Error("pip is not supported on this browser");
2530
+ }
2531
+ console.debug("starting PIP, current state", this.state);
2532
+ if (this.state === PIPStates.started) {
2533
+ yield this.stop();
2534
+ } else if (this.state === PIPStates.starting) {
2535
+ return;
2536
+ }
2537
+ this.state = PIPStates.starting;
2538
+ try {
2539
+ yield this.init(hmsActions, onStateChangeFn);
2540
+ this.pipVideo.addEventListener(LEAVE_EVENT_NAME, this.stop);
2541
+ this.renderLoop();
2542
+ if (!this.isOn()) {
2543
+ yield this.requestPIP();
2544
+ }
2545
+ console.debug("pip started");
2546
+ this.state = PIPStates.started;
2547
+ this.onStateChange(true);
2548
+ } catch (err) {
2549
+ console.error("error in request pip", err);
2550
+ this.state = PIPStates.stopped;
2551
+ }
2552
+ });
2553
+ }
2554
+ /**
2555
+ * @param peers {Array} All Remote Peers present in call.
2556
+ * @param tracksMap {Object} map of track id to track
2557
+ * */
2558
+ updatePeersAndTracks(peers, tracksMap) {
2559
+ return __async(this, null, function* () {
2560
+ if (!this.canvas) {
2561
+ return;
2562
+ }
2563
+ const newTracksToShowUnordered = this.pickTracksToShow(peers, tracksMap);
2564
+ const currentTracksShowing = this.tracksToShow;
2565
+ this.tracksToShow = this.orderNewTracksToShow(newTracksToShowUnordered, currentTracksShowing);
2566
+ try {
2567
+ yield this.detachOldAttachNewTracks(currentTracksShowing, this.tracksToShow, tracksMap);
2568
+ } catch (error) {
2569
+ console.error("error in detaching/attaching tracks", error);
2570
+ }
2571
+ });
2572
+ }
2573
+ // ------- Private function --------------
2574
+ /**
2575
+ * @private
2576
+ */
2577
+ init(hmsActions, onStateChangeFn) {
2578
+ return __async(this, null, function* () {
2579
+ yield this.initMediaElements();
2580
+ this.hmsActions = hmsActions;
2581
+ this.onStateChange = onStateChangeFn;
2582
+ });
2583
+ }
2584
+ initMediaElements() {
2585
+ return __async(this, null, function* () {
2586
+ if (!this.canvas) {
2587
+ const { canvas, pipVideo } = this.initializeCanvasAndVideoElement();
2588
+ this.canvas = canvas;
2589
+ this.pipVideo = pipVideo;
2590
+ this.videoElements = this.initializeVideoElements();
2591
+ const videoPlayPromise = this.pipVideo.play();
2592
+ dummyChangeInCanvas(this.canvas);
2593
+ yield videoPlayPromise;
2594
+ }
2595
+ });
2596
+ }
2597
+ initializeCanvasAndVideoElement() {
2598
+ const canvas = document.createElement("canvas");
2599
+ canvas.width = DEFAULT_CANVAS_WIDTH;
2600
+ canvas.height = DEFAULT_CANVAS_HEIGHT;
2601
+ const pipVideo = document.createElement("video");
2602
+ pipVideo.width = DEFAULT_CANVAS_WIDTH;
2603
+ pipVideo.height = DEFAULT_CANVAS_HEIGHT;
2604
+ pipVideo.muted = true;
2605
+ pipVideo.srcObject = canvas.captureStream();
2606
+ return { canvas, pipVideo };
2607
+ }
2608
+ initializeVideoElements() {
2609
+ let videoElements = [];
2610
+ for (let i = 0; i < MAX_NUMBER_OF_TILES_IN_PIP; i++) {
2611
+ const videoElement = document.createElement("video");
2612
+ videoElement.autoplay = true;
2613
+ videoElement.playsinline = true;
2614
+ videoElements.push(videoElement);
2615
+ }
2616
+ return videoElements;
2617
+ }
2618
+ /**
2619
+ * render loop is responsible for rendering the video elements on canvas/pip.
2620
+ * in each loop current video elements are stitched and painted on canvas
2621
+ */
2622
+ renderLoop() {
2623
+ const delay = 1e3 / DEFAULT_FPS;
2624
+ this.timeoutRef = workerTimers.setTimeout(() => {
2625
+ if (this.state === PIPStates.stopping || this.state === PIPStates.stopped) {
2626
+ return;
2627
+ }
2628
+ if (this.state === PIPStates.started) {
2629
+ drawVideoElementsOnCanvas(this.videoElements, this.canvas);
2630
+ }
2631
+ this.renderLoop();
2632
+ }, delay);
2633
+ }
2634
+ requestPIP() {
2635
+ return __async(this, null, function* () {
2636
+ try {
2637
+ if (this.isOn()) {
2638
+ this.exitPIP();
2639
+ }
2640
+ yield this.pipVideo.requestPictureInPicture();
2641
+ } catch (error) {
2642
+ console.error("error in requestpip", error, "state", this.state);
2643
+ throw error;
2644
+ }
2645
+ });
2646
+ }
2647
+ exitPIP() {
2648
+ document.exitPictureInPicture();
2649
+ }
2650
+ /**
2651
+ * Logic - pick only enabled video tracks
2652
+ * @param peers {Array<any>}
2653
+ * @param tracksMap {Record<string, any>}
2654
+ */
2655
+ pickTracksToShow(peers, tracksMap) {
2656
+ var _a;
2657
+ const tracksToShow = [];
2658
+ for (const peer of peers) {
2659
+ if (tracksToShow.length === MAX_NUMBER_OF_TILES_IN_PIP) {
2660
+ break;
2661
+ } else if (peer.videoTrack && ((_a = tracksMap[peer.videoTrack]) == null ? void 0 : _a.enabled)) {
2662
+ tracksToShow.push(peer.videoTrack);
2663
+ }
2664
+ }
2665
+ return tracksToShow;
2666
+ }
2667
+ /**
2668
+ * there has to be a smart reordering of new tracks based on currently showing
2669
+ * ones to reduce unnecessary displacement. If someone was showing up both
2670
+ * earlier and now, it's a better UX to keep their position same instead
2671
+ * of letting it change.
2672
+ * The returned array is a shuffled version of newTracks with position of
2673
+ * tracks present in the old tracks intact.
2674
+ * eg. old = [1,5,9,3], new = [3,8,2,9], result = [8,2,9,3]
2675
+ * @param oldTracks {Array}
2676
+ * @param newTracks {Array}
2677
+ * @return {Array}
2678
+ */
2679
+ orderNewTracksToShow(newTracks, oldTracks) {
2680
+ const betterNewTracks = [];
2681
+ const leftOvers = [];
2682
+ newTracks.forEach((track) => {
2683
+ const oldPosition = oldTracks.indexOf(track);
2684
+ if (oldPosition !== -1 && oldPosition < newTracks.length) {
2685
+ betterNewTracks[oldPosition] = track;
2686
+ } else {
2687
+ leftOvers.push(track);
2688
+ }
2689
+ });
2690
+ for (let i = 0; i < newTracks.length; i++) {
2691
+ if (!betterNewTracks[i]) {
2692
+ betterNewTracks[i] = leftOvers.shift();
2693
+ }
2694
+ }
2695
+ return betterNewTracks;
2696
+ }
2697
+ /**
2698
+ * call detach for tracks which no longer need to be shown and attach for
2699
+ * new ones which are to be shown now.
2700
+ * Note: oldTracks and newTracks are not necessarily of same length
2701
+ * @param oldTracks {Array<String>}
2702
+ * @param newTracks {Array<String>}
2703
+ * @param tracksMap {Record<String, any>}
2704
+ */
2705
+ // eslint-disable-next-line complexity
2706
+ detachOldAttachNewTracks(oldTracks, newTracks, tracksMap = null) {
2707
+ return __async(this, null, function* () {
2708
+ const numTracks = Math.max(oldTracks.length, newTracks.length);
2709
+ for (let i = 0; i < numTracks; i++) {
2710
+ if (oldTracks[i] === newTracks[i]) {
2711
+ continue;
2712
+ } else if (oldTracks[i]) {
2713
+ if (!tracksMap || tracksMap[oldTracks[i]]) {
2714
+ yield this.hmsActions.detachVideo(oldTracks[i], this.videoElements[i]);
2715
+ }
2716
+ if (this.videoElements[i]) {
2717
+ this.videoElements[i].srcObject = null;
2718
+ }
2719
+ }
2720
+ if (newTracks[i]) {
2721
+ yield this.hmsActions.attachVideo(newTracks[i], this.videoElements[i]);
2722
+ }
2723
+ }
2724
+ });
2725
+ }
2726
+ };
2727
+ var PictureInPicture = new PipManager();
2728
+
2729
+ // src/Prebuilt/components/PIP/SetupMediaSession.js
2730
+ init_define_process_env();
2731
+ import { selectIsLocalAudioEnabled, selectIsLocalVideoEnabled } from "@100mslive/react-sdk";
2732
+ var SetupMediaSession = class {
2733
+ constructor() {
2734
+ __publicField(this, "setup", (actions, store) => {
2735
+ this.actions = actions;
2736
+ this.store = store;
2737
+ this.initState();
2738
+ this.setUpHandlers();
2739
+ });
2740
+ __publicField(this, "initState", () => {
2741
+ var _a, _b, _c, _d;
2742
+ const isMicActive = this.store.getState(selectIsLocalAudioEnabled);
2743
+ const isCamActive = this.store.getState(selectIsLocalVideoEnabled);
2744
+ (_b = (_a = navigator.mediaSession) == null ? void 0 : _a.setMicrophoneActive) == null ? void 0 : _b.call(_a, isMicActive);
2745
+ (_d = (_c = navigator.mediaSession) == null ? void 0 : _c.setCameraActive) == null ? void 0 : _d.call(_c, isCamActive);
2746
+ this.store.subscribe((isMicActive2) => {
2747
+ var _a2, _b2;
2748
+ (_b2 = (_a2 = navigator.mediaSession) == null ? void 0 : _a2.setMicrophoneActive) == null ? void 0 : _b2.call(_a2, isMicActive2);
2749
+ }, selectIsLocalAudioEnabled);
2750
+ this.store.subscribe((isCamActive2) => {
2751
+ var _a2, _b2;
2752
+ (_b2 = (_a2 = navigator.mediaSession) == null ? void 0 : _a2.setCameraActive) == null ? void 0 : _b2.call(_a2, isCamActive2);
2753
+ }, selectIsLocalVideoEnabled);
2754
+ });
2755
+ __publicField(this, "toggleMic", () => __async(this, null, function* () {
2756
+ console.log("toggle mic clicked in pip");
2757
+ const current = this.store.getState(selectIsLocalAudioEnabled);
2758
+ yield this.actions.setLocalAudioEnabled(!current);
2759
+ }));
2760
+ __publicField(this, "toggleCam", () => __async(this, null, function* () {
2761
+ console.log("toggle cam clicked in pip");
2762
+ const current = this.store.getState(selectIsLocalVideoEnabled);
2763
+ yield this.actions.setLocalVideoEnabled(!current);
2764
+ }));
2765
+ __publicField(this, "leave", () => {
2766
+ console.log("leave called from pip");
2767
+ this.actions.leave();
2768
+ });
2769
+ __publicField(this, "setUpHandlers", () => {
2770
+ if (navigator.mediaSession) {
2771
+ try {
2772
+ navigator.mediaSession.setActionHandler("togglemicrophone", this.toggleMic);
2773
+ navigator.mediaSession.setActionHandler("togglecamera", this.toggleCam);
2774
+ navigator.mediaSession.setActionHandler("hangup", this.leave);
2775
+ } catch (err) {
2776
+ console.error("error in setting media session handlers", err);
2777
+ }
2778
+ }
2779
+ });
2780
+ }
2781
+ };
2782
+ var MediaSession = new SetupMediaSession();
2783
+
2784
+ // src/Prebuilt/components/PIP/PIPComponent.jsx
2785
+ var PIPComponent = ({ peers, showLocalPeer }) => {
2786
+ const localPeerRole = useHMSStore16(selectLocalPeerRoleName6);
2787
+ const [isPipOn, setIsPipOn] = useState13(PictureInPicture.isOn());
2788
+ const hmsActions = useHMSActions12();
2789
+ const store = useHMSVanillaStore();
2790
+ const isFeatureEnabled = useIsFeatureEnabled(FEATURE_LIST.PICTURE_IN_PICTURE);
2791
+ const onPipToggle = useCallback7(() => {
2792
+ if (!isPipOn) {
2793
+ PictureInPicture.start(hmsActions, setIsPipOn).catch((err) => console.error("error in starting pip", err));
2794
+ MediaSession.setup(hmsActions, store);
2795
+ } else {
2796
+ PictureInPicture.stop().catch((err) => console.error("error in stopping pip", err));
2797
+ }
2798
+ }, [hmsActions, isPipOn, store]);
2799
+ useEffect8(() => {
2800
+ return () => {
2801
+ PictureInPicture.stop().catch((err) => console.error("error in stopping pip on unmount", err));
2802
+ };
2803
+ }, []);
2804
+ if (!PictureInPicture.isSupported() || localPeerRole === DEFAULT_HLS_VIEWER_ROLE || !isFeatureEnabled) {
2805
+ return null;
2806
+ }
2807
+ return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Tooltip, { title: `${isPipOn ? "Deactivate" : "Activate"} picture in picture view` }, /* @__PURE__ */ React23.createElement(IconButton_default, { active: !isPipOn, key: "pip", onClick: () => onPipToggle(), "data-testid": "pip_btn" }, /* @__PURE__ */ React23.createElement(PipIcon, null))), isPipOn && /* @__PURE__ */ React23.createElement(ActivatedPIP, { showLocalPeer, peers }));
2808
+ };
2809
+ var ActivatedPIP = ({ showLocalPeer, peers }) => {
2810
+ const tracksMap = useHMSStore16(selectTracksMap2);
2811
+ const storePeers = useHMSStore16(showLocalPeer ? selectPeers4 : selectRemotePeers2);
2812
+ useEffect8(() => {
2813
+ let pipPeers = storePeers;
2814
+ if (peers) {
2815
+ pipPeers = storePeers.filter((peer) => peers.includes(peer.id));
2816
+ }
2817
+ PictureInPicture.updatePeersAndTracks(pipPeers, tracksMap).catch((err) => {
2818
+ console.error("error in updating pip", err);
2819
+ });
2820
+ }, [peers, storePeers, tracksMap]);
2821
+ return null;
2822
+ };
2823
+ var PIPComponent_default = PIPComponent;
2824
+
2825
+ // src/Prebuilt/components/PIP/index.jsx
2826
+ var PIP = () => {
2827
+ const pinnedTrack = usePinnedTrack();
2828
+ return /* @__PURE__ */ React24.createElement(PIPComponent_default, { peers: pinnedTrack && pinnedTrack.enabled ? [pinnedTrack.peerId] : void 0, showLocalPeer: true });
2829
+ };
2830
+
2831
+ // src/Prebuilt/components/ScreenShare.jsx
2832
+ init_define_process_env();
2833
+ import React32, { Fragment as Fragment6 } from "react";
2834
+ import { selectIsAllowedToPublish as selectIsAllowedToPublish3, useHMSStore as useHMSStore17, useScreenShare as useScreenShare4 } from "@100mslive/react-sdk";
2835
+ import { ShareScreenIcon as ShareScreenIcon2 } from "@100mslive/react-icons";
2836
+
2837
+ // src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx
2838
+ init_define_process_env();
2839
+ import React31, { Fragment as Fragment5, useState as useState15 } from "react";
2840
+ import { useScreenShare as useScreenShare3 } from "@100mslive/react-sdk";
2841
+ import { PdfShare, ScreenShare, StarIcon, VerticalMenuIcon as VerticalMenuIcon2 } from "@100mslive/react-icons";
2842
+
2843
+ // src/Prebuilt/components/ShareMenuIcon.jsx
2844
+ init_define_process_env();
2845
+ var ScreenShareButton = styled(IconButton_default, {
2846
+ h: "$14",
2847
+ px: "$8",
2848
+ r: "$1",
2849
+ borderTopRightRadius: 0,
2850
+ borderBottomRightRadius: 0,
2851
+ "@md": {
2852
+ px: "$4",
2853
+ mx: 0
2854
+ }
2855
+ });
2856
+ var ShareMenuIcon = styled(ScreenShareButton, {
2857
+ borderTopLeftRadius: 0,
2858
+ borderBottomLeftRadius: 0,
2859
+ borderTopRightRadius: "$1",
2860
+ borderBottomRightRadius: "$1",
2861
+ borderLeftWidth: 0,
2862
+ w: "$4",
2863
+ "@md": {
2864
+ px: "$2"
2865
+ }
2866
+ });
2867
+
2868
+ // src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx
2869
+ init_define_process_env();
2870
+ import React30, { useState as useState14 } from "react";
2871
+
2872
+ // src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx
2873
+ init_define_process_env();
2874
+ import React25 from "react";
2875
+ import { InfoIcon as InfoIcon2 } from "@100mslive/react-icons";
2876
+ var PdfErrorView = ({ isPDFUrlValid }) => {
2877
+ return !isPDFUrlValid && /* @__PURE__ */ React25.createElement(
2878
+ DialogRow,
2879
+ {
2880
+ css: {
2881
+ mt: "-$8",
2882
+ color: "$error",
2883
+ justifyContent: "start"
2884
+ }
2885
+ },
2886
+ /* @__PURE__ */ React25.createElement(InfoIcon2, { width: "12px", height: "12px" }),
2887
+ /* @__PURE__ */ React25.createElement(
2888
+ Text,
2889
+ {
2890
+ variant: "caption",
2891
+ css: {
2892
+ pl: "$1",
2893
+ color: "$error"
2894
+ }
2895
+ },
2896
+ "Please enter a valid PDF URL"
2897
+ )
2898
+ );
2899
+ };
2900
+
2901
+ // src/Prebuilt/components/pdfAnnotator/pdfHeader.jsx
2902
+ init_define_process_env();
2903
+ import React26 from "react";
2904
+ var PDFHeader = () => {
2905
+ return /* @__PURE__ */ React26.createElement(
2906
+ DialogCol,
2907
+ {
2908
+ align: "start",
2909
+ css: {
2910
+ mt: 0,
2911
+ mb: "$6"
2912
+ }
2913
+ },
2914
+ /* @__PURE__ */ React26.createElement(Dialog.Title, { asChild: true }, /* @__PURE__ */ React26.createElement(Text, { as: "h6", variant: "h6" }, "Share PDF")),
2915
+ /* @__PURE__ */ React26.createElement(Dialog.Description, { asChild: true }, /* @__PURE__ */ React26.createElement(
2916
+ Text,
2917
+ {
2918
+ variant: "sm",
2919
+ css: {
2920
+ c: "$textMedEmp"
2921
+ }
2922
+ },
2923
+ "Choose PDF you want to annotate and share"
2924
+ ))
2925
+ );
2926
+ };
2927
+
2928
+ // src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx
2929
+ init_define_process_env();
2930
+ import React27 from "react";
2931
+ import { InfoIcon as InfoIcon3 } from "@100mslive/react-icons";
2932
+ var PDFInfo = () => {
2933
+ return /* @__PURE__ */ React27.createElement(
2934
+ DialogRow,
2935
+ {
2936
+ css: {
2937
+ px: "$8",
2938
+ py: "$3",
2939
+ bg: "$surfaceLight",
2940
+ r: "$1",
2941
+ outline: "none",
2942
+ border: "1px solid $borderLight",
2943
+ minHeight: "$11"
2944
+ }
2945
+ },
2946
+ /* @__PURE__ */ React27.createElement(
2947
+ InfoIcon3,
2948
+ {
2949
+ width: "64px",
2950
+ height: "64px",
2951
+ style: {
2952
+ paddingRight: "16px"
2953
+ }
2954
+ }
2955
+ ),
2956
+ /* @__PURE__ */ React27.createElement(Text, { variant: "caption" }, "On the next screen, ensure you select \u201CThis Tab\u201D and click on share. Only the PDF viewer will be seen by other participants")
2957
+ );
2958
+ };
2959
+
2960
+ // src/Prebuilt/components/pdfAnnotator/submitPdf.jsx
2961
+ init_define_process_env();
2962
+ import React28, { useCallback as useCallback8 } from "react";
2963
+ var SubmitPDF = ({
2964
+ pdfFile,
2965
+ pdfURL,
2966
+ isValidateProgress,
2967
+ setIsPDFUrlValid,
2968
+ setIsValidateProgress,
2969
+ onOpenChange
2970
+ }) => {
2971
+ const [, setPDFConfig] = useSetAppDataByKey(APP_DATA.pdfConfig);
2972
+ const isValidPDF = useCallback8(
2973
+ (pdfURL2) => {
2974
+ const extension = pdfURL2.split(".").pop().toLowerCase();
2975
+ setIsValidateProgress(true);
2976
+ if (extension === "pdf") {
2977
+ setIsPDFUrlValid(true);
2978
+ setIsValidateProgress(false);
2979
+ setPDFConfig({ state: true, file: pdfFile, url: pdfURL2 });
2980
+ onOpenChange(false);
2981
+ }
2982
+ fetch(pdfURL2, { method: "HEAD" }).then((response) => response.headers.get("content-type")).then((contentType) => {
2983
+ if (contentType === "application/pdf") {
2984
+ setIsPDFUrlValid(true);
2985
+ setIsValidateProgress(false);
2986
+ setPDFConfig({ state: true, file: pdfFile, url: pdfURL2 });
2987
+ onOpenChange(false);
2988
+ } else {
2989
+ setIsPDFUrlValid(false);
2990
+ setIsValidateProgress(false);
2991
+ }
2992
+ }).catch(() => {
2993
+ setIsPDFUrlValid(false);
2994
+ setIsValidateProgress(false);
2995
+ });
2996
+ },
2997
+ [onOpenChange, pdfFile, setIsPDFUrlValid, setIsValidateProgress, setPDFConfig]
2998
+ );
2999
+ return /* @__PURE__ */ React28.createElement(
3000
+ Flex,
3001
+ {
3002
+ direction: "row",
3003
+ css: {
3004
+ mb: "0",
3005
+ mt: "auto",
3006
+ gap: "$8"
3007
+ }
3008
+ },
3009
+ /* @__PURE__ */ React28.createElement(
3010
+ Button,
3011
+ {
3012
+ variant: "standard",
3013
+ outlined: true,
3014
+ type: "submit",
3015
+ onClick: () => {
3016
+ onOpenChange(false);
3017
+ },
3018
+ css: { w: "50%" }
3019
+ },
3020
+ "Cancel"
3021
+ ),
3022
+ /* @__PURE__ */ React28.createElement(
3023
+ Button,
3024
+ {
3025
+ variant: "primary",
3026
+ type: "submit",
3027
+ onClick: () => {
3028
+ if (pdfFile) {
3029
+ setPDFConfig({ state: true, file: pdfFile, url: pdfURL });
3030
+ onOpenChange(false);
3031
+ } else if (pdfURL) {
3032
+ isValidPDF(pdfURL);
3033
+ }
3034
+ },
3035
+ disabled: !pdfFile && !pdfURL,
3036
+ loading: isValidateProgress,
3037
+ "data-testid": "share_pdf_btn",
3038
+ css: {
3039
+ w: "50%"
3040
+ }
3041
+ },
3042
+ "Start Sharing"
3043
+ )
3044
+ );
3045
+ };
3046
+
3047
+ // src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx
3048
+ init_define_process_env();
3049
+ import React29 from "react";
3050
+ import { TrashIcon } from "@100mslive/react-icons";
3051
+ var UploadedFile = ({
3052
+ pdfFile,
3053
+ pdfURL,
3054
+ isValidateProgress,
3055
+ setPDFFile,
3056
+ setIsPDFUrlValid,
3057
+ setIsValidateProgress,
3058
+ onOpenChange
3059
+ }) => {
3060
+ const [fileName, ext] = pdfFile.name.split(".");
3061
+ return /* @__PURE__ */ React29.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React29.createElement(Dialog.Portal, null, /* @__PURE__ */ React29.createElement(Dialog.Overlay, null), /* @__PURE__ */ React29.createElement(
3062
+ Dialog.Content,
3063
+ {
3064
+ css: {
3065
+ w: "min(420px,80%)",
3066
+ overflow: "auto",
3067
+ p: "$10"
3068
+ }
3069
+ },
3070
+ /* @__PURE__ */ React29.createElement(Flex, { direction: "column" }, /* @__PURE__ */ React29.createElement(PDFHeader, null), /* @__PURE__ */ React29.createElement(
3071
+ DialogRow,
3072
+ {
3073
+ css: {
3074
+ fontFamily: "$sans",
3075
+ bg: "$surfaceLight",
3076
+ r: "$1",
3077
+ outline: "none",
3078
+ border: "1px solid $borderLight",
3079
+ p: "$4 $6",
3080
+ minHeight: "$11",
3081
+ c: "$textPrimary",
3082
+ fs: "$md",
3083
+ w: "100%",
3084
+ "&:focus": {
3085
+ boxShadow: "0 0 0 1px $colors$borderAccent",
3086
+ border: "1px solid $transparent"
3087
+ },
3088
+ mb: 0,
3089
+ mt: "$6"
3090
+ }
3091
+ },
3092
+ /* @__PURE__ */ React29.createElement(Flex, { direction: "row", css: { flexGrow: "1", maxWidth: "88%" } }, /* @__PURE__ */ React29.createElement(
3093
+ Text,
3094
+ {
3095
+ css: {
3096
+ textOverflow: "ellipsis",
3097
+ overflow: "hidden",
3098
+ whiteSpace: "nowrap"
3099
+ }
3100
+ },
3101
+ fileName
3102
+ ), /* @__PURE__ */ React29.createElement(Text, { css: { whiteSpace: "nowrap" } }, ".", ext)),
3103
+ /* @__PURE__ */ React29.createElement(
3104
+ TrashIcon,
3105
+ {
3106
+ onClick: () => setPDFFile(null),
3107
+ style: {
3108
+ cursor: "pointer"
3109
+ }
3110
+ }
3111
+ )
3112
+ ), /* @__PURE__ */ React29.createElement(PDFInfo, null), /* @__PURE__ */ React29.createElement(
3113
+ SubmitPDF,
3114
+ {
3115
+ pdfFile,
3116
+ pdfURL,
3117
+ isValidateProgress,
3118
+ setIsPDFUrlValid,
3119
+ setIsValidateProgress,
3120
+ onOpenChange
3121
+ }
3122
+ ))
3123
+ )));
3124
+ };
3125
+
3126
+ // src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx
3127
+ function PDFFileOptions({ onOpenChange }) {
3128
+ const [isPDFUrlValid, setIsPDFUrlValid] = useState14(true);
3129
+ const [isValidateProgress, setIsValidateProgress] = useState14(false);
3130
+ const [pdfFile, setPDFFile] = useState14(null);
3131
+ const [pdfURL, setPDFURL] = useState14("");
3132
+ return !pdfFile ? /* @__PURE__ */ React30.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React30.createElement(Dialog.Portal, null, /* @__PURE__ */ React30.createElement(Dialog.Overlay, null), /* @__PURE__ */ React30.createElement(
3133
+ Dialog.Content,
3134
+ {
3135
+ css: {
3136
+ w: "min(420px,80%)",
3137
+ overflow: "auto",
3138
+ p: "$10"
3139
+ }
3140
+ },
3141
+ /* @__PURE__ */ React30.createElement(Flex, { direction: "column" }, /* @__PURE__ */ React30.createElement(PDFHeader, null), /* @__PURE__ */ React30.createElement(
3142
+ DialogInputFile,
3143
+ {
3144
+ onChange: (target) => {
3145
+ setPDFFile(target.files[0]);
3146
+ },
3147
+ placeholder: "Click to upload",
3148
+ type: "file",
3149
+ accept: ".pdf"
3150
+ }
3151
+ ), /* @__PURE__ */ React30.createElement(
3152
+ DialogRow,
3153
+ {
3154
+ css: {
3155
+ m: "$10 0"
3156
+ }
3157
+ },
3158
+ /* @__PURE__ */ React30.createElement(
3159
+ HorizontalDivider,
3160
+ {
3161
+ css: {
3162
+ mr: "$4"
3163
+ }
3164
+ }
3165
+ ),
3166
+ /* @__PURE__ */ React30.createElement(
3167
+ Text,
3168
+ {
3169
+ variant: "tiny",
3170
+ css: {
3171
+ color: "$textDisabled"
3172
+ }
3173
+ },
3174
+ "OR"
3175
+ ),
3176
+ /* @__PURE__ */ React30.createElement(
3177
+ HorizontalDivider,
3178
+ {
3179
+ css: {
3180
+ ml: "$4"
3181
+ }
3182
+ }
3183
+ )
3184
+ ), /* @__PURE__ */ React30.createElement(
3185
+ Text,
3186
+ {
3187
+ variant: "sm",
3188
+ css: {
3189
+ py: "$2"
3190
+ }
3191
+ },
3192
+ "Import from URL"
3193
+ ), /* @__PURE__ */ React30.createElement(
3194
+ Input,
3195
+ {
3196
+ css: { w: "100%", mb: "$10" },
3197
+ value: pdfURL,
3198
+ onFocus: () => {
3199
+ setIsPDFUrlValid(true);
3200
+ setIsValidateProgress(false);
3201
+ },
3202
+ onChange: (e) => {
3203
+ setPDFURL(e.target.value);
3204
+ },
3205
+ placeholder: "Add PDF URL",
3206
+ type: "text",
3207
+ error: !isPDFUrlValid
3208
+ }
3209
+ ), !isPDFUrlValid && /* @__PURE__ */ React30.createElement(PdfErrorView, { isPDFUrlValid }), /* @__PURE__ */ React30.createElement(PDFInfo, null), /* @__PURE__ */ React30.createElement(
3210
+ SubmitPDF,
3211
+ {
3212
+ pdfFile,
3213
+ pdfURL,
3214
+ isValidateProgress,
3215
+ setIsPDFUrlValid,
3216
+ setIsValidateProgress,
3217
+ onOpenChange
3218
+ }
3219
+ ))
3220
+ ))) : /* @__PURE__ */ React30.createElement(
3221
+ UploadedFile,
3222
+ {
3223
+ pdfFile,
3224
+ pdfURL,
3225
+ isValidateProgress,
3226
+ setPDFFile,
3227
+ setIsPDFUrlValid,
3228
+ setIsValidateProgress,
3229
+ onOpenChange
3230
+ }
3231
+ );
3232
+ }
3233
+
3234
+ // src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx
3235
+ var MODALS2 = {
3236
+ SHARE: "share",
3237
+ SCREEN_SHARE: "screenShare",
3238
+ PDF_SHARE: "pdfShare"
3239
+ };
3240
+ function ShareScreenOptions() {
3241
+ const [openModals, setOpenModals] = useState15(/* @__PURE__ */ new Set());
3242
+ const { amIScreenSharing } = useScreenShare3();
3243
+ const updateState = (modalName, value) => {
3244
+ setOpenModals((modals) => {
3245
+ const copy = new Set(modals);
3246
+ if (value) {
3247
+ copy.add(modalName);
3248
+ } else {
3249
+ copy.delete(modalName);
3250
+ }
3251
+ return copy;
3252
+ });
3253
+ };
3254
+ const { toggleScreenShare } = useScreenShare3();
3255
+ return /* @__PURE__ */ React31.createElement(Fragment5, null, /* @__PURE__ */ React31.createElement(Dropdown.Root, { open: openModals.has(MODALS2.SHARE), onOpenChange: (value) => updateState(MODALS2.SHARE, value) }, /* @__PURE__ */ React31.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "sharing_btn", disabled: amIScreenSharing }, /* @__PURE__ */ React31.createElement(ShareMenuIcon, { disabled: amIScreenSharing }, /* @__PURE__ */ React31.createElement(Tooltip, { title: "Share" }, /* @__PURE__ */ React31.createElement(Box, null, /* @__PURE__ */ React31.createElement(VerticalMenuIcon2, null))))), /* @__PURE__ */ React31.createElement(
3256
+ Dropdown.Content,
3257
+ {
3258
+ sideOffset: 5,
3259
+ css: {
3260
+ w: "$96",
3261
+ maxHeight: "$96",
3262
+ p: 0
3263
+ }
3264
+ },
3265
+ /* @__PURE__ */ React31.createElement(
3266
+ Dropdown.Item,
3267
+ {
3268
+ css: {
3269
+ flexDirection: "column",
3270
+ alignItems: "flex-start",
3271
+ px: "$10",
3272
+ pt: "$10",
3273
+ pb: "$6",
3274
+ "&:hover": {
3275
+ bg: "$transparent",
3276
+ cursor: "default"
3277
+ }
3278
+ }
3279
+ },
3280
+ /* @__PURE__ */ React31.createElement(Text, { variant: "h6" }, "Start Sharing"),
3281
+ /* @__PURE__ */ React31.createElement(Text, { variant: "sm" }, "Choose what you want to share")
3282
+ ),
3283
+ /* @__PURE__ */ React31.createElement(
3284
+ Dropdown.Item,
3285
+ {
3286
+ css: {
3287
+ flexDirection: "row",
3288
+ alignItems: "flex-start",
3289
+ gap: "$8",
3290
+ px: "$10",
3291
+ py: "$6",
3292
+ "&:hover": {
3293
+ bg: "$transparent",
3294
+ cursor: "default"
3295
+ }
3296
+ }
3297
+ },
3298
+ /* @__PURE__ */ React31.createElement(
3299
+ Flex,
3300
+ {
3301
+ direction: "column",
3302
+ align: "center",
3303
+ css: {
3304
+ gap: "$6"
3305
+ }
3306
+ },
3307
+ /* @__PURE__ */ React31.createElement(
3308
+ IconButton,
3309
+ {
3310
+ as: "div",
3311
+ onClick: () => toggleScreenShare(),
3312
+ css: {
3313
+ p: "$6",
3314
+ display: "flex",
3315
+ justifyContent: "center",
3316
+ border: "1px solid $grayDefault",
3317
+ r: "$2",
3318
+ bg: "$surfaceLighter",
3319
+ pb: "0"
3320
+ }
3321
+ },
3322
+ /* @__PURE__ */ React31.createElement(
3323
+ ScreenShare,
3324
+ {
3325
+ width: "100%",
3326
+ height: "100%",
3327
+ style: {
3328
+ borderTopLeftRadius: "$0",
3329
+ borderTopRightRadius: "$0"
3330
+ }
3331
+ }
3332
+ )
3333
+ ),
3334
+ /* @__PURE__ */ React31.createElement(Flex, { direction: "column", align: "center" }, /* @__PURE__ */ React31.createElement(Text, { variant: "body2" }, "Share Screen"), /* @__PURE__ */ React31.createElement(
3335
+ Text,
3336
+ {
3337
+ variant: "caption",
3338
+ css: {
3339
+ c: "$textDisabled",
3340
+ textAlign: "center"
3341
+ }
3342
+ },
3343
+ "Share your tab, window or your entire screen"
3344
+ ))
3345
+ ),
3346
+ /* @__PURE__ */ React31.createElement(
3347
+ Flex,
3348
+ {
3349
+ direction: "column",
3350
+ align: "center",
3351
+ css: {
3352
+ gap: "$6"
3353
+ }
3354
+ },
3355
+ /* @__PURE__ */ React31.createElement(
3356
+ IconButton,
3357
+ {
3358
+ onClick: () => {
3359
+ updateState(MODALS2.PDF_SHARE, true);
3360
+ },
3361
+ disabled: amIScreenSharing,
3362
+ css: {
3363
+ p: "$6",
3364
+ display: "flex",
3365
+ justifyContent: "center",
3366
+ border: "$grayDefault 1px solid",
3367
+ r: "$2",
3368
+ bg: "$surfaceLight",
3369
+ pb: "0"
3370
+ }
3371
+ },
3372
+ /* @__PURE__ */ React31.createElement(
3373
+ PdfShare,
3374
+ {
3375
+ width: "100%",
3376
+ height: "100%",
3377
+ style: {
3378
+ borderTopLeftRadius: "$0",
3379
+ borderTopRightRadius: "$0"
3380
+ }
3381
+ }
3382
+ ),
3383
+ /* @__PURE__ */ React31.createElement(
3384
+ Flex,
3385
+ {
3386
+ direction: "row",
3387
+ css: {
3388
+ position: "absolute",
3389
+ top: "29%",
3390
+ left: "54%",
3391
+ padding: "$2 $4",
3392
+ r: "$2",
3393
+ bg: "$primaryLight",
3394
+ zIndex: "2"
3395
+ }
3396
+ },
3397
+ /* @__PURE__ */ React31.createElement(
3398
+ IconButton,
3399
+ {
3400
+ css: {
3401
+ w: "$10",
3402
+ h: "$8",
3403
+ "&:hover": {
3404
+ bg: "$transparent !important",
3405
+ border: "none"
3406
+ }
3407
+ }
3408
+ },
3409
+ /* @__PURE__ */ React31.createElement(StarIcon, null)
3410
+ ),
3411
+ /* @__PURE__ */ React31.createElement(
3412
+ Text,
3413
+ {
3414
+ variant: "xs",
3415
+ css: {
3416
+ fontWeight: "$semiBold",
3417
+ c: "$white",
3418
+ pr: "$4"
3419
+ }
3420
+ },
3421
+ "New"
3422
+ )
3423
+ )
3424
+ ),
3425
+ /* @__PURE__ */ React31.createElement(Flex, { direction: "column", align: "center" }, /* @__PURE__ */ React31.createElement(Text, { variant: "body2" }, "Share PDF"), /* @__PURE__ */ React31.createElement(
3426
+ Text,
3427
+ {
3428
+ variant: "caption",
3429
+ css: {
3430
+ c: "$textDisabled",
3431
+ textAlign: "center"
3432
+ }
3433
+ },
3434
+ "Annotate, draw shapes, and more over PDFs"
3435
+ ))
3436
+ )
3437
+ ),
3438
+ /* @__PURE__ */ React31.createElement(
3439
+ Dropdown.Item,
3440
+ {
3441
+ css: {
3442
+ px: "$10",
3443
+ pb: "$10",
3444
+ pt: "$6",
3445
+ "&:hover": {
3446
+ bg: "$transparent",
3447
+ cursor: "default"
3448
+ }
3449
+ }
3450
+ },
3451
+ /* @__PURE__ */ React31.createElement(
3452
+ Button,
3453
+ {
3454
+ variant: "standard",
3455
+ outlined: true,
3456
+ type: "submit",
3457
+ onClick: () => {
3458
+ updateState(MODALS2.SHARE, false);
3459
+ },
3460
+ "data-testid": "share_btn",
3461
+ css: {
3462
+ w: "100%"
3463
+ }
3464
+ },
3465
+ "Cancel"
3466
+ )
3467
+ )
3468
+ )), openModals.has(MODALS2.PDF_SHARE) && /* @__PURE__ */ React31.createElement(PDFFileOptions, { onOpenChange: (value) => updateState(MODALS2.PDF_SHARE, value) }));
3469
+ }
3470
+
3471
+ // src/Prebuilt/components/ScreenShare.jsx
3472
+ var ScreenshareToggle = ({ css = {} }) => {
3473
+ const isAllowedToPublish = useHMSStore17(selectIsAllowedToPublish3);
3474
+ const isAudioOnly = useUISettings(UI_SETTINGS.isAudioOnly);
3475
+ const { amIScreenSharing, screenShareVideoTrackId: video, toggleScreenShare } = useScreenShare4();
3476
+ const isVideoScreenshare = amIScreenSharing && !!video;
3477
+ if (!isAllowedToPublish.screen || !isScreenshareSupported()) {
3478
+ return null;
3479
+ }
3480
+ return /* @__PURE__ */ React32.createElement(Fragment6, null, /* @__PURE__ */ React32.createElement(Flex, { direction: "row" }, /* @__PURE__ */ React32.createElement(
3481
+ ScreenShareButton,
3482
+ {
3483
+ variant: "standard",
3484
+ key: "ShareScreen",
3485
+ active: !isVideoScreenshare,
3486
+ css,
3487
+ disabled: isAudioOnly,
3488
+ onClick: () => {
3489
+ toggleScreenShare();
3490
+ }
3491
+ },
3492
+ /* @__PURE__ */ React32.createElement(Tooltip, { title: `${!isVideoScreenshare ? "Start" : "Stop"} screen sharing` }, /* @__PURE__ */ React32.createElement(Box, null, /* @__PURE__ */ React32.createElement(ShareScreenIcon2, null)))
3493
+ ), /* @__PURE__ */ React32.createElement(ShareScreenOptions, null)));
3494
+ };
3495
+
3496
+ // src/Prebuilt/components/ScreenshareHintModal.jsx
3497
+ init_define_process_env();
3498
+ import React33 from "react";
3499
+ import { useHMSActions as useHMSActions13 } from "@100mslive/react-sdk";
3500
+ var ScreenShareHintModal = ({ onClose }) => {
3501
+ const hmsActions = useHMSActions13();
3502
+ return /* @__PURE__ */ React33.createElement(Dialog.Root, { defaultOpen: true, onOpenChange: (value) => !value && onClose() }, /* @__PURE__ */ React33.createElement(DialogContent, { title: "AudioOnly Screenshare" }, /* @__PURE__ */ React33.createElement(
3503
+ "img",
3504
+ {
3505
+ src: "https://images.app.100ms.live/share-audio.png",
3506
+ alt: "AudioOnly Screenshare instructions",
3507
+ width: "100%"
3508
+ }
3509
+ ), /* @__PURE__ */ React33.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React33.createElement(
3510
+ Button,
3511
+ {
3512
+ variant: "primary",
3513
+ onClick: () => {
3514
+ hmsActions.setScreenShareEnabled(true, {
3515
+ audioOnly: true,
3516
+ displaySurface: "browser"
3517
+ }).catch(console.error);
3518
+ onClose();
3519
+ },
3520
+ "data-testid": "audio_screenshare_continue"
3521
+ },
3522
+ "Continue"
3523
+ ))));
3524
+ };
3525
+
3526
+ // src/Prebuilt/components/Footer/ChatToggle.jsx
3527
+ init_define_process_env();
3528
+ import React34 from "react";
3529
+ import { selectUnreadHMSMessagesCount, useHMSStore as useHMSStore18 } from "@100mslive/react-sdk";
3530
+ import { ChatIcon, ChatUnreadIcon } from "@100mslive/react-icons";
3531
+ var ChatToggle = () => {
3532
+ const countUnreadMessages = useHMSStore18(selectUnreadHMSMessagesCount);
3533
+ const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
3534
+ const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
3535
+ const isFeatureEnabled = useIsFeatureEnabled(FEATURE_LIST.CHAT);
3536
+ if (!isFeatureEnabled) {
3537
+ return;
3538
+ }
3539
+ return /* @__PURE__ */ React34.createElement(Tooltip, { key: "chat", title: `${isChatOpen ? "Close" : "Open"} chat` }, /* @__PURE__ */ React34.createElement(IconButton_default, { onClick: toggleChat, active: !isChatOpen, "data-testid": "chat_btn" }, countUnreadMessages === 0 ? /* @__PURE__ */ React34.createElement(ChatIcon, null) : /* @__PURE__ */ React34.createElement(ChatUnreadIcon, { "data-testid": "chat_unread_btn" })));
3540
+ };
3541
+
3542
+ // src/Prebuilt/components/Footer/ConferencingFooter.jsx
3543
+ var TranscriptionButton = React35.lazy(() => import("./transcription-BTSB7FZH.js"));
3544
+ var VirtualBackground = React35.lazy(() => import("./VirtualBackground-LHYBWUT5.js"));
3545
+ var ScreenshareAudio = () => {
3546
+ const {
3547
+ amIScreenSharing,
3548
+ screenShareVideoTrackId: video,
3549
+ screenShareAudioTrackId: audio,
3550
+ toggleScreenShare
3551
+ } = useScreenShare5();
3552
+ const isAllowedToPublish = useHMSStore19(selectIsAllowedToPublish4);
3553
+ const isAudioScreenshare = amIScreenSharing && !video && !!audio;
3554
+ const [showModal, setShowModal] = useState16(false);
3555
+ const isFeatureEnabled = useIsFeatureEnabled(FEATURE_LIST.AUDIO_ONLY_SCREENSHARE);
3556
+ if (!isFeatureEnabled || !isAllowedToPublish.screen || !isScreenshareSupported()) {
3557
+ return null;
3558
+ }
3559
+ return /* @__PURE__ */ React35.createElement(Fragment7, null, /* @__PURE__ */ React35.createElement(Tooltip, { title: `${!isAudioScreenshare ? "Start" : "Stop"} audio sharing`, key: "shareAudio" }, /* @__PURE__ */ React35.createElement(
3560
+ IconButton_default,
3561
+ {
3562
+ active: !isAudioScreenshare,
3563
+ onClick: () => {
3564
+ if (amIScreenSharing) {
3565
+ toggleScreenShare();
3566
+ } else {
3567
+ setShowModal(true);
3568
+ }
3569
+ },
3570
+ "data-testid": "screenshare_audio"
3571
+ },
3572
+ /* @__PURE__ */ React35.createElement(MusicIcon, null)
3573
+ )), showModal && /* @__PURE__ */ React35.createElement(ScreenShareHintModal, { onClose: () => setShowModal(false) }));
3574
+ };
3575
+ var ConferencingFooter = () => {
3576
+ const isMobile = useMedia6(config.media.md);
3577
+ return /* @__PURE__ */ React35.createElement(Footer.Root, null, /* @__PURE__ */ React35.createElement(Footer.Left, null, /* @__PURE__ */ React35.createElement(ScreenshareAudio, null), /* @__PURE__ */ React35.createElement(Playlist, { type: HMSPlaylistType4.audio }), /* @__PURE__ */ React35.createElement(Playlist, { type: HMSPlaylistType4.video }), /* @__PURE__ */ React35.createElement(Suspense2, { fallback: "" }, /* @__PURE__ */ React35.createElement(VirtualBackground, null)), FeatureFlags.enableTranscription ? /* @__PURE__ */ React35.createElement(TranscriptionButton, null) : null, /* @__PURE__ */ React35.createElement(
3578
+ Flex,
3579
+ {
3580
+ align: "center",
3581
+ css: {
3582
+ display: "none",
3583
+ "@md": {
3584
+ display: "flex",
3585
+ gap: "$8"
3586
+ }
3587
+ }
3588
+ },
3589
+ isMobile && /* @__PURE__ */ React35.createElement(EmojiReaction, null),
3590
+ /* @__PURE__ */ React35.createElement(MetaActions_default, { isMobile: true })
3591
+ )), /* @__PURE__ */ React35.createElement(Footer.Center, null, /* @__PURE__ */ React35.createElement(AudioVideoToggle, null), /* @__PURE__ */ React35.createElement(ScreenshareToggle, null), /* @__PURE__ */ React35.createElement(PIP, null), /* @__PURE__ */ React35.createElement(MoreSettings, null), /* @__PURE__ */ React35.createElement(Flex, { align: "center", css: { display: "none", "@md": { display: "flex" } } }, /* @__PURE__ */ React35.createElement(ChatToggle, null)), /* @__PURE__ */ React35.createElement(LeaveRoom, null)), /* @__PURE__ */ React35.createElement(Footer.Right, null, !isMobile && /* @__PURE__ */ React35.createElement(EmojiReaction, null), /* @__PURE__ */ React35.createElement(MetaActions_default, null), /* @__PURE__ */ React35.createElement(ChatToggle, null)));
3592
+ };
3593
+
3594
+ // src/Prebuilt/components/Footer/StreamingFooter.jsx
3595
+ init_define_process_env();
3596
+ import React36 from "react";
3597
+ var StreamingFooter = () => {
3598
+ return /* @__PURE__ */ React36.createElement(
3599
+ Footer.Root,
3600
+ {
3601
+ css: {
3602
+ flexWrap: "nowrap",
3603
+ "@md": {
3604
+ justifyContent: "center"
3605
+ }
3606
+ }
3607
+ },
3608
+ /* @__PURE__ */ React36.createElement(
3609
+ Footer.Left,
3610
+ {
3611
+ css: {
3612
+ "@md": {
3613
+ w: "unset",
3614
+ p: "0"
3615
+ }
3616
+ }
3617
+ },
3618
+ /* @__PURE__ */ React36.createElement(AudioVideoToggle, null)
3619
+ ),
3620
+ /* @__PURE__ */ React36.createElement(
3621
+ Footer.Center,
3622
+ {
3623
+ css: {
3624
+ "@md": {
3625
+ w: "unset"
3626
+ }
3627
+ }
3628
+ },
3629
+ /* @__PURE__ */ React36.createElement(ScreenshareToggle, { css: { "@sm": { display: "none" } } }),
3630
+ /* @__PURE__ */ React36.createElement(Box, { css: { "@md": { display: "none" } } }, /* @__PURE__ */ React36.createElement(PIP, null)),
3631
+ /* @__PURE__ */ React36.createElement(
3632
+ Box,
3633
+ {
3634
+ css: {
3635
+ display: "none",
3636
+ "@md": {
3637
+ display: "flex",
3638
+ alignItems: "center",
3639
+ mx: "$4"
3640
+ }
3641
+ }
3642
+ },
3643
+ /* @__PURE__ */ React36.createElement(StreamActions, null)
3644
+ ),
3645
+ /* @__PURE__ */ React36.createElement(MoreSettings, null),
3646
+ /* @__PURE__ */ React36.createElement(Box, { css: { "@md": { display: "none" } } }, /* @__PURE__ */ React36.createElement(LeaveRoom, null)),
3647
+ /* @__PURE__ */ React36.createElement(Flex, { align: "center", css: { display: "none", "@md": { display: "flex" } } }, /* @__PURE__ */ React36.createElement(ChatToggle, null))
3648
+ ),
3649
+ /* @__PURE__ */ React36.createElement(Footer.Right, null, /* @__PURE__ */ React36.createElement(EmojiReaction, null), /* @__PURE__ */ React36.createElement(MetaActions_default, null), /* @__PURE__ */ React36.createElement(ChatToggle, null))
3650
+ );
3651
+ };
3652
+
3653
+ // src/Prebuilt/components/Footer.jsx
3654
+ var Footer2 = () => {
3655
+ return isStreamingKit() ? /* @__PURE__ */ React37.createElement(StreamingFooter, null) : /* @__PURE__ */ React37.createElement(ConferencingFooter, null);
3656
+ };
3657
+
3658
+ // src/Prebuilt/components/RoleChangeRequestModal.jsx
3659
+ init_define_process_env();
3660
+ import React38 from "react";
3661
+ import { selectRoleChangeRequest, useHMSActions as useHMSActions14, useHMSStore as useHMSStore20 } from "@100mslive/react-sdk";
3662
+ var RoleChangeRequestModal = () => {
3663
+ var _a, _b;
3664
+ const hmsActions = useHMSActions14();
3665
+ const isHeadless = useIsHeadless();
3666
+ const roleChangeRequest = useHMSStore20(selectRoleChangeRequest);
3667
+ if (!(roleChangeRequest == null ? void 0 : roleChangeRequest.role) || isHeadless) {
3668
+ return null;
3669
+ }
3670
+ return /* @__PURE__ */ React38.createElement(
3671
+ RequestDialog,
3672
+ {
3673
+ title: "Role Change Request",
3674
+ onOpenChange: (value) => !value && hmsActions.rejectChangeRole(roleChangeRequest),
3675
+ body: `${(_a = roleChangeRequest == null ? void 0 : roleChangeRequest.requestedBy) == null ? void 0 : _a.name} has requested you to change your role to ${(_b = roleChangeRequest == null ? void 0 : roleChangeRequest.role) == null ? void 0 : _b.name}.`,
3676
+ onAction: () => {
3677
+ hmsActions.acceptChangeRole(roleChangeRequest);
3678
+ },
3679
+ actionText: "Accept"
3680
+ }
3681
+ );
3682
+ };
3683
+
3684
+ // src/Prebuilt/components/conference.jsx
3685
+ var Conference = () => {
3686
+ var _a, _b;
3687
+ const navigate = useNavigation();
3688
+ const { roomId, role } = useParams();
3689
+ const isHeadless = useIsHeadless();
3690
+ const roomState = useHMSStore21(selectRoomState);
3691
+ const prevState = usePrevious(roomState);
3692
+ const isConnectedToRoom = useHMSStore21(selectIsConnectedToRoom2);
3693
+ const hmsActions = useHMSActions15();
3694
+ const [hideControls, setHideControls] = useState17(false);
3695
+ const dropdownList = useHMSStore21(selectAppData4(APP_DATA.dropdownList));
3696
+ const skipPreview = useSkipPreview();
3697
+ const { showPreview } = useHMSPrebuiltContext();
3698
+ const authTokenInAppData = useAuthToken();
3699
+ const headerRef = useRef7();
3700
+ const footerRef = useRef7();
3701
+ const dropdownListRef = useRef7();
3702
+ const performAutoHide = hideControls && (isAndroid || isIOS || isIPadOS);
3703
+ const toggleControls = () => {
3704
+ var _a2;
3705
+ if (((_a2 = dropdownListRef.current) == null ? void 0 : _a2.length) === 0) {
3706
+ setHideControls((value) => !value);
3707
+ }
3708
+ };
3709
+ useEffect9(() => {
3710
+ let timeout = null;
3711
+ dropdownListRef.current = dropdownList || [];
3712
+ if (dropdownListRef.current.length === 0) {
3713
+ clearTimeout(timeout);
3714
+ timeout = setTimeout(() => {
3715
+ if (dropdownListRef.current.length === 0) {
3716
+ setHideControls(true);
3717
+ }
3718
+ }, 5e3);
3719
+ }
3720
+ return () => {
3721
+ clearTimeout(timeout);
3722
+ };
3723
+ }, [dropdownList, hideControls]);
3724
+ useEffect9(() => {
3725
+ if (!roomId) {
3726
+ navigate(`/`);
3727
+ return;
3728
+ }
3729
+ if (!showPreview) {
3730
+ return;
3731
+ }
3732
+ if (!prevState && !(roomState === HMSRoomState.Connecting || roomState === HMSRoomState.Reconnecting || isConnectedToRoom)) {
3733
+ if (role)
3734
+ navigate(`/preview/${roomId || ""}/${role}`);
3735
+ else
3736
+ navigate(`/preview/${roomId || ""}`);
3737
+ }
3738
+ }, [isConnectedToRoom, prevState, roomState, navigate, role, roomId, showPreview]);
3739
+ useEffect9(() => {
3740
+ if (authTokenInAppData && !isConnectedToRoom && !showPreview && roomState !== HMSRoomState.Connecting) {
3741
+ hmsActions.join({
3742
+ userName: "Test",
3743
+ authToken: authTokenInAppData,
3744
+ initEndpoint: define_process_env_default.REACT_APP_ENV ? `https://${define_process_env_default.REACT_APP_ENV}-init.100ms.live/init` : void 0,
3745
+ initialSettings: {
3746
+ isAudioMuted: skipPreview,
3747
+ isVideoMuted: skipPreview,
3748
+ speakerAutoSelectionBlacklist: ["Yeti Stereo Microphone"]
3749
+ }
3750
+ }).catch(console.error);
3751
+ }
3752
+ }, [authTokenInAppData, skipPreview, hmsActions, isConnectedToRoom, showPreview, roomState]);
3753
+ useEffect9(() => {
3754
+ if (isHeadless) {
3755
+ hmsActions.ignoreMessageTypes(["chat", EMOJI_REACTION_TYPE]);
3756
+ }
3757
+ }, [isHeadless, hmsActions]);
3758
+ if (!isConnectedToRoom) {
3759
+ return /* @__PURE__ */ React39.createElement(FullPageProgress_default, null);
3760
+ }
3761
+ return /* @__PURE__ */ React39.createElement(Flex, { css: { size: "100%", overflow: "hidden" }, direction: "column" }, !isHeadless && /* @__PURE__ */ React39.createElement(
3762
+ Box,
3763
+ {
3764
+ ref: headerRef,
3765
+ css: {
3766
+ h: "$18",
3767
+ transition: "margin 0.3s ease-in-out",
3768
+ marginTop: performAutoHide ? `-${(_a = headerRef.current) == null ? void 0 : _a.clientHeight}px` : "none",
3769
+ "@md": {
3770
+ h: "$17"
3771
+ }
3772
+ },
3773
+ "data-testid": "header"
3774
+ },
3775
+ /* @__PURE__ */ React39.createElement(Header, null)
3776
+ ), /* @__PURE__ */ React39.createElement(
3777
+ Box,
3778
+ {
3779
+ css: {
3780
+ w: "100%",
3781
+ flex: "1 1 0",
3782
+ minHeight: 0,
3783
+ paddingBottom: "env(safe-area-inset-bottom)"
3784
+ },
3785
+ id: "conferencing",
3786
+ "data-testid": "conferencing",
3787
+ onClick: toggleControls
3788
+ },
3789
+ /* @__PURE__ */ React39.createElement(ConferenceMainView, null)
3790
+ ), !isHeadless && /* @__PURE__ */ React39.createElement(
3791
+ Box,
3792
+ {
3793
+ ref: footerRef,
3794
+ css: {
3795
+ flexShrink: 0,
3796
+ maxHeight: "$24",
3797
+ transition: "margin 0.3s ease-in-out",
3798
+ marginBottom: performAutoHide ? `-${(_b = footerRef.current) == null ? void 0 : _b.clientHeight}px` : void 0,
3799
+ "@md": {
3800
+ maxHeight: "unset"
3801
+ }
3802
+ },
3803
+ "data-testid": "footer"
3804
+ },
3805
+ /* @__PURE__ */ React39.createElement(Footer2, null)
3806
+ ), /* @__PURE__ */ React39.createElement(RoleChangeRequestModal, null));
3807
+ };
3808
+ var conference_default = Conference;
3809
+ export {
3810
+ conference_default as default
3811
+ };
3812
+ //# sourceMappingURL=conference-IDNRO4WK.js.map