@100mslive/roomkit-react 0.3.22-alpha.3 → 0.3.22-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. package/dist/Accordion/Accordion.d.ts +322 -134
  2. package/dist/Accordion/index.d.ts +322 -134
  3. package/dist/Avatar/Avatar.d.ts +141 -47
  4. package/dist/Button/Button.d.ts +141 -47
  5. package/dist/Checkbox/Checkbox.d.ts +322 -134
  6. package/dist/Collapsible/Collapsible.d.ts +483 -201
  7. package/dist/Divider/Divider.d.ts +322 -134
  8. package/dist/Dropdown/Dropdown.d.ts +1932 -804
  9. package/dist/Fieldset/Fieldset.d.ts +141 -47
  10. package/dist/Footer/Footer.d.ts +1288 -536
  11. package/dist/{PDFView-RMR33QH4.css → HLSView-CNAJ5SBZ.css} +3 -3
  12. package/dist/{LeaveScreen-ZAG5UJZL.css.map → HLSView-CNAJ5SBZ.css.map} +1 -1
  13. package/dist/{HLSView-EYGGK6BH.js → HLSView-YIWJTBCT.js} +24 -38
  14. package/dist/HLSView-YIWJTBCT.js.map +7 -0
  15. package/dist/IconButton/IconButton.d.ts +141 -47
  16. package/dist/Input/Input.d.ts +926 -362
  17. package/dist/Label/Label.d.ts +141 -47
  18. package/dist/Layout/Box.d.ts +141 -47
  19. package/dist/Layout/Flex.d.ts +141 -47
  20. package/dist/Link/Link.d.ts +141 -47
  21. package/dist/Modal/Dialog.d.ts +987 -329
  22. package/dist/Modal/DialogContent.d.ts +1127 -469
  23. package/dist/Pagination/StyledPagination.d.ts +644 -268
  24. package/dist/Popover/index.d.ts +483 -201
  25. package/dist/Prebuilt/IconButton.d.ts +322 -134
  26. package/dist/Prebuilt/components/Chat/ChatBody.d.ts +322 -134
  27. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +805 -335
  28. package/dist/Prebuilt/components/Settings/common.d.ts +322 -134
  29. package/dist/Progress/index.d.ts +322 -134
  30. package/dist/RadioGroup/RadioGroup.d.ts +483 -201
  31. package/dist/ReactSelect/ReactSelect.d.ts +1610 -670
  32. package/dist/Select/Select.d.ts +483 -201
  33. package/dist/Sheet/Sheet.d.ts +987 -329
  34. package/dist/Slider/Slider.d.ts +141 -47
  35. package/dist/Stats/StyledStats.d.ts +966 -402
  36. package/dist/Switch/Switch.d.ts +141 -47
  37. package/dist/Tabs/Tabs.d.ts +644 -268
  38. package/dist/Text/Text.d.ts +141 -47
  39. package/dist/TextArea/TextArea.d.ts +141 -47
  40. package/dist/Theme/base.config.d.ts +78 -26
  41. package/dist/Theme/stitches.config.d.ts +1514 -1067
  42. package/dist/TileMenu/StyledMenuTile.d.ts +1127 -469
  43. package/dist/Toast/Toast.d.ts +946 -382
  44. package/dist/Video/Video.d.ts +141 -47
  45. package/dist/VideoList/StyledVideoList.d.ts +483 -201
  46. package/dist/VideoTile/StyledVideoTile.d.ts +1610 -670
  47. package/dist/chunk-4UCH4XSJ.js +34759 -0
  48. package/dist/chunk-4UCH4XSJ.js.map +7 -0
  49. package/dist/index.cjs.css +2 -2
  50. package/dist/index.cjs.css.map +1 -1
  51. package/dist/index.cjs.js +22367 -22558
  52. package/dist/index.cjs.js.map +4 -4
  53. package/dist/index.css +2 -2
  54. package/dist/index.css.map +1 -1
  55. package/dist/index.js +15 -25
  56. package/dist/meta.cjs.json +5076 -5434
  57. package/dist/meta.esbuild.json +6290 -9146
  58. package/package.json +8 -8
  59. package/src/Avatar/Avatar.tsx +1 -1
  60. package/src/Popover/Popover.stories.tsx +1 -1
  61. package/src/Prebuilt/App.tsx +2 -6
  62. package/src/Prebuilt/components/Chat/Chat.tsx +8 -12
  63. package/src/Prebuilt/components/Chat/ChatFooter.tsx +1 -1
  64. package/src/Prebuilt/components/Notifications/Notifications.tsx +171 -13
  65. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +2 -9
  66. package/src/Prebuilt/components/Notifications/ReconnectNotifications.tsx +5 -1
  67. package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.tsx +5 -7
  68. package/src/Prebuilt/components/Notifications/TrackNotifications.tsx +1 -23
  69. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx +5 -13
  70. package/src/Prebuilt/components/StatsForNerds.jsx +3 -32
  71. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +31 -43
  72. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +2 -2
  73. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +1 -3
  74. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +0 -6
  75. package/src/Prebuilt/layouts/HLSView.jsx +0 -1
  76. package/src/Prebuilt/layouts/PDFView.jsx +0 -1
  77. package/src/Prebuilt/layouts/SidePane.tsx +6 -12
  78. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +34 -35
  79. package/dist/ConferenceScreen-CSVWECB5.js +0 -1778
  80. package/dist/ConferenceScreen-CSVWECB5.js.map +0 -7
  81. package/dist/ConferenceScreen-YRURU3RV.css +0 -2780
  82. package/dist/ConferenceScreen-YRURU3RV.css.map +0 -7
  83. package/dist/EmbedView-N2E4DZQA.js +0 -17
  84. package/dist/EmbedView-N2E4DZQA.js.map +0 -7
  85. package/dist/EmbedView-S54NTHF5.css +0 -2780
  86. package/dist/EmbedView-S54NTHF5.css.map +0 -7
  87. package/dist/EmojiReaction-3X4ST4AU.js +0 -11
  88. package/dist/EmojiReaction-3X4ST4AU.js.map +0 -7
  89. package/dist/HLSView-EYGGK6BH.js.map +0 -7
  90. package/dist/HLSView-LBTFLMI4.css +0 -2780
  91. package/dist/HLSView-LBTFLMI4.css.map +0 -7
  92. package/dist/LeaveScreen-D6XU64JL.js +0 -556
  93. package/dist/LeaveScreen-D6XU64JL.js.map +0 -7
  94. package/dist/LeaveScreen-ZAG5UJZL.css +0 -2780
  95. package/dist/MoreSettings-R7B4BSNT.css +0 -2780
  96. package/dist/MoreSettings-R7B4BSNT.css.map +0 -7
  97. package/dist/MoreSettings-TBJVM7OY.js +0 -16
  98. package/dist/MoreSettings-TBJVM7OY.js.map +0 -7
  99. package/dist/PDFView-JOIJDP65.js +0 -84
  100. package/dist/PDFView-JOIJDP65.js.map +0 -7
  101. package/dist/PDFView-RMR33QH4.css.map +0 -7
  102. package/dist/Polls-IN3V2HFI.js +0 -1584
  103. package/dist/Polls-IN3V2HFI.js.map +0 -7
  104. package/dist/Polls-JW7JWGTE.css +0 -2780
  105. package/dist/Polls-JW7JWGTE.css.map +0 -7
  106. package/dist/Prebuilt/components/Notifications/DeviceChangeNotifications.d.ts +0 -1
  107. package/dist/Prebuilt/components/Notifications/ErrorNotifications.d.ts +0 -1
  108. package/dist/Prebuilt/components/Notifications/MessageNotifications.d.ts +0 -1
  109. package/dist/Prebuilt/components/Notifications/PollNotificationModal.d.ts +0 -1
  110. package/dist/Prebuilt/components/Notifications/RoleChangeNotification.d.ts +0 -1
  111. package/dist/RaiseHand-WES4KKMD.js +0 -10
  112. package/dist/RaiseHand-WES4KKMD.js.map +0 -7
  113. package/dist/RoleProminence-4ZBDBCMU.css +0 -2780
  114. package/dist/RoleProminence-4ZBDBCMU.css.map +0 -7
  115. package/dist/RoleProminence-PB32DLIB.js +0 -116
  116. package/dist/RoleProminence-PB32DLIB.js.map +0 -7
  117. package/dist/RoomDetailsPane-CZH2SNLE.js +0 -53
  118. package/dist/RoomDetailsPane-CZH2SNLE.js.map +0 -7
  119. package/dist/RoomDetailsPane-XWH2KEFI.css +0 -2780
  120. package/dist/RoomDetailsPane-XWH2KEFI.css.map +0 -7
  121. package/dist/ScreenshareLayout-XVENPVK3.js +0 -358
  122. package/dist/ScreenshareLayout-XVENPVK3.js.map +0 -7
  123. package/dist/ScreenshareLayout-YUW3KHAB.css +0 -2780
  124. package/dist/ScreenshareLayout-YUW3KHAB.css.map +0 -7
  125. package/dist/SidePaneTabs-QXCDHOGG.js +0 -1354
  126. package/dist/SidePaneTabs-QXCDHOGG.js.map +0 -7
  127. package/dist/SidePaneTabs-WQGVOWRP.css +0 -2780
  128. package/dist/SidePaneTabs-WQGVOWRP.css.map +0 -7
  129. package/dist/VBPicker-XN74N67R.js +0 -322
  130. package/dist/VBPicker-XN74N67R.js.map +0 -7
  131. package/dist/VBPicker-YDM2YIOM.css +0 -2780
  132. package/dist/VBPicker-YDM2YIOM.css.map +0 -7
  133. package/dist/WaitingView-77PRTIBV.js +0 -10
  134. package/dist/WaitingView-77PRTIBV.js.map +0 -7
  135. package/dist/WhiteboardLayout-FZC7SOSG.js +0 -96
  136. package/dist/WhiteboardLayout-FZC7SOSG.js.map +0 -7
  137. package/dist/WhiteboardLayout-MNTUWEVK.css +0 -2780
  138. package/dist/WhiteboardLayout-MNTUWEVK.css.map +0 -7
  139. package/dist/android-perm-1.png +0 -0
  140. package/dist/audio-level.png +0 -0
  141. package/dist/chunk-26D5FDBW.js +0 -16812
  142. package/dist/chunk-26D5FDBW.js.map +0 -7
  143. package/dist/chunk-2J5WS52X.js +0 -2595
  144. package/dist/chunk-2J5WS52X.js.map +0 -7
  145. package/dist/chunk-2LWOQMYY.js +0 -30
  146. package/dist/chunk-2LWOQMYY.js.map +0 -7
  147. package/dist/chunk-3MRQJSIY.js +0 -171
  148. package/dist/chunk-3MRQJSIY.js.map +0 -7
  149. package/dist/chunk-4X4WB7X3.js +0 -98
  150. package/dist/chunk-4X4WB7X3.js.map +0 -7
  151. package/dist/chunk-7QZJMUHM.js +0 -90
  152. package/dist/chunk-7QZJMUHM.js.map +0 -7
  153. package/dist/chunk-ABCV7TX5.js +0 -71
  154. package/dist/chunk-ABCV7TX5.js.map +0 -7
  155. package/dist/chunk-BQOT4DK7.js +0 -418
  156. package/dist/chunk-BQOT4DK7.js.map +0 -7
  157. package/dist/chunk-ENHSO6YN.js +0 -6337
  158. package/dist/chunk-ENHSO6YN.js.map +0 -7
  159. package/dist/chunk-JKWX7W4K.js +0 -161
  160. package/dist/chunk-JKWX7W4K.js.map +0 -7
  161. package/dist/chunk-LO4BXA4G.js +0 -114
  162. package/dist/chunk-LO4BXA4G.js.map +0 -7
  163. package/dist/chunk-MRVWNFXC.js +0 -59
  164. package/dist/chunk-MRVWNFXC.js.map +0 -7
  165. package/dist/chunk-OA4HW7HW.js +0 -262
  166. package/dist/chunk-OA4HW7HW.js.map +0 -7
  167. package/dist/chunk-PJQSPAFZ.js +0 -178
  168. package/dist/chunk-PJQSPAFZ.js.map +0 -7
  169. package/dist/chunk-QHQKY35W.js +0 -830
  170. package/dist/chunk-QHQKY35W.js.map +0 -7
  171. package/dist/chunk-QKXHQ6DV.js +0 -254
  172. package/dist/chunk-QKXHQ6DV.js.map +0 -7
  173. package/dist/chunk-RTWNTT77.js +0 -62
  174. package/dist/chunk-RTWNTT77.js.map +0 -7
  175. package/dist/chunk-TBXRX6MK.js +0 -576
  176. package/dist/chunk-TBXRX6MK.js.map +0 -7
  177. package/dist/chunk-TCOPR3BK.js +0 -487
  178. package/dist/chunk-TCOPR3BK.js.map +0 -7
  179. package/dist/chunk-VKORP2LF.js +0 -41
  180. package/dist/chunk-VKORP2LF.js.map +0 -7
  181. package/dist/chunk-YYVDCP5Z.js +0 -136
  182. package/dist/chunk-YYVDCP5Z.js.map +0 -7
  183. package/dist/empty-chat.svg +0 -12
  184. package/dist/ios-perm-0.png +0 -0
  185. package/dist/pdf-share.png +0 -0
  186. package/dist/screen-share.png +0 -0
  187. package/dist/transaction_error.svg +0 -12
  188. package/src/Prebuilt/components/Notifications/DeviceChangeNotifications.tsx +0 -18
  189. package/src/Prebuilt/components/Notifications/ErrorNotifications.tsx +0 -56
  190. package/src/Prebuilt/components/Notifications/MessageNotifications.tsx +0 -24
  191. package/src/Prebuilt/components/Notifications/PollNotificationModal.tsx +0 -71
  192. package/src/Prebuilt/components/Notifications/RoleChangeNotification.tsx +0 -24
@@ -1,2595 +0,0 @@
1
- import {
2
- StopRecordingInSheet
3
- } from "./chunk-QKXHQ6DV.js";
4
- import {
5
- EmojiReaction
6
- } from "./chunk-LO4BXA4G.js";
7
- import {
8
- useMyMetadata
9
- } from "./chunk-RTWNTT77.js";
10
- import {
11
- Accordion,
12
- ActionTile,
13
- Button,
14
- ChangeNameModal,
15
- Checkbox,
16
- Dialog,
17
- DialogContent,
18
- DialogDropdownTrigger,
19
- DialogRow,
20
- DialogSelect,
21
- Ee,
22
- HorizontalDivider,
23
- Input,
24
- Label,
25
- Loading,
26
- NoiseCancellation,
27
- PictureInPicture,
28
- RadioGroup,
29
- RoleChangeModal,
30
- SettingsModal_default,
31
- Sheet,
32
- Switch,
33
- TextArea,
34
- formatBytes,
35
- trackSourceOptions,
36
- trackTypeOptions,
37
- useDropdownSelection,
38
- useIsSidepaneTypeOpen,
39
- usePIPWindow,
40
- usePollViewToggle,
41
- useSheetToggle,
42
- useSidepaneToggle
43
- } from "./chunk-26D5FDBW.js";
44
- import {
45
- Text
46
- } from "./chunk-JKWX7W4K.js";
47
- import {
48
- Dropdown,
49
- ToastManager,
50
- useDropdownList,
51
- useFilteredRoles,
52
- useLandscapeHLSStream,
53
- useMobileHLSStream,
54
- useRecordingHandler
55
- } from "./chunk-BQOT4DK7.js";
56
- import {
57
- Box,
58
- Flex
59
- } from "./chunk-7QZJMUHM.js";
60
- import {
61
- IconButton,
62
- IconButton_default,
63
- Tooltip,
64
- getFormattedCount,
65
- usePinnedTrack,
66
- useRoomLayoutConferencingScreen,
67
- useRoomLayoutHeader,
68
- useSetAppDataByKey,
69
- useSetIsCaptionEnabled,
70
- useSetSubscribedChatSelector,
71
- useSetUiSettings,
72
- useShowPolls
73
- } from "./chunk-ENHSO6YN.js";
74
- import {
75
- APP_DATA,
76
- CAPTION_TOAST,
77
- CHAT_SELECTOR,
78
- DEFAULT_PORTAL_CONTAINER,
79
- RTMP_RECORD_DEFAULT_RESOLUTION,
80
- RTMP_RECORD_RESOLUTION_MAX,
81
- RTMP_RECORD_RESOLUTION_MIN,
82
- SHEET_OPTIONS,
83
- SIDE_PANE_OPTIONS,
84
- UI_SETTINGS,
85
- __async,
86
- __publicField,
87
- __spreadValues,
88
- config,
89
- getCssText,
90
- init_define_process_env,
91
- isMacOS,
92
- styled
93
- } from "./chunk-TBXRX6MK.js";
94
-
95
- // src/Prebuilt/components/MoreSettings/MoreSettings.tsx
96
- init_define_process_env();
97
- import React20 from "react";
98
- import { useMedia as useMedia4 } from "react-use";
99
-
100
- // src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx
101
- init_define_process_env();
102
- import React18, { Fragment as Fragment2, useState as useState12 } from "react";
103
- import { HMSHLSPlayer } from "@100mslive/hls-player";
104
- import { match as match2 } from "ts-pattern";
105
- import {
106
- HMSTranscriptionMode as HMSTranscriptionMode2,
107
- selectAppData,
108
- selectIsTranscriptionAllowedByMode,
109
- selectIsTranscriptionEnabled as selectIsTranscriptionEnabled2,
110
- selectLocalPeerID as selectLocalPeerID4,
111
- useHMSActions as useHMSActions12,
112
- useHMSStore as useHMSStore11
113
- } from "@100mslive/react-sdk";
114
- import {
115
- BrbIcon,
116
- CheckIcon as CheckIcon2,
117
- HamburgerMenuIcon,
118
- InfoIcon as InfoIcon2,
119
- OpenCaptionIcon,
120
- PipIcon as PipIcon2,
121
- SettingsIcon
122
- } from "@100mslive/react-icons";
123
-
124
- // src/Prebuilt/components/PIP/index.jsx
125
- init_define_process_env();
126
- import React2 from "react";
127
-
128
- // src/Prebuilt/components/PIP/PIPComponent.tsx
129
- init_define_process_env();
130
- import React, { useCallback, useEffect, useState } from "react";
131
- import { selectPeers, selectTracksMap, useHMSActions, useHMSVanillaStore } from "@100mslive/react-sdk";
132
- import { PipIcon } from "@100mslive/react-icons";
133
-
134
- // src/Prebuilt/components/PIP/SetupMediaSession.js
135
- init_define_process_env();
136
- import { selectIsLocalAudioEnabled, selectIsLocalVideoEnabled } from "@100mslive/react-sdk";
137
- var SetupMediaSession = class {
138
- constructor() {
139
- __publicField(this, "setup", (actions, store) => {
140
- this.actions = actions;
141
- this.store = store;
142
- this.initState();
143
- this.setUpHandlers();
144
- });
145
- __publicField(this, "initState", () => {
146
- var _a, _b, _c, _d;
147
- const isMicActive = this.store.getState(selectIsLocalAudioEnabled);
148
- const isCamActive = this.store.getState(selectIsLocalVideoEnabled);
149
- (_b = (_a = navigator.mediaSession) == null ? void 0 : _a.setMicrophoneActive) == null ? void 0 : _b.call(_a, isMicActive);
150
- (_d = (_c = navigator.mediaSession) == null ? void 0 : _c.setCameraActive) == null ? void 0 : _d.call(_c, isCamActive);
151
- this.store.subscribe((isMicActive2) => {
152
- var _a2, _b2;
153
- (_b2 = (_a2 = navigator.mediaSession) == null ? void 0 : _a2.setMicrophoneActive) == null ? void 0 : _b2.call(_a2, isMicActive2);
154
- }, selectIsLocalAudioEnabled);
155
- this.store.subscribe((isCamActive2) => {
156
- var _a2, _b2;
157
- (_b2 = (_a2 = navigator.mediaSession) == null ? void 0 : _a2.setCameraActive) == null ? void 0 : _b2.call(_a2, isCamActive2);
158
- }, selectIsLocalVideoEnabled);
159
- });
160
- __publicField(this, "toggleMic", () => __async(this, null, function* () {
161
- console.log("toggle mic clicked in pip");
162
- const current = this.store.getState(selectIsLocalAudioEnabled);
163
- yield this.actions.setLocalAudioEnabled(!current);
164
- }));
165
- __publicField(this, "toggleCam", () => __async(this, null, function* () {
166
- console.log("toggle cam clicked in pip");
167
- const current = this.store.getState(selectIsLocalVideoEnabled);
168
- yield this.actions.setLocalVideoEnabled(!current);
169
- }));
170
- __publicField(this, "leave", () => {
171
- console.log("leave called from pip");
172
- this.actions.leave();
173
- });
174
- __publicField(this, "setUpHandlers", () => {
175
- if (navigator.mediaSession) {
176
- try {
177
- navigator.mediaSession.setActionHandler("togglemicrophone", this.toggleMic);
178
- navigator.mediaSession.setActionHandler("togglecamera", this.toggleCam);
179
- navigator.mediaSession.setActionHandler("hangup", this.leave);
180
- } catch (err) {
181
- console.error("error in setting media session handlers", err);
182
- }
183
- }
184
- });
185
- }
186
- };
187
- var MediaSession = new SetupMediaSession();
188
-
189
- // src/Prebuilt/components/PIP/PIPComponent.tsx
190
- var PIPComponent = ({ content = null }) => {
191
- const [isPipOn, setIsPipOn] = useState(PictureInPicture.isOn());
192
- const hmsActions = useHMSActions();
193
- const store = useHMSVanillaStore();
194
- const onPipToggle = useCallback(() => {
195
- if (!isPipOn) {
196
- PictureInPicture.start(hmsActions, setIsPipOn).catch((err) => console.error("error in starting pip", err));
197
- MediaSession.setup(hmsActions, store);
198
- } else {
199
- PictureInPicture.stop().catch((err) => console.error("error in stopping pip", err));
200
- }
201
- }, [hmsActions, isPipOn, store]);
202
- if (!PictureInPicture.isSupported()) {
203
- return null;
204
- }
205
- return /* @__PURE__ */ React.createElement(React.Fragment, null, content ? /* @__PURE__ */ React.createElement(Flex, { css: { w: "100%" }, onClick: () => onPipToggle(), "data-testid": "pip_btn" }, content) : /* @__PURE__ */ React.createElement(Tooltip, { title: `${isPipOn ? "Deactivate" : "Activate"} picture in picture view` }, /* @__PURE__ */ React.createElement(IconButton_default, { active: !isPipOn, key: "pip", onClick: () => onPipToggle(), "data-testid": "pip_btn" }, /* @__PURE__ */ React.createElement(PipIcon, null))));
206
- };
207
- var ActivatedPIP = () => {
208
- const store = useHMSVanillaStore();
209
- const pinnedTrack = usePinnedTrack();
210
- useEffect(() => {
211
- function subscribeToStore() {
212
- return store.subscribe((tracksMap) => {
213
- let pipPeers = store.getState(selectPeers);
214
- if (pinnedTrack) {
215
- pipPeers = pipPeers.filter((peer) => pinnedTrack.peerId === peer.id);
216
- }
217
- PictureInPicture.updatePeersAndTracks(pipPeers, tracksMap).catch((err) => {
218
- console.error("error in updating pip", err);
219
- });
220
- }, selectTracksMap);
221
- }
222
- let unsubscribe = PictureInPicture.isOn() ? subscribeToStore() : void 0;
223
- PictureInPicture.listenToStateChange((isOn) => {
224
- if (isOn) {
225
- if (!unsubscribe) {
226
- unsubscribe = subscribeToStore();
227
- }
228
- } else {
229
- unsubscribe == null ? void 0 : unsubscribe();
230
- unsubscribe = void 0;
231
- }
232
- });
233
- return () => {
234
- unsubscribe == null ? void 0 : unsubscribe();
235
- unsubscribe = void 0;
236
- };
237
- }, [pinnedTrack, store]);
238
- return /* @__PURE__ */ React.createElement(React.Fragment, null);
239
- };
240
- var PIPComponent_default = PIPComponent;
241
-
242
- // src/Prebuilt/components/PIP/index.jsx
243
- var PIP = ({ content = null }) => {
244
- return /* @__PURE__ */ React2.createElement(PIPComponent_default, { content });
245
- };
246
-
247
- // src/Prebuilt/components/PIP/PIPChat.tsx
248
- init_define_process_env();
249
- import React7, { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo2, useState as useState5 } from "react";
250
- import {
251
- selectHMSMessages as selectHMSMessages2,
252
- selectLocalPeerID as selectLocalPeerID2,
253
- selectPeerNameByID as selectPeerNameByID3,
254
- selectSessionStore as selectSessionStore5,
255
- selectUnreadHMSMessagesCount as selectUnreadHMSMessagesCount2,
256
- useHMSStore as useHMSStore5
257
- } from "@100mslive/react-sdk";
258
- import { SendIcon } from "@100mslive/react-icons";
259
-
260
- // src/Prebuilt/components/Chat/ChatBody.tsx
261
- init_define_process_env();
262
- import React6, { Fragment, useCallback as useCallback5, useEffect as useEffect3, useLayoutEffect, useMemo, useRef, useState as useState4 } from "react";
263
- import { useMedia as useMedia2 } from "react-use";
264
- import AutoSizer from "react-virtualized-auto-sizer";
265
- import { VariableSizeList } from "react-window";
266
- import {
267
- selectHMSMessages,
268
- selectLocalPeerID,
269
- selectLocalPeerName as selectLocalPeerName2,
270
- selectLocalPeerRoleName,
271
- selectPeerNameByID as selectPeerNameByID2,
272
- selectSessionStore as selectSessionStore4,
273
- selectUnreadHMSMessagesCount,
274
- useHMSActions as useHMSActions5,
275
- useHMSStore as useHMSStore4,
276
- useHMSVanillaStore as useHMSVanillaStore3
277
- } from "@100mslive/react-sdk";
278
- import { SolidPinIcon } from "@100mslive/react-icons";
279
-
280
- // src/Prebuilt/components/Chat/ChatActions.tsx
281
- init_define_process_env();
282
- import React4, { useCallback as useCallback4, useState as useState2 } from "react";
283
- import { selectLocalPeerName, selectPermissions, useHMSActions as useHMSActions4, useHMSStore as useHMSStore2 } from "@100mslive/react-sdk";
284
- import {
285
- CopyIcon,
286
- CrossCircleIcon,
287
- CrossIcon,
288
- EyeCloseIcon,
289
- PeopleRemoveIcon,
290
- PinIcon,
291
- ReplyGroupIcon,
292
- ReplyIcon,
293
- VerticalMenuIcon
294
- } from "@100mslive/react-icons";
295
-
296
- // src/Prebuilt/components/Chat/MwebChatOption.tsx
297
- init_define_process_env();
298
- import React3 from "react";
299
- var MwebChatOption = ({
300
- icon,
301
- text,
302
- onClick,
303
- color = "$on_surface_high"
304
- }) => {
305
- return /* @__PURE__ */ React3.createElement(Flex, { align: "center", css: { w: "100%", color, cursor: "pointer", gap: "$4", p: "$8" }, onClick }, icon, /* @__PURE__ */ React3.createElement(Text, { variant: "sm", css: { color, fontWeight: "$semiBold" } }, text));
306
- };
307
-
308
- // src/Prebuilt/components/hooks/useChatBlacklist.ts
309
- init_define_process_env();
310
- import { useCallback as useCallback2 } from "react";
311
- import { selectLocalPeer, selectSessionStore, useHMSActions as useHMSActions2, useHMSStore } from "@100mslive/react-sdk";
312
- var useChatBlacklist = (sessionStoreKey) => {
313
- const hmsActions = useHMSActions2();
314
- const blacklistedIDs = useHMSStore(selectSessionStore(sessionStoreKey));
315
- const blacklistItem = useCallback2(
316
- (blacklistID) => __async(void 0, null, function* () {
317
- yield hmsActions.sessionStore.set(sessionStoreKey, [...blacklistedIDs || [], blacklistID]).catch((err) => ToastManager.addToast({ title: err.description }));
318
- }),
319
- [hmsActions, sessionStoreKey, blacklistedIDs]
320
- );
321
- return { blacklistItem, blacklistedIDs };
322
- };
323
- var useIsPeerBlacklisted = ({ local = false, peerCustomerUserId = "" }) => {
324
- const localPeer = useHMSStore(selectLocalPeer);
325
- const blacklistedPeerIDs = useHMSStore(selectSessionStore("chatPeerBlacklist" /* CHAT_PEER_BLACKLIST */)) || [];
326
- return blacklistedPeerIDs == null ? void 0 : blacklistedPeerIDs.includes(local ? localPeer == null ? void 0 : localPeer.customerUserId : peerCustomerUserId);
327
- };
328
-
329
- // src/Prebuilt/components/hooks/usePinnedMessages.ts
330
- init_define_process_env();
331
- import { useCallback as useCallback3 } from "react";
332
- import {
333
- selectPeerNameByID,
334
- selectSessionStore as selectSessionStore2,
335
- useHMSActions as useHMSActions3,
336
- useHMSVanillaStore as useHMSVanillaStore2
337
- } from "@100mslive/react-sdk";
338
- var usePinnedMessages = () => {
339
- const hmsActions = useHMSActions3();
340
- const vanillaStore = useHMSVanillaStore2();
341
- const setPinnedMessages = useCallback3(
342
- (message, pinnedBy) => __async(void 0, null, function* () {
343
- const peerName = vanillaStore.getState(selectPeerNameByID(message == null ? void 0 : message.sender)) || (message == null ? void 0 : message.senderName);
344
- const newPinnedMessage = { text: "", id: message.id, pinnedBy };
345
- if (message && peerName) {
346
- newPinnedMessage["text"] = `${peerName}: ${message.message}`;
347
- } else if (message) {
348
- newPinnedMessage["text"] = message.message;
349
- }
350
- const pinnedMessages = vanillaStore.getState(selectSessionStore2("pinnedMessages" /* PINNED_MESSAGES */)) || [];
351
- if (!(pinnedMessages == null ? void 0 : pinnedMessages.find((pinnedMessage) => pinnedMessage.id === newPinnedMessage.id))) {
352
- yield hmsActions.sessionStore.set("pinnedMessages" /* PINNED_MESSAGES */, [...pinnedMessages, newPinnedMessage].slice(-3)).catch((err) => ToastManager.addToast({ title: err.description }));
353
- }
354
- }),
355
- [hmsActions, vanillaStore]
356
- );
357
- const removePinnedMessage = useCallback3(
358
- (indexToRemove) => __async(void 0, null, function* () {
359
- const pinnedMessages = vanillaStore.getState(selectSessionStore2("pinnedMessages" /* PINNED_MESSAGES */)) || [];
360
- if (pinnedMessages[indexToRemove]) {
361
- yield hmsActions.sessionStore.set(
362
- "pinnedMessages" /* PINNED_MESSAGES */,
363
- pinnedMessages.filter((_, index) => index !== indexToRemove)
364
- ).catch((err) => ToastManager.addToast({ title: err.description }));
365
- }
366
- }),
367
- [hmsActions, vanillaStore]
368
- );
369
- const unpinBlacklistedMessages = useCallback3(
370
- (blacklistedMessageIDSet) => __async(void 0, null, function* () {
371
- const pinnedMessages = vanillaStore.getState(selectSessionStore2("pinnedMessages" /* PINNED_MESSAGES */)) || [];
372
- const filteredPinnedMessages = pinnedMessages == null ? void 0 : pinnedMessages.filter(
373
- (pinnedMessage) => !(blacklistedMessageIDSet == null ? void 0 : blacklistedMessageIDSet.has(pinnedMessage.id))
374
- );
375
- yield hmsActions.sessionStore.set("pinnedMessages" /* PINNED_MESSAGES */, filteredPinnedMessages).catch((err) => ToastManager.addToast({ title: err.description }));
376
- }),
377
- [hmsActions, vanillaStore]
378
- );
379
- return { setPinnedMessages, removePinnedMessage, unpinBlacklistedMessages };
380
- };
381
-
382
- // src/Prebuilt/components/Chat/ChatActions.tsx
383
- var iconStyle = { height: "1.125rem", width: "1.125rem" };
384
- var tooltipBoxCSS = {
385
- fontSize: "$xs",
386
- backgroundColor: "$surface_default",
387
- p: "$1 $5",
388
- fontWeight: "$regular",
389
- borderRadius: "$3"
390
- };
391
- var ChatActions = ({
392
- showPinAction,
393
- onReply,
394
- onReplyGroup,
395
- showReply,
396
- message,
397
- sentByLocalPeer,
398
- isMobile,
399
- openSheet,
400
- setOpenSheet
401
- }) => {
402
- var _a, _b;
403
- const { elements } = useRoomLayoutConferencingScreen();
404
- const { can_hide_message = false, can_block_user = false } = ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.real_time_controls) || {};
405
- const { roles_whitelist = [] } = (elements == null ? void 0 : elements.chat) || {};
406
- const [open, setOpen] = useState2(false);
407
- const actions = useHMSActions4();
408
- const canRemoveOthers = (_b = useHMSStore2(selectPermissions)) == null ? void 0 : _b.removeOthers;
409
- const { blacklistItem: blacklistPeer } = useChatBlacklist("chatPeerBlacklist" /* CHAT_PEER_BLACKLIST */);
410
- const localPeerName = useHMSStore2(selectLocalPeerName);
411
- const { setPinnedMessages, unpinBlacklistedMessages } = usePinnedMessages();
412
- const { blacklistItem: blacklistMessage, blacklistedIDs: blacklistedMessageIDs } = useChatBlacklist(
413
- "chatMessageBlacklist" /* CHAT_MESSAGE_BLACKLIST */
414
- );
415
- const isSenderBlocked = useIsPeerBlacklisted({ peerCustomerUserId: message.senderUserId });
416
- const updatePinnedMessages = useCallback4(
417
- (messageID = "") => {
418
- const blacklistedMessageIDSet = /* @__PURE__ */ new Set([...blacklistedMessageIDs || [], messageID]);
419
- unpinBlacklistedMessages(blacklistedMessageIDSet);
420
- },
421
- [blacklistedMessageIDs, unpinBlacklistedMessages]
422
- );
423
- const copyMessageContent = useCallback4(() => {
424
- try {
425
- navigator == null ? void 0 : navigator.clipboard.writeText(message.message);
426
- ToastManager.addToast({
427
- title: "Message copied successfully"
428
- });
429
- } catch (e) {
430
- console.log(e);
431
- ToastManager.addToast({
432
- title: "Could not copy message"
433
- });
434
- }
435
- }, [message]);
436
- const options = {
437
- reply: {
438
- text: "Reply privately",
439
- tooltipText: "Reply privately",
440
- icon: /* @__PURE__ */ React4.createElement(ReplyIcon, { style: iconStyle }),
441
- onClick: onReply,
442
- show: showReply
443
- },
444
- replyGroup: {
445
- text: "Reply to group",
446
- tooltipText: "Reply to group",
447
- icon: /* @__PURE__ */ React4.createElement(ReplyGroupIcon, { style: iconStyle }),
448
- onClick: onReplyGroup,
449
- show: !!message.senderRole && roles_whitelist.includes(message.senderRole)
450
- },
451
- pin: {
452
- text: "Pin message",
453
- tooltipText: "Pin",
454
- icon: /* @__PURE__ */ React4.createElement(PinIcon, { style: iconStyle }),
455
- onClick: () => setPinnedMessages(message, localPeerName || ""),
456
- show: showPinAction
457
- },
458
- copy: {
459
- text: "Copy text",
460
- tooltipText: "Copy",
461
- icon: /* @__PURE__ */ React4.createElement(CopyIcon, { style: iconStyle }),
462
- onClick: copyMessageContent,
463
- show: true
464
- },
465
- hide: {
466
- text: message.recipientPeer ? "Hide for both" : "Hide for everyone",
467
- icon: /* @__PURE__ */ React4.createElement(EyeCloseIcon, { style: iconStyle }),
468
- onClick: () => __async(void 0, null, function* () {
469
- blacklistMessage(message.id);
470
- updatePinnedMessages(message.id);
471
- }),
472
- show: !!can_hide_message
473
- },
474
- block: {
475
- text: "Block from chat",
476
- icon: /* @__PURE__ */ React4.createElement(CrossCircleIcon, { style: iconStyle }),
477
- onClick: () => __async(void 0, null, function* () {
478
- if (message.senderUserId) {
479
- blacklistPeer(message.senderUserId);
480
- }
481
- }),
482
- color: "$alert_error_default",
483
- show: !!can_block_user && !sentByLocalPeer && !isSenderBlocked
484
- },
485
- remove: {
486
- text: "Remove participant",
487
- icon: /* @__PURE__ */ React4.createElement(PeopleRemoveIcon, { style: iconStyle }),
488
- color: "$alert_error_default",
489
- show: !!canRemoveOthers && !sentByLocalPeer,
490
- onClick: () => __async(void 0, null, function* () {
491
- if (!message.sender) {
492
- return;
493
- }
494
- try {
495
- yield actions.removePeer(message.sender, "");
496
- } catch (error) {
497
- ToastManager.addToast({ title: error.message, variant: "error" });
498
- }
499
- })
500
- }
501
- };
502
- if (isMobile) {
503
- return /* @__PURE__ */ React4.createElement(Sheet.Root, { open: openSheet, onOpenChange: setOpenSheet }, /* @__PURE__ */ React4.createElement(Sheet.Content, { css: { bg: "$surface_default", pb: "$14" }, onClick: (e) => setOpenSheet(false, e) }, /* @__PURE__ */ React4.createElement(
504
- Sheet.Title,
505
- {
506
- css: {
507
- display: "flex",
508
- color: "$on_surface_high",
509
- w: "100%",
510
- justifyContent: "space-between",
511
- mt: "$8",
512
- fontSize: "$md",
513
- px: "$10",
514
- pb: "$8",
515
- borderBottom: "1px solid $border_bright",
516
- alignItems: "center"
517
- }
518
- },
519
- "Message options",
520
- /* @__PURE__ */ React4.createElement(Sheet.Close, { css: { color: "$on_surface_high" }, onClick: (e) => setOpenSheet(false, e) }, /* @__PURE__ */ React4.createElement(CrossIcon, null))
521
- ), Object.keys(options).map((optionKey) => {
522
- const option = options[optionKey];
523
- return option.show ? /* @__PURE__ */ React4.createElement(
524
- MwebChatOption,
525
- {
526
- key: optionKey,
527
- text: option.text,
528
- icon: option.icon,
529
- onClick: option.onClick,
530
- color: option == null ? void 0 : option.color
531
- }
532
- ) : null;
533
- })));
534
- }
535
- return /* @__PURE__ */ React4.createElement(Dropdown.Root, { open, onOpenChange: setOpen, css: { "@md": { display: "none" } } }, /* @__PURE__ */ React4.createElement(
536
- Flex,
537
- {
538
- className: "chat_actions",
539
- css: {
540
- background: "$surface_bright",
541
- borderRadius: "$1",
542
- p: "$2",
543
- opacity: open ? 1 : 0,
544
- position: "absolute",
545
- top: 0,
546
- right: 0,
547
- zIndex: 1,
548
- "@md": { opacity: 1 }
549
- }
550
- },
551
- options.reply.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.reply.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { "data-testid": "reply_message_btn", onClick: options.reply.onClick }, options.reply.icon)) : null,
552
- options.replyGroup.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.replyGroup.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { "data-testid": "reply_group_message_btn", onClick: options.replyGroup.onClick }, options.replyGroup.icon)) : null,
553
- options.pin.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.pin.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { "data-testid": "pin_message_btn", onClick: options.pin.onClick }, options.pin.icon)) : null,
554
- options.copy.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.copy.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { onClick: options.copy.onClick, "data-testid": "copy_message_btn" }, /* @__PURE__ */ React4.createElement(CopyIcon, { style: iconStyle }))) : null,
555
- options.block.show || options.hide.show || options.remove.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: "More actions" }, /* @__PURE__ */ React4.createElement(Dropdown.Trigger, { asChild: true }, /* @__PURE__ */ React4.createElement(IconButton, null, /* @__PURE__ */ React4.createElement(VerticalMenuIcon, { style: iconStyle })))) : null
556
- ), /* @__PURE__ */ React4.createElement(Dropdown.Portal, null, /* @__PURE__ */ React4.createElement(
557
- Dropdown.Content,
558
- {
559
- sideOffset: 5,
560
- align: "end",
561
- css: { width: "$48", backgroundColor: "$surface_bright", py: "$0", border: "1px solid $border_bright" }
562
- },
563
- options.hide.show ? /* @__PURE__ */ React4.createElement(Dropdown.Item, { "data-testid": "hide_message_btn", onClick: options.hide.onClick }, options.hide.icon, /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", fontWeight: "$semiBold" } }, options.hide.text)) : null,
564
- options.block.show ? /* @__PURE__ */ React4.createElement(
565
- Dropdown.Item,
566
- {
567
- "data-testid": "block_peer_btn",
568
- onClick: options.block.onClick,
569
- css: { color: options.block.color }
570
- },
571
- options.block.icon,
572
- /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", color: "inherit", fontWeight: "$semiBold" } }, options.block.text)
573
- ) : null,
574
- options.remove.show ? /* @__PURE__ */ React4.createElement(
575
- Dropdown.Item,
576
- {
577
- "data-testid": "remove_peer_btn",
578
- onClick: options.remove.onClick,
579
- css: { color: options.remove.color }
580
- },
581
- options.remove.icon,
582
- /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", color: "inherit", fontWeight: "$semiBold" } }, options.remove.text)
583
- ) : null
584
- )));
585
- };
586
-
587
- // src/Prebuilt/components/Chat/EmptyChat.tsx
588
- init_define_process_env();
589
- import React5 from "react";
590
- import { useMedia } from "react-use";
591
-
592
- // src/Prebuilt/images/empty-chat.svg
593
- var empty_chat_default = "./empty-chat.svg";
594
-
595
- // src/Prebuilt/components/Chat/EmptyChat.tsx
596
- var EmptyChat = () => {
597
- var _a;
598
- const { elements } = useRoomLayoutConferencingScreen();
599
- const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
600
- const isMobile = useMedia(config.media.md);
601
- const canSendMessages = elements.chat && (elements.chat.public_chat_enabled || elements.chat.private_chat_enabled || elements.chat.roles_whitelist && elements.chat.roles_whitelist.length) && !isLocalPeerBlacklisted;
602
- const isMobileHLSStream = useMobileHLSStream();
603
- const isLandscapeStream = useLandscapeHLSStream();
604
- const streaming = isMobileHLSStream || isLandscapeStream;
605
- if (isMobile && ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.is_overlay) && !streaming)
606
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null);
607
- return /* @__PURE__ */ React5.createElement(
608
- Flex,
609
- {
610
- css: {
611
- width: "100%",
612
- flex: "1 1 0",
613
- textAlign: "center",
614
- px: "$4"
615
- },
616
- align: "center",
617
- justify: "center"
618
- },
619
- /* @__PURE__ */ React5.createElement(Box, null, /* @__PURE__ */ React5.createElement(Box, { css: { m: "0 auto", mt: "$4", "@media (max-height: 575px)": { display: "none" } } }, /* @__PURE__ */ React5.createElement("img", { src: empty_chat_default, style: { display: "inline" }, alt: "Empty Chat", height: 132, width: 185 })), /* @__PURE__ */ React5.createElement(Text, { variant: "h5", css: { mt: "$8", c: "$on_surface_high" } }, canSendMessages ? "Start a conversation" : "No messages yet"), canSendMessages ? /* @__PURE__ */ React5.createElement(
620
- Text,
621
- {
622
- variant: "sm",
623
- css: { mt: "$4", maxWidth: "80%", textAlign: "center", mx: "auto", c: "$on_surface_medium" }
624
- },
625
- "There are no messages here yet. Start a conversation by sending a message."
626
- ) : null)
627
- );
628
- };
629
-
630
- // src/Prebuilt/components/hooks/usePinnedBy.tsx
631
- init_define_process_env();
632
- import { useEffect as useEffect2, useState as useState3 } from "react";
633
- import { selectSessionStore as selectSessionStore3, useHMSStore as useHMSStore3 } from "@100mslive/react-sdk";
634
- var usePinnedBy = (messageId) => {
635
- const pinnedMessages = useHMSStore3(selectSessionStore3("pinnedMessages" /* PINNED_MESSAGES */));
636
- const [pinnedBy, setPinnedBy] = useState3("");
637
- useEffect2(() => {
638
- let match4 = "";
639
- pinnedMessages == null ? void 0 : pinnedMessages.forEach((pinnedMessage) => {
640
- if (pinnedMessage.id === messageId) {
641
- match4 = pinnedMessage.pinnedBy;
642
- }
643
- });
644
- setPinnedBy(match4);
645
- }, [messageId, pinnedMessages]);
646
- return pinnedBy;
647
- };
648
-
649
- // src/Prebuilt/components/Chat/utils.ts
650
- init_define_process_env();
651
- var formatTime = (date) => {
652
- if (!(date instanceof Date)) {
653
- return "";
654
- }
655
- const hours = date.getHours();
656
- const minutes = date.getMinutes();
657
- const suffix = hours > 11 ? "PM" : "AM";
658
- return `${hours < 10 ? "0" : ""}${hours}:${minutes < 10 ? "0" : ""}${minutes} ${suffix}`;
659
- };
660
- var CHAT_MESSAGE_LIMIT = 2e3;
661
-
662
- // src/Prebuilt/components/Chat/ChatBody.tsx
663
- var rowHeights = {};
664
- var listInstance = null;
665
- function getRowHeight(index) {
666
- var _a;
667
- return ((_a = rowHeights[index]) == null ? void 0 : _a.size) || 72;
668
- }
669
- var setRowHeight = (index, id, size) => {
670
- var _a, _b;
671
- if (((_a = rowHeights[index]) == null ? void 0 : _a.id) === id && ((_b = rowHeights[index]) == null ? void 0 : _b.size) === size) {
672
- return;
673
- }
674
- listInstance == null ? void 0 : listInstance.resetAfterIndex(Math.max(index - 1, 0));
675
- Object.assign(rowHeights, { [index]: { size, id } });
676
- };
677
- var getMessageBackgroundColor = (messageType, selectedPeerID, selectedRole, isOverlay) => {
678
- if (messageType && !(selectedPeerID || selectedRole)) {
679
- return isOverlay ? "rgba(0, 0, 0, 0.64)" : "$surface_default";
680
- }
681
- return "";
682
- };
683
- var MessageTypeContainer = ({ left, right }) => {
684
- return /* @__PURE__ */ React6.createElement(
685
- Flex,
686
- {
687
- align: "center",
688
- css: {
689
- ml: "$2",
690
- mr: "$4",
691
- gap: "$space$2",
692
- flexWrap: "nowrap"
693
- }
694
- },
695
- left && /* @__PURE__ */ React6.createElement(
696
- Text,
697
- {
698
- variant: "xs",
699
- as: "span",
700
- css: {
701
- color: "$on_surface_medium",
702
- textTransform: "capitalize",
703
- fontWeight: "$regular",
704
- whiteSpace: "nowrap"
705
- }
706
- },
707
- left
708
- ),
709
- right && /* @__PURE__ */ React6.createElement(
710
- Text,
711
- {
712
- as: "span",
713
- variant: "overline",
714
- css: {
715
- color: "$on_surface_medium",
716
- fontWeight: "$regular",
717
- whiteSpace: "nowrap"
718
- }
719
- },
720
- right
721
- )
722
- );
723
- };
724
- var MessageType = ({
725
- roles,
726
- hasCurrentUserSent,
727
- receiver
728
- }) => {
729
- const peerName = useHMSStore4(selectPeerNameByID2(receiver));
730
- const localPeerRoleName = useHMSStore4(selectLocalPeerRoleName);
731
- if (receiver) {
732
- return /* @__PURE__ */ React6.createElement(MessageTypeContainer, { left: hasCurrentUserSent ? `${peerName ? `to ${peerName}` : ""}` : "to You", right: "(DM)" });
733
- }
734
- if (roles && roles.length) {
735
- return /* @__PURE__ */ React6.createElement(MessageTypeContainer, { left: `to ${hasCurrentUserSent ? roles[0] : localPeerRoleName}`, right: "(Group)" });
736
- }
737
- return null;
738
- };
739
- var URL_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
740
- var Link = styled("a", {
741
- color: "$primary_default",
742
- wordBreak: "break-word",
743
- "&:hover": {
744
- textDecoration: "underline"
745
- }
746
- });
747
- var AnnotisedMessage = ({ message, length }) => {
748
- if (!message) {
749
- return /* @__PURE__ */ React6.createElement(Fragment, null);
750
- }
751
- return /* @__PURE__ */ React6.createElement(Fragment, null, message.trim().split(/(\s)/).map(
752
- (part) => URL_REGEX.test(part) ? /* @__PURE__ */ React6.createElement(Link, { href: part, key: part, target: "_blank", rel: "noopener noreferrer" }, part.slice(0, length)) : part.slice(0, length)
753
- ));
754
- };
755
- var getMessageType = ({ roles, receiver }) => {
756
- if (roles && roles.length > 0) {
757
- return "role";
758
- }
759
- return receiver ? "private" : "";
760
- };
761
- var SenderName = styled(Text, {
762
- overflow: "hidden",
763
- textOverflow: "ellipsis",
764
- whiteSpace: "nowrap",
765
- width: "100%",
766
- minWidth: 0,
767
- color: "$on_surface_high",
768
- fontWeight: "$semiBold"
769
- });
770
- var ChatMessage = React6.memo(
771
- ({ index, style = {}, message }) => {
772
- var _a, _b, _c;
773
- const { elements } = useRoomLayoutConferencingScreen();
774
- const rowRef = useRef(null);
775
- const isMobile = useMedia2(config.media.md);
776
- const isPrivateChatEnabled = !!((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.private_chat_enabled);
777
- const isOverlay = ((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.is_overlay) && isMobile;
778
- const localPeerId = useHMSStore4(selectLocalPeerID);
779
- const [selectedRole, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
780
- const [selectedPeer, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER);
781
- const messageType = getMessageType({
782
- roles: message.recipientRoles,
783
- receiver: message.recipientPeer
784
- });
785
- const [openSheet, setOpenSheetBare] = useState4(false);
786
- const showPinAction = !!((_c = elements == null ? void 0 : elements.chat) == null ? void 0 : _c.allow_pinning_messages);
787
- const showReply = message.sender !== selectedPeer.id && message.sender !== localPeerId && isPrivateChatEnabled;
788
- useLayoutEffect(() => {
789
- if (rowRef.current) {
790
- setRowHeight(index, message.id, rowRef.current.clientHeight);
791
- }
792
- }, [index, message.id]);
793
- const setOpenSheet = (value, e) => {
794
- e == null ? void 0 : e.stopPropagation();
795
- setOpenSheetBare(value);
796
- };
797
- return /* @__PURE__ */ React6.createElement(
798
- Box,
799
- {
800
- css: {
801
- mb: "$5",
802
- pr: "$10",
803
- mt: "$4",
804
- "&:not(:hover} .chat_actions": { display: "none" },
805
- "&:hover .chat_actions": { display: "flex", opacity: 1 }
806
- },
807
- style
808
- },
809
- /* @__PURE__ */ React6.createElement(
810
- Flex,
811
- {
812
- ref: rowRef,
813
- align: "center",
814
- css: {
815
- flexWrap: "wrap",
816
- position: "relative",
817
- // Theme independent color, token should not be used for transparent chat
818
- background: getMessageBackgroundColor(messageType, selectedPeer.id, selectedRole, !!isOverlay),
819
- r: "$1",
820
- p: "$4",
821
- userSelect: "none",
822
- "@md": {
823
- cursor: "pointer"
824
- },
825
- "&:hover": {
826
- background: "linear-gradient(277deg, $surface_default 0%, $surface_dim 60.87%)"
827
- }
828
- },
829
- "data-testid": "chat_msg",
830
- onClick: (e) => {
831
- if (isMobile) {
832
- setOpenSheet(true, e);
833
- }
834
- }
835
- },
836
- /* @__PURE__ */ React6.createElement(PinnedBy, { messageId: message.id, index, rowRef }),
837
- /* @__PURE__ */ React6.createElement(
838
- Text,
839
- {
840
- css: {
841
- color: isOverlay ? "#FFF" : "$on_surface_high",
842
- fontWeight: "$semiBold",
843
- display: "flex",
844
- alignItems: "center",
845
- alignSelf: "stretch",
846
- width: "100%"
847
- },
848
- as: "div"
849
- },
850
- /* @__PURE__ */ React6.createElement(
851
- Flex,
852
- {
853
- align: "baseline",
854
- css: {
855
- flexWrap: "nowrap",
856
- maxWidth: "calc(100% - 10ch)",
857
- textOverflow: "ellipsis",
858
- whiteSpace: "nowrap"
859
- }
860
- },
861
- message.senderName === "You" || !message.senderName ? /* @__PURE__ */ React6.createElement(
862
- SenderName,
863
- {
864
- as: "span",
865
- variant: "sub2",
866
- css: { color: isOverlay ? "#FFF" : "$on_surface_high", fontWeight: "$semiBold" }
867
- },
868
- message.senderName || "Anonymous"
869
- ) : /* @__PURE__ */ React6.createElement(Tooltip, { title: message.senderName, side: "top", align: "start", boxCss: { zIndex: 50 } }, /* @__PURE__ */ React6.createElement(
870
- SenderName,
871
- {
872
- as: "span",
873
- variant: "sub2",
874
- css: { color: isOverlay ? "#FFF" : "$on_surface_high", fontWeight: "$semiBold" }
875
- },
876
- message.sender === localPeerId ? `${message.senderName} (You)` : message.senderName
877
- )),
878
- /* @__PURE__ */ React6.createElement(
879
- MessageType,
880
- {
881
- hasCurrentUserSent: message.sender === localPeerId,
882
- receiver: message.recipientPeer,
883
- roles: message.recipientRoles
884
- }
885
- )
886
- ),
887
- !isOverlay ? /* @__PURE__ */ React6.createElement(
888
- Text,
889
- {
890
- as: "span",
891
- variant: "caption",
892
- css: {
893
- color: "$on_surface_medium",
894
- flexShrink: 0,
895
- position: "absolute",
896
- right: 0,
897
- zIndex: 1,
898
- mr: "$4",
899
- p: "$2"
900
- }
901
- },
902
- formatTime(message.time)
903
- ) : null,
904
- /* @__PURE__ */ React6.createElement(
905
- ChatActions,
906
- {
907
- showPinAction,
908
- message,
909
- sentByLocalPeer: message.sender === localPeerId,
910
- onReply: () => {
911
- setRoleSelector("");
912
- setPeerSelector({ id: message.sender, name: message.senderName });
913
- },
914
- onReplyGroup: () => {
915
- if (message.senderRole) {
916
- setRoleSelector(message.senderRole);
917
- setPeerSelector({});
918
- }
919
- },
920
- showReply,
921
- isMobile,
922
- openSheet,
923
- setOpenSheet
924
- }
925
- )
926
- ),
927
- /* @__PURE__ */ React6.createElement(
928
- Text,
929
- {
930
- variant: "sm",
931
- css: {
932
- w: "100%",
933
- mt: "$2",
934
- wordBreak: "break-word",
935
- whiteSpace: "pre-wrap",
936
- userSelect: "all",
937
- color: isOverlay ? "#FFF" : "$on_surface_high"
938
- },
939
- onClick: (e) => {
940
- setOpenSheet(true, e);
941
- }
942
- },
943
- /* @__PURE__ */ React6.createElement(AnnotisedMessage, { message: message.message })
944
- )
945
- )
946
- );
947
- }
948
- );
949
- var MessageWrapper = React6.memo(
950
- ({ index, style, data }) => {
951
- return /* @__PURE__ */ React6.createElement(ChatMessage, { style, index, key: data[index].id, message: data[index] });
952
- }
953
- );
954
- var VirtualizedChatMessages = React6.forwardRef(({ messages, scrollToBottom }, listRef) => {
955
- const hmsActions = useHMSActions5();
956
- const itemKey = useCallback5((index, data) => {
957
- return data[index].id;
958
- }, []);
959
- useEffect3(() => {
960
- requestAnimationFrame(() => scrollToBottom(1));
961
- }, [scrollToBottom]);
962
- return /* @__PURE__ */ React6.createElement(
963
- Box,
964
- {
965
- css: {
966
- mr: "-$10",
967
- h: "100%"
968
- }
969
- },
970
- /* @__PURE__ */ React6.createElement(
971
- AutoSizer,
972
- {
973
- style: {
974
- width: "90%"
975
- }
976
- },
977
- ({ height, width }) => /* @__PURE__ */ React6.createElement(
978
- VariableSizeList,
979
- {
980
- ref: (node) => {
981
- if (node) {
982
- listRef.current = node;
983
- listInstance = node;
984
- }
985
- },
986
- itemCount: messages.length,
987
- itemSize: getRowHeight,
988
- itemData: messages,
989
- width,
990
- height,
991
- style: {
992
- overflowX: "hidden"
993
- },
994
- itemKey,
995
- onItemsRendered: ({ visibleStartIndex, visibleStopIndex }) => {
996
- for (let i = visibleStartIndex; i <= visibleStopIndex; i++) {
997
- if (!messages[i].read) {
998
- hmsActions.setMessageRead(true, messages[i].id);
999
- }
1000
- }
1001
- }
1002
- },
1003
- MessageWrapper
1004
- )
1005
- )
1006
- );
1007
- });
1008
- var ChatBody = React6.forwardRef(
1009
- ({ scrollToBottom }, listRef) => {
1010
- const messages = useHMSStore4(selectHMSMessages);
1011
- const blacklistedMessageIDs = useHMSStore4(selectSessionStore4("chatMessageBlacklist" /* CHAT_MESSAGE_BLACKLIST */));
1012
- const filteredMessages = useMemo(() => {
1013
- const blacklistedMessageIDSet = new Set(blacklistedMessageIDs || []);
1014
- return (messages == null ? void 0 : messages.filter((message) => message.type === "chat" && !blacklistedMessageIDSet.has(message.id))) || [];
1015
- }, [blacklistedMessageIDs, messages]);
1016
- const vanillaStore = useHMSVanillaStore3();
1017
- const rerenderOnFirstMount = useRef(false);
1018
- useEffect3(() => {
1019
- const unsubscribe = vanillaStore.subscribe(() => {
1020
- if (!listRef.current) {
1021
- return;
1022
- }
1023
- const outerElement = listRef.current._outerRef;
1024
- if (outerElement && outerElement.clientHeight + outerElement.scrollTop + outerElement.offsetTop >= outerElement.scrollHeight) {
1025
- requestAnimationFrame(() => scrollToBottom(1));
1026
- }
1027
- }, selectUnreadHMSMessagesCount);
1028
- return unsubscribe;
1029
- }, [vanillaStore, listRef, scrollToBottom]);
1030
- useEffect3(() => {
1031
- if (filteredMessages.length > 0 && (listRef == null ? void 0 : listRef.current) && !rerenderOnFirstMount.current) {
1032
- rerenderOnFirstMount.current = true;
1033
- listRef.current.resetAfterIndex(0);
1034
- }
1035
- }, [listRef, filteredMessages]);
1036
- return filteredMessages.length === 0 ? /* @__PURE__ */ React6.createElement(EmptyChat, null) : /* @__PURE__ */ React6.createElement(VirtualizedChatMessages, { messages: filteredMessages, ref: listRef, scrollToBottom });
1037
- }
1038
- );
1039
- var PinnedBy = ({
1040
- messageId,
1041
- index,
1042
- rowRef
1043
- }) => {
1044
- const pinnedBy = usePinnedBy(messageId);
1045
- const localPeerName = useHMSStore4(selectLocalPeerName2);
1046
- useLayoutEffect(() => {
1047
- if (rowRef == null ? void 0 : rowRef.current) {
1048
- if (pinnedBy) {
1049
- rowRef.current.style.background = "linear-gradient(277deg, var(--hms-ui-colors-surface_default) 0%, var(--hms-ui-colors-surface_dim) 60.87%)";
1050
- } else {
1051
- rowRef.current.style.background = "";
1052
- }
1053
- setRowHeight(index, messageId, rowRef == null ? void 0 : rowRef.current.clientHeight);
1054
- }
1055
- }, [index, messageId, pinnedBy, rowRef]);
1056
- if (!pinnedBy) {
1057
- return null;
1058
- }
1059
- return /* @__PURE__ */ React6.createElement(Flex, { align: "center", css: { gap: "$2", mb: "$2", color: "$on_surface_low" } }, /* @__PURE__ */ React6.createElement(SolidPinIcon, { height: 12, width: 12 }), /* @__PURE__ */ React6.createElement(Text, { variant: "xs", css: { color: "inherit" } }, "Pinned by ", localPeerName === pinnedBy ? "you" : pinnedBy));
1060
- };
1061
-
1062
- // src/Prebuilt/components/PIP/PIPChat.tsx
1063
- var PIPChat = () => {
1064
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1065
- const messages = useHMSStore5(selectHMSMessages2);
1066
- const localPeerID = useHMSStore5(selectLocalPeerID2);
1067
- const count = useHMSStore5(selectUnreadHMSMessagesCount2);
1068
- const [unreadMessageCount, setUnreadMessageCount] = useState5(0);
1069
- const getSenderName = useCallback6(
1070
- (senderName, senderID) => {
1071
- const slicedName = senderName.length > 10 ? senderName.slice(0, 10) + "..." : senderName;
1072
- return slicedName + (senderID === localPeerID ? " (You)" : "");
1073
- },
1074
- [localPeerID]
1075
- );
1076
- useEffect4(() => {
1077
- const timeoutId = setTimeout(() => {
1078
- setUnreadMessageCount(count);
1079
- }, 100);
1080
- return () => clearTimeout(timeoutId);
1081
- }, [count]);
1082
- const blacklistedMessageIDs = useHMSStore5(selectSessionStore5("chatMessageBlacklist" /* CHAT_MESSAGE_BLACKLIST */));
1083
- const filteredMessages = useMemo2(() => {
1084
- const blacklistedMessageIDSet = new Set(blacklistedMessageIDs || []);
1085
- return (messages == null ? void 0 : messages.filter((message) => message.type === "chat" && !blacklistedMessageIDSet.has(message.id))) || [];
1086
- }, [blacklistedMessageIDs, messages]);
1087
- const { enabled: isChatEnabled = true, updatedBy: chatStateUpdatedBy = "" } = useHMSStore5(selectSessionStore5("chatState" /* CHAT_STATE */)) || {};
1088
- const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
1089
- const { elements } = useRoomLayoutConferencingScreen();
1090
- const message_placeholder = ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.message_placeholder) || "Send a message";
1091
- const canSendChatMessages = !!((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.public_chat_enabled) || !!((_d = (_c = elements == null ? void 0 : elements.chat) == null ? void 0 : _c.roles_whitelist) == null ? void 0 : _d.length) || !!((_e = elements == null ? void 0 : elements.chat) == null ? void 0 : _e.private_chat_enabled);
1092
- const getChatStatus = useCallback6(() => {
1093
- if (isLocalPeerBlacklisted)
1094
- return "You've been blocked from sending messages";
1095
- if (!isChatEnabled)
1096
- return `Chat has been paused by ${chatStateUpdatedBy.peerId === localPeerID ? "you" : chatStateUpdatedBy == null ? void 0 : chatStateUpdatedBy.userName}`;
1097
- return message_placeholder;
1098
- }, [
1099
- chatStateUpdatedBy.peerId,
1100
- chatStateUpdatedBy == null ? void 0 : chatStateUpdatedBy.userName,
1101
- isChatEnabled,
1102
- isLocalPeerBlacklisted,
1103
- localPeerID,
1104
- message_placeholder
1105
- ]);
1106
- return /* @__PURE__ */ React7.createElement("div", { style: { height: "100%" } }, /* @__PURE__ */ React7.createElement(
1107
- Box,
1108
- {
1109
- id: "chat-container",
1110
- css: {
1111
- bg: "$surface_dim",
1112
- overflowY: "auto",
1113
- // Subtracting height of footer
1114
- h: canSendChatMessages ? "calc(100% - 87px)" : "100%",
1115
- position: "relative"
1116
- }
1117
- },
1118
- unreadMessageCount ? /* @__PURE__ */ React7.createElement(
1119
- Box,
1120
- {
1121
- id: "new-message-notif",
1122
- style: {
1123
- position: "fixed",
1124
- bottom: "76px",
1125
- right: "4px"
1126
- }
1127
- },
1128
- /* @__PURE__ */ React7.createElement(
1129
- Text,
1130
- {
1131
- variant: "xs",
1132
- css: { cursor: "pointer" },
1133
- style: { color: "white", background: "gray", padding: "4px", borderRadius: "4px" }
1134
- },
1135
- unreadMessageCount === 1 ? "New message" : `${unreadMessageCount} new messages`
1136
- )
1137
- ) : "",
1138
- filteredMessages.length === 0 ? /* @__PURE__ */ React7.createElement(
1139
- "div",
1140
- {
1141
- style: {
1142
- display: "flex",
1143
- flexDirection: "column",
1144
- height: "100%",
1145
- width: "100%",
1146
- alignItems: "center",
1147
- justifyContent: "center"
1148
- }
1149
- },
1150
- /* @__PURE__ */ React7.createElement(Text, { variant: "h5", css: { mt: "$8", c: "$on_surface_high" } }, canSendChatMessages ? "Start a conversation" : "No messages yet"),
1151
- canSendChatMessages ? /* @__PURE__ */ React7.createElement(Text, { variant: "sm", style: { maxWidth: "80%", textAlign: "center", marginTop: "4px" } }, "There are no messages here yet. Start a conversation by sending a message.") : ""
1152
- ) : filteredMessages.map((message) => /* @__PURE__ */ React7.createElement(Box, { className: "pip-message", key: message.id, id: message.id, style: { padding: "8px 0.75rem" } }, /* @__PURE__ */ React7.createElement(Flex, { style: { width: "100%", alignItems: "center", justifyContent: "between" } }, /* @__PURE__ */ React7.createElement(
1153
- Text,
1154
- {
1155
- style: { display: "flex", justifyContent: "between", width: "100%", alignItems: "center" },
1156
- css: {
1157
- color: "$on_surface_high",
1158
- fontWeight: "$semiBold"
1159
- }
1160
- },
1161
- /* @__PURE__ */ React7.createElement(Flex, { style: { flexGrow: 1, gap: "2px", alignItems: "center" } }, message.senderName === "You" || !message.senderName ? /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, message.senderName || "Anonymous") : /* @__PURE__ */ React7.createElement(Tooltip, { title: message.senderName, side: "top", align: "start" }, /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, getSenderName(message.senderName, message == null ? void 0 : message.sender))), /* @__PURE__ */ React7.createElement(
1162
- MessageTitle,
1163
- {
1164
- localPeerID,
1165
- recipientPeer: message.recipientPeer,
1166
- recipientRoles: message.recipientRoles
1167
- }
1168
- )),
1169
- /* @__PURE__ */ React7.createElement(
1170
- Text,
1171
- {
1172
- variant: "xs",
1173
- css: {
1174
- color: "$on_surface_medium",
1175
- flexShrink: 0,
1176
- p: "$2",
1177
- whitespace: "nowrap"
1178
- }
1179
- },
1180
- formatTime(message.time)
1181
- )
1182
- )), /* @__PURE__ */ React7.createElement(
1183
- Text,
1184
- {
1185
- variant: "sm",
1186
- css: {
1187
- w: "100%",
1188
- mt: "$2",
1189
- wordBreak: "break-word",
1190
- whiteSpace: "pre-wrap",
1191
- userSelect: "all",
1192
- color: "$on_surface_high"
1193
- }
1194
- },
1195
- /* @__PURE__ */ React7.createElement(AnnotisedMessage, { message: message.message })
1196
- ))),
1197
- /* @__PURE__ */ React7.createElement("div", { id: "marker", style: { height: filteredMessages.length ? "1px" : 0 } })
1198
- ), canSendChatMessages && /* @__PURE__ */ React7.createElement(Box, { css: { bg: "$surface_dim" } }, /* @__PURE__ */ React7.createElement(Flex, { css: { px: "$4", pb: "3px", gap: "$2", alignItems: "center" } }, /* @__PURE__ */ React7.createElement(Text, { variant: "caption" }, "To:"), /* @__PURE__ */ React7.createElement(Flex, { css: { bg: "$primary_bright", color: "$on_primary_high", r: "$2" } }, /* @__PURE__ */ React7.createElement(
1199
- "select",
1200
- {
1201
- id: "selector",
1202
- style: {
1203
- background: "inherit",
1204
- color: "inherit",
1205
- border: "none",
1206
- outline: "none",
1207
- borderRadius: "4px",
1208
- padding: "0 2px"
1209
- },
1210
- defaultValue: ((_f = elements.chat) == null ? void 0 : _f.public_chat_enabled) ? "Everyone" : (_h = (_g = elements.chat) == null ? void 0 : _g.roles_whitelist) == null ? void 0 : _h[0]
1211
- },
1212
- (_j = (_i = elements.chat) == null ? void 0 : _i.roles_whitelist) == null ? void 0 : _j.map((role) => /* @__PURE__ */ React7.createElement("option", { key: role, value: role }, role)),
1213
- ((_k = elements.chat) == null ? void 0 : _k.public_chat_enabled) ? /* @__PURE__ */ React7.createElement("option", { value: "Everyone" }, "Everyone") : ""
1214
- ))), /* @__PURE__ */ React7.createElement(
1215
- Flex,
1216
- {
1217
- align: "center",
1218
- css: {
1219
- bg: "$surface_default",
1220
- minHeight: "$16",
1221
- width: "100%",
1222
- py: "$6",
1223
- pl: "$4",
1224
- boxSizing: "border-box",
1225
- gap: "$2",
1226
- r: "$2"
1227
- }
1228
- },
1229
- /* @__PURE__ */ React7.createElement(
1230
- TextArea,
1231
- {
1232
- id: "chat-input",
1233
- maxLength: CHAT_MESSAGE_LIMIT,
1234
- disabled: !isChatEnabled || isLocalPeerBlacklisted,
1235
- rows: 1,
1236
- css: {
1237
- w: "100%",
1238
- c: "$on_surface_high",
1239
- p: "0.75rem 0.75rem !important",
1240
- border: "none",
1241
- resize: "none"
1242
- },
1243
- placeholder: getChatStatus(),
1244
- required: true,
1245
- autoComplete: "off",
1246
- "aria-autocomplete": "none"
1247
- }
1248
- ),
1249
- /* @__PURE__ */ React7.createElement(
1250
- IconButton_default,
1251
- {
1252
- id: "send-btn",
1253
- disabled: !isChatEnabled || isLocalPeerBlacklisted,
1254
- title: getChatStatus(),
1255
- css: {
1256
- ml: "auto",
1257
- height: "max-content",
1258
- mr: "$4",
1259
- "&:hover": { c: "$on_surface_medium" }
1260
- },
1261
- "data-testid": "send_msg_btn"
1262
- },
1263
- /* @__PURE__ */ React7.createElement(SendIcon, null)
1264
- )
1265
- )));
1266
- };
1267
- var MessageTitle = ({
1268
- recipientPeer,
1269
- recipientRoles,
1270
- localPeerID
1271
- }) => {
1272
- const peerName = useHMSStore5(selectPeerNameByID3(recipientPeer));
1273
- return /* @__PURE__ */ React7.createElement(React7.Fragment, null, recipientRoles ? /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, "to ", recipientRoles, " (Group)") : null, recipientPeer ? /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, "to ", recipientPeer === localPeerID ? "You" : peerName, " (DM)") : null);
1274
- };
1275
-
1276
- // src/Prebuilt/components/PIP/PIPChatOption.tsx
1277
- init_define_process_env();
1278
- import React8 from "react";
1279
- import { ExternalLinkIcon } from "@100mslive/react-icons";
1280
- var PIPChatOption = ({ openChat, showPIPChat }) => {
1281
- if (!showPIPChat) {
1282
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null);
1283
- }
1284
- return /* @__PURE__ */ React8.createElement(Dropdown.Item, { onClick: openChat, "data-testid": "pip_chat_btn" }, /* @__PURE__ */ React8.createElement(ExternalLinkIcon, null), /* @__PURE__ */ React8.createElement(Text, { variant: "sm", css: { ml: "$4", color: "$on_surface_high" } }, "Pop out Chat"));
1285
- };
1286
-
1287
- // src/Prebuilt/components/PIP/PIPWindow.tsx
1288
- init_define_process_env();
1289
- import { createPortal } from "react-dom";
1290
- var PIPWindow = ({ pipWindow, children }) => {
1291
- pipWindow.document.body.style.margin = "0";
1292
- pipWindow.document.body.style.overflow = "clip";
1293
- return createPortal(children, pipWindow.document.body);
1294
- };
1295
-
1296
- // src/Prebuilt/components/Settings/StartRecording.jsx
1297
- init_define_process_env();
1298
- import React10, { useState as useState7 } from "react";
1299
- import { selectPermissions as selectPermissions2, useHMSActions as useHMSActions6, useHMSStore as useHMSStore6, useRecordingStreaming } from "@100mslive/react-sdk";
1300
- import { AlertTriangleIcon } from "@100mslive/react-icons";
1301
-
1302
- // src/Prebuilt/components/Streaming/ResolutionInput.jsx
1303
- init_define_process_env();
1304
- import React9, { useCallback as useCallback7, useState as useState6 } from "react";
1305
- import { InfoIcon } from "@100mslive/react-icons";
1306
- var ResolutionInput = ({ onResolutionChange, disabled, tooltipText, css, testId }) => {
1307
- const [resolution, setResolution] = useState6(RTMP_RECORD_DEFAULT_RESOLUTION);
1308
- const resolutionChangeHandler = useCallback7(
1309
- (event) => {
1310
- const { name, value } = event.target;
1311
- let width = name === "resWidth" ? Number(value) : resolution.width;
1312
- let height = name === "resHeight" ? Number(value) : resolution.height;
1313
- if (width === 0) {
1314
- width = null;
1315
- }
1316
- if (height === 0) {
1317
- height = null;
1318
- }
1319
- const newResolution = {
1320
- width: !isNaN(width) ? width : RTMP_RECORD_DEFAULT_RESOLUTION.width,
1321
- height: !isNaN(height) ? height : RTMP_RECORD_DEFAULT_RESOLUTION.height
1322
- };
1323
- setResolution(newResolution);
1324
- },
1325
- [resolution]
1326
- );
1327
- return /* @__PURE__ */ React9.createElement(DialogRow, { breakSm: true, css }, /* @__PURE__ */ React9.createElement(Flex, { gap: 1 }, /* @__PURE__ */ React9.createElement(Label, { css: { mb: "$8" } }, "Resolution"), tooltipText && /* @__PURE__ */ React9.createElement(Tooltip, { title: tooltipText }, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(InfoIcon, { color: "#B0C3DB" })))), /* @__PURE__ */ React9.createElement(
1328
- Flex,
1329
- {
1330
- justify: "between",
1331
- css: { width: !tooltipText ? "100%" : "70%", "@sm": { width: "100%" } },
1332
- gap: 2,
1333
- direction: "column"
1334
- },
1335
- /* @__PURE__ */ React9.createElement(Flex, { justify: "between", gap: 2 }, /* @__PURE__ */ React9.createElement(Flex, { direction: "column", css: { width: "50%" } }, /* @__PURE__ */ React9.createElement(Text, { variant: "xs" }, "Width"), /* @__PURE__ */ React9.createElement(
1336
- Input,
1337
- {
1338
- "data-testid": `${testId}_width`,
1339
- css: { width: "100%", mt: "$4" },
1340
- name: "resWidth",
1341
- value: resolution.width,
1342
- onChange: resolutionChangeHandler,
1343
- readOnly: disabled,
1344
- min: RTMP_RECORD_RESOLUTION_MIN,
1345
- max: RTMP_RECORD_RESOLUTION_MAX,
1346
- onBlur: () => onResolutionChange(resolution),
1347
- type: "number"
1348
- }
1349
- )), /* @__PURE__ */ React9.createElement(Flex, { direction: "column", css: { width: "50%" } }, /* @__PURE__ */ React9.createElement(Text, { variant: "xs" }, "Height"), /* @__PURE__ */ React9.createElement(
1350
- Input,
1351
- {
1352
- "data-testid": `${testId}_height`,
1353
- css: { width: "100%", mt: "$4" },
1354
- name: "resHeight",
1355
- value: resolution.height,
1356
- onChange: resolutionChangeHandler,
1357
- onBlur: () => onResolutionChange(resolution),
1358
- readOnly: disabled,
1359
- min: RTMP_RECORD_RESOLUTION_MIN,
1360
- max: RTMP_RECORD_RESOLUTION_MAX,
1361
- type: "number"
1362
- }
1363
- )))
1364
- ));
1365
- };
1366
-
1367
- // src/Prebuilt/components/Settings/StartRecording.jsx
1368
- var StartRecording = ({ open, onOpenChange }) => {
1369
- const permissions = useHMSStore6(selectPermissions2);
1370
- const [resolution, setResolution] = useState7(RTMP_RECORD_DEFAULT_RESOLUTION);
1371
- const { startRecording, recordingStarted } = useRecordingHandler();
1372
- const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
1373
- const hmsActions = useHMSActions6();
1374
- if (!(permissions == null ? void 0 : permissions.browserRecording) || isHLSRunning) {
1375
- return null;
1376
- }
1377
- if (isBrowserRecordingOn) {
1378
- return /* @__PURE__ */ React10.createElement(Dialog.Root, { open, onOpenChange }, /* @__PURE__ */ React10.createElement(Dialog.Portal, null, /* @__PURE__ */ React10.createElement(
1379
- Dialog.Content,
1380
- {
1381
- css: {
1382
- width: "min(400px,80%)",
1383
- p: "$10",
1384
- bg: "#201617"
1385
- }
1386
- },
1387
- /* @__PURE__ */ React10.createElement(Dialog.Title, null, /* @__PURE__ */ React10.createElement(Flex, { gap: 2, css: { c: "$alert_error_default" } }, /* @__PURE__ */ React10.createElement(AlertTriangleIcon, null), /* @__PURE__ */ React10.createElement(Text, { css: { c: "inherit" }, variant: "h6" }, "End Recording"))),
1388
- /* @__PURE__ */ React10.createElement(Text, { variant: "sm", css: { c: "$on_surface_medium", my: "$8" } }, "Are you sure you want to end recording? You can\u2019t undo this action."),
1389
- /* @__PURE__ */ React10.createElement(Flex, { justify: "end", css: { mt: "$12" } }, /* @__PURE__ */ React10.createElement(Dialog.Close, { asChild: true }, /* @__PURE__ */ React10.createElement(Button, { outlined: true, css: { borderColor: "$secondary_bright", mr: "$4" } }, "Don't end")), /* @__PURE__ */ React10.createElement(
1390
- Button,
1391
- {
1392
- "data-testid": "stop_recording_confirm_mobile",
1393
- variant: "danger",
1394
- icon: true,
1395
- onClick: () => __async(void 0, null, function* () {
1396
- try {
1397
- yield hmsActions.stopRTMPAndRecording();
1398
- } catch (error) {
1399
- ToastManager.addToast({
1400
- title: error.message,
1401
- variant: "error"
1402
- });
1403
- }
1404
- onOpenChange(false);
1405
- })
1406
- },
1407
- "End recording"
1408
- ))
1409
- )));
1410
- }
1411
- return /* @__PURE__ */ React10.createElement(Dialog.Root, { open, onOpenChange }, /* @__PURE__ */ React10.createElement(Dialog.Content, { css: { width: "min(400px,80%)", p: "$10" } }, /* @__PURE__ */ React10.createElement(Dialog.Title, null, /* @__PURE__ */ React10.createElement(Text, { variant: "h6" }, "Start Recording")), /* @__PURE__ */ React10.createElement(
1412
- ResolutionInput,
1413
- {
1414
- testId: "recording_resolution_mobile",
1415
- css: { flexDirection: "column", alignItems: "start" },
1416
- onResolutionChange: setResolution
1417
- }
1418
- ), /* @__PURE__ */ React10.createElement(
1419
- Button,
1420
- {
1421
- "data-testid": "start_recording_confirm_mobile",
1422
- variant: "primary",
1423
- icon: true,
1424
- css: { ml: "auto" },
1425
- type: "submit",
1426
- disabled: recordingStarted || isStreamingOn,
1427
- onClick: () => __async(void 0, null, function* () {
1428
- yield startRecording(resolution);
1429
- onOpenChange(false);
1430
- })
1431
- },
1432
- "Start"
1433
- )));
1434
- };
1435
- var StartRecording_default = StartRecording;
1436
-
1437
- // src/Prebuilt/components/StatsForNerds.jsx
1438
- init_define_process_env();
1439
- import React11, { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef2, useState as useState8 } from "react";
1440
- import { match, P } from "ts-pattern";
1441
- import {
1442
- selectHMSStats,
1443
- selectLocalPeerID as selectLocalPeerID3,
1444
- selectPeersMap,
1445
- selectTracksMap as selectTracksMap2,
1446
- useHMSActions as useHMSActions7,
1447
- useHMSStatsStore,
1448
- useHMSStore as useHMSStore7
1449
- } from "@100mslive/react-sdk";
1450
- var StatsForNerds = ({ onOpenChange }) => {
1451
- var _a;
1452
- const tracksWithLabels = useTracksWithLabel();
1453
- const statsOptions = useMemo3(
1454
- () => [{ id: "local-peer", label: "Local Peer Stats" }, ...tracksWithLabels],
1455
- [tracksWithLabels]
1456
- );
1457
- const hmsActions = useHMSActions7();
1458
- const details = hmsActions.getDebugInfo();
1459
- const [selectedStat, setSelectedStat] = useState8(statsOptions[0]);
1460
- const [showStatsOnTiles, setShowStatsOnTiles] = useSetUiSettings(UI_SETTINGS.showStatsOnTiles);
1461
- const [open, setOpen] = useState8(false);
1462
- const ref = useRef2();
1463
- const selectionBg = useDropdownSelection();
1464
- useEffect5(() => {
1465
- if (selectedStat.id !== "local-peer" && !tracksWithLabels.find((track) => track.id === selectedStat.id)) {
1466
- setSelectedStat("local-peer");
1467
- }
1468
- }, [tracksWithLabels, selectedStat]);
1469
- return /* @__PURE__ */ React11.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React11.createElement(Dialog.Portal, null, /* @__PURE__ */ React11.createElement(Dialog.Overlay, null), /* @__PURE__ */ React11.createElement(
1470
- Dialog.Content,
1471
- {
1472
- css: {
1473
- width: "min(500px, 95%)",
1474
- height: "min(656px, 90%)",
1475
- overflowY: "auto"
1476
- }
1477
- },
1478
- /* @__PURE__ */ React11.createElement(Dialog.Title, { css: { p: "$4 0" } }, /* @__PURE__ */ React11.createElement(Flex, { justify: "between" }, /* @__PURE__ */ React11.createElement(Flex, { align: "center", css: { mb: "$1" } }, /* @__PURE__ */ React11.createElement(Text, { variant: "h6", inline: true }, "Stats For Nerds")), /* @__PURE__ */ React11.createElement(Dialog.DefaultClose, { "data-testid": "stats_dialog_close_icon" }))),
1479
- /* @__PURE__ */ React11.createElement(HorizontalDivider, { css: { mt: "0.8rem" } }),
1480
- /* @__PURE__ */ React11.createElement(Flex, { justify: "start", gap: 4, css: { m: "$10 0" } }, /* @__PURE__ */ React11.createElement(Switch, { checked: showStatsOnTiles, onCheckedChange: setShowStatsOnTiles }), /* @__PURE__ */ React11.createElement(Text, { variant: "body2", css: { fontWeight: "$semiBold" } }, "Show Stats on Tiles")),
1481
- /* @__PURE__ */ React11.createElement(
1482
- Flex,
1483
- {
1484
- direction: "column",
1485
- css: {
1486
- mb: "$12",
1487
- position: "relative",
1488
- minWidth: 0
1489
- }
1490
- },
1491
- /* @__PURE__ */ React11.createElement(Label, { variant: "body2", css: { c: "$on_surface_high" } }, "Stats For"),
1492
- /* @__PURE__ */ React11.createElement(Dropdown.Root, { "data-testid": "dialog_select_Stats For", open, onOpenChange: setOpen }, /* @__PURE__ */ React11.createElement(
1493
- DialogDropdownTrigger,
1494
- {
1495
- title: selectedStat.label || "Select Stats",
1496
- css: { mt: "$4" },
1497
- titleCSS: { mx: 0 },
1498
- open,
1499
- ref
1500
- }
1501
- ), /* @__PURE__ */ React11.createElement(Dropdown.Portal, null, /* @__PURE__ */ React11.createElement(Dropdown.Content, { align: "start", sideOffset: 8, css: { w: (_a = ref.current) == null ? void 0 : _a.clientWidth, zIndex: 1e3 } }, statsOptions.map((option) => {
1502
- const isSelected = option.id === selectedStat.id && option.layer === selectedStat.layer;
1503
- return /* @__PURE__ */ React11.createElement(
1504
- Dropdown.Item,
1505
- {
1506
- key: `${option.id}-${option.layer || ""}`,
1507
- onClick: () => {
1508
- setSelectedStat(option);
1509
- },
1510
- css: {
1511
- px: "$9",
1512
- bg: isSelected ? selectionBg : void 0,
1513
- c: isSelected ? "$on_primary_high" : "$on_primary_high"
1514
- }
1515
- },
1516
- option.label
1517
- );
1518
- }))))
1519
- ),
1520
- selectedStat.id === "local-peer" ? /* @__PURE__ */ React11.createElement(LocalPeerStats, null) : /* @__PURE__ */ React11.createElement(TrackStats, { trackID: selectedStat.id, layer: selectedStat.layer, local: selectedStat.local }),
1521
- /* @__PURE__ */ React11.createElement(Flex, { justify: "start", gap: 4, css: { m: "$10 0", w: "100%" } }, /* @__PURE__ */ React11.createElement(DebugInfo, { details }))
1522
- )));
1523
- };
1524
- var useTracksWithLabel = () => {
1525
- const tracksMap = useHMSStore7(selectTracksMap2);
1526
- const peersMap = useHMSStore7(selectPeersMap);
1527
- const localPeerID = useHMSStore7(selectLocalPeerID3);
1528
- const tracksWithLabels = useMemo3(
1529
- () => Object.values(tracksMap).reduce((res, track) => {
1530
- var _a, _b;
1531
- const peerName = (_a = peersMap[track.peerId]) == null ? void 0 : _a.name;
1532
- const isLocalTrack = track.peerId === localPeerID;
1533
- if (isLocalTrack && ((_b = track.layerDefinitions) == null ? void 0 : _b.length)) {
1534
- res = res.concat(
1535
- track.layerDefinitions.map(({ layer }) => {
1536
- return {
1537
- id: track.id,
1538
- layer,
1539
- local: true,
1540
- label: `${peerName} ${track.source} ${track.type} - ${layer}`
1541
- };
1542
- })
1543
- );
1544
- return res;
1545
- }
1546
- res.push({
1547
- id: track.id,
1548
- local: isLocalTrack,
1549
- label: `${peerName} ${track.source} ${track.type}`
1550
- });
1551
- return res;
1552
- }, []),
1553
- [tracksMap, peersMap, localPeerID]
1554
- );
1555
- return tracksWithLabels;
1556
- };
1557
- var LocalPeerStats = () => {
1558
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1559
- const stats = useHMSStatsStore(selectHMSStats.localPeerStats);
1560
- if (!stats) {
1561
- return null;
1562
- }
1563
- return /* @__PURE__ */ React11.createElement(Flex, { css: { flexWrap: "wrap", gap: "$10" } }, /* @__PURE__ */ React11.createElement(StatsRow, { label: "Packets Lost", value: (_a = stats.subscribe) == null ? void 0 : _a.packetsLost }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Jitter", value: (_b = stats.subscribe) == null ? void 0 : _b.jitter }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Publish Bitrate", value: formatBytes((_c = stats.publish) == null ? void 0 : _c.bitrate, "b/s") }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Subscribe Bitrate", value: formatBytes((_d = stats.subscribe) == null ? void 0 : _d.bitrate, "b/s") }), /* @__PURE__ */ React11.createElement(
1564
- StatsRow,
1565
- {
1566
- label: "Available Outgoing Bitrate",
1567
- value: formatBytes((_e = stats.publish) == null ? void 0 : _e.availableOutgoingBitrate, "b/s")
1568
- }
1569
- ), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Total Bytes Sent", value: formatBytes((_f = stats.publish) == null ? void 0 : _f.bytesSent) }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Total Bytes Received", value: formatBytes((_g = stats.subscribe) == null ? void 0 : _g.bytesReceived) }), /* @__PURE__ */ React11.createElement(
1570
- StatsRow,
1571
- {
1572
- label: "Round Trip Time",
1573
- value: `${(((((_h = stats.publish) == null ? void 0 : _h.currentRoundTripTime) || 0) + (((_i = stats.subscribe) == null ? void 0 : _i.currentRoundTripTime) || 0)) / 2).toFixed(3) * 1e3} ms`
1574
- }
1575
- ));
1576
- };
1577
- var TrackStats = ({ trackID, layer, local }) => {
1578
- var _a;
1579
- const selector = match({ trackID, layer, local }).with(
1580
- {
1581
- layer: P.when((layer2) => !!layer2)
1582
- },
1583
- () => selectHMSStats.localVideoTrackStatsByLayer(layer)(trackID)
1584
- ).with({ local: P.when((local2) => !!local2) }, () => selectHMSStats.localAudioTrackStatsByID(trackID)).otherwise(() => selectHMSStats.trackStatsByID(trackID));
1585
- const stats = useHMSStatsStore(selector);
1586
- if (!stats) {
1587
- return null;
1588
- }
1589
- const inbound = stats.type.includes("inbound");
1590
- return /* @__PURE__ */ React11.createElement(Flex, { css: { flexWrap: "wrap", gap: "$10" } }, /* @__PURE__ */ React11.createElement(StatsRow, { label: "Type", value: stats.type + " " + stats.kind }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Bitrate", value: formatBytes(stats.bitrate, "b/s") }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Packets Lost", value: stats.packetsLost }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Jitter", value: (_a = stats.jitter) == null ? void 0 : _a.toFixed(3) }), /* @__PURE__ */ React11.createElement(
1591
- StatsRow,
1592
- {
1593
- label: inbound ? "Bytes Received" : "Bytes Sent",
1594
- value: formatBytes(inbound ? stats.bytesReceived : stats.bytesSent)
1595
- }
1596
- ), stats.kind === "video" && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(StatsRow, { label: "Framerate", value: stats.framesPerSecond }), !inbound && /* @__PURE__ */ React11.createElement(StatsRow, { label: "Quality Limitation Reason", value: stats.qualityLimitationReason })), /* @__PURE__ */ React11.createElement(
1597
- StatsRow,
1598
- {
1599
- label: "Round Trip Time",
1600
- value: stats.roundTripTime ? `${(stats.roundTripTime * 1e3).toFixed(3)} ms` : "-"
1601
- }
1602
- ));
1603
- };
1604
- var DebugInfo = ({ details }) => {
1605
- var _a;
1606
- return /* @__PURE__ */ React11.createElement(Accordion.Root, { type: "single", collapsible: true, css: { w: "100%" } }, /* @__PURE__ */ React11.createElement(Accordion.Item, { value: "Debug Info" }, /* @__PURE__ */ React11.createElement(Accordion.Header, null, /* @__PURE__ */ React11.createElement(Label, { variant: "body2", css: { c: "$on_surface_high" } }, "Debug Info")), /* @__PURE__ */ React11.createElement(Accordion.Content, null, /* @__PURE__ */ React11.createElement(Flex, { css: { flexWrap: "wrap", mt: "$10", gap: "$10" } }, /* @__PURE__ */ React11.createElement(StatsRow, { css: { w: "100%" }, label: "Websocket URL", value: details == null ? void 0 : details.websocketURL }), /* @__PURE__ */ React11.createElement(StatsRow, { css: { w: "100%" }, label: "Init Endpoint", value: details == null ? void 0 : details.initEndpoint }), /* @__PURE__ */ React11.createElement(StatsRow, { css: { w: "100%" }, label: "Enabled flags", value: (_a = details == null ? void 0 : details.enabledFlags) == null ? void 0 : _a.join(", ") })))));
1607
- };
1608
- var StatsRow = React11.memo(({ label, value, css }) => /* @__PURE__ */ React11.createElement(Box, { css: __spreadValues({ bg: "$surface_bright", w: "calc(50% - $6)", p: "$8", r: "$3" }, css) }, /* @__PURE__ */ React11.createElement(
1609
- Text,
1610
- {
1611
- variant: "overline",
1612
- css: {
1613
- fontWeight: "$semiBold",
1614
- color: "$on_surface_medium",
1615
- textTransform: "uppercase"
1616
- }
1617
- },
1618
- label
1619
- ), /* @__PURE__ */ React11.createElement(Text, { variant: "sub1", css: { fontWeight: "$semiBold", color: "$on_surface_high" } }, value || "-")));
1620
-
1621
- // src/Prebuilt/components/MoreSettings/BulkRoleChangeModal.jsx
1622
- init_define_process_env();
1623
- import React12, { useCallback as useCallback8, useRef as useRef3, useState as useState9 } from "react";
1624
- import { useHMSActions as useHMSActions8 } from "@100mslive/react-sdk";
1625
- import { AlertTriangleIcon as AlertTriangleIcon2, ChangeRoleIcon, CheckIcon } from "@100mslive/react-icons";
1626
- var BulkRoleChangeModal = ({ onOpenChange }) => {
1627
- var _a, _b;
1628
- const roles = useFilteredRoles();
1629
- const hmsActions = useHMSActions8();
1630
- const ref = useRef3(null);
1631
- const roleRef = useRef3(null);
1632
- const [selectedBulkRole, setBulkRole] = useState9([]);
1633
- const [selectedRole, setRole] = useState9("");
1634
- const [bulkRoleDialog, setBulkRoleDialog] = useState9(false);
1635
- const [roleDialog, setRoleDialog] = useState9(false);
1636
- const [errorMessage, setErrorMessage] = useState9("");
1637
- const [isSubmiting, setIsSubmiting] = useState9(false);
1638
- const changeBulkRole = useCallback8(() => __async(void 0, null, function* () {
1639
- if (selectedBulkRole.length > 0 && selectedRole) {
1640
- try {
1641
- setIsSubmiting(true);
1642
- yield hmsActions.changeRoleOfPeersWithRoles(selectedBulkRole, selectedRole);
1643
- setIsSubmiting(false);
1644
- setErrorMessage("");
1645
- onOpenChange(false);
1646
- } catch (err) {
1647
- setErrorMessage((err == null ? void 0 : err.message) ? err == null ? void 0 : err.message : "Unknown error");
1648
- setIsSubmiting(false);
1649
- }
1650
- }
1651
- }), [selectedBulkRole, selectedRole, hmsActions, onOpenChange]);
1652
- return /* @__PURE__ */ React12.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React12.createElement(DialogContent, { title: "Bulk Role Change", Icon: ChangeRoleIcon }, /* @__PURE__ */ React12.createElement(DialogRow, null, /* @__PURE__ */ React12.createElement(Text, null, "For Roles: "), /* @__PURE__ */ React12.createElement(
1653
- Dropdown.Root,
1654
- {
1655
- open: bulkRoleDialog,
1656
- onOpenChange: (value) => {
1657
- if (value) {
1658
- setBulkRoleDialog(value);
1659
- }
1660
- },
1661
- modal: false
1662
- },
1663
- /* @__PURE__ */ React12.createElement(
1664
- DialogDropdownTrigger,
1665
- {
1666
- ref,
1667
- title: selectedBulkRole.length === 0 ? "Select Multiple Roles" : selectedBulkRole.toString(),
1668
- css: {
1669
- w: "70%",
1670
- p: "$8"
1671
- },
1672
- open: bulkRoleDialog
1673
- }
1674
- ),
1675
- /* @__PURE__ */ React12.createElement(
1676
- Dropdown.Content,
1677
- {
1678
- css: { w: (_a = ref.current) == null ? void 0 : _a.clientWidth, zIndex: 1e3 },
1679
- onInteractOutside: () => {
1680
- if (bulkRoleDialog) {
1681
- setBulkRoleDialog(false);
1682
- }
1683
- }
1684
- },
1685
- roles && roles.map((role) => {
1686
- return /* @__PURE__ */ React12.createElement(
1687
- Dropdown.CheckboxItem,
1688
- {
1689
- key: role,
1690
- checked: selectedBulkRole.includes(role),
1691
- onCheckedChange: (value) => {
1692
- setBulkRole((selection) => {
1693
- return value ? [...selection, role] : selection.filter((selectedRole2) => selectedRole2 !== role);
1694
- });
1695
- setErrorMessage("");
1696
- }
1697
- },
1698
- /* @__PURE__ */ React12.createElement(Checkbox.Root, { css: { margin: "$2" }, checked: selectedBulkRole.includes(role) }, /* @__PURE__ */ React12.createElement(Checkbox.Indicator, null, /* @__PURE__ */ React12.createElement(CheckIcon, { width: 16, height: 16 }))),
1699
- role
1700
- );
1701
- })
1702
- )
1703
- )), /* @__PURE__ */ React12.createElement(DialogRow, null, /* @__PURE__ */ React12.createElement(Text, null, "To Role: "), /* @__PURE__ */ React12.createElement(Dropdown.Root, { open: roleDialog, onOpenChange: (value) => setRoleDialog(value) }, /* @__PURE__ */ React12.createElement(
1704
- DialogDropdownTrigger,
1705
- {
1706
- ref: roleRef,
1707
- title: selectedRole || "Select Role",
1708
- css: {
1709
- w: "70%",
1710
- p: "$8"
1711
- },
1712
- open: roleDialog
1713
- }
1714
- ), /* @__PURE__ */ React12.createElement(Dropdown.Content, { css: { w: (_b = roleRef.current) == null ? void 0 : _b.clientWidth, zIndex: 1e3 } }, roles && roles.map((role) => {
1715
- return /* @__PURE__ */ React12.createElement(
1716
- Dropdown.Item,
1717
- {
1718
- key: role,
1719
- onSelect: () => {
1720
- setRole(role);
1721
- setErrorMessage("");
1722
- }
1723
- },
1724
- role
1725
- );
1726
- })))), /* @__PURE__ */ React12.createElement(DialogRow, null, errorMessage && /* @__PURE__ */ React12.createElement(Flex, { gap: 2, css: { c: "$alert_error_default", w: "70%", ml: "auto" } }, /* @__PURE__ */ React12.createElement(AlertTriangleIcon2, null), /* @__PURE__ */ React12.createElement(Text, { css: { c: "inherit" } }, errorMessage))), /* @__PURE__ */ React12.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React12.createElement(Button, { variant: "primary", onClick: changeBulkRole, disabled: !(selectedRole && selectedBulkRole.length > 0) }, isSubmiting && /* @__PURE__ */ React12.createElement(Loading, { css: { color: "$on_primary_medium" } }), "Apply"))));
1727
- };
1728
-
1729
- // src/Prebuilt/components/MoreSettings/CaptionModal.tsx
1730
- init_define_process_env();
1731
- import React14 from "react";
1732
- import { useMedia as useMedia3 } from "react-use";
1733
-
1734
- // src/Prebuilt/components/MoreSettings/CaptionContent.tsx
1735
- init_define_process_env();
1736
- import React13 from "react";
1737
- import { HMSTranscriptionMode, selectIsTranscriptionEnabled, useHMSActions as useHMSActions9, useHMSStore as useHMSStore8 } from "@100mslive/react-sdk";
1738
- import { AlertTriangleIcon as AlertTriangleIcon3, CrossIcon as CrossIcon2 } from "@100mslive/react-icons";
1739
- var CaptionContent = ({ isMobile, onExit }) => {
1740
- const DURATION = 2e3;
1741
- const actions = useHMSActions9();
1742
- const isTranscriptionEnabled = useHMSStore8(selectIsTranscriptionEnabled);
1743
- const [toastId, setToastId] = useSetAppDataByKey(CAPTION_TOAST.captionToast);
1744
- const [isCaptionEnabled, setIsCaptionEnabled] = useSetIsCaptionEnabled();
1745
- return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
1746
- Text,
1747
- {
1748
- variant: isMobile ? "md" : "lg",
1749
- css: {
1750
- color: "$on_surface_high",
1751
- fontWeight: "$semiBold",
1752
- display: "flex",
1753
- "@md": { px: "$8" }
1754
- }
1755
- },
1756
- isTranscriptionEnabled ? "Disable" : "Enable",
1757
- " Closed Caption (CC) for this session?",
1758
- /* @__PURE__ */ React13.createElement(
1759
- Box,
1760
- {
1761
- css: { color: "inherit", ml: "auto", "&:hover": { color: "$on_surface_medium", cursor: "pointer" } },
1762
- onClick: onExit
1763
- },
1764
- /* @__PURE__ */ React13.createElement(CrossIcon2, null)
1765
- )
1766
- ), !isMobile ? /* @__PURE__ */ React13.createElement(Text, { variant: "sm", css: { color: "$on_surface_medium", mt: "$4", "@md": { px: "$8" } } }, "This will ", isTranscriptionEnabled ? "disable" : "enable", " Closed Captions for everyone in this room. You can\xA0", isTranscriptionEnabled ? "enable" : "disable", " it later.") : null, /* @__PURE__ */ React13.createElement(
1767
- Flex,
1768
- {
1769
- justify: "between",
1770
- align: "center",
1771
- css: {
1772
- width: "100%",
1773
- gap: "$md",
1774
- mt: "$10",
1775
- "@md": { px: "$4" }
1776
- }
1777
- },
1778
- isMobile ? null : /* @__PURE__ */ React13.createElement(Button, { variant: "standard", css: { w: "100%" }, outlined: true, onClick: onExit }, "Cancel"),
1779
- /* @__PURE__ */ React13.createElement(
1780
- Flex,
1781
- {
1782
- direction: "column",
1783
- justify: "between",
1784
- align: "center",
1785
- css: {
1786
- width: "100%",
1787
- "@md": { px: "$4" }
1788
- }
1789
- },
1790
- isMobile && isTranscriptionEnabled ? /* @__PURE__ */ React13.createElement(
1791
- Button,
1792
- {
1793
- variant: "standard",
1794
- css: { w: "100%", mb: "$4" },
1795
- outlined: true,
1796
- onClick: () => {
1797
- setIsCaptionEnabled(!isCaptionEnabled);
1798
- onExit();
1799
- }
1800
- },
1801
- isCaptionEnabled ? "Hide For Me" : "Show For Me"
1802
- ) : null,
1803
- /* @__PURE__ */ React13.createElement(
1804
- Button,
1805
- {
1806
- variant: isTranscriptionEnabled ? "danger" : "primary",
1807
- css: { width: "100%" },
1808
- "data-testid": "popup_change_btn",
1809
- onClick: () => __async(void 0, null, function* () {
1810
- try {
1811
- if (isTranscriptionEnabled) {
1812
- yield actions.stopTranscription({
1813
- mode: HMSTranscriptionMode.CAPTION
1814
- });
1815
- setIsCaptionEnabled(false);
1816
- const id2 = ToastManager.replaceToast(toastId, {
1817
- title: `Disabling Closed Caption for everyone.`,
1818
- variant: "standard",
1819
- duration: DURATION,
1820
- icon: /* @__PURE__ */ React13.createElement(Loading, { color: "currentColor" })
1821
- });
1822
- setToastId(id2);
1823
- onExit();
1824
- return;
1825
- }
1826
- yield actions.startTranscription({
1827
- mode: HMSTranscriptionMode.CAPTION
1828
- });
1829
- const id = ToastManager.replaceToast(toastId, {
1830
- title: `Enabling Closed Caption for everyone.`,
1831
- variant: "standard",
1832
- duration: DURATION,
1833
- icon: /* @__PURE__ */ React13.createElement(Loading, { color: "currentColor" })
1834
- });
1835
- setToastId(id);
1836
- } catch (err) {
1837
- const id = ToastManager.replaceToast(toastId, {
1838
- title: `Failed to ${isTranscriptionEnabled ? "disable" : "enable"} closed caption`,
1839
- variant: "error",
1840
- icon: /* @__PURE__ */ React13.createElement(AlertTriangleIcon3, { style: { marginRight: "0.5rem" } })
1841
- });
1842
- setToastId(id);
1843
- } finally {
1844
- setIsCaptionEnabled(true);
1845
- }
1846
- onExit();
1847
- })
1848
- },
1849
- isTranscriptionEnabled ? "Disable" : "Enable",
1850
- " for Everyone"
1851
- )
1852
- )
1853
- ), isMobile && /* @__PURE__ */ React13.createElement(Text, { variant: "sm", css: { color: "$on_surface_medium", pb: "$4", mb: "$8", "@md": { px: "$8", mt: "$4" } } }, "This will ", isTranscriptionEnabled ? "disable" : "enable", " Closed Captions for everyone in this room. You can\xA0", isTranscriptionEnabled ? "enable" : "disable", " it later."));
1854
- };
1855
-
1856
- // src/Prebuilt/components/MoreSettings/CaptionModal.tsx
1857
- var CaptionModal = ({ onOpenChange }) => {
1858
- const isMobile = useMedia3(config.media.md);
1859
- const props = {
1860
- isMobile,
1861
- onExit: () => {
1862
- onOpenChange(false);
1863
- }
1864
- };
1865
- if (isMobile) {
1866
- return /* @__PURE__ */ React14.createElement(Sheet.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React14.createElement(Sheet.Content, { css: { bg: "$surface_dim", p: "$8 0" } }, /* @__PURE__ */ React14.createElement(CaptionContent, __spreadValues({}, props))));
1867
- }
1868
- return /* @__PURE__ */ React14.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React14.createElement(Dialog.Portal, null, /* @__PURE__ */ React14.createElement(Dialog.Overlay, null), /* @__PURE__ */ React14.createElement(Dialog.Content, { css: { bg: "$surface_dim", width: "min(400px,80%)", p: "$10" } }, /* @__PURE__ */ React14.createElement(CaptionContent, __spreadValues({}, props)))));
1869
- };
1870
-
1871
- // src/Prebuilt/components/MoreSettings/FullScreenItem.tsx
1872
- init_define_process_env();
1873
- import React15 from "react";
1874
- import { ExpandIcon } from "@100mslive/react-icons";
1875
-
1876
- // src/Prebuilt/components/hooks/useFullscreen.ts
1877
- init_define_process_env();
1878
- import { useCallback as useCallback9, useEffect as useEffect6, useState as useState10 } from "react";
1879
- import screenfull from "screenfull";
1880
- var useFullscreen = () => {
1881
- const [isFullScreenEnabled, setIsFullScreenEnabled] = useState10(screenfull.isFullscreen);
1882
- const toggle = useCallback9(() => __async(void 0, null, function* () {
1883
- if (!screenfull.isEnabled) {
1884
- ToastManager.addToast({ title: "Fullscreen feature not supported" });
1885
- return;
1886
- }
1887
- try {
1888
- const container = document.querySelector(DEFAULT_PORTAL_CONTAINER);
1889
- if (isFullScreenEnabled) {
1890
- yield screenfull.exit();
1891
- } else if (container) {
1892
- yield screenfull.request(container);
1893
- }
1894
- } catch (err) {
1895
- ToastManager.addToast({ title: err.message });
1896
- }
1897
- }), [isFullScreenEnabled]);
1898
- useEffect6(() => {
1899
- const onChange = () => {
1900
- setIsFullScreenEnabled(screenfull.isFullscreen);
1901
- };
1902
- if (screenfull.isEnabled) {
1903
- screenfull.on("change", onChange);
1904
- }
1905
- return () => {
1906
- if (screenfull.isEnabled) {
1907
- screenfull.off("change", onChange);
1908
- }
1909
- };
1910
- }, []);
1911
- return {
1912
- allowed: screenfull.isEnabled,
1913
- isFullscreen: isFullScreenEnabled,
1914
- toggleFullscreen: toggle
1915
- };
1916
- };
1917
-
1918
- // src/Prebuilt/components/MoreSettings/FullScreenItem.tsx
1919
- var FullScreenItem = () => {
1920
- const { allowed, isFullscreen, toggleFullscreen } = useFullscreen();
1921
- if (!allowed) {
1922
- return null;
1923
- }
1924
- return /* @__PURE__ */ React15.createElement(
1925
- Dropdown.Item,
1926
- {
1927
- onClick: () => {
1928
- toggleFullscreen();
1929
- },
1930
- "data-testid": "full_screen_btn"
1931
- },
1932
- /* @__PURE__ */ React15.createElement(ExpandIcon, null),
1933
- /* @__PURE__ */ React15.createElement(Text, { variant: "sm", css: { ml: "$4" } }, isFullscreen ? "Exit " : "Go ", "Fullscreen")
1934
- );
1935
- };
1936
-
1937
- // src/Prebuilt/components/MoreSettings/MuteAllModal.tsx
1938
- init_define_process_env();
1939
- import React17, { useCallback as useCallback10, useState as useState11 } from "react";
1940
- import {
1941
- selectAvailableRoleNames,
1942
- useHMSActions as useHMSActions10,
1943
- useHMSStore as useHMSStore10
1944
- } from "@100mslive/react-sdk";
1945
- import { MicOffIcon } from "@100mslive/react-icons";
1946
-
1947
- // src/Prebuilt/components/MoreSettings/MuteAllContent.tsx
1948
- init_define_process_env();
1949
- import React16 from "react";
1950
- import { selectPermissions as selectPermissions3, useHMSStore as useHMSStore9 } from "@100mslive/react-sdk";
1951
- var MuteAllContent = (props) => {
1952
- const roles = props.roles || [];
1953
- const permissions = useHMSStore9(selectPermissions3);
1954
- return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
1955
- DialogSelect,
1956
- {
1957
- title: "Role",
1958
- options: [{ label: "All Roles", value: "" }, ...roles.map((role) => ({ label: role, value: role }))],
1959
- selected: props.selectedRole,
1960
- keyField: "value",
1961
- labelField: "label",
1962
- onChange: props.setRole
1963
- }
1964
- ), /* @__PURE__ */ React16.createElement(
1965
- DialogSelect,
1966
- {
1967
- title: "Track type",
1968
- options: trackTypeOptions,
1969
- selected: props.trackType,
1970
- onChange: props.setTrackType,
1971
- keyField: "value",
1972
- labelField: "label"
1973
- }
1974
- ), /* @__PURE__ */ React16.createElement(
1975
- DialogSelect,
1976
- {
1977
- title: "Track source",
1978
- options: trackSourceOptions,
1979
- selected: props.selectedSource,
1980
- onChange: props.setSource,
1981
- keyField: "value",
1982
- labelField: "label"
1983
- }
1984
- ), /* @__PURE__ */ React16.createElement(DialogRow, null, /* @__PURE__ */ React16.createElement(Text, { variant: "md" }, "Track status"), /* @__PURE__ */ React16.createElement(RadioGroup.Root, { value: String(props.enabled), onValueChange: (value) => props.setEnabled(value === "true") }, (permissions == null ? void 0 : permissions.mute) && /* @__PURE__ */ React16.createElement(Flex, { align: "center", css: { mr: "$8" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Item, { value: "false", id: "trackDisableRadio", css: { mr: "$4" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Indicator, null)), /* @__PURE__ */ React16.createElement(Label, { htmlFor: "trackDisableRadio" }, "Mute")), (permissions == null ? void 0 : permissions.unmute) && /* @__PURE__ */ React16.createElement(Flex, { align: "center", css: { cursor: "pointer" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Item, { value: "true", id: "trackEnableRadio", css: { mr: "$4" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Indicator, null)), /* @__PURE__ */ React16.createElement(Label, { htmlFor: "trackEnableRadio" }, "Request Unmute")))), /* @__PURE__ */ React16.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React16.createElement(Button, { variant: "primary", onClick: props.muteAll, css: { w: (props == null ? void 0 : props.isMobile) ? "100%" : "" } }, "Apply")));
1985
- };
1986
-
1987
- // src/Prebuilt/components/MoreSettings/MuteAllModal.tsx
1988
- var MuteAllModal = ({
1989
- onOpenChange,
1990
- isMobile = false
1991
- }) => {
1992
- const roles = useHMSStore10(selectAvailableRoleNames);
1993
- const hmsActions = useHMSActions10();
1994
- const [enabled, setEnabled] = useState11(false);
1995
- const [trackType, setTrackType] = useState11();
1996
- const [selectedRole, setRole] = useState11();
1997
- const [selectedSource, setSource] = useState11();
1998
- const muteAll = useCallback10(() => __async(void 0, null, function* () {
1999
- yield hmsActions.setRemoteTracksEnabled({
2000
- enabled,
2001
- type: trackType,
2002
- source: selectedSource,
2003
- roles: selectedRole ? [selectedRole] : void 0
2004
- });
2005
- onOpenChange(false);
2006
- }), [selectedRole, enabled, trackType, selectedSource, hmsActions, onOpenChange]);
2007
- const props = {
2008
- muteAll,
2009
- roles,
2010
- enabled,
2011
- setEnabled,
2012
- trackType,
2013
- setTrackType,
2014
- selectedRole,
2015
- setRole,
2016
- selectedSource,
2017
- setSource,
2018
- isMobile
2019
- };
2020
- if (isMobile) {
2021
- return /* @__PURE__ */ React17.createElement(Sheet.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React17.createElement(Sheet.Content, { css: { px: "$10" } }, /* @__PURE__ */ React17.createElement(MuteAllContent, __spreadValues({}, props))));
2022
- }
2023
- return /* @__PURE__ */ React17.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React17.createElement(DialogContent, { title: "Mute/Unmute Remote Tracks", Icon: MicOffIcon }, /* @__PURE__ */ React17.createElement(MuteAllContent, __spreadValues({}, props))));
2024
- };
2025
-
2026
- // src/Prebuilt/components/PIP/usePIPChat.tsx
2027
- init_define_process_env();
2028
- import { useEffect as useEffect7 } from "react";
2029
- import { useHMSActions as useHMSActions11 } from "@100mslive/react-sdk";
2030
- var usePIPChat = () => {
2031
- const hmsActions = useHMSActions11();
2032
- const { isSupported, requestPipWindow, pipWindow, closePipWindow } = usePIPWindow();
2033
- useEffect7(() => {
2034
- if (document && pipWindow) {
2035
- const style = document.createElement("style");
2036
- style.id = "stitches";
2037
- style.textContent = getCssText();
2038
- pipWindow.document.head.appendChild(style);
2039
- }
2040
- }, [pipWindow]);
2041
- useEffect7(() => {
2042
- if (pipWindow) {
2043
- const chatContainer = pipWindow.document.getElementById("chat-container");
2044
- const selector = pipWindow.document.getElementById("selector");
2045
- const sendBtn = pipWindow.document.getElementById("send-btn");
2046
- const pipChatInput = pipWindow.document.getElementById("chat-input");
2047
- const marker = pipWindow.document.getElementById("marker");
2048
- marker == null ? void 0 : marker.scrollIntoView({ block: "end" });
2049
- const observer = new IntersectionObserver(
2050
- (entries) => {
2051
- entries.forEach((entry) => {
2052
- if (entry.isIntersecting && entry.target.id) {
2053
- hmsActions.setMessageRead(true, entry.target.id);
2054
- }
2055
- });
2056
- },
2057
- {
2058
- root: chatContainer,
2059
- threshold: 0.8
2060
- }
2061
- );
2062
- const mutationObserver = new MutationObserver((mutations) => {
2063
- mutations.forEach((mutation) => {
2064
- if (mutation.addedNodes.length > 0) {
2065
- const newMessages = mutation.addedNodes;
2066
- newMessages.forEach((message) => {
2067
- const messageId = message == null ? void 0 : message.id;
2068
- if (messageId === "new-message-notif") {
2069
- message.addEventListener(
2070
- "click",
2071
- () => setTimeout(() => marker == null ? void 0 : marker.scrollIntoView({ block: "end", behavior: "smooth" }), 0)
2072
- );
2073
- } else if (messageId)
2074
- observer.observe(message);
2075
- });
2076
- }
2077
- });
2078
- });
2079
- mutationObserver.observe(chatContainer, {
2080
- childList: true
2081
- });
2082
- const sendMessage = () => __async(void 0, null, function* () {
2083
- const selection = (selector == null ? void 0 : selector.value) || "Everyone";
2084
- if (selection === "Everyone") {
2085
- yield hmsActions.sendBroadcastMessage(pipChatInput.value.trim());
2086
- } else {
2087
- yield hmsActions.sendGroupMessage(pipChatInput.value.trim(), [selection]);
2088
- }
2089
- pipChatInput.value = "";
2090
- setTimeout(() => marker == null ? void 0 : marker.scrollIntoView({ block: "end", behavior: "smooth" }), 0);
2091
- });
2092
- if (sendBtn && hmsActions && pipChatInput) {
2093
- const pipMessages = pipWindow.document.getElementsByClassName("pip-message");
2094
- [...pipMessages].forEach((message) => {
2095
- if (message.id) {
2096
- hmsActions.setMessageRead(true, message.id);
2097
- }
2098
- });
2099
- const sendOnEnter = (e) => {
2100
- if (e.key === "Enter")
2101
- sendMessage();
2102
- };
2103
- sendBtn.addEventListener("click", sendMessage);
2104
- pipChatInput.addEventListener("keypress", sendOnEnter);
2105
- return () => {
2106
- sendBtn.removeEventListener("click", sendMessage);
2107
- pipChatInput.removeEventListener("keypress", sendOnEnter);
2108
- mutationObserver.disconnect();
2109
- observer.disconnect();
2110
- };
2111
- }
2112
- }
2113
- }, [pipWindow, hmsActions]);
2114
- useEffect7(() => {
2115
- return () => {
2116
- pipWindow && closePipWindow();
2117
- };
2118
- }, [closePipWindow, pipWindow]);
2119
- return { isSupported, requestPipWindow, pipWindow };
2120
- };
2121
-
2122
- // src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx
2123
- var MODALS = {
2124
- CHANGE_NAME: "changeName",
2125
- SELF_ROLE_CHANGE: "selfRoleChange",
2126
- MORE_SETTINGS: "moreSettings",
2127
- START_RECORDING: "startRecording",
2128
- DEVICE_SETTINGS: "deviceSettings",
2129
- STATS_FOR_NERDS: "statsForNerds",
2130
- BULK_ROLE_CHANGE: "bulkRoleChange",
2131
- MUTE_ALL: "muteAll",
2132
- EMBED_URL: "embedUrl",
2133
- CAPTION: "caption"
2134
- };
2135
- var DesktopOptions = ({
2136
- elements,
2137
- screenType
2138
- }) => {
2139
- const localPeerId = useHMSStore11(selectLocalPeerID4);
2140
- const hmsActions = useHMSActions12();
2141
- const enablHlsStats = useHMSStore11(selectAppData(APP_DATA.hlsStats));
2142
- const [openModals, setOpenModals] = useState12(/* @__PURE__ */ new Set());
2143
- const { isBRBOn, toggleBRB } = useMyMetadata();
2144
- const isPipOn = PictureInPicture.isOn();
2145
- const isBRBEnabled = !!(elements == null ? void 0 : elements.brb);
2146
- const isTranscriptionAllowed = useHMSStore11(selectIsTranscriptionAllowedByMode(HMSTranscriptionMode2.CAPTION));
2147
- const isTranscriptionEnabled = useHMSStore11(selectIsTranscriptionEnabled2);
2148
- const { isSupported, pipWindow, requestPipWindow } = usePIPChat();
2149
- const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
2150
- const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
2151
- const showPipChatOption = !!(elements == null ? void 0 : elements.chat) && isSupported && !pipWindow;
2152
- useDropdownList({ open: openModals.size > 0, name: "MoreSettings" });
2153
- const updateState = (modalName, value) => {
2154
- setOpenModals((modals) => {
2155
- const copy = new Set(modals);
2156
- if (value) {
2157
- copy.clear();
2158
- copy.add(modalName);
2159
- } else {
2160
- copy.delete(modalName);
2161
- }
2162
- return copy;
2163
- });
2164
- };
2165
- return /* @__PURE__ */ React18.createElement(Fragment2, null, isSupported && pipWindow ? /* @__PURE__ */ React18.createElement(PIPWindow, { pipWindow }, /* @__PURE__ */ React18.createElement(PIPChat, null)) : null, /* @__PURE__ */ React18.createElement(
2166
- Dropdown.Root,
2167
- {
2168
- open: openModals.has(MODALS.MORE_SETTINGS),
2169
- onOpenChange: (value) => updateState(MODALS.MORE_SETTINGS, value),
2170
- modal: false
2171
- },
2172
- /* @__PURE__ */ React18.createElement(Tooltip, { title: "More options" }, /* @__PURE__ */ React18.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "more_settings_btn" }, /* @__PURE__ */ React18.createElement(IconButton_default, null, /* @__PURE__ */ React18.createElement(HamburgerMenuIcon, null)))),
2173
- /* @__PURE__ */ React18.createElement(
2174
- Dropdown.Content,
2175
- {
2176
- sideOffset: 5,
2177
- align: "end",
2178
- css: {
2179
- py: "$0",
2180
- maxHeight: "unset",
2181
- "@md": { w: "$64" },
2182
- "div[role='separator']:first-child": {
2183
- display: "none"
2184
- }
2185
- }
2186
- },
2187
- isBRBEnabled && screenType !== "hls_live_streaming" ? /* @__PURE__ */ React18.createElement(Dropdown.Item, { onClick: toggleBRB, "data-testid": "brb_btn" }, /* @__PURE__ */ React18.createElement(BrbIcon, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4", color: "$on_surface_high" } }, "Be Right Back"), /* @__PURE__ */ React18.createElement(Flex, { justify: "end", css: { color: "$on_surface_high", flexGrow: "1" } }, isBRBOn ? /* @__PURE__ */ React18.createElement(CheckIcon2, null) : null)) : null,
2188
- isTranscriptionAllowed ? /* @__PURE__ */ React18.createElement(
2189
- Dropdown.Item,
2190
- {
2191
- "data-testid": "closed_caption_admin",
2192
- onClick: () => {
2193
- updateState(MODALS.CAPTION, true);
2194
- }
2195
- },
2196
- /* @__PURE__ */ React18.createElement(OpenCaptionIcon, null),
2197
- /* @__PURE__ */ React18.createElement(Flex, { direction: "column", css: { flexGrow: "1" } }, /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4", color: "$on_surface_high" } }, "Closed Captions"), /* @__PURE__ */ React18.createElement(Text, { variant: "caption", css: { ml: "$4", color: "$on_surface_medium" } }, isTranscriptionEnabled ? "Enabled" : "Disabled")),
2198
- /* @__PURE__ */ React18.createElement(Switch, { id: "closed_caption_start_stop", checked: isTranscriptionEnabled, disabled: false })
2199
- ) : null,
2200
- screenType !== "hls_live_streaming" ? /* @__PURE__ */ React18.createElement(Dropdown.Item, { css: { p: 0, "&:empty": { display: "none" } } }, /* @__PURE__ */ React18.createElement(
2201
- PIP,
2202
- {
2203
- content: /* @__PURE__ */ React18.createElement(Flex, { css: { w: "100%", h: "100%", p: "$8" } }, /* @__PURE__ */ React18.createElement(PipIcon2, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, isPipOn ? "Disable" : "Enable", " Picture-in-Picture"))
2204
- }
2205
- )) : null,
2206
- /* @__PURE__ */ React18.createElement(
2207
- PIPChatOption,
2208
- {
2209
- showPIPChat: showPipChatOption,
2210
- openChat: () => __async(void 0, null, function* () {
2211
- isChatOpen && toggleChat();
2212
- yield requestPipWindow(350, 500);
2213
- })
2214
- }
2215
- ),
2216
- /* @__PURE__ */ React18.createElement(FullScreenItem, null),
2217
- /* @__PURE__ */ React18.createElement(Dropdown.ItemSeparator, { css: { mx: 0 } }),
2218
- /* @__PURE__ */ React18.createElement(Dropdown.Item, { onClick: () => updateState(MODALS.DEVICE_SETTINGS, true), "data-testid": "device_settings_btn" }, /* @__PURE__ */ React18.createElement(SettingsIcon, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Settings")),
2219
- match2({ screenType, isSupported: HMSHLSPlayer.isSupported() }).with({ screenType: "hls_live_streaming", isSupported: false }, () => null).with({ screenType: "hls_live_streaming", isSupported: true }, () => {
2220
- return /* @__PURE__ */ React18.createElement(
2221
- Dropdown.Item,
2222
- {
2223
- onClick: () => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats),
2224
- "data-testid": "hls_stats"
2225
- },
2226
- /* @__PURE__ */ React18.createElement(
2227
- Checkbox.Root,
2228
- {
2229
- css: { margin: "$2" },
2230
- checked: enablHlsStats,
2231
- onCheckedChange: () => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats)
2232
- },
2233
- /* @__PURE__ */ React18.createElement(Checkbox.Indicator, null, /* @__PURE__ */ React18.createElement(CheckIcon2, { width: 16, height: 16 }))
2234
- ),
2235
- /* @__PURE__ */ React18.createElement(Flex, { justify: "between", css: { width: "100%" } }, /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Show HLS Stats"), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, `${isMacOS ? "\u2318" : "ctrl"} + ]`))
2236
- );
2237
- }).otherwise(() => /* @__PURE__ */ React18.createElement(
2238
- Dropdown.Item,
2239
- {
2240
- onClick: () => updateState(MODALS.STATS_FOR_NERDS, true),
2241
- "data-testid": "stats_for_nerds_btn"
2242
- },
2243
- /* @__PURE__ */ React18.createElement(InfoIcon2, null),
2244
- /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Stats for Nerds")
2245
- ))
2246
- )
2247
- ), openModals.has(MODALS.BULK_ROLE_CHANGE) && /* @__PURE__ */ React18.createElement(BulkRoleChangeModal, { onOpenChange: (value) => updateState(MODALS.BULK_ROLE_CHANGE, value) }), openModals.has(MODALS.MUTE_ALL) && /* @__PURE__ */ React18.createElement(MuteAllModal, { onOpenChange: (value) => updateState(MODALS.MUTE_ALL, value) }), openModals.has(MODALS.START_RECORDING) && /* @__PURE__ */ React18.createElement(StartRecording_default, { open: true, onOpenChange: (value) => updateState(MODALS.START_RECORDING, value) }), openModals.has(MODALS.DEVICE_SETTINGS) && /* @__PURE__ */ React18.createElement(
2248
- SettingsModal_default,
2249
- {
2250
- open: true,
2251
- onOpenChange: (value) => updateState(MODALS.DEVICE_SETTINGS, value),
2252
- screenType
2253
- }
2254
- ), openModals.has(MODALS.STATS_FOR_NERDS) && /* @__PURE__ */ React18.createElement(StatsForNerds, { open: true, onOpenChange: (value) => updateState(MODALS.STATS_FOR_NERDS, value) }), openModals.has(MODALS.SELF_ROLE_CHANGE) && /* @__PURE__ */ React18.createElement(
2255
- RoleChangeModal,
2256
- {
2257
- peerId: localPeerId,
2258
- onOpenChange: (value) => updateState(MODALS.SELF_ROLE_CHANGE, value)
2259
- }
2260
- ), openModals.has(MODALS.CAPTION) && /* @__PURE__ */ React18.createElement(CaptionModal, { onOpenChange: (value) => updateState(MODALS.CAPTION, value) }));
2261
- };
2262
-
2263
- // src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx
2264
- init_define_process_env();
2265
- import React19, { useRef as useRef4, useState as useState14 } from "react";
2266
- import { useClickAway } from "react-use";
2267
- import { match as match3 } from "ts-pattern";
2268
- import {
2269
- HMSTranscriptionMode as HMSTranscriptionMode3,
2270
- selectIsConnectedToRoom,
2271
- selectIsLocalVideoEnabled as selectIsLocalVideoEnabled2,
2272
- selectIsTranscriptionAllowedByMode as selectIsTranscriptionAllowedByMode2,
2273
- selectIsTranscriptionEnabled as selectIsTranscriptionEnabled3,
2274
- selectPeerCount,
2275
- selectPermissions as selectPermissions4,
2276
- useHMSActions as useHMSActions13,
2277
- useHMSStore as useHMSStore13,
2278
- useRecordingStreaming as useRecordingStreaming2
2279
- } from "@100mslive/react-sdk";
2280
- import {
2281
- BrbIcon as BrbIcon2,
2282
- ClosedCaptionIcon,
2283
- CrossIcon as CrossIcon3,
2284
- EmojiIcon,
2285
- HamburgerMenuIcon as HamburgerMenuIcon2,
2286
- HandIcon,
2287
- HandRaiseSlashedIcon,
2288
- InfoIcon as InfoIcon3,
2289
- OpenCaptionIcon as OpenCaptionIcon2,
2290
- PeopleIcon,
2291
- QuizActiveIcon,
2292
- QuizIcon,
2293
- RecordIcon,
2294
- SettingsIcon as SettingsIcon2,
2295
- VirtualBackgroundIcon
2296
- } from "@100mslive/react-icons";
2297
-
2298
- // src/Prebuilt/components/hooks/useUnreadPollQuizPresent.tsx
2299
- init_define_process_env();
2300
- import { useEffect as useEffect8, useState as useState13 } from "react";
2301
- import { HMSNotificationTypes, useHMSNotifications, useHMSStore as useHMSStore12 } from "@100mslive/react-sdk";
2302
- var useUnreadPollQuizPresent = () => {
2303
- const localPeerID = useHMSStore12(Ee);
2304
- const notification = useHMSNotifications(HMSNotificationTypes.POLL_STARTED);
2305
- const [unreadPollQuiz, setUnreadPollQuiz] = useState13(false);
2306
- useEffect8(() => {
2307
- if (!notification) {
2308
- return;
2309
- }
2310
- setUnreadPollQuiz(notification.data.startedBy !== localPeerID);
2311
- }, [localPeerID, notification]);
2312
- return { unreadPollQuiz, setUnreadPollQuiz };
2313
- };
2314
-
2315
- // src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx
2316
- var MODALS2 = {
2317
- CHANGE_NAME: "changeName",
2318
- SELF_ROLE_CHANGE: "selfRoleChange",
2319
- MORE_SETTINGS: "moreSettings",
2320
- START_RECORDING: "startRecording",
2321
- DEVICE_SETTINGS: "deviceSettings",
2322
- STATS_FOR_NERDS: "statsForNerds",
2323
- BULK_ROLE_CHANGE: "bulkRoleChange",
2324
- MUTE_ALL: "muteAll",
2325
- EMBED_URL: "embedUrl",
2326
- CAPTION: "caption"
2327
- };
2328
- var MwebOptions = ({
2329
- elements,
2330
- screenType
2331
- }) => {
2332
- const hmsActions = useHMSActions13();
2333
- const permissions = useHMSStore13(selectPermissions4);
2334
- const isConnected = useHMSStore13(selectIsConnectedToRoom);
2335
- const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming2();
2336
- const [openModals, setOpenModals] = useState14(/* @__PURE__ */ new Set());
2337
- const [openOptionsSheet, setOpenOptionsSheet] = useState14(false);
2338
- const [openSettingsSheet, setOpenSettingsSheet] = useState14(false);
2339
- const [showEmojiCard, setShowEmojiCard] = useState14(false);
2340
- const [showRecordingOn, setShowRecordingOn] = useState14(false);
2341
- const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
2342
- const { showPolls } = useShowPolls();
2343
- const togglePollView = usePollViewToggle();
2344
- const peerCount = useHMSStore13(selectPeerCount);
2345
- const emojiCardRef = useRef4(null);
2346
- const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
2347
- const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent();
2348
- const { title, description } = useRoomLayoutHeader();
2349
- const toggleDetailsSheet = useSheetToggle(SHEET_OPTIONS.ROOM_DETAILS);
2350
- const isMobileHLSStream = useMobileHLSStream();
2351
- const isLandscapeHLSStream = useLandscapeHLSStream();
2352
- const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
2353
- const isLocalVideoEnabled = useHMSStore13(selectIsLocalVideoEnabled2);
2354
- const { startRecording, isRecordingLoading } = useRecordingHandler();
2355
- const isTranscriptionAllowed = useHMSStore13(selectIsTranscriptionAllowedByMode2(HMSTranscriptionMode3.CAPTION));
2356
- const isTranscriptionEnabled = useHMSStore13(selectIsTranscriptionEnabled3);
2357
- const [isCaptionEnabled] = useSetIsCaptionEnabled();
2358
- useDropdownList({ open: openModals.size > 0 || openOptionsSheet || openSettingsSheet, name: "MoreSettings" });
2359
- const updateState = (modalName, value) => {
2360
- setOpenModals((modals) => {
2361
- const copy = new Set(modals);
2362
- if (value) {
2363
- copy.add(modalName);
2364
- } else {
2365
- copy.delete(modalName);
2366
- }
2367
- return copy;
2368
- });
2369
- };
2370
- useClickAway(emojiCardRef, () => setShowEmojiCard(false));
2371
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(Sheet.Root, { open: openOptionsSheet, onOpenChange: setOpenOptionsSheet }, /* @__PURE__ */ React19.createElement(Tooltip, { title: "More options" }, /* @__PURE__ */ React19.createElement(Sheet.Trigger, { asChild: true, "data-testid": "more_settings_btn" }, /* @__PURE__ */ React19.createElement(IconButton_default, { css: { bg: isMobileHLSStream || isLandscapeHLSStream ? "$surface_default" : "" } }, /* @__PURE__ */ React19.createElement(HamburgerMenuIcon2, null)))), /* @__PURE__ */ React19.createElement(Sheet.Content, { css: { bg: "$surface_dim", pb: "$14" } }, /* @__PURE__ */ React19.createElement(
2372
- Sheet.Title,
2373
- {
2374
- css: {
2375
- display: "flex",
2376
- color: "$on_surface_high",
2377
- w: "100%",
2378
- justifyContent: "space-between",
2379
- fontSize: "$md",
2380
- mt: "$8",
2381
- px: "$10",
2382
- pb: "$8",
2383
- borderBottom: "1px solid $border_default",
2384
- mb: "$8",
2385
- alignItems: "center"
2386
- }
2387
- },
2388
- "Options",
2389
- /* @__PURE__ */ React19.createElement(Sheet.Close, null, /* @__PURE__ */ React19.createElement(Box, { css: { color: "$on_surface_high" } }, /* @__PURE__ */ React19.createElement(CrossIcon3, null)))
2390
- ), /* @__PURE__ */ React19.createElement(
2391
- Box,
2392
- {
2393
- css: {
2394
- display: "grid",
2395
- gridTemplateColumns: "1fr 1fr 1fr",
2396
- gridTemplateRows: "auto",
2397
- gridColumnGap: "$6",
2398
- gridRowGap: "$8",
2399
- px: "$9"
2400
- }
2401
- },
2402
- (elements == null ? void 0 : elements.participant_list) && /* @__PURE__ */ React19.createElement(
2403
- ActionTile.Root,
2404
- {
2405
- onClick: () => {
2406
- toggleParticipants();
2407
- setOpenOptionsSheet(false);
2408
- }
2409
- },
2410
- /* @__PURE__ */ React19.createElement(ActionTile.Count, null, getFormattedCount(peerCount)),
2411
- /* @__PURE__ */ React19.createElement(PeopleIcon, null),
2412
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Participants")
2413
- ),
2414
- elements.hand_raise ? /* @__PURE__ */ React19.createElement(
2415
- ActionTile.Root,
2416
- {
2417
- active: isHandRaised,
2418
- onClick: () => {
2419
- toggleHandRaise();
2420
- setOpenOptionsSheet(false);
2421
- }
2422
- },
2423
- isHandRaised ? /* @__PURE__ */ React19.createElement(HandRaiseSlashedIcon, null) : /* @__PURE__ */ React19.createElement(HandIcon, null),
2424
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, isHandRaised ? "Lower" : "Raise", " Hand")
2425
- ) : null,
2426
- /* @__PURE__ */ React19.createElement(NoiseCancellation, { setOpenOptionsSheet, actionTile: true }),
2427
- isTranscriptionAllowed ? /* @__PURE__ */ React19.createElement(
2428
- ActionTile.Root,
2429
- {
2430
- onClick: () => {
2431
- setOpenOptionsSheet(false);
2432
- updateState(MODALS2.CAPTION, true);
2433
- }
2434
- },
2435
- isTranscriptionEnabled && isCaptionEnabled ? /* @__PURE__ */ React19.createElement(ClosedCaptionIcon, null) : /* @__PURE__ */ React19.createElement(OpenCaptionIcon2, null),
2436
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Closed Caption")
2437
- ) : null,
2438
- isLocalVideoEnabled && !!(elements == null ? void 0 : elements.virtual_background) ? /* @__PURE__ */ React19.createElement(
2439
- ActionTile.Root,
2440
- {
2441
- onClick: () => {
2442
- toggleVB();
2443
- setOpenOptionsSheet(false);
2444
- }
2445
- },
2446
- /* @__PURE__ */ React19.createElement(VirtualBackgroundIcon, null),
2447
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Virtual Background")
2448
- ) : null,
2449
- (elements == null ? void 0 : elements.emoji_reactions) && !(isLandscapeHLSStream || isMobileHLSStream) && /* @__PURE__ */ React19.createElement(
2450
- ActionTile.Root,
2451
- {
2452
- onClick: () => {
2453
- setShowEmojiCard(true);
2454
- setOpenOptionsSheet(false);
2455
- }
2456
- },
2457
- /* @__PURE__ */ React19.createElement(EmojiIcon, null),
2458
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Emoji Reactions")
2459
- ),
2460
- showPolls && /* @__PURE__ */ React19.createElement(
2461
- ActionTile.Root,
2462
- {
2463
- onClick: () => {
2464
- togglePollView();
2465
- setOpenOptionsSheet(false);
2466
- setUnreadPollQuiz(false);
2467
- }
2468
- },
2469
- unreadPollQuiz ? /* @__PURE__ */ React19.createElement(QuizActiveIcon, null) : /* @__PURE__ */ React19.createElement(QuizIcon, null),
2470
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Polls and Quizzes")
2471
- ),
2472
- (elements == null ? void 0 : elements.brb) && /* @__PURE__ */ React19.createElement(
2473
- ActionTile.Root,
2474
- {
2475
- active: isBRBOn,
2476
- onClick: () => {
2477
- toggleBRB();
2478
- setOpenOptionsSheet(false);
2479
- }
2480
- },
2481
- /* @__PURE__ */ React19.createElement(BrbIcon2, null),
2482
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Be Right Back")
2483
- ),
2484
- /* @__PURE__ */ React19.createElement(
2485
- ActionTile.Root,
2486
- {
2487
- onClick: () => {
2488
- setOpenSettingsSheet(true);
2489
- setOpenOptionsSheet(false);
2490
- }
2491
- },
2492
- /* @__PURE__ */ React19.createElement(SettingsIcon2, null),
2493
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Settings")
2494
- ),
2495
- isConnected && (permissions == null ? void 0 : permissions.browserRecording) ? /* @__PURE__ */ React19.createElement(
2496
- ActionTile.Root,
2497
- {
2498
- disabled: isHLSRunning,
2499
- onClick: () => __async(void 0, null, function* () {
2500
- if (isRecordingLoading) {
2501
- return;
2502
- }
2503
- if (isBrowserRecordingOn || isStreamingOn) {
2504
- setOpenOptionsSheet(false);
2505
- setShowRecordingOn(true);
2506
- } else {
2507
- yield startRecording();
2508
- setOpenOptionsSheet(false);
2509
- }
2510
- if (isHLSRunning) {
2511
- setOpenOptionsSheet(false);
2512
- }
2513
- })
2514
- },
2515
- isRecordingLoading ? /* @__PURE__ */ React19.createElement(Loading, null) : /* @__PURE__ */ React19.createElement(RecordIcon, null),
2516
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, match3({ isBrowserRecordingOn, isRecordingLoading }).with({ isBrowserRecordingOn: true, isRecordingLoading: false }, () => "Recording On").with({ isRecordingLoading: true }, () => "Starting Recording").with({ isRecordingLoading: false }, () => "Start Recording").otherwise(() => null))
2517
- ) : null,
2518
- title || description ? /* @__PURE__ */ React19.createElement(
2519
- ActionTile.Root,
2520
- {
2521
- onClick: () => {
2522
- setOpenOptionsSheet(false);
2523
- toggleDetailsSheet();
2524
- }
2525
- },
2526
- /* @__PURE__ */ React19.createElement(InfoIcon3, null),
2527
- /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "About Session")
2528
- ) : null
2529
- ))), /* @__PURE__ */ React19.createElement(SettingsModal_default, { open: openSettingsSheet, onOpenChange: setOpenSettingsSheet, screenType }), openModals.has(MODALS2.MUTE_ALL) && /* @__PURE__ */ React19.createElement(MuteAllModal, { onOpenChange: (value) => updateState(MODALS2.MUTE_ALL, value), isMobile: true }), openModals.has(MODALS2.CHANGE_NAME) && /* @__PURE__ */ React19.createElement(
2530
- ChangeNameModal,
2531
- {
2532
- onOpenChange: (value) => updateState(MODALS2.CHANGE_NAME, value),
2533
- openParentSheet: () => setOpenOptionsSheet(true)
2534
- }
2535
- ), openModals.has(MODALS2.CAPTION) && /* @__PURE__ */ React19.createElement(CaptionModal, { onOpenChange: (value) => updateState(MODALS2.CAPTION, value) }), showEmojiCard && /* @__PURE__ */ React19.createElement(
2536
- Box,
2537
- {
2538
- ref: emojiCardRef,
2539
- css: {
2540
- maxWidth: "100%",
2541
- w: "100%",
2542
- position: "absolute",
2543
- left: 0,
2544
- right: 0,
2545
- bottom: "$18",
2546
- bg: "$surface_default",
2547
- zIndex: "10",
2548
- p: "$8",
2549
- pb: 0,
2550
- r: "$1",
2551
- mx: "$4"
2552
- }
2553
- },
2554
- /* @__PURE__ */ React19.createElement(EmojiReaction, { showCard: true })
2555
- ), showRecordingOn && /* @__PURE__ */ React19.createElement(
2556
- StopRecordingInSheet,
2557
- {
2558
- onClose: () => setShowRecordingOn(false),
2559
- onStopRecording: () => __async(void 0, null, function* () {
2560
- try {
2561
- yield hmsActions.stopRTMPAndRecording();
2562
- setShowRecordingOn(false);
2563
- } catch (error) {
2564
- ToastManager.addToast({
2565
- // @ts-ignore
2566
- title: error.message,
2567
- variant: "error"
2568
- });
2569
- }
2570
- })
2571
- }
2572
- ));
2573
- };
2574
-
2575
- // src/Prebuilt/components/MoreSettings/MoreSettings.tsx
2576
- var MoreSettings = ({
2577
- elements,
2578
- screenType
2579
- }) => {
2580
- const isMobile = useMedia4(config.media.md);
2581
- const isLandscapeHLSStream = useLandscapeHLSStream();
2582
- return isMobile || isLandscapeHLSStream ? /* @__PURE__ */ React20.createElement(MwebOptions, { elements, screenType }) : /* @__PURE__ */ React20.createElement(DesktopOptions, { elements, screenType });
2583
- };
2584
-
2585
- export {
2586
- useIsPeerBlacklisted,
2587
- usePinnedMessages,
2588
- CHAT_MESSAGE_LIMIT,
2589
- AnnotisedMessage,
2590
- ChatBody,
2591
- ActivatedPIP,
2592
- useUnreadPollQuizPresent,
2593
- MoreSettings
2594
- };
2595
- //# sourceMappingURL=chunk-2J5WS52X.js.map