stream-chat-react 14.2.0 → 14.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (454) hide show
  1. package/README.md +7 -9
  2. package/dist/cjs/ReactPlayerWrapper.16cd6fed.js +24 -0
  3. package/dist/cjs/ReactPlayerWrapper.16cd6fed.js.map +1 -0
  4. package/dist/cjs/audioProcessing.22303d69.js +148 -0
  5. package/dist/cjs/audioProcessing.22303d69.js.map +1 -0
  6. package/dist/cjs/emojis.js +211 -226
  7. package/dist/cjs/emojis.js.map +1 -1
  8. package/dist/cjs/index.js +26216 -30901
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/mp3-encoder.js +30 -58
  11. package/dist/cjs/mp3-encoder.js.map +1 -1
  12. package/dist/cjs/useNotificationApi.9ffe5761.js +5516 -0
  13. package/dist/cjs/useNotificationApi.9ffe5761.js.map +1 -0
  14. package/dist/css/index.css +13 -0
  15. package/dist/css/index.css.map +1 -1
  16. package/dist/es/ReactPlayerWrapper.d2ae5941.mjs +22 -0
  17. package/dist/es/ReactPlayerWrapper.d2ae5941.mjs.map +1 -0
  18. package/dist/es/audioProcessing.766ca76c.mjs +107 -0
  19. package/dist/es/audioProcessing.766ca76c.mjs.map +1 -0
  20. package/dist/es/emojis.mjs +207 -205
  21. package/dist/es/emojis.mjs.map +1 -1
  22. package/dist/es/index.mjs +25961 -31232
  23. package/dist/es/index.mjs.map +1 -1
  24. package/dist/es/mp3-encoder.mjs +31 -38
  25. package/dist/es/mp3-encoder.mjs.map +1 -1
  26. package/dist/es/useNotificationApi.6fdc3ce7.mjs +4195 -0
  27. package/dist/es/useNotificationApi.6fdc3ce7.mjs.map +1 -0
  28. package/dist/types/a11y/a11yUtils.d.ts.map +1 -1
  29. package/dist/types/a11y/hooks/useAriaIdentifiers.d.ts.map +1 -1
  30. package/dist/types/a11y/hooks/useResolvedModalAriaProps.d.ts.map +1 -1
  31. package/dist/types/components/AIStateIndicator/AIStateIndicator.d.ts.map +1 -1
  32. package/dist/types/components/AIStateIndicator/hooks/useAIState.d.ts.map +1 -1
  33. package/dist/types/components/Accessibility/AriaLiveRegion.d.ts.map +1 -1
  34. package/dist/types/components/Accessibility/NotificationAnnouncer.d.ts.map +1 -1
  35. package/dist/types/components/Accessibility/hooks/useIncomingMessageAnnouncements.d.ts.map +1 -1
  36. package/dist/types/components/Accessibility/useAriaLiveAnnouncer.d.ts +0 -1
  37. package/dist/types/components/Accessibility/useAriaLiveAnnouncer.d.ts.map +1 -1
  38. package/dist/types/components/Attachment/Attachment.d.ts.map +1 -1
  39. package/dist/types/components/Attachment/AttachmentActions.d.ts +3 -1
  40. package/dist/types/components/Attachment/AttachmentActions.d.ts.map +1 -1
  41. package/dist/types/components/Attachment/AttachmentContainer.d.ts +1 -1
  42. package/dist/types/components/Attachment/AttachmentContainer.d.ts.map +1 -1
  43. package/dist/types/components/Attachment/Audio.d.ts.map +1 -1
  44. package/dist/types/components/Attachment/FileAttachment.d.ts.map +1 -1
  45. package/dist/types/components/Attachment/Geolocation.d.ts.map +1 -1
  46. package/dist/types/components/Attachment/Giphy.d.ts.map +1 -1
  47. package/dist/types/components/Attachment/Image.d.ts.map +1 -1
  48. package/dist/types/components/Attachment/LinkPreview/Card.d.ts +3 -1
  49. package/dist/types/components/Attachment/LinkPreview/Card.d.ts.map +1 -1
  50. package/dist/types/components/Attachment/LinkPreview/CardAudio.d.ts.map +1 -1
  51. package/dist/types/components/Attachment/LinkPreview/UnableToRenderCard.d.ts +1 -1
  52. package/dist/types/components/Attachment/LinkPreview/UnableToRenderCard.d.ts.map +1 -1
  53. package/dist/types/components/Attachment/ModalGallery.d.ts.map +1 -1
  54. package/dist/types/components/Attachment/VideoAttachment.d.ts.map +1 -1
  55. package/dist/types/components/Attachment/VoiceRecording.d.ts.map +1 -1
  56. package/dist/types/components/Attachment/attachment-sizing.d.ts.map +1 -1
  57. package/dist/types/components/Attachment/audioSampling.d.ts.map +1 -1
  58. package/dist/types/components/Attachment/components/DownloadButton.d.ts.map +1 -1
  59. package/dist/types/components/Attachment/components/FileSizeIndicator.d.ts.map +1 -1
  60. package/dist/types/components/Attachment/icons.d.ts.map +1 -1
  61. package/dist/types/components/Attachment/utils.d.ts.map +1 -1
  62. package/dist/types/components/AudioPlayback/AudioPlayer.d.ts +1 -2
  63. package/dist/types/components/AudioPlayback/AudioPlayer.d.ts.map +1 -1
  64. package/dist/types/components/AudioPlayback/AudioPlayerPool.d.ts +1 -1
  65. package/dist/types/components/AudioPlayback/AudioPlayerPool.d.ts.map +1 -1
  66. package/dist/types/components/AudioPlayback/WithAudioPlayback.d.ts.map +1 -1
  67. package/dist/types/components/AudioPlayback/components/PlaybackRateButton.d.ts.map +1 -1
  68. package/dist/types/components/AudioPlayback/components/ProgressBar.d.ts.map +1 -1
  69. package/dist/types/components/AudioPlayback/components/WaveProgressBar.d.ts.map +1 -1
  70. package/dist/types/components/AudioPlayback/components/formatTime.d.ts +1 -1
  71. package/dist/types/components/AudioPlayback/components/formatTime.d.ts.map +1 -1
  72. package/dist/types/components/AudioPlayback/components/keyboardSeek.d.ts.map +1 -1
  73. package/dist/types/components/AudioPlayback/components/progressBarA11y.d.ts.map +1 -1
  74. package/dist/types/components/AudioPlayback/components/useInteractiveProgressBar.d.ts.map +1 -1
  75. package/dist/types/components/AudioPlayback/plugins/AudioPlayerNotificationsPlugin.d.ts.map +1 -1
  76. package/dist/types/components/Avatar/Avatar.d.ts.map +1 -1
  77. package/dist/types/components/Avatar/ChannelAvatar.d.ts.map +1 -1
  78. package/dist/types/components/Avatar/GroupAvatar.d.ts.map +1 -1
  79. package/dist/types/components/Badge/Badge.d.ts +1 -1
  80. package/dist/types/components/Badge/Badge.d.ts.map +1 -1
  81. package/dist/types/components/Badge/MediaBadge.d.ts.map +1 -1
  82. package/dist/types/components/BaseImage/ImagePlaceholder.d.ts.map +1 -1
  83. package/dist/types/components/BaseImage/toBaseImageDescriptors.d.ts.map +1 -1
  84. package/dist/types/components/Button/PlayButton.d.ts.map +1 -1
  85. package/dist/types/components/Channel/Channel.d.ts +3 -1
  86. package/dist/types/components/Channel/Channel.d.ts.map +1 -1
  87. package/dist/types/components/Channel/channelState.d.ts.map +1 -1
  88. package/dist/types/components/Channel/hooks/useChannelContainerClasses.d.ts +1 -1
  89. package/dist/types/components/Channel/hooks/useChannelContainerClasses.d.ts.map +1 -1
  90. package/dist/types/components/Channel/hooks/useCreateChannelStateContext.d.ts +1 -1
  91. package/dist/types/components/Channel/hooks/useCreateChannelStateContext.d.ts.map +1 -1
  92. package/dist/types/components/Channel/hooks/useCreateTypingContext.d.ts.map +1 -1
  93. package/dist/types/components/Channel/hooks/useEditMessageHandler.d.ts.map +1 -1
  94. package/dist/types/components/Channel/hooks/useIsMounted.d.ts +0 -1
  95. package/dist/types/components/Channel/hooks/useIsMounted.d.ts.map +1 -1
  96. package/dist/types/components/Channel/hooks/useMentionsHandlers.d.ts.map +1 -1
  97. package/dist/types/components/Channel/utils.d.ts +2 -2
  98. package/dist/types/components/Channel/utils.d.ts.map +1 -1
  99. package/dist/types/components/ChannelHeader/ChannelHeader.d.ts.map +1 -1
  100. package/dist/types/components/ChannelList/ChannelList.d.ts +3 -1
  101. package/dist/types/components/ChannelList/ChannelList.d.ts.map +1 -1
  102. package/dist/types/components/ChannelList/ChannelListUI.d.ts.map +1 -1
  103. package/dist/types/components/ChannelList/hooks/useChannelListShape.d.ts.map +1 -1
  104. package/dist/types/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts.map +1 -1
  105. package/dist/types/components/ChannelList/hooks/usePaginatedChannels.d.ts +12 -2
  106. package/dist/types/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
  107. package/dist/types/components/ChannelList/utils.d.ts +3 -3
  108. package/dist/types/components/ChannelList/utils.d.ts.map +1 -1
  109. package/dist/types/components/ChannelListItem/ChannelListItem.d.ts.map +1 -1
  110. package/dist/types/components/ChannelListItem/ChannelListItemActionButtons.defaults.d.ts.map +1 -1
  111. package/dist/types/components/ChannelListItem/ChannelListItemUI.d.ts +3 -1
  112. package/dist/types/components/ChannelListItem/ChannelListItemUI.d.ts.map +1 -1
  113. package/dist/types/components/ChannelListItem/hooks/useChannelDisplayName.d.ts.map +1 -1
  114. package/dist/types/components/ChannelListItem/hooks/useChannelPreviewInfo.d.ts.map +1 -1
  115. package/dist/types/components/ChannelListItem/hooks/useIsChannelMuted.d.ts.map +1 -1
  116. package/dist/types/components/ChannelListItem/hooks/useMessageDeliveryStatus.d.ts.map +1 -1
  117. package/dist/types/components/ChannelListItem/utils.d.ts +2 -2
  118. package/dist/types/components/ChannelListItem/utils.d.ts.map +1 -1
  119. package/dist/types/components/Chat/Chat.d.ts +3 -0
  120. package/dist/types/components/Chat/Chat.d.ts.map +1 -1
  121. package/dist/types/components/Chat/hooks/useChat.d.ts.map +1 -1
  122. package/dist/types/components/Chat/hooks/useCreateChatClient.d.ts.map +1 -1
  123. package/dist/types/components/Chat/hooks/useCreateChatContext.d.ts.map +1 -1
  124. package/dist/types/components/Chat/hooks/useSplitActionSet.d.ts +6 -6
  125. package/dist/types/components/Chat/hooks/useSplitActionSet.d.ts.map +1 -1
  126. package/dist/types/components/ChatView/ChatView.a11y.utility.d.ts.map +1 -1
  127. package/dist/types/components/ChatView/ChatView.d.ts.map +1 -1
  128. package/dist/types/components/DateSeparator/DateSeparator.d.ts +3 -1
  129. package/dist/types/components/DateSeparator/DateSeparator.d.ts.map +1 -1
  130. package/dist/types/components/Dialog/components/Callout.d.ts.map +1 -1
  131. package/dist/types/components/Dialog/components/ContextMenu.d.ts +3 -3
  132. package/dist/types/components/Dialog/components/ContextMenu.d.ts.map +1 -1
  133. package/dist/types/components/Dialog/components/Prompt.d.ts +1 -1
  134. package/dist/types/components/Dialog/components/Prompt.d.ts.map +1 -1
  135. package/dist/types/components/Dialog/components/Viewer.d.ts +1 -1
  136. package/dist/types/components/Dialog/components/Viewer.d.ts.map +1 -1
  137. package/dist/types/components/Dialog/hooks/useDialog.d.ts +8 -6
  138. package/dist/types/components/Dialog/hooks/useDialog.d.ts.map +1 -1
  139. package/dist/types/components/Dialog/hooks/usePopoverPosition.d.ts +5 -6
  140. package/dist/types/components/Dialog/hooks/usePopoverPosition.d.ts.map +1 -1
  141. package/dist/types/components/Dialog/service/DialogAnchor.d.ts.map +1 -1
  142. package/dist/types/components/Dialog/service/DialogManager.d.ts +1 -1
  143. package/dist/types/components/Dialog/service/DialogManager.d.ts.map +1 -1
  144. package/dist/types/components/Dialog/service/DialogPortal.d.ts.map +1 -1
  145. package/dist/types/components/DragAndDrop/DragAndDropContainer.d.ts.map +1 -1
  146. package/dist/types/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +3 -1
  147. package/dist/types/components/EmptyStateIndicator/EmptyStateIndicator.d.ts.map +1 -1
  148. package/dist/types/components/EventComponent/EventComponent.d.ts +6 -1
  149. package/dist/types/components/EventComponent/EventComponent.d.ts.map +1 -1
  150. package/dist/types/components/FileIcon/FileIcon.d.ts.map +1 -1
  151. package/dist/types/components/FileIcon/FileIconSet.d.ts.map +1 -1
  152. package/dist/types/components/Form/Dropdown.d.ts.map +1 -1
  153. package/dist/types/components/Form/FieldError.d.ts.map +1 -1
  154. package/dist/types/components/Form/SwitchField.d.ts.map +1 -1
  155. package/dist/types/components/Form/TextInputFieldSet.d.ts.map +1 -1
  156. package/dist/types/components/Gallery/Gallery.d.ts.map +1 -1
  157. package/dist/types/components/Gallery/GalleryContext.d.ts +2 -4
  158. package/dist/types/components/Gallery/GalleryContext.d.ts.map +1 -1
  159. package/dist/types/components/Gallery/GalleryHeader.d.ts.map +1 -1
  160. package/dist/types/components/Icons/BaseIcon.d.ts.map +1 -1
  161. package/dist/types/components/InfiniteScrollPaginator/InfiniteScroll.d.ts.map +1 -1
  162. package/dist/types/components/InfiniteScrollPaginator/InfiniteScrollPaginator.d.ts.map +1 -1
  163. package/dist/types/components/InfiniteScrollPaginator/hooks/useCursorPaginator.d.ts.map +1 -1
  164. package/dist/types/components/LoadMore/LoadMoreButton.d.ts +3 -1
  165. package/dist/types/components/LoadMore/LoadMoreButton.d.ts.map +1 -1
  166. package/dist/types/components/LoadMore/LoadMorePaginator.d.ts +1 -1
  167. package/dist/types/components/LoadMore/LoadMorePaginator.d.ts.map +1 -1
  168. package/dist/types/components/Loading/LoadingErrorIndicator.d.ts +6 -1
  169. package/dist/types/components/Loading/LoadingErrorIndicator.d.ts.map +1 -1
  170. package/dist/types/components/Loading/LoadingIndicator.d.ts.map +1 -1
  171. package/dist/types/components/Loading/UploadProgressIndicator.d.ts.map +1 -1
  172. package/dist/types/components/Loading/UploadedSizeIndicator.d.ts.map +1 -1
  173. package/dist/types/components/Loading/progress-indicators.d.ts.map +1 -1
  174. package/dist/types/components/Location/ShareLocationDialog.d.ts.map +1 -1
  175. package/dist/types/components/Location/hooks/useLiveLocationSharingManager.d.ts +1 -1
  176. package/dist/types/components/Location/hooks/useLiveLocationSharingManager.d.ts.map +1 -1
  177. package/dist/types/components/MediaRecorder/AudioRecorder/AudioRecordingPlayback.d.ts +1 -1
  178. package/dist/types/components/MediaRecorder/AudioRecorder/AudioRecordingPlayback.d.ts.map +1 -1
  179. package/dist/types/components/MediaRecorder/AudioRecorder/RecordingTimer.d.ts.map +1 -1
  180. package/dist/types/components/MediaRecorder/AudioRecorder/hooks/useTimeElapsed.d.ts.map +1 -1
  181. package/dist/types/components/MediaRecorder/AudioRecorder/recordingStateIdentity.d.ts +3 -3
  182. package/dist/types/components/MediaRecorder/AudioRecorder/recordingStateIdentity.d.ts.map +1 -1
  183. package/dist/types/components/MediaRecorder/RecordingPermissionDeniedNotification.d.ts.map +1 -1
  184. package/dist/types/components/MediaRecorder/classes/MediaRecorderController.d.ts +1 -1
  185. package/dist/types/components/MediaRecorder/classes/MediaRecorderController.d.ts.map +1 -1
  186. package/dist/types/components/MediaRecorder/hooks/useMediaRecorder.d.ts.map +1 -1
  187. package/dist/types/components/MediaRecorder/transcode/audioProcessing.d.ts.map +1 -1
  188. package/dist/types/components/MediaRecorder/transcode/index.d.ts.map +1 -1
  189. package/dist/types/components/MediaRecorder/transcode/wav.d.ts.map +1 -1
  190. package/dist/types/components/Message/Message.d.ts.map +1 -1
  191. package/dist/types/components/Message/MessageBubble.d.ts +1 -1
  192. package/dist/types/components/Message/MessageBubble.d.ts.map +1 -1
  193. package/dist/types/components/Message/MessageEditedIndicator.d.ts +3 -1
  194. package/dist/types/components/Message/MessageEditedIndicator.d.ts.map +1 -1
  195. package/dist/types/components/Message/MessageRepliesCountButton.d.ts.map +1 -1
  196. package/dist/types/components/Message/MessageStatus.d.ts +3 -1
  197. package/dist/types/components/Message/MessageStatus.d.ts.map +1 -1
  198. package/dist/types/components/Message/MessageText.d.ts +3 -1
  199. package/dist/types/components/Message/MessageText.d.ts.map +1 -1
  200. package/dist/types/components/Message/MessageTimestamp.d.ts +3 -1
  201. package/dist/types/components/Message/MessageTimestamp.d.ts.map +1 -1
  202. package/dist/types/components/Message/MessageTranslationIndicator.d.ts.map +1 -1
  203. package/dist/types/components/Message/MessageUI.d.ts.map +1 -1
  204. package/dist/types/components/Message/PinIndicator.d.ts.map +1 -1
  205. package/dist/types/components/Message/QuotedMessage.d.ts.map +1 -1
  206. package/dist/types/components/Message/ReminderNotification.d.ts.map +1 -1
  207. package/dist/types/components/Message/StreamedMessageText.d.ts.map +1 -1
  208. package/dist/types/components/Message/emojiRegex.d.ts +15 -0
  209. package/dist/types/components/Message/emojiRegex.d.ts.map +1 -0
  210. package/dist/types/components/Message/hooks/useDeleteHandler.d.ts +1 -1
  211. package/dist/types/components/Message/hooks/useDeleteHandler.d.ts.map +1 -1
  212. package/dist/types/components/Message/hooks/useFlagHandler.d.ts.map +1 -1
  213. package/dist/types/components/Message/hooks/useMarkUnreadHandler.d.ts.map +1 -1
  214. package/dist/types/components/Message/hooks/useMentionsHandler.d.ts.map +1 -1
  215. package/dist/types/components/Message/hooks/useMessageReminder.d.ts.map +1 -1
  216. package/dist/types/components/Message/hooks/useMessageTextStreaming.d.ts.map +1 -1
  217. package/dist/types/components/Message/hooks/useMuteHandler.d.ts.map +1 -1
  218. package/dist/types/components/Message/hooks/useOpenThreadHandler.d.ts.map +1 -1
  219. package/dist/types/components/Message/hooks/usePinHandler.d.ts.map +1 -1
  220. package/dist/types/components/Message/hooks/useReactionHandler.d.ts.map +1 -1
  221. package/dist/types/components/Message/hooks/useRetryHandler.d.ts.map +1 -1
  222. package/dist/types/components/Message/hooks/useUserHandler.d.ts +0 -1
  223. package/dist/types/components/Message/hooks/useUserHandler.d.ts.map +1 -1
  224. package/dist/types/components/Message/hooks/useUserRole.d.ts.map +1 -1
  225. package/dist/types/components/Message/renderText/componentRenderers/Anchor.d.ts +1 -1
  226. package/dist/types/components/Message/renderText/componentRenderers/Anchor.d.ts.map +1 -1
  227. package/dist/types/components/Message/renderText/componentRenderers/Emoji.d.ts.map +1 -1
  228. package/dist/types/components/Message/renderText/componentRenderers/Mention.d.ts.map +1 -1
  229. package/dist/types/components/Message/renderText/regex.d.ts.map +1 -1
  230. package/dist/types/components/Message/renderText/rehypePlugins/emojiMarkdownPlugin.d.ts +1 -1
  231. package/dist/types/components/Message/renderText/rehypePlugins/emojiMarkdownPlugin.d.ts.map +1 -1
  232. package/dist/types/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts +1 -1
  233. package/dist/types/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts.map +1 -1
  234. package/dist/types/components/Message/renderText/remarkPlugins/htmlToTextPlugin.d.ts +3 -1
  235. package/dist/types/components/Message/renderText/remarkPlugins/htmlToTextPlugin.d.ts.map +1 -1
  236. package/dist/types/components/Message/renderText/remarkPlugins/imageToLink.d.ts.map +1 -1
  237. package/dist/types/components/Message/renderText/renderText.d.ts +1 -1
  238. package/dist/types/components/Message/renderText/renderText.d.ts.map +1 -1
  239. package/dist/types/components/Message/utils.d.ts +5 -5
  240. package/dist/types/components/Message/utils.d.ts.map +1 -1
  241. package/dist/types/components/MessageActions/DeleteMessageAlert.d.ts.map +1 -1
  242. package/dist/types/components/MessageActions/DownloadSubmenu.d.ts +3 -0
  243. package/dist/types/components/MessageActions/DownloadSubmenu.d.ts.map +1 -0
  244. package/dist/types/components/MessageActions/MessageActions.defaults.d.ts.map +1 -1
  245. package/dist/types/components/MessageActions/QuickMessageActionButton.d.ts +2 -1
  246. package/dist/types/components/MessageActions/QuickMessageActionButton.d.ts.map +1 -1
  247. package/dist/types/components/MessageActions/downloadUtils.d.ts.map +1 -1
  248. package/dist/types/components/MessageActions/hooks/useBaseMessageActionSetFilter.d.ts.map +1 -1
  249. package/dist/types/components/MessageComposer/AttachmentPreviewList/AttachmentPreviewList.d.ts.map +1 -1
  250. package/dist/types/components/MessageComposer/AttachmentPreviewList/AttachmentUploadedSizeIndicator.d.ts.map +1 -1
  251. package/dist/types/components/MessageComposer/AttachmentPreviewList/AudioAttachmentPreview.d.ts.map +1 -1
  252. package/dist/types/components/MessageComposer/AttachmentPreviewList/FileAttachmentPreview.d.ts.map +1 -1
  253. package/dist/types/components/MessageComposer/AttachmentPreviewList/GeolocationPreview.d.ts.map +1 -1
  254. package/dist/types/components/MessageComposer/AttachmentPreviewList/MediaAttachmentPreview.d.ts.map +1 -1
  255. package/dist/types/components/MessageComposer/AttachmentPreviewList/UnsupportedAttachmentPreview.d.ts.map +1 -1
  256. package/dist/types/components/MessageComposer/AttachmentPreviewList/VoiceRecordingPreviewSlot.d.ts.map +1 -1
  257. package/dist/types/components/MessageComposer/AttachmentPreviewList/utils/AttachmentPreviewRoot.d.ts.map +1 -1
  258. package/dist/types/components/MessageComposer/AttachmentSelector/AttachmentSelector.d.ts +6 -6
  259. package/dist/types/components/MessageComposer/AttachmentSelector/AttachmentSelector.d.ts.map +1 -1
  260. package/dist/types/components/MessageComposer/AttachmentSelector/CommandsMenu.d.ts +1 -1
  261. package/dist/types/components/MessageComposer/AttachmentSelector/CommandsMenu.d.ts.map +1 -1
  262. package/dist/types/components/MessageComposer/CommandChip.d.ts.map +1 -1
  263. package/dist/types/components/MessageComposer/EditedMessagePreview.d.ts.map +1 -1
  264. package/dist/types/components/MessageComposer/LinkPreviewList.d.ts.map +1 -1
  265. package/dist/types/components/MessageComposer/MessageComposer.d.ts +3 -1
  266. package/dist/types/components/MessageComposer/MessageComposer.d.ts.map +1 -1
  267. package/dist/types/components/MessageComposer/QuotedMessageIndicator.d.ts.map +1 -1
  268. package/dist/types/components/MessageComposer/QuotedMessagePreview.d.ts.map +1 -1
  269. package/dist/types/components/MessageComposer/RemoveAttachmentPreviewButton.d.ts +1 -1
  270. package/dist/types/components/MessageComposer/RemoveAttachmentPreviewButton.d.ts.map +1 -1
  271. package/dist/types/components/MessageComposer/SendButton.d.ts.map +1 -1
  272. package/dist/types/components/MessageComposer/StopAIGenerationButton.d.ts.map +1 -1
  273. package/dist/types/components/MessageComposer/WithDragAndDropUpload.d.ts.map +1 -1
  274. package/dist/types/components/MessageComposer/hooks/useAttachmentsForPreview.d.ts +7 -7
  275. package/dist/types/components/MessageComposer/hooks/useCreateMessageComposerContext.d.ts.map +1 -1
  276. package/dist/types/components/MessageComposer/hooks/useMessageComposerBindings.d.ts.map +1 -1
  277. package/dist/types/components/MessageComposer/hooks/usePasteHandler.d.ts.map +1 -1
  278. package/dist/types/components/MessageComposer/hooks/useSubmitHandler.d.ts.map +1 -1
  279. package/dist/types/components/MessageComposer/hooks/useTextareaRef.d.ts +0 -1
  280. package/dist/types/components/MessageComposer/hooks/useTextareaRef.d.ts.map +1 -1
  281. package/dist/types/components/MessageComposer/preEditSnapshot.d.ts.map +1 -1
  282. package/dist/types/components/MessageList/CustomNotification.d.ts +3 -1
  283. package/dist/types/components/MessageList/CustomNotification.d.ts.map +1 -1
  284. package/dist/types/components/MessageList/FloatingDateSeparator.d.ts.map +1 -1
  285. package/dist/types/components/MessageList/GiphyPreviewMessage.d.ts.map +1 -1
  286. package/dist/types/components/MessageList/MessageList.d.ts.map +1 -1
  287. package/dist/types/components/MessageList/MessageListMainPanel.d.ts.map +1 -1
  288. package/dist/types/components/MessageList/NewMessageNotification.d.ts +3 -1
  289. package/dist/types/components/MessageList/NewMessageNotification.d.ts.map +1 -1
  290. package/dist/types/components/MessageList/ScrollToLatestMessageButton.d.ts +3 -1
  291. package/dist/types/components/MessageList/ScrollToLatestMessageButton.d.ts.map +1 -1
  292. package/dist/types/components/MessageList/UnreadMessagesNotification.d.ts.map +1 -1
  293. package/dist/types/components/MessageList/UnreadMessagesSeparator.d.ts.map +1 -1
  294. package/dist/types/components/MessageList/VirtualizedMessageListComponents.d.ts +1 -2
  295. package/dist/types/components/MessageList/VirtualizedMessageListComponents.d.ts.map +1 -1
  296. package/dist/types/components/MessageList/hooks/MessageList/scrollInstrumentation.d.ts.map +1 -1
  297. package/dist/types/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts +1 -1
  298. package/dist/types/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts.map +1 -1
  299. package/dist/types/components/MessageList/hooks/MessageList/useFloatingDateSeparatorMessageList.d.ts.map +1 -1
  300. package/dist/types/components/MessageList/hooks/MessageList/useMessageListElements.d.ts.map +1 -1
  301. package/dist/types/components/MessageList/hooks/MessageList/useMessageListScrollManager.d.ts.map +1 -1
  302. package/dist/types/components/MessageList/hooks/MessageList/useScrollLocationLogic.d.ts.map +1 -1
  303. package/dist/types/components/MessageList/hooks/MessageList/useUnreadMessagesNotification.d.ts.map +1 -1
  304. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useFloatingDateSeparator.d.ts.map +1 -1
  305. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts +0 -1
  306. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts.map +1 -1
  307. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.d.ts.map +1 -1
  308. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts +0 -1
  309. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts.map +1 -1
  310. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts.map +1 -1
  311. package/dist/types/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.d.ts.map +1 -1
  312. package/dist/types/components/MessageList/hooks/useLastDeliveredData.d.ts.map +1 -1
  313. package/dist/types/components/MessageList/hooks/useLastOwnMessage.d.ts.map +1 -1
  314. package/dist/types/components/MessageList/hooks/useLastReadData.d.ts.map +1 -1
  315. package/dist/types/components/MessageList/hooks/useMarkRead.d.ts.map +1 -1
  316. package/dist/types/components/MessageList/utils.d.ts +0 -1
  317. package/dist/types/components/MessageList/utils.d.ts.map +1 -1
  318. package/dist/types/components/Modal/CloseButtonOnModalOverlay.d.ts +1 -1
  319. package/dist/types/components/Modal/CloseButtonOnModalOverlay.d.ts.map +1 -1
  320. package/dist/types/components/Modal/GlobalModal.d.ts +3 -1
  321. package/dist/types/components/Modal/GlobalModal.d.ts.map +1 -1
  322. package/dist/types/components/Notifications/NotificationConfigurationContext.d.ts +24 -0
  323. package/dist/types/components/Notifications/NotificationConfigurationContext.d.ts.map +1 -0
  324. package/dist/types/components/Notifications/NotificationList.d.ts +58 -1
  325. package/dist/types/components/Notifications/NotificationList.d.ts.map +1 -1
  326. package/dist/types/components/Notifications/hooks/useNotificationApi.d.ts.map +1 -1
  327. package/dist/types/components/Notifications/hooks/useNotifications.d.ts +5 -0
  328. package/dist/types/components/Notifications/hooks/useNotifications.d.ts.map +1 -1
  329. package/dist/types/components/Notifications/hooks/useSystemNotifications.d.ts.map +1 -1
  330. package/dist/types/components/Notifications/index.d.ts +1 -0
  331. package/dist/types/components/Notifications/index.d.ts.map +1 -1
  332. package/dist/types/components/Notifications/notificationTarget.d.ts +3 -3
  333. package/dist/types/components/Notifications/notificationTarget.d.ts.map +1 -1
  334. package/dist/types/components/Poll/Poll.d.ts.map +1 -1
  335. package/dist/types/components/Poll/PollActions/AddCommentPrompt.d.ts.map +1 -1
  336. package/dist/types/components/Poll/PollActions/PollAction.d.ts.map +1 -1
  337. package/dist/types/components/Poll/PollActions/PollActions.d.ts.map +1 -1
  338. package/dist/types/components/Poll/PollActions/PollAnswerList.d.ts.map +1 -1
  339. package/dist/types/components/Poll/PollActions/PollQuestion.d.ts.map +1 -1
  340. package/dist/types/components/Poll/PollActions/PollResults/PollOptionWithVotes.d.ts.map +1 -1
  341. package/dist/types/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.d.ts.map +1 -1
  342. package/dist/types/components/Poll/PollActions/PollResults/PollOptionWithVotesList.d.ts.map +1 -1
  343. package/dist/types/components/Poll/PollCreationDialog/PollCreationDialog.d.ts.map +1 -1
  344. package/dist/types/components/Poll/PollCreationDialog/PollCreationDialogControls.d.ts.map +1 -1
  345. package/dist/types/components/Poll/PollHeader.d.ts +1 -1
  346. package/dist/types/components/Poll/PollHeader.d.ts.map +1 -1
  347. package/dist/types/components/Poll/PollOptionList.d.ts.map +1 -1
  348. package/dist/types/components/Poll/PollOptionSelector.d.ts.map +1 -1
  349. package/dist/types/components/Poll/PollVote.d.ts.map +1 -1
  350. package/dist/types/components/Poll/constants.d.ts.map +1 -1
  351. package/dist/types/components/Poll/hooks/usePollAnswerPagination.d.ts.map +1 -1
  352. package/dist/types/components/Poll/hooks/usePollOptionVotesPagination.d.ts.map +1 -1
  353. package/dist/types/components/Portal/Portal.d.ts.map +1 -1
  354. package/dist/types/components/ReactFileUtilities/LoadingIndicator.d.ts.map +1 -1
  355. package/dist/types/components/ReactFileUtilities/utils.d.ts.map +1 -1
  356. package/dist/types/components/Reactions/MessageReactions.d.ts +3 -1
  357. package/dist/types/components/Reactions/MessageReactions.d.ts.map +1 -1
  358. package/dist/types/components/Reactions/MessageReactionsDetail.d.ts.map +1 -1
  359. package/dist/types/components/Reactions/ReactionSelector.d.ts.map +1 -1
  360. package/dist/types/components/Reactions/ReactionSelectorWithButton.d.ts.map +1 -1
  361. package/dist/types/components/Reactions/SpriteImage.d.ts.map +1 -1
  362. package/dist/types/components/Reactions/hooks/useProcessReactions.d.ts.map +1 -1
  363. package/dist/types/components/Reactions/reactionOptions.d.ts +11 -1
  364. package/dist/types/components/Reactions/reactionOptions.d.ts.map +1 -1
  365. package/dist/types/components/Reactions/utils/utils.d.ts.map +1 -1
  366. package/dist/types/components/SafeAnchor/SafeAnchor.d.ts +3 -1
  367. package/dist/types/components/SafeAnchor/SafeAnchor.d.ts.map +1 -1
  368. package/dist/types/components/Search/Search.d.ts.map +1 -1
  369. package/dist/types/components/Search/SearchBar/SearchBar.d.ts.map +1 -1
  370. package/dist/types/components/Search/SearchContext.d.ts.map +1 -1
  371. package/dist/types/components/Search/SearchResults/SearchResultItem.d.ts +1 -1
  372. package/dist/types/components/Search/SearchResults/SearchResultItem.d.ts.map +1 -1
  373. package/dist/types/components/Search/SearchResults/SearchSourceResultList.d.ts.map +1 -1
  374. package/dist/types/components/Search/SearchResults/SearchSourceResults.d.ts.map +1 -1
  375. package/dist/types/components/Search/SearchSourceResultsContext.d.ts.map +1 -1
  376. package/dist/types/components/Search/hooks/useSearchQueriesInProgress.d.ts.map +1 -1
  377. package/dist/types/components/SkipNavigation/SkipNavigation.d.ts.map +1 -1
  378. package/dist/types/components/SummarizedMessagePreview/SummarizedMessagePreview.d.ts.map +1 -1
  379. package/dist/types/components/SummarizedMessagePreview/hooks/useLatestMessagePreview.d.ts.map +1 -1
  380. package/dist/types/components/TextareaComposer/SuggestionList/CommandItem.d.ts.map +1 -1
  381. package/dist/types/components/TextareaComposer/SuggestionList/EmoticonItem.d.ts.map +1 -1
  382. package/dist/types/components/TextareaComposer/SuggestionList/SuggestionList.d.ts.map +1 -1
  383. package/dist/types/components/TextareaComposer/SuggestionList/SuggestionListItem.d.ts.map +1 -1
  384. package/dist/types/components/TextareaComposer/SuggestionList/UserItem.d.ts.map +1 -1
  385. package/dist/types/components/TextareaComposer/TextareaComposer.d.ts.map +1 -1
  386. package/dist/types/components/TextareaComposer/hooks/useTextareaPlaceholder.d.ts.map +1 -1
  387. package/dist/types/components/Thread/Thread.d.ts.map +1 -1
  388. package/dist/types/components/Thread/ThreadHead.d.ts.map +1 -1
  389. package/dist/types/components/Thread/ThreadHeader.d.ts.map +1 -1
  390. package/dist/types/components/Threads/ThreadContext.d.ts.map +1 -1
  391. package/dist/types/components/Threads/ThreadList/ThreadList.d.ts.map +1 -1
  392. package/dist/types/components/Threads/ThreadList/ThreadListItem.d.ts.map +1 -1
  393. package/dist/types/components/Threads/ThreadList/ThreadListItemUI.d.ts.map +1 -1
  394. package/dist/types/components/Threads/UnreadCountBadge.d.ts +1 -1
  395. package/dist/types/components/Threads/UnreadCountBadge.d.ts.map +1 -1
  396. package/dist/types/components/Threads/hooks/useThreadManagerState.d.ts.map +1 -1
  397. package/dist/types/components/Threads/hooks/useThreadState.d.ts.map +1 -1
  398. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  399. package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
  400. package/dist/types/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +1 -1
  401. package/dist/types/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts.map +1 -1
  402. package/dist/types/components/TypingIndicator/TypingIndicator.d.ts +8 -1
  403. package/dist/types/components/TypingIndicator/TypingIndicator.d.ts.map +1 -1
  404. package/dist/types/components/TypingIndicator/TypingIndicatorHeader.d.ts.map +1 -1
  405. package/dist/types/components/TypingIndicator/utils/getTypingStatusMessage.d.ts.map +1 -1
  406. package/dist/types/components/UtilityComponents/useStableId.d.ts +7 -3
  407. package/dist/types/components/UtilityComponents/useStableId.d.ts.map +1 -1
  408. package/dist/types/components/VideoPlayer/ReactPlayerWrapper.d.ts +9 -0
  409. package/dist/types/components/VideoPlayer/ReactPlayerWrapper.d.ts.map +1 -0
  410. package/dist/types/components/VideoPlayer/VideoPlayer.d.ts.map +1 -1
  411. package/dist/types/components/VideoPlayer/VideoThumbnail.d.ts.map +1 -1
  412. package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
  413. package/dist/types/components/Window/Window.d.ts +3 -1
  414. package/dist/types/components/Window/Window.d.ts.map +1 -1
  415. package/dist/types/context/AttachmentSelectorContext.d.ts.map +1 -1
  416. package/dist/types/context/ChannelActionContext.d.ts.map +1 -1
  417. package/dist/types/context/ChannelListContext.d.ts.map +1 -1
  418. package/dist/types/context/ChannelStateContext.d.ts.map +1 -1
  419. package/dist/types/context/ChatContext.d.ts.map +1 -1
  420. package/dist/types/context/ComponentContext.d.ts +5 -1
  421. package/dist/types/context/ComponentContext.d.ts.map +1 -1
  422. package/dist/types/context/DialogManagerContext.d.ts.map +1 -1
  423. package/dist/types/context/MessageComposerContext.d.ts.map +1 -1
  424. package/dist/types/context/MessageContext.d.ts.map +1 -1
  425. package/dist/types/context/MessageListContext.d.ts.map +1 -1
  426. package/dist/types/context/MessageTranslationViewContext.d.ts.map +1 -1
  427. package/dist/types/context/ModalContext.d.ts.map +1 -1
  428. package/dist/types/context/PollContext.d.ts.map +1 -1
  429. package/dist/types/context/TranslationContext.d.ts.map +1 -1
  430. package/dist/types/context/TypingContext.d.ts.map +1 -1
  431. package/dist/types/context/VirtualizedMessageListContext.d.ts.map +1 -1
  432. package/dist/types/i18n/Streami18n.d.ts +3 -3
  433. package/dist/types/i18n/Streami18n.d.ts.map +1 -1
  434. package/dist/types/i18n/TranslationBuilder/TranslationBuilder.d.ts.map +1 -1
  435. package/dist/types/i18n/TranslationBuilder/notifications/NotificationTranslationTopic.d.ts.map +1 -1
  436. package/dist/types/i18n/utils.d.ts +2 -2
  437. package/dist/types/i18n/utils.d.ts.map +1 -1
  438. package/dist/types/plugins/Emojis/EmojiPicker.d.ts.map +1 -1
  439. package/dist/types/plugins/Emojis/middleware/textComposerEmojiMiddleware.d.ts.map +1 -1
  440. package/dist/types/utils/findReverse.d.ts.map +1 -1
  441. package/dist/types/utils/getChannel.d.ts.map +1 -1
  442. package/dist/types/utils/getTextareaCaretRect.d.ts.map +1 -1
  443. package/dist/types/utils/getWholeChar.d.ts.map +1 -1
  444. package/dist/types/utils/mergeDeep.d.ts.map +1 -1
  445. package/dist/types/utils/useStableCallback.d.ts.map +1 -1
  446. package/package.json +85 -67
  447. package/dist/cjs/audioProcessing.56e5db9d.js +0 -123
  448. package/dist/cjs/audioProcessing.56e5db9d.js.map +0 -1
  449. package/dist/cjs/useNotificationApi.f2c7704d.js +0 -4855
  450. package/dist/cjs/useNotificationApi.f2c7704d.js.map +0 -1
  451. package/dist/es/audioProcessing.21cb49e1.mjs +0 -124
  452. package/dist/es/audioProcessing.21cb49e1.mjs.map +0 -1
  453. package/dist/es/useNotificationApi.f91ae46b.mjs +0 -4839
  454. package/dist/es/useNotificationApi.f91ae46b.mjs.map +0 -1
@@ -0,0 +1,4195 @@
1
+ import React, { createContext, createElement, forwardRef, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
2
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
3
+ import { ErrorFromResponse, FixedSizeQueueCache, MessageComposer, StateStore, localMessageToNewMessagePayload } from "stream-chat";
4
+ import { nanoid } from "nanoid";
5
+ import { useSyncExternalStore } from "use-sync-external-store/shim";
6
+ import { createPortal } from "react-dom";
7
+ import Dayjs from "dayjs";
8
+ import calendar from "dayjs/plugin/calendar";
9
+ import localizedFormat from "dayjs/plugin/localizedFormat";
10
+ import clsx from "clsx";
11
+ import { autoPlacement, autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/react";
12
+ import debounce from "lodash.debounce";
13
+ import throttle from "lodash.throttle";
14
+ import deepequal from "react-fast-compare";
15
+ import emojiRegex from "emoji-regex";
16
+ import * as linkify from "linkifyjs";
17
+ //#region src/context/ChannelActionContext.tsx
18
+ var ChannelActionContext = React.createContext(void 0);
19
+ var ChannelActionProvider = ({ children, value }) => /* @__PURE__ */ jsx(ChannelActionContext.Provider, {
20
+ value,
21
+ children
22
+ });
23
+ var useChannelActionContext = (componentName) => {
24
+ const contextValue = useContext(ChannelActionContext);
25
+ if (!contextValue) {
26
+ console.warn(`The useChannelActionContext hook was called outside of the ChannelActionContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`);
27
+ return {};
28
+ }
29
+ return contextValue;
30
+ };
31
+ //#endregion
32
+ //#region src/context/ChannelListContext.tsx
33
+ var ChannelListContext = createContext(void 0);
34
+ /**
35
+ * Context provider for components rendered within the `ChannelList`
36
+ */
37
+ var ChannelListContextProvider = ({ children, value }) => /* @__PURE__ */ jsx(ChannelListContext.Provider, {
38
+ value,
39
+ children
40
+ });
41
+ var useChannelListContext = () => {
42
+ const contextValue = useContext(ChannelListContext);
43
+ if (!contextValue) return {};
44
+ return contextValue;
45
+ };
46
+ //#endregion
47
+ //#region src/context/ChannelStateContext.tsx
48
+ var ChannelStateContext = React.createContext(void 0);
49
+ var ChannelStateProvider = ({ children, value }) => /* @__PURE__ */ jsx(ChannelStateContext.Provider, {
50
+ value,
51
+ children
52
+ });
53
+ var remainingWarningCount = 1;
54
+ var useChannelStateContext = (componentName) => {
55
+ const contextValue = useContext(ChannelStateContext);
56
+ if (!contextValue) {
57
+ if (componentName && remainingWarningCount > 0) {
58
+ console.warn(`The useChannelStateContext hook was called outside of the ChannelStateContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`);
59
+ remainingWarningCount -= 1;
60
+ }
61
+ return {};
62
+ }
63
+ return contextValue;
64
+ };
65
+ //#endregion
66
+ //#region src/context/ChatContext.tsx
67
+ var ChatContext = React.createContext(void 0);
68
+ var ChatProvider = ({ children, value }) => /* @__PURE__ */ jsx(ChatContext.Provider, {
69
+ value,
70
+ children
71
+ });
72
+ var useChatContext = (componentName) => {
73
+ const contextValue = useContext(ChatContext);
74
+ if (!contextValue) {
75
+ console.warn(`The useChatContext hook was called outside of the ChatContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${componentName} component.`);
76
+ return {};
77
+ }
78
+ return contextValue;
79
+ };
80
+ //#endregion
81
+ //#region src/context/ComponentContext.tsx
82
+ var ComponentContext = React.createContext({});
83
+ var ComponentProvider = ({ children, value }) => /* @__PURE__ */ jsx(ComponentContext.Provider, {
84
+ value,
85
+ children
86
+ });
87
+ var useComponentContext = (_componentName) => useContext(ComponentContext);
88
+ //#endregion
89
+ //#region src/components/Dialog/service/DialogManager.ts
90
+ /**
91
+ * Keeps a map of Dialog objects.
92
+ * Dialog can be controlled via `Dialog` object retrieved using `useDialog()` hook.
93
+ * The hook returns an object with the following API:
94
+ *
95
+ * - `dialog.open()` - opens the dialog
96
+ * - `dialog.close()` - closes the dialog
97
+ * - `dialog.toggle()` - toggles the dialog open state. Accepts boolean argument closeAll. If enabled closes any other dialog that would be open.
98
+ * - `dialog.remove()` - removes the dialog object reference from the state (primarily for cleanup purposes)
99
+ */
100
+ var DialogManager = class {
101
+ constructor({ closeOnClickOutside = true, id } = {}) {
102
+ this.state = new StateStore({
103
+ dialogsById: {},
104
+ openedDialogIds: []
105
+ });
106
+ this.remove = (id) => {
107
+ const dialog = this.get(id);
108
+ if (!dialog) return;
109
+ if (dialog.removalTimeout) clearTimeout(dialog.removalTimeout);
110
+ this.state.next((current) => {
111
+ const newDialogs = { ...current.dialogsById };
112
+ delete newDialogs[id];
113
+ return {
114
+ ...current,
115
+ dialogsById: newDialogs,
116
+ openedDialogIds: current.openedDialogIds.filter((dialogId) => dialogId !== id)
117
+ };
118
+ });
119
+ };
120
+ this.closeOnClickOutside = closeOnClickOutside;
121
+ this.id = id ?? nanoid();
122
+ }
123
+ get openDialogCount() {
124
+ return this.state.getLatestValue().openedDialogIds.length;
125
+ }
126
+ get(id) {
127
+ return this.state.getLatestValue().dialogsById[id];
128
+ }
129
+ getOrCreate({ closeOnClickOutside, id }) {
130
+ let dialog = this.get(id);
131
+ if (!dialog) {
132
+ dialog = {
133
+ close: () => {
134
+ this.close(id);
135
+ },
136
+ closeOnClickOutside,
137
+ id,
138
+ isOpen: false,
139
+ open: () => {
140
+ this.open({ id });
141
+ },
142
+ removalTimeout: void 0,
143
+ remove: () => {
144
+ this.remove(id);
145
+ },
146
+ toggle: (closeAll = false) => {
147
+ this.toggle({ id }, closeAll);
148
+ }
149
+ };
150
+ this.state.next((current) => ({
151
+ ...current,
152
+ dialogsById: {
153
+ ...current.dialogsById,
154
+ [id]: dialog
155
+ }
156
+ }));
157
+ }
158
+ if (dialog.closeOnClickOutside !== closeOnClickOutside || !!dialog.removalTimeout) {
159
+ if (dialog.removalTimeout) clearTimeout(dialog.removalTimeout);
160
+ this.state.next((current) => ({
161
+ ...current,
162
+ dialogsById: {
163
+ ...current.dialogsById,
164
+ [id]: {
165
+ ...current.dialogsById[id],
166
+ closeOnClickOutside,
167
+ removalTimeout: void 0
168
+ }
169
+ },
170
+ openedDialogIds: current.dialogsById[id]?.isOpen ? [...current.openedDialogIds.filter((dialogId) => dialogId !== id), id] : current.openedDialogIds
171
+ }));
172
+ }
173
+ return dialog;
174
+ }
175
+ open(params, closeRest) {
176
+ const dialog = this.getOrCreate(params);
177
+ if (dialog.isOpen) return;
178
+ if (closeRest) this.closeAll();
179
+ this.state.next((current) => ({
180
+ ...current,
181
+ dialogsById: {
182
+ ...current.dialogsById,
183
+ [dialog.id]: {
184
+ ...dialog,
185
+ isOpen: true
186
+ }
187
+ },
188
+ openedDialogIds: [...current.openedDialogIds.filter((dialogId) => dialogId !== dialog.id), dialog.id]
189
+ }));
190
+ }
191
+ close(id) {
192
+ const dialog = this.state.getLatestValue().dialogsById[id];
193
+ if (!dialog?.isOpen) return;
194
+ this.state.next((current) => ({
195
+ ...current,
196
+ dialogsById: {
197
+ ...current.dialogsById,
198
+ [dialog.id]: {
199
+ ...dialog,
200
+ isOpen: false
201
+ }
202
+ },
203
+ openedDialogIds: current.openedDialogIds.filter((dialogId) => dialogId !== id)
204
+ }));
205
+ }
206
+ closeAll() {
207
+ Object.values(this.state.getLatestValue().dialogsById).forEach((dialog) => dialog.close());
208
+ }
209
+ toggle(params, closeAll = false) {
210
+ if (this.state.getLatestValue().dialogsById[params.id]?.isOpen) this.close(params.id);
211
+ else this.open(params, closeAll);
212
+ }
213
+ /**
214
+ * Marks the dialog state as unused. If the dialog id is referenced again quickly,
215
+ * the state will not be removed. Otherwise, the state will be removed after
216
+ * a short timeout.
217
+ */
218
+ markForRemoval(id) {
219
+ const dialog = this.get(id);
220
+ if (!dialog) return;
221
+ this.state.next((current) => ({
222
+ ...current,
223
+ dialogsById: {
224
+ ...current.dialogsById,
225
+ [id]: {
226
+ ...dialog,
227
+ removalTimeout: setTimeout(() => {
228
+ this.remove(id);
229
+ }, 16)
230
+ }
231
+ },
232
+ openedDialogIds: current.openedDialogIds.filter((dialogId) => dialogId !== id)
233
+ }));
234
+ }
235
+ cancelPendingRemoval(id) {
236
+ const dialog = this.get(id);
237
+ if (!dialog?.removalTimeout) return;
238
+ clearTimeout(dialog.removalTimeout);
239
+ this.state.next((current) => ({
240
+ ...current,
241
+ dialogsById: {
242
+ ...current.dialogsById,
243
+ [id]: {
244
+ ...current.dialogsById[id],
245
+ removalTimeout: void 0
246
+ }
247
+ },
248
+ openedDialogIds: current.dialogsById[id]?.isOpen ? [...current.openedDialogIds.filter((dialogId) => dialogId !== id), id] : current.openedDialogIds
249
+ }));
250
+ }
251
+ };
252
+ //#endregion
253
+ //#region src/store/hooks/useStateStore.ts
254
+ var noop = () => {};
255
+ function useStateStore(store, selector) {
256
+ return useSyncExternalStore(useCallback((onStoreChange) => {
257
+ return store?.subscribeWithSelector(selector, onStoreChange) ?? noop;
258
+ }, [store, selector]), useMemo(() => {
259
+ let cachedTuple;
260
+ return () => {
261
+ const currentValue = store?.getLatestValue();
262
+ if (!currentValue) return void 0;
263
+ if (cachedTuple && cachedTuple[0] === currentValue) return cachedTuple[1];
264
+ const newlySelected = selector(currentValue);
265
+ if (cachedTuple) {
266
+ let selectededAreEqualToCached = true;
267
+ for (const key in cachedTuple[1]) {
268
+ if (cachedTuple[1][key] === newlySelected[key]) continue;
269
+ selectededAreEqualToCached = false;
270
+ break;
271
+ }
272
+ if (selectededAreEqualToCached) return cachedTuple[1];
273
+ }
274
+ cachedTuple = [currentValue, newlySelected];
275
+ return cachedTuple[1];
276
+ };
277
+ }, [store, selector]));
278
+ }
279
+ //#endregion
280
+ //#region src/components/Dialog/hooks/useDialog.ts
281
+ var useDialog = ({ closeOnClickOutside, dialogManagerId, id }) => {
282
+ const { dialogManager } = useDialogManager({ dialogManagerId });
283
+ useEffect(() => {
284
+ dialogManager.cancelPendingRemoval(id);
285
+ return () => {
286
+ dialogManager.markForRemoval(id);
287
+ };
288
+ }, [dialogManager, id]);
289
+ return dialogManager.getOrCreate({
290
+ closeOnClickOutside,
291
+ id
292
+ });
293
+ };
294
+ var useDialogOnNearestManager = ({ id }) => {
295
+ const { dialogManager } = useNearestDialogManagerContext() ?? {};
296
+ return {
297
+ dialog: useDialog({
298
+ dialogManagerId: dialogManager?.id,
299
+ id
300
+ }),
301
+ dialogManager
302
+ };
303
+ };
304
+ var modalDialogId = "modal-dialog";
305
+ var useModalDialog = (id = modalDialogId) => useDialog({
306
+ dialogManagerId: modalDialogManagerId,
307
+ id
308
+ });
309
+ var useDialogIsOpen = (id, dialogManagerId) => {
310
+ const { dialogManager } = useDialogManager({ dialogManagerId });
311
+ const dialogIsOpenSelector = useCallback(({ dialogsById }) => ({ isOpen: !!dialogsById[id]?.isOpen }), [id]);
312
+ return useStateStore(dialogManager.state, dialogIsOpenSelector).isOpen;
313
+ };
314
+ var useModalDialogIsOpen = (id = modalDialogId) => useDialogIsOpen(id, modalDialogManagerId);
315
+ var useDialogIsTopmost = (id, dialogManagerId) => {
316
+ const { dialogManager } = useDialogManager({ dialogManagerId });
317
+ const dialogIsTopmostSelector = useCallback(({ openedDialogIds }) => ({ isTopmost: openedDialogIds[openedDialogIds.length - 1] === id }), [id]);
318
+ return useStateStore(dialogManager.state, dialogIsTopmostSelector).isTopmost;
319
+ };
320
+ var useModalDialogIsTopmost = (id = modalDialogId) => useDialogIsTopmost(id, modalDialogManagerId);
321
+ var openedDialogCountSelector = (nextValue) => ({ openedDialogCount: nextValue.openedDialogIds.length });
322
+ var useOpenedDialogCount = ({ dialogManagerId } = {}) => {
323
+ const { dialogManager } = useDialogManager({ dialogManagerId });
324
+ return useStateStore(dialogManager.state, openedDialogCountSelector).openedDialogCount;
325
+ };
326
+ //#endregion
327
+ //#region src/components/Portal/Portal.ts
328
+ var Portal = ({ children, getPortalDestination, isOpen }) => {
329
+ const [portalDestination, setPortalDestination] = useState(null);
330
+ useLayoutEffect(() => {
331
+ const destination = getPortalDestination();
332
+ if (!destination || !isOpen) return;
333
+ setPortalDestination(destination);
334
+ }, [getPortalDestination, isOpen]);
335
+ if (!portalDestination) return null;
336
+ return createPortal(children, portalDestination);
337
+ };
338
+ //#endregion
339
+ //#region src/components/Dialog/service/DialogPortal.tsx
340
+ var shouldCloseOnOutsideClick = ({ dialog, managerCloseOnClickOutside }) => dialog.closeOnClickOutside ?? managerCloseOnClickOutside;
341
+ var DialogPortalDestination = () => {
342
+ const { dialogManager } = useNearestDialogManagerContext() ?? {};
343
+ const openedDialogCount = useOpenedDialogCount({ dialogManagerId: dialogManager?.id });
344
+ const [destinationRoot, setDestinationRoot] = useState(null);
345
+ useEffect(() => {
346
+ if (!destinationRoot || !dialogManager) return;
347
+ const handleDocumentClick = (event) => {
348
+ const target = event.target;
349
+ const clickedOverlay = target.closest?.("[data-str-chat__portal-id]");
350
+ if (clickedOverlay && clickedOverlay !== destinationRoot) return;
351
+ if (target !== destinationRoot && destinationRoot.contains(target)) return;
352
+ setTimeout(() => {
353
+ Object.values(dialogManager.state.getLatestValue().dialogsById).forEach((dialog) => {
354
+ if (!dialog.isOpen) return;
355
+ if (!shouldCloseOnOutsideClick({
356
+ dialog,
357
+ managerCloseOnClickOutside: dialogManager.closeOnClickOutside
358
+ })) return;
359
+ dialogManager.close(dialog.id);
360
+ });
361
+ }, 0);
362
+ };
363
+ document.addEventListener("click", handleDocumentClick, { capture: true });
364
+ return () => {
365
+ document.removeEventListener("click", handleDocumentClick, { capture: true });
366
+ };
367
+ }, [destinationRoot, dialogManager]);
368
+ if (!openedDialogCount) return null;
369
+ return /* @__PURE__ */ jsx("div", {
370
+ className: "str-chat__dialog-overlay",
371
+ "data-str-chat__portal-id": dialogManager?.id,
372
+ "data-testid": "str-chat__dialog-overlay",
373
+ ref: setDestinationRoot,
374
+ style: { "--str-chat__dialog-overlay-height": openedDialogCount > 0 ? "100%" : "0" }
375
+ });
376
+ };
377
+ var DialogPortalEntry = ({ children, dialogId, dialogManagerId }) => {
378
+ const { dialogManager } = useDialogManager({
379
+ dialogId,
380
+ dialogManagerId
381
+ });
382
+ const dialogIsOpen = useDialogIsOpen(dialogId, dialogManagerId);
383
+ return /* @__PURE__ */ jsx(Portal, {
384
+ getPortalDestination: useCallback(() => document.querySelector(`div[data-str-chat__portal-id="${dialogManager.id}"]`), [dialogManager.id]),
385
+ isOpen: dialogIsOpen,
386
+ children
387
+ });
388
+ };
389
+ //#endregion
390
+ //#region src/context/DialogManagerContext.tsx
391
+ var dialogManagersRegistry = new StateStore({});
392
+ var getDialogManager = (id) => dialogManagersRegistry.getLatestValue()[id];
393
+ var getOrCreateDialogManager = ({ closeOnClickOutside, id }) => {
394
+ let manager = getDialogManager(id);
395
+ if (!manager) {
396
+ manager = new DialogManager({
397
+ closeOnClickOutside,
398
+ id
399
+ });
400
+ dialogManagersRegistry.partialNext({ [id]: manager });
401
+ } else if (typeof closeOnClickOutside === "boolean") manager.closeOnClickOutside = closeOnClickOutside;
402
+ return manager;
403
+ };
404
+ var removeDialogManager = (id) => {
405
+ if (!getDialogManager(id)) return;
406
+ dialogManagersRegistry.partialNext({ [id]: void 0 });
407
+ };
408
+ var DialogManagerProviderContext = React.createContext(void 0);
409
+ /**
410
+ * Creates/provides a dialog manager and its portal destination.
411
+ */
412
+ var DialogManagerProvider = ({ children, closeOnClickOutside, id }) => {
413
+ const [dialogManager, setDialogManager] = useState(() => {
414
+ if (id) return getDialogManager(id) ?? null;
415
+ return new DialogManager({ closeOnClickOutside });
416
+ });
417
+ useEffect(() => {
418
+ if (!id) return;
419
+ setDialogManager(getOrCreateDialogManager({
420
+ closeOnClickOutside,
421
+ id
422
+ }));
423
+ return () => {
424
+ removeDialogManager(id);
425
+ setDialogManager(null);
426
+ };
427
+ }, [closeOnClickOutside, id]);
428
+ if (!dialogManager) return null;
429
+ return /* @__PURE__ */ jsxs(DialogManagerProviderContext.Provider, {
430
+ value: { dialogManager },
431
+ children: [children, /* @__PURE__ */ jsx(DialogPortalDestination, {})]
432
+ });
433
+ };
434
+ var getManagerFromStore = ({ dialogId, dialogManagerId, newState, previousState }) => {
435
+ let managerInNewState;
436
+ let managerInPrevState;
437
+ if (dialogManagerId) if (!dialogId) {
438
+ managerInNewState = newState[dialogManagerId];
439
+ managerInPrevState = previousState?.[dialogManagerId];
440
+ } else {
441
+ if (newState[dialogManagerId]?.get(dialogId)) managerInNewState = newState[dialogManagerId];
442
+ if (previousState?.[dialogManagerId]?.get(dialogId)) managerInPrevState = previousState[dialogManagerId];
443
+ }
444
+ else if (dialogId) {
445
+ managerInNewState = Object.values(newState).find((dialogMng) => dialogId && dialogMng?.get(dialogId));
446
+ managerInPrevState = previousState && Object.values(previousState).find((dialogMng) => dialogId && dialogMng?.get(dialogId));
447
+ }
448
+ return {
449
+ managerInNewState,
450
+ managerInPrevState
451
+ };
452
+ };
453
+ /**
454
+ * Retrieves the nearest dialog manager or searches for the dialog manager by dialog manager id or dialog id.
455
+ * Dialog id will take precedence over dialog manager id if both are provided and dialog manager is found by dialog id.
456
+ */
457
+ var useDialogManager = ({ dialogId, dialogManagerId } = {}) => {
458
+ const nearestDialogManagerContext = useContext(DialogManagerProviderContext);
459
+ const [dialogManagerContext, setDialogManagerContext] = useState(() => {
460
+ const { managerInNewState } = getManagerFromStore({
461
+ dialogId,
462
+ dialogManagerId,
463
+ newState: dialogManagersRegistry.getLatestValue(),
464
+ previousState: void 0
465
+ });
466
+ return managerInNewState ? { dialogManager: managerInNewState } : nearestDialogManagerContext;
467
+ });
468
+ useEffect(() => {
469
+ if (!dialogId && !dialogManagerId) return;
470
+ const unsubscribe = dialogManagersRegistry.subscribeWithSelector((state) => state, (newState, previousState) => {
471
+ const { managerInNewState, managerInPrevState } = getManagerFromStore({
472
+ dialogId,
473
+ dialogManagerId,
474
+ newState,
475
+ previousState
476
+ });
477
+ if (!managerInPrevState || managerInNewState?.id !== managerInPrevState.id) setDialogManagerContext((prevState) => {
478
+ if (prevState?.dialogManager.id === managerInNewState?.id) return prevState;
479
+ return { dialogManager: managerInNewState || nearestDialogManagerContext?.dialogManager };
480
+ });
481
+ });
482
+ return () => {
483
+ unsubscribe();
484
+ };
485
+ }, [
486
+ dialogId,
487
+ dialogManagerId,
488
+ nearestDialogManagerContext?.dialogManager
489
+ ]);
490
+ if (!dialogManagerContext?.dialogManager) console.warn(`Dialog manager (manager id: ${dialogManagerId}, dialog id: ${dialogId}) is not available`);
491
+ return dialogManagerContext;
492
+ };
493
+ var modalDialogManagerId = "modal-dialog-manager";
494
+ var ModalDialogManagerProvider = ({ children }) => /* @__PURE__ */ jsx(DialogManagerProvider, {
495
+ id: modalDialogManagerId,
496
+ children
497
+ });
498
+ var useModalDialogManager = () => useMemo(() => getDialogManager(modalDialogManagerId), []);
499
+ var useNearestDialogManagerContext = () => useContext(DialogManagerProviderContext);
500
+ //#endregion
501
+ //#region src/context/MessageComposerContext.tsx
502
+ var MessageComposerContext = createContext(void 0);
503
+ var MessageComposerContextProvider = ({ children, value }) => /* @__PURE__ */ jsx(MessageComposerContext.Provider, {
504
+ value,
505
+ children
506
+ });
507
+ var useMessageComposerContext = (componentName) => {
508
+ const contextValue = useContext(MessageComposerContext);
509
+ if (!contextValue) return {};
510
+ return contextValue;
511
+ };
512
+ //#endregion
513
+ //#region src/i18n/utils.ts
514
+ var isNumberOrString = (output) => typeof output === "string" || typeof output === "number";
515
+ var isDayOrMoment = (output) => !!output?.isSame;
516
+ var isDate = (output) => output !== null && typeof output === "object" && typeof output.getTime === "function";
517
+ var DEFAULT_RELATIVE_COMPACT_MAX_DAYS = 6;
518
+ var DEFAULT_RELATIVE_COMPACT_MAX_WEEKS = 3;
519
+ /**
520
+ * Turns a date into a short, readable label: "Today", "Yesterday", "2d ago", "1w ago",
521
+ * or a calendar date (DD/MM/YY) for older or future dates.
522
+ *
523
+ * What appears for each period:
524
+ * - Same day → "Today"
525
+ * - Yesterday → "Yesterday"
526
+ * - 2 to maxDays days ago → "2d ago", "3d ago", … "Nd ago"
527
+ * - If maxWeeks is greater than 0: 1 to maxWeeks weeks ago → "1w ago", "2w ago", …
528
+ * - Anything older (or in the future) → calendar date
529
+ *
530
+ * To change the wording or which label is used, add these to your locale JSON (example in English):
531
+ *
532
+ * "timestamp/relativeToday": "Today",
533
+ * "timestamp/relativeYesterday": "Yesterday",
534
+ * "timestamp/relativeDaysAgo": "{{ count }}d ago",
535
+ * "timestamp/relativeWeeksAgo": "{{ count }}w ago",
536
+ *
537
+ * To use this style for a timestamp (e.g. poll votes), add for example:
538
+ *
539
+ * "timestamp/PollVote": "{{ timestamp | timestampFormatter(relativeCompact: true) }}"
540
+ *
541
+ * Only "Xd ago", no "Xw ago" (anything 7+ days ago shows as a date):
542
+ *
543
+ * "timestamp/PollVote": "{{ timestamp | timestampFormatter(relativeCompact: true; relativeCompactMaxWeeks: 0) }}"
544
+ *
545
+ * To change how far "days ago" and "weeks ago" go: use relativeCompactMaxDays and
546
+ * relativeCompactMaxWeeks in the formatter (e.g. relativeCompactMaxWeeks: 2 for only 1w and 2w ago).
547
+ */
548
+ function getRelativeCompactDateString(messageCreatedAt, t, tDateTimeParser, maxDays = DEFAULT_RELATIVE_COMPACT_MAX_DAYS, maxWeeks = DEFAULT_RELATIVE_COMPACT_MAX_WEEKS) {
549
+ const then = tDateTimeParser(messageCreatedAt);
550
+ if (!isDayOrMoment(then)) return null;
551
+ const now = tDateTimeParser((/* @__PURE__ */ new Date()).toISOString());
552
+ if (!isDayOrMoment(now)) return null;
553
+ const diffDays = now.startOf("day").diff(then.startOf("day"), "day");
554
+ if (diffDays < 0) return then.format("DD/MM/YY");
555
+ if (diffDays === 0) return t("timestamp/relativeToday");
556
+ if (diffDays === 1) return t("timestamp/relativeYesterday");
557
+ if (diffDays >= 2 && diffDays <= maxDays) return t("timestamp/relativeDaysAgo", { count: diffDays });
558
+ if (maxWeeks > 0) {
559
+ const maxDaysForWeeks = maxWeeks * 7;
560
+ if (diffDays >= 7 && diffDays <= maxDaysForWeeks) return t("timestamp/relativeWeeksAgo", { count: Math.ceil(diffDays / 7) });
561
+ }
562
+ return then.format("DD/MM/YY");
563
+ }
564
+ function getDateString({ calendar, calendarFormats, format, formatDate, messageCreatedAt, relativeCompact, relativeCompactMaxDays, relativeCompactMaxWeeks, t, tDateTimeParser, timestampTranslationKey }) {
565
+ if (!messageCreatedAt || typeof messageCreatedAt === "string" && !Date.parse(messageCreatedAt)) return null;
566
+ if (typeof formatDate === "function") return formatDate(new Date(messageCreatedAt));
567
+ if (relativeCompact && t && tDateTimeParser) {
568
+ const maxDays = typeof relativeCompactMaxDays === "number" ? relativeCompactMaxDays : typeof relativeCompactMaxDays === "string" ? parseInt(relativeCompactMaxDays, 10) : DEFAULT_RELATIVE_COMPACT_MAX_DAYS;
569
+ const maxWeeks = typeof relativeCompactMaxWeeks === "number" ? relativeCompactMaxWeeks : typeof relativeCompactMaxWeeks === "string" ? parseInt(relativeCompactMaxWeeks, 10) : DEFAULT_RELATIVE_COMPACT_MAX_WEEKS;
570
+ const result = getRelativeCompactDateString(messageCreatedAt, t, tDateTimeParser, Number.isNaN(maxDays) ? DEFAULT_RELATIVE_COMPACT_MAX_DAYS : maxDays, Number.isNaN(maxWeeks) ? DEFAULT_RELATIVE_COMPACT_MAX_WEEKS : maxWeeks);
571
+ if (result) return result;
572
+ }
573
+ if (t && timestampTranslationKey) {
574
+ const options = {};
575
+ if (typeof calendar !== "undefined" && calendar !== null) options.calendar = calendar;
576
+ if (typeof calendarFormats !== "undefined" && calendarFormats !== null) options.calendarFormats = calendarFormats;
577
+ if (typeof format !== "undefined" && format !== null) options.format = format;
578
+ const translatedTimestamp = t(timestampTranslationKey, {
579
+ ...options,
580
+ timestamp: new Date(messageCreatedAt)
581
+ });
582
+ if (timestampTranslationKey !== translatedTimestamp) return translatedTimestamp;
583
+ }
584
+ if (!tDateTimeParser) return null;
585
+ const parsedTime = tDateTimeParser(messageCreatedAt);
586
+ if (isDayOrMoment(parsedTime))
587
+ /**
588
+ * parsedTime.calendar is guaranteed on the type but is only
589
+ * available when a user calls dayjs.extend(calendar)
590
+ */
591
+ return calendar && parsedTime.calendar ? parsedTime.calendar(void 0, calendarFormats || void 0) : parsedTime.format(format || void 0);
592
+ if (isDate(parsedTime)) return parsedTime.toDateString();
593
+ if (isNumberOrString(parsedTime)) return parsedTime;
594
+ return null;
595
+ }
596
+ var predefinedFormatters = {
597
+ durationFormatter: (streamI18n) => (value, _, { format, withSuffix }) => {
598
+ const durationValue = value;
599
+ if (format && Dayjs.isDayjs(streamI18n.DateTimeParser)) return streamI18n.DateTimeParser.duration(durationValue).format(format);
600
+ return streamI18n.DateTimeParser.duration(durationValue).humanize(!!withSuffix);
601
+ },
602
+ timestampFormatter: (streamI18n) => (value, _, { calendarFormats, ...options }) => {
603
+ let parsedCalendarFormats;
604
+ try {
605
+ if (!options.calendar) parsedCalendarFormats = {};
606
+ else if (typeof calendarFormats === "string") parsedCalendarFormats = JSON.parse(calendarFormats);
607
+ else if (typeof calendarFormats === "object") parsedCalendarFormats = calendarFormats;
608
+ } catch (e) {
609
+ console.error("[TIMESTAMP FORMATTER]", e);
610
+ }
611
+ const result = getDateString({
612
+ ...options,
613
+ calendarFormats: parsedCalendarFormats,
614
+ messageCreatedAt: value,
615
+ t: streamI18n.t,
616
+ tDateTimeParser: streamI18n.tDateTimeParser
617
+ });
618
+ if (!result || typeof result === "number") return JSON.stringify(value);
619
+ return result;
620
+ }
621
+ };
622
+ var defaultTranslatorFunction = ((key) => key);
623
+ var defaultDateTimeParser = (input) => Dayjs(input);
624
+ var isLanguageSupported = (language) => {
625
+ return [
626
+ "de",
627
+ "en",
628
+ "es",
629
+ "fr",
630
+ "hi",
631
+ "it",
632
+ "ja",
633
+ "ko",
634
+ "nl",
635
+ "pt",
636
+ "ru",
637
+ "tr"
638
+ ].some((translation) => language === translation);
639
+ };
640
+ //#endregion
641
+ //#region src/context/TranslationContext.tsx
642
+ Dayjs.extend(calendar);
643
+ Dayjs.extend(localizedFormat);
644
+ var TranslationContext = React.createContext({
645
+ t: defaultTranslatorFunction,
646
+ tDateTimeParser: defaultDateTimeParser,
647
+ userLanguage: "en"
648
+ });
649
+ var TranslationProvider = ({ children, value }) => /* @__PURE__ */ jsx(TranslationContext.Provider, {
650
+ value,
651
+ children
652
+ });
653
+ var useTranslationContext = (componentName) => {
654
+ const contextValue = useContext(TranslationContext);
655
+ if (!contextValue) {
656
+ console.warn(`The useTranslationContext hook was called outside of the TranslationContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${componentName} component.`);
657
+ return {};
658
+ }
659
+ return contextValue;
660
+ };
661
+ //#endregion
662
+ //#region src/context/TypingContext.tsx
663
+ var TypingContext = React.createContext(void 0);
664
+ var TypingProvider = ({ children, value }) => /* @__PURE__ */ jsx(TypingContext.Provider, {
665
+ value,
666
+ children
667
+ });
668
+ var useTypingContext = (componentName) => {
669
+ const contextValue = useContext(TypingContext);
670
+ if (!contextValue) {
671
+ console.warn(`The useTypingContext hook was called outside of the TypingContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`);
672
+ return {};
673
+ }
674
+ return contextValue;
675
+ };
676
+ //#endregion
677
+ //#region src/components/Notifications/notificationTarget.ts
678
+ var NOTIFICATION_TARGET_PANELS = [
679
+ "channel",
680
+ "thread",
681
+ "channel-list",
682
+ "thread-list",
683
+ "modal"
684
+ ];
685
+ var isNotificationTargetPanel = (value) => typeof value === "string" && NOTIFICATION_TARGET_PANELS.includes(value);
686
+ var getNotificationTargetPanel = (notification) => {
687
+ const targetTag = notification.tags?.find((tag) => tag.startsWith("target:"));
688
+ if (targetTag) {
689
+ const candidate = targetTag.slice(7);
690
+ if (isNotificationTargetPanel(candidate)) return candidate;
691
+ }
692
+ const panel = notification.origin.context?.panel;
693
+ return isNotificationTargetPanel(panel) ? panel : void 0;
694
+ };
695
+ var getNotificationTargetPanels = (notification) => {
696
+ const targetPanels = (notification.tags ?? []).filter((tag) => tag.startsWith("target:")).map((tag) => tag.slice(7)).filter((value) => isNotificationTargetPanel(value));
697
+ if (targetPanels.length > 0) return Array.from(new Set(targetPanels));
698
+ const panel = notification.origin.context?.panel;
699
+ return isNotificationTargetPanel(panel) ? [panel] : [];
700
+ };
701
+ var getNotificationTargetTag = (panel) => `target:${panel}`;
702
+ var addNotificationTargetTag = (panel, tags) => {
703
+ if (!panel) return tags ?? [];
704
+ return Array.from(new Set([getNotificationTargetTag(panel), ...tags ?? []]));
705
+ };
706
+ var isNotificationForPanel = (notification, panel, options) => {
707
+ const explicitTargetPanels = getNotificationTargetPanels(notification);
708
+ if (explicitTargetPanels.length > 0) return explicitTargetPanels.includes(panel);
709
+ return (options?.fallbackPanel ?? "channel") === panel;
710
+ };
711
+ //#endregion
712
+ //#region src/components/Dialog/hooks/usePopoverPosition.ts
713
+ var hasResizeObserver = typeof window !== "undefined" && "ResizeObserver" in window;
714
+ function autoMiddlewareFor(p) {
715
+ if (!String(p).startsWith("auto")) return null;
716
+ return autoPlacement({ alignment: p === "auto-start" ? "start" : p === "auto-end" ? "end" : void 0 });
717
+ }
718
+ function toOffsetMw(opt) {
719
+ if (opt == null) return null;
720
+ if (Array.isArray(opt)) {
721
+ const [crossAxis, mainAxis] = opt;
722
+ return offset({
723
+ crossAxis,
724
+ mainAxis
725
+ });
726
+ }
727
+ if (typeof opt === "number") return offset(opt);
728
+ return offset(opt);
729
+ }
730
+ function usePopoverPosition({ allowFlip = true, allowShift = true, autoUpdateOptions, fitAvailableSpace = false, freeze = false, offset, placement = "bottom-start", shiftOptions }) {
731
+ const autoMw = autoMiddlewareFor(placement);
732
+ const offsetMiddleware = toOffsetMw(offset);
733
+ const isSidePlacement = placement.startsWith("left") || placement.startsWith("right");
734
+ const mergedShiftOptions = shiftOptions ? {
735
+ padding: 8,
736
+ ...shiftOptions
737
+ } : { padding: 8 };
738
+ return useFloating({
739
+ middleware: [
740
+ ...offsetMiddleware ? [offsetMiddleware] : [],
741
+ ...autoMw ? [autoMw] : allowFlip && !isSidePlacement ? [flip()] : [],
742
+ ...allowShift ? [shift(mergedShiftOptions)] : [],
743
+ ...fitAvailableSpace ? [size({ apply: () => {} })] : []
744
+ ],
745
+ placement: String(placement).startsWith("auto") ? "bottom" : placement,
746
+ strategy: "fixed",
747
+ whileElementsMounted: freeze ? void 0 : (reference, floating, update) => autoUpdate(reference, floating, update, {
748
+ ancestorResize: true,
749
+ ancestorScroll: true,
750
+ animationFrame: false,
751
+ elementResize: hasResizeObserver,
752
+ ...autoUpdateOptions
753
+ })
754
+ });
755
+ }
756
+ //#endregion
757
+ //#region src/components/Button/Button.tsx
758
+ var variantToClass = {
759
+ danger: "str-chat__button--destructive",
760
+ primary: "str-chat__button--primary",
761
+ secondary: "str-chat__button--secondary"
762
+ };
763
+ var appearanceToClass = {
764
+ ghost: "str-chat__button--ghost",
765
+ outline: "str-chat__button--outline",
766
+ solid: "str-chat__button--solid"
767
+ };
768
+ var sizeToClass = {
769
+ lg: "str-chat__button--size-lg",
770
+ md: "str-chat__button--size-md",
771
+ sm: "str-chat__button--size-sm",
772
+ xs: "str-chat__button--size-xs"
773
+ };
774
+ var Button = forwardRef(function Button({ appearance, children, circular, className, inverseTheme, size, variant, ...props }, ref) {
775
+ return /* @__PURE__ */ jsx("button", {
776
+ ref,
777
+ type: "button",
778
+ ...props,
779
+ className: clsx("str-chat__button", variant != null && variantToClass[variant], appearance != null && appearanceToClass[appearance], circular && "str-chat__button--circular", inverseTheme && "str-chat__theme-inverse", size != null && sizeToClass[size], className),
780
+ children: /* @__PURE__ */ jsx("div", {
781
+ className: "str-chat__button__content",
782
+ children
783
+ })
784
+ });
785
+ });
786
+ //#endregion
787
+ //#region src/components/Icons/BaseIcon.tsx
788
+ var BaseIcon = ({ className, decorative = true, ...props }) => {
789
+ const ariaHidden = props["aria-hidden"] ?? (decorative ? true : void 0);
790
+ const focusable = props.focusable ?? (decorative ? false : void 0);
791
+ return /* @__PURE__ */ jsx("svg", {
792
+ viewBox: "0 0 20 20",
793
+ xmlns: "http://www.w3.org/2000/svg",
794
+ ...props,
795
+ "aria-hidden": ariaHidden,
796
+ className: clsx("str-chat__icon", className),
797
+ focusable
798
+ });
799
+ };
800
+ //#endregion
801
+ //#region src/components/Icons/createIcon.tsx
802
+ function toIconClass(name) {
803
+ return "str-chat__icon--" + name.replace(/^Icon/, "").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Za-z])(\d)/g, "$1-$2").replace(/(\d)([A-Za-z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
804
+ }
805
+ function createIcon(name, content, defaultProps) {
806
+ const iconClass = toIconClass(name);
807
+ const Icon = ({ className, ...props }) => /* @__PURE__ */ jsx(BaseIcon, {
808
+ ...defaultProps,
809
+ ...props,
810
+ className: clsx(iconClass, className),
811
+ children: content
812
+ });
813
+ Icon.displayName = name;
814
+ return Icon;
815
+ }
816
+ //#endregion
817
+ //#region src/components/Icons/icons.tsx
818
+ var IconLeave = createIcon("IconLeave", /* @__PURE__ */ jsx("path", {
819
+ d: "M8.75 3.125H3.75V16.875H8.75M8.75 10H17.5M17.5 10L14.375 6.875M17.5 10L14.375 13.125",
820
+ fill: "none",
821
+ stroke: "currentColor",
822
+ strokeLinecap: "round",
823
+ strokeLinejoin: "round",
824
+ strokeWidth: "1.5"
825
+ }));
826
+ var IconArrowDown = createIcon("IconArrowDown", /* @__PURE__ */ jsx("path", {
827
+ d: "M10 3.125V16.875M10 16.875L4.375 11.25M10 16.875L15.625 11.25",
828
+ fill: "none",
829
+ stroke: "currentColor",
830
+ strokeLinecap: "round",
831
+ strokeLinejoin: "round",
832
+ strokeWidth: "1.5"
833
+ }));
834
+ var IconArrowDownCircle = createIcon("IconArrowDownCircle", /* @__PURE__ */ jsx("path", {
835
+ d: "M7.5 10.625L10 13.125M10 13.125L12.5 10.625M10 13.125V6.875M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
836
+ fill: "none",
837
+ stroke: "currentColor",
838
+ strokeLinecap: "round",
839
+ strokeLinejoin: "round",
840
+ strokeWidth: "1.5"
841
+ }));
842
+ var IconArrowLeft = createIcon("IconArrowLeft", /* @__PURE__ */ jsx("path", {
843
+ d: "M16.875 10H3.125M3.125 10L8.75 4.375M3.125 10L8.75 15.625",
844
+ fill: "none",
845
+ stroke: "currentColor",
846
+ strokeLinecap: "round",
847
+ strokeLinejoin: "round",
848
+ strokeWidth: "1.5"
849
+ }), { "data-rtl-mirror": "" });
850
+ var IconArrowUpRight = createIcon("IconArrowUpRight", /* @__PURE__ */ jsx("path", {
851
+ d: "M5 15L15 5M15 5H6.875M15 5V13.125",
852
+ fill: "none",
853
+ stroke: "currentColor",
854
+ strokeLinecap: "round",
855
+ strokeLinejoin: "round",
856
+ strokeWidth: "1.5"
857
+ }), { "data-rtl-mirror": "" });
858
+ var IconRetry = createIcon("IconRetry", /* @__PURE__ */ jsx("path", {
859
+ d: "M14.3751 8.12481H18.1251M18.1251 8.12481V4.37481M18.1251 8.12481L14.8618 5.13809C13.9063 4.18263 12.6904 3.52991 11.3661 3.26151C10.0418 2.9931 8.66771 3.12091 7.41561 3.62896C6.1635 4.137 5.08887 5.00276 4.32599 6.11806C3.5631 7.23336 3.1458 8.54875 3.12621 9.89986C3.10662 11.251 3.48562 12.5779 4.21585 13.7148C4.94609 14.8518 5.99517 15.7483 7.23202 16.2925C8.46887 16.8366 9.83865 17.0042 11.1702 16.7743C12.5018 16.5444 13.736 15.9272 14.7188 14.9998",
860
+ fill: "none",
861
+ stroke: "currentColor",
862
+ strokeLinecap: "round",
863
+ strokeLinejoin: "round",
864
+ strokeWidth: "1.5"
865
+ }));
866
+ var IconRefresh = createIcon("IconRefresh", /* @__PURE__ */ jsx("path", {
867
+ d: "M13.125 7.49978H16.875M16.875 7.49978V3.74978M16.875 7.49978L14.6656 5.29041C13.3861 4.01095 11.6538 3.2875 9.84437 3.27697C8.03494 3.26644 6.29431 3.96968 5 5.23416M6.875 12.4998H3.125M3.125 12.4998V16.2498M3.125 12.4998L5.33437 14.7092C6.61388 15.9886 8.34621 16.7121 10.1556 16.7226C11.9651 16.7331 13.7057 16.0299 15 14.7654",
868
+ fill: "none",
869
+ stroke: "currentColor",
870
+ strokeLinecap: "round",
871
+ strokeLinejoin: "round",
872
+ strokeWidth: "1.5"
873
+ }));
874
+ var IconReply = createIcon("IconReply", /* @__PURE__ */ jsx("path", {
875
+ d: "M17.5812 15.525C16.2953 14.1555 12.9195 11.25 8.12265 11.25V15L1.87265 8.75L8.12265 2.5V6.25C12.2476 6.25 17.5359 10.1914 18.1226 15.2766C18.1308 15.3424 18.1177 15.4091 18.0854 15.4671C18.0531 15.525 18.0031 15.5712 17.9428 15.5988C17.8825 15.6265 17.815 15.6343 17.75 15.621C17.685 15.6077 17.6259 15.5741 17.5812 15.525Z",
876
+ fill: "none",
877
+ stroke: "currentColor",
878
+ strokeLinecap: "round",
879
+ strokeLinejoin: "round",
880
+ strokeWidth: "1.5"
881
+ }), { "data-rtl-mirror": "" });
882
+ var IconArrowUp = createIcon("IconArrowUp", /* @__PURE__ */ jsx("path", {
883
+ d: "M10 16.875V3.125M10 3.125L4.375 8.75M10 3.125L15.625 8.75",
884
+ fill: "none",
885
+ stroke: "currentColor",
886
+ strokeLinecap: "round",
887
+ strokeLinejoin: "round",
888
+ strokeWidth: "1.5"
889
+ }));
890
+ var IconBell = createIcon("IconBell", /* @__PURE__ */ jsx("path", {
891
+ d: "M7.50015 15C7.50015 15.663 7.76354 16.2989 8.23238 16.7678C8.70122 17.2366 9.33711 17.5 10.0001 17.5C10.6632 17.5 11.2991 17.2366 11.7679 16.7678C12.2368 16.2989 12.5001 15.663 12.5001 15M4.37515 8.125C4.37515 6.63316 4.96778 5.20242 6.02267 4.14752C7.07756 3.09263 8.5083 2.5 10.0001 2.5C11.492 2.5 12.9227 3.09263 13.9776 4.14752C15.0325 5.20242 15.6251 6.63316 15.6251 8.125C15.6251 10.9234 16.2736 13.1719 16.7892 14.0625C16.844 14.1574 16.8728 14.2649 16.8729 14.3745C16.873 14.484 16.8444 14.5916 16.7898 14.6865C16.7352 14.7815 16.6566 14.8604 16.5619 14.9154C16.4672 14.9705 16.3597 14.9996 16.2501 15H3.75015C3.64076 14.9993 3.53345 14.97 3.43896 14.9149C3.34448 14.8597 3.26611 14.7808 3.2117 14.6859C3.15729 14.591 3.12874 14.4835 3.12891 14.3741C3.12907 14.2647 3.15795 14.1572 3.21265 14.0625C3.72749 13.1719 4.37515 10.9227 4.37515 8.125Z",
892
+ fill: "none",
893
+ stroke: "currentColor",
894
+ strokeLinecap: "round",
895
+ strokeLinejoin: "round",
896
+ strokeWidth: "1.5"
897
+ }));
898
+ var IconBellOff = createIcon("IconBellOff", /* @__PURE__ */ jsx("path", {
899
+ d: "M3.75015 3.12492L10.0001 9.99992C10.0001 9.99992 13.8094 14.1901 16.2501 16.8749M7.50015 14.9999C7.50015 15.663 7.76354 16.2988 8.23238 16.7677C8.70122 17.2365 9.33711 17.4999 10.0001 17.4999C10.6632 17.4999 11.2991 17.2365 11.7679 16.7677C12.2368 16.2988 12.5001 15.663 12.5001 14.9999M7.22515 3.23117C8.0809 2.74583 9.04899 2.49341 10.0328 2.49912C11.0166 2.50482 11.9817 2.76845 12.8317 3.26369C13.6818 3.75893 14.3871 4.46846 14.8773 5.32147C15.3674 6.17447 15.6253 7.14111 15.6251 8.12492C15.6251 10.3984 16.0533 12.3093 16.49 13.4218M14.5455 14.9999H3.75015C3.64076 14.9993 3.53345 14.9699 3.43896 14.9148C3.34448 14.8597 3.26611 14.7807 3.2117 14.6858C3.15729 14.5909 3.12874 14.4834 3.12891 14.374C3.12907 14.2646 3.15795 14.1572 3.21265 14.0624C3.72749 13.1718 4.37515 10.9226 4.37515 8.12492C4.37327 6.97806 4.72371 5.85829 5.37905 4.91711",
900
+ fill: "none",
901
+ stroke: "currentColor",
902
+ strokeLinecap: "round",
903
+ strokeLinejoin: "round",
904
+ strokeWidth: "1.5"
905
+ }));
906
+ var IconBookmark = createIcon("IconBookmark", /* @__PURE__ */ jsx("path", {
907
+ d: "M15 17.5L10 14.375L5 17.5V3.75C5 3.58424 5.06585 3.42527 5.18306 3.30806C5.30027 3.19085 5.45924 3.125 5.625 3.125H14.375C14.5408 3.125 14.6997 3.19085 14.8169 3.30806C14.9342 3.42527 15 3.58424 15 3.75V17.5Z",
908
+ fill: "none",
909
+ stroke: "currentColor",
910
+ strokeLinecap: "round",
911
+ strokeLinejoin: "round",
912
+ strokeWidth: "1.5"
913
+ }));
914
+ var IconBookmarkRemove = createIcon("IconBookmarkRemove", /* @__PURE__ */ jsx("path", {
915
+ d: "M5 6.49074V17.5L10 14.375L15 17.5V16M5.125 3.125H14.375C14.5408 3.125 14.6997 3.19085 14.8169 3.30806C14.9342 3.42527 15 3.58424 15 3.75V13M5.125 3.125L3.5 1.5M5.125 3.125L15 13M15 13L17.5 15.5",
916
+ fill: "none",
917
+ stroke: "currentColor",
918
+ strokeLinecap: "round",
919
+ strokeLinejoin: "round",
920
+ strokeWidth: "1.5"
921
+ }));
922
+ var IconMessageBubbles = createIcon("IconMessageBubbles", /* @__PURE__ */ jsx("path", {
923
+ d: "M12.8076 6.25836C13.7525 6.30974 14.6692 6.59868 15.4728 7.09845C16.2764 7.59821 16.941 8.29265 17.4049 9.11746C17.8688 9.94227 18.1172 10.8708 18.1269 11.8171C18.1367 12.7634 17.9075 13.6968 17.4607 14.531L18.0982 16.6998C18.1298 16.8075 18.1319 16.9217 18.1041 17.0304C18.0764 17.1392 18.0198 17.2385 17.9405 17.3178C17.8611 17.3972 17.7618 17.4537 17.6531 17.4815C17.5443 17.5092 17.4301 17.5072 17.3224 17.4756L15.156 16.8357C14.4404 17.2184 13.6504 17.4419 12.8404 17.4907C12.0303 17.5396 11.2192 17.4127 10.4628 17.1188C9.70632 16.8249 9.02237 16.3708 8.45781 15.7878C7.89325 15.2049 7.46143 14.5067 7.19195 13.7412M2.53882 10.781C1.90215 9.59158 1.71418 8.21294 2.00918 6.89647C2.30419 5.58 3.06253 4.41341 4.14591 3.60942C5.22929 2.80543 6.56555 2.4176 7.91103 2.51665C9.2565 2.6157 10.5216 3.19503 11.4755 4.149C12.4295 5.10297 13.0088 6.36803 13.1079 7.7135C13.2069 9.05898 12.8191 10.3952 12.0151 11.4786C11.2111 12.562 10.0445 13.3203 8.72806 13.6153C7.41159 13.9104 6.03295 13.7224 4.84351 13.0857L2.67476 13.7232C2.56707 13.7548 2.45285 13.7569 2.3441 13.7291C2.23535 13.7014 2.13608 13.6448 2.05671 13.5655C1.97735 13.4861 1.92082 13.3868 1.89307 13.2781C1.86531 13.1693 1.86735 13.0551 1.89898 12.9474L2.53882 10.781Z",
924
+ fill: "none",
925
+ stroke: "currentColor",
926
+ strokeLinecap: "round",
927
+ strokeLinejoin: "round",
928
+ strokeWidth: "1.5"
929
+ }));
930
+ var IconMessageBubble = createIcon("IconMessageBubble", /* @__PURE__ */ jsx("path", {
931
+ d: "M6.24431 16.4932C7.81972 17.405 9.67297 17.7127 11.4585 17.359C13.2441 17.0053 14.84 16.0143 15.9489 14.5708C17.0578 13.1273 17.6038 11.3298 17.4852 9.51341C17.3667 7.69704 16.5916 5.98577 15.3045 4.69866C14.0174 3.41156 12.3061 2.63646 10.4897 2.51789C8.67333 2.39932 6.87582 2.94537 5.43231 4.05422C3.9888 5.16308 2.99781 6.75906 2.64412 8.54461C2.29042 10.3302 2.59815 12.1834 3.50993 13.7588L2.53259 16.6768C2.49586 16.7869 2.49053 16.9051 2.5172 17.0181C2.54386 17.131 2.60146 17.2344 2.68355 17.3165C2.76563 17.3985 2.86895 17.4561 2.98194 17.4828C3.09492 17.5095 3.21309 17.5041 3.32321 17.4674L6.24431 16.4932Z",
932
+ fill: "none",
933
+ stroke: "currentColor",
934
+ strokeLinecap: "round",
935
+ strokeLinejoin: "round",
936
+ strokeWidth: "1.5"
937
+ }));
938
+ var IconMessageBubbleFill = createIcon("IconMessageBubbleFill", /* @__PURE__ */ jsx("path", { d: "M18.125 10.0001C18.1253 11.4028 17.7624 12.7818 17.0717 14.0027C16.381 15.2236 15.3859 16.2449 14.1834 16.9671C12.9808 17.6894 11.6118 18.088 10.2095 18.1242C8.80719 18.1603 7.41942 17.8328 6.18125 17.1735L3.52109 18.0602C3.30085 18.1337 3.0645 18.1444 2.83854 18.091C2.61257 18.0377 2.40593 17.9225 2.24176 17.7583C2.07759 17.5942 1.96239 17.3875 1.90906 17.1615C1.85573 16.9356 1.86639 16.6992 1.93984 16.479L2.82656 13.8188C2.24699 12.7292 1.92328 11.5218 1.88 10.2883C1.83672 9.0549 2.075 7.8278 2.57677 6.70019C3.07854 5.57258 3.8306 4.57411 4.77587 3.78055C5.72114 2.98699 6.83478 2.41921 8.03224 2.1203C9.22971 1.82139 10.4795 1.79922 11.6868 2.05545C12.8942 2.31169 14.0272 2.8396 15.0001 3.59912C15.9729 4.35865 16.7599 5.32981 17.3014 6.43891C17.8428 7.548 18.1245 8.76588 18.125 10.0001Z" }));
939
+ var IconThread = createIcon("IconThread", /* @__PURE__ */ jsx("path", {
940
+ d: "M7.5 8.75H12.8125M7.5 11.25H12.8125M10.3125 16.875H3.75C3.58424 16.875 3.42527 16.8092 3.30806 16.6919C3.19085 16.5747 3.125 16.4158 3.125 16.25V9.6875C3.125 7.78126 3.88225 5.95309 5.23017 4.60517C6.57809 3.25725 8.40626 2.5 10.3125 2.5C11.2564 2.5 12.191 2.68591 13.063 3.04712C13.9351 3.40832 14.7274 3.93775 15.3948 4.60517C16.0623 5.27259 16.5917 6.06493 16.9529 6.93696C17.3141 7.80899 17.5 8.74362 17.5 9.6875C17.5 10.6314 17.3141 11.566 16.9529 12.438C16.5917 13.3101 16.0623 14.1024 15.3948 14.7698C14.7274 15.4373 13.9351 15.9667 13.063 16.3279C12.191 16.6891 11.2564 16.875 10.3125 16.875Z",
941
+ fill: "none",
942
+ stroke: "currentColor",
943
+ strokeLinecap: "round",
944
+ strokeLinejoin: "round",
945
+ strokeWidth: "1.5"
946
+ }));
947
+ var IconThreadFill = createIcon("IconThreadFill", /* @__PURE__ */ jsx("path", { d: "M10.3125 1.875C8.24119 1.87727 6.25538 2.70111 4.79074 4.16574C3.32611 5.63038 2.50227 7.61619 2.5 9.6875V16.25C2.5 16.5815 2.6317 16.8995 2.86612 17.1339C3.10054 17.3683 3.41848 17.5 3.75 17.5H10.3125C12.3845 17.5 14.3716 16.6769 15.8368 15.2118C17.3019 13.7466 18.125 11.7595 18.125 9.6875C18.125 7.6155 17.3019 5.62836 15.8368 4.16323C14.3716 2.6981 12.3845 1.875 10.3125 1.875ZM12.8125 11.875H7.5C7.33424 11.875 7.17527 11.8092 7.05806 11.6919C6.94085 11.5747 6.875 11.4158 6.875 11.25C6.875 11.0842 6.94085 10.9253 7.05806 10.8081C7.17527 10.6908 7.33424 10.625 7.5 10.625H12.8125C12.9783 10.625 13.1372 10.6908 13.2544 10.8081C13.3717 10.9253 13.4375 11.0842 13.4375 11.25C13.4375 11.4158 13.3717 11.5747 13.2544 11.6919C13.1372 11.8092 12.9783 11.875 12.8125 11.875ZM12.8125 9.375H7.5C7.33424 9.375 7.17527 9.30915 7.05806 9.19194C6.94085 9.07473 6.875 8.91576 6.875 8.75C6.875 8.58424 6.94085 8.42527 7.05806 8.30806C7.17527 8.19085 7.33424 8.125 7.5 8.125H12.8125C12.9783 8.125 13.1372 8.19085 13.2544 8.30806C13.3717 8.42527 13.4375 8.58424 13.4375 8.75C13.4375 8.91576 13.3717 9.07473 13.2544 9.19194C13.1372 9.30915 12.9783 9.375 12.8125 9.375Z" }));
948
+ var IconNotification = createIcon("IconNotification", /* @__PURE__ */ jsx("path", {
949
+ d: "M16.25 10V16.25C16.25 16.4158 16.1842 16.5747 16.0669 16.6919C15.9497 16.8092 15.7908 16.875 15.625 16.875H3.75C3.58424 16.875 3.42527 16.8092 3.30806 16.6919C3.19085 16.5747 3.125 16.4158 3.125 16.25V4.375C3.125 4.20924 3.19085 4.05027 3.30806 3.93306C3.42527 3.81585 3.58424 3.75 3.75 3.75H10M17.5 4.6875C17.5 5.89562 16.5206 6.875 15.3125 6.875C14.1044 6.875 13.125 5.89562 13.125 4.6875C13.125 3.47938 14.1044 2.5 15.3125 2.5C16.5206 2.5 17.5 3.47938 17.5 4.6875Z",
950
+ fill: "none",
951
+ stroke: "currentColor",
952
+ strokeLinecap: "round",
953
+ strokeLinejoin: "round",
954
+ strokeWidth: "1.5"
955
+ }));
956
+ var IconCamera = createIcon("IconCamera", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", {
957
+ d: "M16.25 16.25H3.75C3.41848 16.25 3.10054 16.1183 2.86612 15.8839C2.6317 15.6495 2.5 15.3315 2.5 15V6.25C2.5 5.91848 2.6317 5.60054 2.86612 5.36612C3.10054 5.1317 3.41848 5 3.75 5H6.25L7.5 3.125H12.5L13.75 5H16.25C16.5815 5 16.8995 5.1317 17.1339 5.36612C17.3683 5.60054 17.5 5.91848 17.5 6.25V15C17.5 15.3315 17.3683 15.6495 17.1339 15.8839C16.8995 16.1183 16.5815 16.25 16.25 16.25Z",
958
+ fill: "none",
959
+ stroke: "currentColor",
960
+ strokeLinecap: "round",
961
+ strokeLinejoin: "round",
962
+ strokeWidth: "1.5"
963
+ }), /* @__PURE__ */ jsx("path", {
964
+ d: "M10 13.125C11.5533 13.125 12.8125 11.8658 12.8125 10.3125C12.8125 8.7592 11.5533 7.5 10 7.5C8.4467 7.5 7.1875 8.7592 7.1875 10.3125C7.1875 11.8658 8.4467 13.125 10 13.125Z",
965
+ fill: "none",
966
+ stroke: "currentColor",
967
+ strokeLinecap: "round",
968
+ strokeLinejoin: "round",
969
+ strokeWidth: "1.5"
970
+ })] }));
971
+ var IconLink = createIcon("IconLink", /* @__PURE__ */ jsx("path", {
972
+ d: "M7.49989 12.4999L12.4999 7.49989M8.74989 5.94598L11.0983 3.60223C11.8035 2.90843 12.7543 2.52139 13.7436 2.52542C14.7328 2.52945 15.6804 2.92422 16.3799 3.62374C17.0795 4.32326 17.4742 5.27086 17.4783 6.26012C17.4823 7.24938 17.0953 8.20016 16.4015 8.90536L14.053 11.2499M5.94598 8.74989L3.60223 11.0983C2.90843 11.8035 2.52139 12.7543 2.52542 13.7436C2.52945 14.7328 2.92422 15.6804 3.62374 16.3799C4.32326 17.0795 5.27086 17.4742 6.26012 17.4783C7.24938 17.4823 8.20016 17.0953 8.90536 16.4015L11.2499 14.053",
973
+ fill: "none",
974
+ stroke: "currentColor",
975
+ strokeLinecap: "round",
976
+ strokeLinejoin: "round",
977
+ strokeWidth: "1.5"
978
+ }));
979
+ var IconPoll = createIcon("IconPoll", /* @__PURE__ */ jsx("path", {
980
+ d: "M3.75 16.25V10.625H7.5M17.5 16.25H2.5M7.5 16.25V6.875H11.875M11.875 16.25V3.125H16.25V16.25",
981
+ fill: "none",
982
+ stroke: "currentColor",
983
+ strokeLinecap: "round",
984
+ strokeLinejoin: "round",
985
+ strokeWidth: "1.5"
986
+ }));
987
+ var IconCheckmark1Small = createIcon("IconCheckmark1Small", /* @__PURE__ */ jsx("path", {
988
+ d: "M3.125 11.25L7.5 15.625L17.5 5.625",
989
+ fill: "none",
990
+ stroke: "currentColor",
991
+ strokeLinecap: "round",
992
+ strokeLinejoin: "round",
993
+ strokeWidth: "1.5"
994
+ }));
995
+ var IconCheckmark = createIcon("IconCheckmark", /* @__PURE__ */ jsx("path", {
996
+ d: "M3.125 11.25L7.5 15.625L17.5 5.625",
997
+ fill: "none",
998
+ stroke: "currentColor",
999
+ strokeLinecap: "round",
1000
+ strokeLinejoin: "round",
1001
+ strokeWidth: "1.5"
1002
+ }));
1003
+ var IconChevronDown = createIcon("IconChevronDown", /* @__PURE__ */ jsx("path", {
1004
+ d: "M16.25 7.5L10 13.75L3.75 7.5",
1005
+ fill: "none",
1006
+ stroke: "currentColor",
1007
+ strokeLinecap: "round",
1008
+ strokeLinejoin: "round",
1009
+ strokeWidth: "1.5"
1010
+ }));
1011
+ var IconChevronLeft = createIcon("IconChevronLeft", /* @__PURE__ */ jsx("path", {
1012
+ d: "M12.5 16.25L6.25 10L12.5 3.75",
1013
+ fill: "none",
1014
+ stroke: "currentColor",
1015
+ strokeLinecap: "round",
1016
+ strokeLinejoin: "round",
1017
+ strokeWidth: "1.5"
1018
+ }), { "data-rtl-mirror": "" });
1019
+ var IconChevronRight = createIcon("IconChevronRight", /* @__PURE__ */ jsx("path", {
1020
+ d: "M7.5 3.75L13.75 10L7.5 16.25",
1021
+ fill: "none",
1022
+ stroke: "currentColor",
1023
+ strokeLinecap: "round",
1024
+ strokeLinejoin: "round",
1025
+ strokeWidth: "1.5"
1026
+ }), { "data-rtl-mirror": "" });
1027
+ var IconNoSign = createIcon("IconNoSign", /* @__PURE__ */ jsx("path", {
1028
+ d: "M15.3031 15.3031L4.69688 4.69688M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1029
+ fill: "none",
1030
+ stroke: "currentColor",
1031
+ strokeLinecap: "round",
1032
+ strokeMiterlimit: "10",
1033
+ strokeWidth: "1.5"
1034
+ }));
1035
+ var IconMinusCircle = createIcon("IconMinusCircle", /* @__PURE__ */ jsx("path", {
1036
+ d: "M6.875 10H13.125M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1037
+ fill: "none",
1038
+ stroke: "currentColor",
1039
+ strokeLinecap: "round",
1040
+ strokeMiterlimit: "10",
1041
+ strokeWidth: "1.5"
1042
+ }));
1043
+ var IconMinus = createIcon("IconMinus", /* @__PURE__ */ jsx("path", {
1044
+ d: "M16.875 9.40039C17.2064 9.40039 17.4746 9.66863 17.4746 10C17.4746 10.3314 17.2064 10.5996 16.875 10.5996H3.125C2.79363 10.5996 2.52539 10.3314 2.52539 10C2.52539 9.66863 2.79363 9.40039 3.125 9.40039H16.875Z",
1045
+ fill: "currentColor"
1046
+ }));
1047
+ var IconXCircle = createIcon("IconXCircle", /* @__PURE__ */ jsx("path", {
1048
+ d: "M12.5 7.5L7.5 12.5M7.5 7.5L12.5 12.5M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1049
+ fill: "none",
1050
+ stroke: "currentColor",
1051
+ strokeLinecap: "round",
1052
+ strokeLinejoin: "round",
1053
+ strokeWidth: "1.5"
1054
+ }));
1055
+ var IconClock = createIcon("IconClock", /* @__PURE__ */ jsx("path", {
1056
+ d: "M10 5.625V10H14.375M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1057
+ fill: "none",
1058
+ stroke: "currentColor",
1059
+ strokeLinecap: "round",
1060
+ strokeLinejoin: "round",
1061
+ strokeWidth: "1.5"
1062
+ }));
1063
+ var IconQuote = createIcon("IconQuote", /* @__PURE__ */ jsx("path", {
1064
+ d: "M8.4375 11.25H3.125C2.95924 11.25 2.80027 11.1842 2.68306 11.0669C2.56585 10.9497 2.5 10.7908 2.5 10.625V5.625C2.5 5.45924 2.56585 5.30027 2.68306 5.18306C2.80027 5.06585 2.95924 5 3.125 5H7.8125C7.97826 5 8.13723 5.06585 8.25444 5.18306C8.37165 5.30027 8.4375 5.45924 8.4375 5.625V12.5C8.4375 13.3288 8.10826 14.1237 7.52221 14.7097C6.93616 15.2958 6.1413 15.625 5.3125 15.625M17.5 11.25H12.1875C12.0217 11.25 11.8628 11.1842 11.7456 11.0669C11.6283 10.9497 11.5625 10.7908 11.5625 10.625V5.625C11.5625 5.45924 11.6283 5.30027 11.7456 5.18306C11.8628 5.06585 12.0217 5 12.1875 5H16.875C17.0408 5 17.1997 5.06585 17.3169 5.18306C17.4342 5.30027 17.5 5.45924 17.5 5.625V12.5C17.5 13.3288 17.1708 14.1237 16.5847 14.7097C15.9987 15.2958 15.2038 15.625 14.375 15.625",
1065
+ fill: "none",
1066
+ stroke: "currentColor",
1067
+ strokeLinecap: "round",
1068
+ strokeLinejoin: "round",
1069
+ strokeWidth: "1.5"
1070
+ }));
1071
+ var IconXmark = createIcon("IconXmark", /* @__PURE__ */ jsx("path", {
1072
+ d: "M15.625 4.375L4.375 15.625M15.625 15.625L4.375 4.375",
1073
+ fill: "none",
1074
+ stroke: "currentColor",
1075
+ strokeLinecap: "round",
1076
+ strokeLinejoin: "round",
1077
+ strokeWidth: "2"
1078
+ }));
1079
+ var IconXmarkSmall = createIcon("IconXmarkSmall", /* @__PURE__ */ jsx("path", {
1080
+ d: "M13.5 6.5L6.5 13.5M13.5 13.5L6.5 6.5",
1081
+ fill: "none",
1082
+ stroke: "currentColor",
1083
+ strokeLinecap: "round",
1084
+ strokeLinejoin: "round",
1085
+ strokeWidth: "1.5"
1086
+ }));
1087
+ var IconMore = createIcon("IconMore", /* @__PURE__ */ jsxs(Fragment$1, { children: [
1088
+ /* @__PURE__ */ jsx("path", { d: "M10 11.25C10.6904 11.25 11.25 10.6904 11.25 10C11.25 9.30964 10.6904 8.75 10 8.75C9.30964 8.75 8.75 9.30964 8.75 10C8.75 10.6904 9.30964 11.25 10 11.25Z" }),
1089
+ /* @__PURE__ */ jsx("path", { d: "M4.6875 11.25C5.37786 11.25 5.9375 10.6904 5.9375 10C5.9375 9.30964 5.37786 8.75 4.6875 8.75C3.99714 8.75 3.4375 9.30964 3.4375 10C3.4375 10.6904 3.99714 11.25 4.6875 11.25Z" }),
1090
+ /* @__PURE__ */ jsx("path", { d: "M15.3125 11.25C16.0029 11.25 16.5625 10.6904 16.5625 10C16.5625 9.30964 16.0029 8.75 15.3125 8.75C14.6221 8.75 14.0625 9.30964 14.0625 10C14.0625 10.6904 14.6221 11.25 15.3125 11.25Z" })
1091
+ ] }));
1092
+ var IconReorder = createIcon("IconReorder", /* @__PURE__ */ jsx("path", { d: "M8.875 15.3125C8.875 16.2445 8.11948 17 7.1875 17C6.25552 17 5.5 16.2445 5.5 15.3125C5.5 14.3805 6.25552 13.625 7.1875 13.625C8.11948 13.625 8.875 14.3805 8.875 15.3125ZM14.5 15.3125C14.5 16.2445 13.7445 17 12.8125 17C11.8805 17 11.125 16.2445 11.125 15.3125C11.125 14.3805 11.8805 13.625 12.8125 13.625C13.7445 13.625 14.5 14.3805 14.5 15.3125ZM8.875 10C8.875 10.932 8.11948 11.6875 7.1875 11.6875C6.25552 11.6875 5.5 10.932 5.5 10C5.5 9.06802 6.25552 8.3125 7.1875 8.3125C8.11948 8.3125 8.875 9.06802 8.875 10ZM14.5 10C14.5 10.932 13.7445 11.6875 12.8125 11.6875C11.8805 11.6875 11.125 10.932 11.125 10C11.125 9.06802 11.8805 8.3125 12.8125 8.3125C13.7445 8.3125 14.5 9.06802 14.5 10ZM8.875 4.6875C8.875 5.61948 8.11948 6.375 7.1875 6.375C6.25552 6.375 5.5 5.61948 5.5 4.6875C5.5 3.75552 6.25552 3 7.1875 3C8.11948 3 8.875 3.75552 8.875 4.6875ZM14.5 4.6875C14.5 5.61948 13.7445 6.375 12.8125 6.375C11.8805 6.375 11.125 5.61948 11.125 4.6875C11.125 3.75552 11.8805 3 12.8125 3C13.7445 3 14.5 3.75552 14.5 4.6875Z" }));
1093
+ var IconChecks = createIcon("IconChecks", /* @__PURE__ */ jsx("path", {
1094
+ d: "M1.5 10.5724L4.98387 13.9936L13.1129 6.00977M10.371 13.9936L18.5 6.00977",
1095
+ fill: "none",
1096
+ stroke: "currentColor",
1097
+ strokeLinecap: "round",
1098
+ strokeLinejoin: "round",
1099
+ strokeWidth: "1.5"
1100
+ }));
1101
+ var IconDownload = createIcon("IconDownload", /* @__PURE__ */ jsx("path", {
1102
+ d: "M2.375 11.25C2.375 10.8358 2.71079 10.5 3.125 10.5C3.53921 10.5 3.875 10.8358 3.875 11.25V15.5H16.125V11.25C16.125 10.8358 16.4608 10.5 16.875 10.5C17.2892 10.5 17.625 10.8358 17.625 11.25V16.25C17.625 16.6642 17.2892 17 16.875 17H3.125C2.71079 17 2.375 16.6642 2.375 16.25V11.25ZM9.25 2.5C9.25 2.08579 9.58579 1.75 10 1.75C10.4142 1.75 10.75 2.08579 10.75 2.5V9.43945L12.5947 7.59473C12.8876 7.30183 13.3624 7.30183 13.6553 7.59473C13.9482 7.88762 13.9482 8.36238 13.6553 8.65527L10.5303 11.7803C10.2374 12.0732 9.76262 12.0732 9.46973 11.7803L6.34473 8.65527C6.05183 8.36238 6.05183 7.88762 6.34473 7.59473C6.63762 7.30183 7.11238 7.30183 7.40527 7.59473L9.25 9.43945V2.5Z",
1103
+ fill: "currentColor"
1104
+ }));
1105
+ var IconEdit = createIcon("IconEdit", /* @__PURE__ */ jsx("path", {
1106
+ d: "M10.625 5.0001L15 9.3751M7.24141 16.8751H3.75C3.58424 16.8751 3.42527 16.8093 3.30806 16.692C3.19085 16.5748 3.125 16.4159 3.125 16.2501V12.7587C3.12508 12.5932 3.19082 12.4344 3.30781 12.3173L12.9422 2.68291C13.0594 2.56579 13.2183 2.5 13.384 2.5C13.5497 2.5 13.7086 2.56579 13.8258 2.68291L17.3172 6.17198C17.4343 6.28917 17.5001 6.44808 17.5001 6.61377C17.5001 6.77946 17.4343 6.93837 17.3172 7.05557L7.68281 16.6923C7.56569 16.8093 7.40695 16.875 7.24141 16.8751Z",
1107
+ fill: "none",
1108
+ stroke: "currentColor",
1109
+ strokeLinecap: "round",
1110
+ strokeLinejoin: "round",
1111
+ strokeWidth: "1.5"
1112
+ }));
1113
+ var IconEmoji = createIcon("IconEmoji", /* @__PURE__ */ jsxs(Fragment$1, { children: [
1114
+ /* @__PURE__ */ jsx("path", { d: "M16.75 10C16.75 6.27208 13.7279 3.25 10 3.25C6.27208 3.25 3.25 6.27208 3.25 10C3.25 13.7279 6.27208 16.75 10 16.75C13.7279 16.75 16.75 13.7279 16.75 10ZM18.25 10C18.25 14.5563 14.5563 18.25 10 18.25C5.44365 18.25 1.75 14.5563 1.75 10C1.75 5.44365 5.44365 1.75 10 1.75C14.5563 1.75 18.25 5.44365 18.25 10Z" }),
1115
+ /* @__PURE__ */ jsx("path", { d: "M7.1875 9.375C7.70527 9.375 8.125 8.95527 8.125 8.4375C8.125 7.91973 7.70527 7.5 7.1875 7.5C6.66973 7.5 6.25 7.91973 6.25 8.4375C6.25 8.95527 6.66973 9.375 7.1875 9.375Z" }),
1116
+ /* @__PURE__ */ jsx("path", { d: "M12.8125 9.375C13.3303 9.375 13.75 8.95527 13.75 8.4375C13.75 7.91973 13.3303 7.5 12.8125 7.5C12.2947 7.5 11.875 7.91973 11.875 8.4375C11.875 8.95527 12.2947 9.375 12.8125 9.375Z" }),
1117
+ /* @__PURE__ */ jsx("path", { d: "M12.4756 11.499C12.683 11.1407 13.1425 11.0182 13.501 11.2256C13.8593 11.433 13.9818 11.8925 13.7744 12.251C13.0125 13.568 11.6947 14.5 10 14.5C8.30531 14.5 6.98748 13.568 6.22559 12.251C6.01825 11.8925 6.14067 11.433 6.49902 11.2256C6.85749 11.0182 7.31695 11.1407 7.52441 11.499C8.05942 12.424 8.91824 13 10 13C11.0818 13 11.9406 12.424 12.4756 11.499Z" })
1118
+ ] }));
1119
+ var IconEmojiAdd = createIcon("IconEmojiAdd", /* @__PURE__ */ jsxs(Fragment$1, { children: [
1120
+ /* @__PURE__ */ jsx("path", {
1121
+ d: "M1.75 10C1.75 5.44365 5.44365 1.75 10 1.75C10.4142 1.75 10.75 2.08579 10.75 2.5C10.75 2.91421 10.4142 3.25 10 3.25C6.27208 3.25 3.25 6.27208 3.25 10C3.25 13.7279 6.27208 16.75 10 16.75C13.7279 16.75 16.75 13.7279 16.75 10C16.75 9.58579 17.0858 9.25 17.5 9.25C17.9142 9.25 18.25 9.58579 18.25 10C18.25 14.5563 14.5563 18.25 10 18.25C5.44365 18.25 1.75 14.5563 1.75 10Z",
1122
+ fill: "currentColor"
1123
+ }),
1124
+ /* @__PURE__ */ jsx("path", {
1125
+ d: "M7.1875 9.375C7.70527 9.375 8.125 8.95527 8.125 8.4375C8.125 7.91973 7.70527 7.5 7.1875 7.5C6.66973 7.5 6.25 7.91973 6.25 8.4375C6.25 8.95527 6.66973 9.375 7.1875 9.375Z",
1126
+ fill: "currentColor"
1127
+ }),
1128
+ /* @__PURE__ */ jsx("path", {
1129
+ d: "M12.8125 9.375C13.3303 9.375 13.75 8.95527 13.75 8.4375C13.75 7.91973 13.3303 7.5 12.8125 7.5C12.2947 7.5 11.875 7.91973 11.875 8.4375C11.875 8.95527 12.2947 9.375 12.8125 9.375Z",
1130
+ fill: "currentColor"
1131
+ }),
1132
+ /* @__PURE__ */ jsx("path", {
1133
+ d: "M12.4756 11.499C12.683 11.1407 13.1425 11.0182 13.501 11.2256C13.8593 11.433 13.9818 11.8925 13.7744 12.251C13.0125 13.568 11.6947 14.5 10 14.5C8.30531 14.5 6.98748 13.568 6.22559 12.251C6.01825 11.8925 6.14067 11.433 6.49902 11.2256C6.85749 11.0182 7.31695 11.1407 7.52441 11.499C8.05942 12.424 8.91824 13 10 13C11.0818 13 11.9406 12.424 12.4756 11.499Z",
1134
+ fill: "currentColor"
1135
+ }),
1136
+ /* @__PURE__ */ jsx("path", {
1137
+ d: "M15.083 6.87524V4.91626H13.125C12.7108 4.91626 12.375 4.58047 12.375 4.16626C12.3752 3.7522 12.7109 3.41626 13.125 3.41626H15.083V1.45825C15.083 1.04415 15.4189 0.708427 15.833 0.708252C16.2472 0.708252 16.583 1.04404 16.583 1.45825V3.41626H18.542C18.9559 3.41644 19.2918 3.7523 19.292 4.16626C19.292 4.58036 18.9561 4.91608 18.542 4.91626H16.583V6.87524C16.5828 7.28931 16.2471 7.62524 15.833 7.62524C15.4191 7.62507 15.0832 7.2892 15.083 6.87524Z",
1138
+ fill: "currentColor"
1139
+ })
1140
+ ] }));
1141
+ var IconExclamationMarkFill = createIcon("IconExclamationMarkFill", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", { d: "M10 16.875C10.6904 16.875 11.25 16.3154 11.25 15.625C11.25 14.9346 10.6904 14.375 10 14.375C9.30964 14.375 8.75 14.9346 8.75 15.625C8.75 16.3154 9.30964 16.875 10 16.875Z" }), /* @__PURE__ */ jsx("path", { d: "M9 11.875V3.75C9 3.19772 9.44772 2.75 10 2.75C10.5523 2.75 11 3.19772 11 3.75V11.875C11 12.4273 10.5523 12.875 10 12.875C9.44772 12.875 9 12.4273 9 11.875Z" })] }));
1142
+ var IconExclamationCircleFill = createIcon("IconExclamationCircleFill", /* @__PURE__ */ jsx("path", { d: "M10 1.875C8.39303 1.875 6.82214 2.35152 5.486 3.24431C4.14985 4.1371 3.10844 5.40605 2.49348 6.8907C1.87852 8.37535 1.71762 10.009 2.03112 11.5851C2.34463 13.1612 3.11846 14.6089 4.25476 15.7452C5.39106 16.8815 6.8388 17.6554 8.41489 17.9689C9.99099 18.2824 11.6247 18.1215 13.1093 17.5065C14.594 16.8916 15.8629 15.8502 16.7557 14.514C17.6485 13.1779 18.125 11.607 18.125 10C18.1227 7.84581 17.266 5.78051 15.7427 4.25727C14.2195 2.73403 12.1542 1.87727 10 1.875ZM9.375 6.25C9.375 6.08424 9.44085 5.92527 9.55806 5.80806C9.67527 5.69085 9.83424 5.625 10 5.625C10.1658 5.625 10.3247 5.69085 10.4419 5.80806C10.5592 5.92527 10.625 6.08424 10.625 6.25V10.625C10.625 10.7908 10.5592 10.9497 10.4419 11.0669C10.3247 11.1842 10.1658 11.25 10 11.25C9.83424 11.25 9.67527 11.1842 9.55806 11.0669C9.44085 10.9497 9.375 10.7908 9.375 10.625V6.25ZM10 14.375C9.81458 14.375 9.63333 14.32 9.47916 14.217C9.32499 14.114 9.20482 13.9676 9.13387 13.7963C9.06291 13.625 9.04434 13.4365 9.08052 13.2546C9.11669 13.0727 9.20598 12.9057 9.33709 12.7746C9.4682 12.6435 9.63525 12.5542 9.81711 12.518C9.99896 12.4818 10.1875 12.5004 10.3588 12.5714C10.5301 12.6423 10.6765 12.7625 10.7795 12.9167C10.8825 13.0708 10.9375 13.2521 10.9375 13.4375C10.9375 13.6861 10.8387 13.9246 10.6629 14.1004C10.4871 14.2762 10.2486 14.375 10 14.375Z" }));
1143
+ var IconExclamationMark = createIcon("IconExclamationMark", /* @__PURE__ */ jsxs(Fragment$1, { children: [
1144
+ /* @__PURE__ */ jsx("path", { d: "M16.75 10C16.75 6.27208 13.7279 3.25 10 3.25C6.27208 3.25 3.25 6.27208 3.25 10C3.25 13.7279 6.27208 16.75 10 16.75C13.7279 16.75 16.75 13.7279 16.75 10ZM18.25 10C18.25 14.5563 14.5563 18.25 10 18.25C5.44365 18.25 1.75 14.5563 1.75 10C1.75 5.44365 5.44365 1.75 10 1.75C14.5563 1.75 18.25 5.44365 18.25 10Z" }),
1145
+ /* @__PURE__ */ jsx("path", { d: "M9.25 10.625V6.25C9.25 5.83579 9.58579 5.5 10 5.5C10.4142 5.5 10.75 5.83579 10.75 6.25V10.625C10.75 11.0392 10.4142 11.375 10 11.375C9.58579 11.375 9.25 11.0392 9.25 10.625Z" }),
1146
+ /* @__PURE__ */ jsx("path", { d: "M10 14.375C10.5178 14.375 10.9375 13.9553 10.9375 13.4375C10.9375 12.9197 10.5178 12.5 10 12.5C9.48223 12.5 9.0625 12.9197 9.0625 13.4375C9.0625 13.9553 9.48223 14.375 10 14.375Z" })
1147
+ ] }));
1148
+ var IconExclamationTriangleFill = createIcon("IconExclamationTriangleFill", /* @__PURE__ */ jsx("path", { d: "M18.4999 14.6946L11.6678 2.82974C11.4971 2.53906 11.2534 2.29803 10.9608 2.13057C10.6682 1.9631 10.337 1.875 9.99986 1.875C9.66275 1.875 9.33149 1.9631 9.03892 2.13057C8.74635 2.29803 8.50262 2.53906 8.33189 2.82974L1.49986 14.6946C1.33559 14.9757 1.24902 15.2955 1.24902 15.6211C1.24902 15.9468 1.33559 16.2665 1.49986 16.5477C1.6684 16.8401 1.91171 17.0825 2.20483 17.2498C2.49795 17.4172 2.83032 17.5036 3.16783 17.5001H16.8319C17.1691 17.5033 17.5012 17.4168 17.794 17.2494C18.0868 17.0821 18.3299 16.8399 18.4983 16.5477C18.6628 16.2667 18.7496 15.947 18.7499 15.6214C18.7502 15.2957 18.6639 14.9759 18.4999 14.6946ZM9.37486 8.12505C9.37486 7.95929 9.44071 7.80032 9.55792 7.68311C9.67513 7.5659 9.8341 7.50005 9.99986 7.50005C10.1656 7.50005 10.3246 7.5659 10.4418 7.68311C10.559 7.80032 10.6249 7.95929 10.6249 8.12505V11.2501C10.6249 11.4158 10.559 11.5748 10.4418 11.692C10.3246 11.8092 10.1656 11.8751 9.99986 11.8751C9.8341 11.8751 9.67513 11.8092 9.55792 11.692C9.44071 11.5748 9.37486 11.4158 9.37486 11.2501V8.12505ZM9.99986 15.0001C9.81444 15.0001 9.63319 14.9451 9.47901 14.8421C9.32484 14.739 9.20468 14.5926 9.13372 14.4213C9.06277 14.25 9.0442 14.0615 9.08038 13.8797C9.11655 13.6978 9.20584 13.5308 9.33695 13.3996C9.46806 13.2685 9.63511 13.1792 9.81696 13.1431C9.99882 13.1069 10.1873 13.1255 10.3586 13.1964C10.5299 13.2674 10.6764 13.3875 10.7794 13.5417C10.8824 13.6959 10.9374 13.8771 10.9374 14.0626C10.9374 14.3112 10.8386 14.5496 10.6628 14.7255C10.487 14.9013 10.2485 15.0001 9.99986 15.0001Z" }));
1149
+ var IconEyeFill = createIcon("IconEyeFill", /* @__PURE__ */ jsx("path", { d: "M19.3211 9.74688C19.2937 9.68516 18.632 8.21719 17.1609 6.74609C15.2008 4.78594 12.725 3.75 9.99999 3.75C7.27499 3.75 4.79921 4.78594 2.83905 6.74609C1.36796 8.21719 0.703118 9.6875 0.678899 9.74688C0.643362 9.82681 0.625 9.91331 0.625 10.0008C0.625 10.0883 0.643362 10.1748 0.678899 10.2547C0.706243 10.3164 1.36796 11.7836 2.83905 13.2547C4.79921 15.2141 7.27499 16.25 9.99999 16.25C12.725 16.25 15.2008 15.2141 17.1609 13.2547C18.632 11.7836 19.2937 10.3164 19.3211 10.2547C19.3566 10.1748 19.375 10.0883 19.375 10.0008C19.375 9.91331 19.3566 9.82681 19.3211 9.74688ZM9.99999 13.125C9.38193 13.125 8.77774 12.9417 8.26384 12.5983C7.74993 12.255 7.34939 11.7669 7.11287 11.1959C6.87634 10.6249 6.81446 9.99653 6.93504 9.39034C7.05562 8.78415 7.35324 8.22733 7.79028 7.79029C8.22732 7.35325 8.78414 7.05562 9.39033 6.93505C9.99652 6.81447 10.6249 6.87635 11.1959 7.11288C11.7669 7.3494 12.255 7.74994 12.5983 8.26384C12.9417 8.77775 13.125 9.38193 13.125 10C13.125 10.8288 12.7958 11.6237 12.2097 12.2097C11.6236 12.7958 10.8288 13.125 9.99999 13.125Z" }));
1150
+ var IconUnsupportedAttachment = createIcon("IconUnsupportedAttachment", /* @__PURE__ */ jsx("path", {
1151
+ d: "M4.5 16.75H15.5V7.625H11.875C11.4608 7.625 11.125 7.28921 11.125 6.875V3.25H4.5V16.75ZM11.3447 9.46973C11.6376 9.17683 12.1124 9.17683 12.4053 9.46973C12.6982 9.76262 12.6982 10.2374 12.4053 10.5303L11.0605 11.875L12.4053 13.2197C12.6982 13.5126 12.6982 13.9874 12.4053 14.2803C12.1124 14.5732 11.6376 14.5732 11.3447 14.2803L10 12.9355L8.65527 14.2803C8.36238 14.5732 7.88762 14.5732 7.59473 14.2803C7.30183 13.9874 7.30183 13.5126 7.59473 13.2197L8.93945 11.875L7.59473 10.5303C7.30183 10.2374 7.30183 9.76262 7.59473 9.46973C7.88762 9.17683 8.36238 9.17683 8.65527 9.46973L10 10.8145L11.3447 9.46973ZM12.625 6.125H14.4395L12.625 4.31055V6.125ZM17 16.875C17 17.2397 16.8555 17.5898 16.5977 17.8477C16.3398 18.1055 15.9897 18.25 15.625 18.25H4.375C4.01033 18.25 3.66021 18.1055 3.40234 17.8477C3.14448 17.5898 3 17.2397 3 16.875V3.125C3 2.76033 3.14448 2.41021 3.40234 2.15234L3.50391 2.06152C3.74856 1.86111 4.05597 1.75 4.375 1.75H11.875C12.0739 1.75 12.2646 1.82907 12.4053 1.96973L16.7803 6.34473C16.9209 6.48538 17 6.67609 17 6.875V16.875Z",
1152
+ fill: "currentColor"
1153
+ }));
1154
+ var IconUpload = createIcon("IconUpload", /* @__PURE__ */ jsx("path", {
1155
+ d: "M11.875 2.5H4.375C4.20924 2.5 4.05027 2.56585 3.93306 2.68306C3.81585 2.80027 3.75 2.95924 3.75 3.125V16.875C3.75 17.0408 3.81585 17.1997 3.93306 17.3169C4.05027 17.4342 4.20924 17.5 4.375 17.5H15.625C15.7908 17.5 15.9497 17.4342 16.0669 17.3169C16.1842 17.1997 16.25 17.0408 16.25 16.875V6.875M11.875 2.5L16.25 6.875M11.875 2.5V6.875H16.25M8.125 11.25L10 9.375M10 9.375L11.875 11.25M10 9.375V14.375",
1156
+ fill: "none",
1157
+ stroke: "currentColor",
1158
+ strokeLinecap: "round",
1159
+ strokeLinejoin: "round",
1160
+ strokeWidth: "1.5"
1161
+ }));
1162
+ var IconFile = createIcon("IconFile", /* @__PURE__ */ jsx("path", {
1163
+ d: "M11.875 2.5H4.375C4.20924 2.5 4.05027 2.56585 3.93306 2.68306C3.81585 2.80027 3.75 2.95924 3.75 3.125V16.875C3.75 17.0408 3.81585 17.1997 3.93306 17.3169C4.05027 17.4342 4.20924 17.5 4.375 17.5H15.625C15.7908 17.5 15.9497 17.4342 16.0669 17.3169C16.1842 17.1997 16.25 17.0408 16.25 16.875V6.875M11.875 2.5L16.25 6.875M11.875 2.5V6.875H16.25",
1164
+ fill: "none",
1165
+ stroke: "currentColor",
1166
+ strokeLinecap: "round",
1167
+ strokeLinejoin: "round",
1168
+ strokeWidth: "1.5"
1169
+ }));
1170
+ var IconFlag = createIcon("IconFlag", /* @__PURE__ */ jsx("path", {
1171
+ d: "M3.75 17.5001V4.3751C8.75 0.0446299 12.5 8.70557 17.5 4.3751V13.7501C12.5 18.0806 8.75 9.41963 3.75 13.7501",
1172
+ fill: "none",
1173
+ stroke: "currentColor",
1174
+ strokeLinecap: "round",
1175
+ strokeLinejoin: "round",
1176
+ strokeWidth: "1.5"
1177
+ }));
1178
+ var IconImage = createIcon("IconImage", /* @__PURE__ */ jsx("path", {
1179
+ d: "M4.42891 16.875L12.9953 8.30781C13.0534 8.2497 13.1223 8.2036 13.1982 8.17215C13.274 8.1407 13.3554 8.12451 13.4375 8.12451C13.5196 8.12451 13.601 8.1407 13.6768 8.17215C13.7527 8.2036 13.8216 8.2497 13.8797 8.30781L16.875 11.3039M3.75 3.125H16.25C16.5952 3.125 16.875 3.40482 16.875 3.75V16.25C16.875 16.5952 16.5952 16.875 16.25 16.875H3.75C3.40482 16.875 3.125 16.5952 3.125 16.25V3.75C3.125 3.40482 3.40482 3.125 3.75 3.125ZM8.75 7.5C8.75 8.19036 8.19036 8.75 7.5 8.75C6.80964 8.75 6.25 8.19036 6.25 7.5C6.25 6.80964 6.80964 6.25 7.5 6.25C8.19036 6.25 8.75 6.80964 8.75 7.5Z",
1180
+ fill: "none",
1181
+ stroke: "currentColor",
1182
+ strokeLinecap: "round",
1183
+ strokeLinejoin: "round",
1184
+ strokeWidth: "1.5"
1185
+ }));
1186
+ var IconSearch = createIcon("IconSearch", /* @__PURE__ */ jsx("path", {
1187
+ d: "M13.1695 13.1695L17.5 17.5M15 8.75C15 12.2018 12.2018 15 8.75 15C5.29822 15 2.5 12.2018 2.5 8.75C2.5 5.29822 5.29822 2.5 8.75 2.5C12.2018 2.5 15 5.29822 15 8.75Z",
1188
+ fill: "none",
1189
+ stroke: "currentColor",
1190
+ strokeLinecap: "round",
1191
+ strokeLinejoin: "round",
1192
+ strokeWidth: "1.5"
1193
+ }), { "data-rtl-mirror": "" });
1194
+ var IconLocation = createIcon("IconLocation", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", {
1195
+ d: "M10 10.625C11.3807 10.625 12.5 9.50571 12.5 8.125C12.5 6.74429 11.3807 5.625 10 5.625C8.61929 5.625 7.5 6.74429 7.5 8.125C7.5 9.50571 8.61929 10.625 10 10.625Z",
1196
+ fill: "none",
1197
+ stroke: "currentColor",
1198
+ strokeLinecap: "round",
1199
+ strokeLinejoin: "round",
1200
+ strokeWidth: "1.5"
1201
+ }), /* @__PURE__ */ jsx("path", {
1202
+ d: "M16.25 8.125C16.25 13.75 10 18.125 10 18.125C10 18.125 3.75 13.75 3.75 8.125C3.75 6.4674 4.40848 4.87769 5.58058 3.70558C6.75269 2.53348 8.3424 1.875 10 1.875C11.6576 1.875 13.2473 2.53348 14.4194 3.70558C15.5915 4.87769 16.25 6.4674 16.25 8.125Z",
1203
+ fill: "none",
1204
+ stroke: "currentColor",
1205
+ strokeLinecap: "round",
1206
+ strokeLinejoin: "round",
1207
+ strokeWidth: "1.5"
1208
+ })] }));
1209
+ var IconVoice = createIcon("IconVoice", /* @__PURE__ */ jsx("path", {
1210
+ d: "M10 15.625V18.75M10 15.625C11.4918 15.625 12.9226 15.0324 13.9775 13.9775C15.0324 12.9226 15.625 11.4918 15.625 10M10 15.625C8.50816 15.625 7.07742 15.0324 6.02252 13.9775C4.96763 12.9226 4.375 11.4918 4.375 10M10 1.875C11.7259 1.875 13.125 3.27411 13.125 5V10C13.125 11.7259 11.7259 13.125 10 13.125C8.27411 13.125 6.875 11.7259 6.875 10V5C6.875 3.27411 8.27411 1.875 10 1.875Z",
1211
+ fill: "none",
1212
+ stroke: "currentColor",
1213
+ strokeLinecap: "round",
1214
+ strokeLinejoin: "round",
1215
+ strokeWidth: "1.5"
1216
+ }));
1217
+ var IconMicrophoneSolid = createIcon("IconMicrophoneSolid", /* @__PURE__ */ jsx("path", {
1218
+ d: "M6.25 10V5C6.25 4.00544 6.64509 3.05161 7.34835 2.34835C8.05161 1.64509 9.00544 1.25 10 1.25C10.9946 1.25 11.9484 1.64509 12.6517 2.34835C13.3549 3.05161 13.75 4.00544 13.75 5V10C13.75 10.9946 13.3549 11.9484 12.6517 12.6517C11.9484 13.3549 10.9946 13.75 10 13.75C9.00544 13.75 8.05161 13.3549 7.34835 12.6517C6.64509 11.9484 6.25 10.9946 6.25 10ZM16.25 10C16.25 9.83424 16.1842 9.67527 16.0669 9.55806C15.9497 9.44085 15.7908 9.375 15.625 9.375C15.4592 9.375 15.3003 9.44085 15.1831 9.55806C15.0658 9.67527 15 9.83424 15 10C15 11.3261 14.4732 12.5979 13.5355 13.5355C12.5979 14.4732 11.3261 15 10 15C8.67392 15 7.40215 14.4732 6.46447 13.5355C5.52678 12.5979 5 11.3261 5 10C5 9.83424 4.93415 9.67527 4.81694 9.55806C4.69973 9.44085 4.54076 9.375 4.375 9.375C4.20924 9.375 4.05027 9.44085 3.93306 9.55806C3.81585 9.67527 3.75 9.83424 3.75 10C3.7519 11.5489 4.32806 13.042 5.36707 14.1907C6.40607 15.3393 7.83409 16.062 9.375 16.2188V18.75C9.375 18.9158 9.44085 19.0747 9.55806 19.1919C9.67527 19.3092 9.83424 19.375 10 19.375C10.1658 19.375 10.3247 19.3092 10.4419 19.1919C10.5592 19.0747 10.625 18.9158 10.625 18.75V16.2188C12.1659 16.062 13.5939 15.3393 14.6329 14.1907C15.6719 13.042 16.2481 11.5489 16.25 10Z",
1219
+ fill: "currentColor"
1220
+ }));
1221
+ var IconMute = createIcon("IconMute", /* @__PURE__ */ jsx("path", {
1222
+ d: "M15.625 8.125V11.875M18.125 6.875V13.125M4.375 3.125L16.875 16.875M9.38672 4.92109L12.5 2.5V8.34609M12.5 12.0625V17.5L6.875 13.125H3.125C2.95924 13.125 2.80027 13.0592 2.68306 12.9419C2.56585 12.8247 2.5 12.6658 2.5 12.5V7.5C2.5 7.33424 2.56585 7.17527 2.68306 7.05806C2.80027 6.94085 2.95924 6.875 3.125 6.875H7.78437",
1223
+ fill: "none",
1224
+ stroke: "currentColor",
1225
+ strokeLinecap: "round",
1226
+ strokeLinejoin: "round",
1227
+ strokeWidth: "1.5"
1228
+ }), { "data-rtl-mirror": "" });
1229
+ var IconSend = createIcon("IconSend", /* @__PURE__ */ jsx("path", {
1230
+ d: "M11.2498 10H6.24982M6.24982 10L3.7881 2.71328C3.74537 2.59349 3.7402 2.4635 3.7733 2.34069C3.80639 2.21788 3.87616 2.10808 3.9733 2.02597C4.07044 1.94386 4.19032 1.89335 4.31693 1.88117C4.44353 1.86899 4.57084 1.89573 4.68185 1.95781L17.8069 9.4461C17.9045 9.50015 17.986 9.57937 18.0427 9.67555C18.0994 9.77172 18.1293 9.88133 18.1293 9.99297C18.1293 10.1046 18.0994 10.2142 18.0427 10.3104C17.986 10.4066 17.9045 10.4858 17.8069 10.5398L4.68185 18.0469C4.57051 18.1096 4.4426 18.1367 4.31537 18.1245C4.18815 18.1123 4.06772 18.0614 3.97032 17.9787C3.87292 17.8959 3.80323 17.7853 3.77065 17.6617C3.73807 17.5381 3.74416 17.4075 3.7881 17.2875L6.24982 10Z",
1231
+ fill: "none",
1232
+ stroke: "currentColor",
1233
+ strokeLinecap: "round",
1234
+ strokeLinejoin: "round",
1235
+ strokeWidth: "1.5"
1236
+ }), { "data-rtl-mirror": "" });
1237
+ var IconAttachment = createIcon("IconAttachment", /* @__PURE__ */ jsx("path", {
1238
+ d: "M12.4999 6.24998L5.9913 12.8664C5.76258 13.102 5.63576 13.4181 5.63823 13.7465C5.6407 14.0748 5.77227 14.389 6.00451 14.6211C6.23674 14.8533 6.55099 14.9847 6.87934 14.987C7.20769 14.9894 7.52376 14.8624 7.75927 14.6336L15.5179 6.76795C15.9868 6.29905 16.2502 5.6631 16.2502 4.99998C16.2502 4.33686 15.9868 3.70091 15.5179 3.23201C15.049 2.76312 14.413 2.49969 13.7499 2.49969C13.0868 2.49969 12.4508 2.76312 11.9819 3.23201L4.22333 11.0984C3.52953 11.8036 3.14249 12.7544 3.14652 13.7437C3.15054 14.7329 3.54531 15.6805 4.24483 16.38C4.94435 17.0796 5.89195 17.4743 6.88121 17.4784C7.87048 17.4824 8.82126 17.0953 9.52645 16.4015L15.9374 9.99998",
1239
+ fill: "none",
1240
+ stroke: "currentColor",
1241
+ strokeLinecap: "round",
1242
+ strokeLinejoin: "round",
1243
+ strokeWidth: "1.5"
1244
+ }));
1245
+ var IconPauseFill = createIcon("IconPauseFill", /* @__PURE__ */ jsx("path", { d: "M16.875 3.75V16.25C16.875 16.5815 16.7433 16.8995 16.5089 17.1339C16.2745 17.3683 15.9565 17.5 15.625 17.5H12.5C12.1685 17.5 11.8505 17.3683 11.6161 17.1339C11.3817 16.8995 11.25 16.5815 11.25 16.25V3.75C11.25 3.41848 11.3817 3.10054 11.6161 2.86612C11.8505 2.6317 12.1685 2.5 12.5 2.5H15.625C15.9565 2.5 16.2745 2.6317 16.5089 2.86612C16.7433 3.10054 16.875 3.41848 16.875 3.75ZM7.5 2.5H4.375C4.04348 2.5 3.72554 2.6317 3.49112 2.86612C3.2567 3.10054 3.125 3.41848 3.125 3.75V16.25C3.125 16.5815 3.2567 16.8995 3.49112 17.1339C3.72554 17.3683 4.04348 17.5 4.375 17.5H7.5C7.83152 17.5 8.14946 17.3683 8.38388 17.1339C8.6183 16.8995 8.75 16.5815 8.75 16.25V3.75C8.75 3.41848 8.6183 3.10054 8.38388 2.86612C8.14946 2.6317 7.83152 2.5 7.5 2.5Z" }));
1246
+ var IconUser = createIcon("IconUser", /* @__PURE__ */ jsx("path", {
1247
+ d: "M10 12.5C12.7614 12.5 15 10.2614 15 7.5C15 4.73858 12.7614 2.5 10 2.5C7.23858 2.5 5 4.73858 5 7.5C5 10.2614 7.23858 12.5 10 12.5ZM10 12.5C6.76172 12.5 4.01328 14.2602 2.5 16.875M10 12.5C13.2383 12.5 15.9867 14.2602 17.5 16.875",
1248
+ fill: "none",
1249
+ stroke: "currentColor",
1250
+ strokeLinecap: "round",
1251
+ strokeLinejoin: "round",
1252
+ strokeWidth: "1.5"
1253
+ }));
1254
+ var IconUserAdd = createIcon("IconUserAdd", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("g", {
1255
+ clipPath: "url(#clip0_14246_498359)",
1256
+ children: /* @__PURE__ */ jsx("path", {
1257
+ d: "M15.625 10.625H19.375M17.5 8.75V12.5M8.4375 12.5C11.0263 12.5 13.125 10.4013 13.125 7.8125C13.125 5.22367 11.0263 3.125 8.4375 3.125C5.84867 3.125 3.75 5.22367 3.75 7.8125C3.75 10.4013 5.84867 12.5 8.4375 12.5ZM8.4375 12.5C5.74688 12.5 3.48047 13.7148 1.875 15.625M8.4375 12.5C11.1281 12.5 13.3945 13.7148 15 15.625",
1258
+ fill: "none",
1259
+ stroke: "currentColor",
1260
+ strokeLinecap: "round",
1261
+ strokeLinejoin: "round",
1262
+ strokeWidth: "1.5"
1263
+ })
1264
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
1265
+ id: "clip0_14246_498359",
1266
+ children: /* @__PURE__ */ jsx("rect", {
1267
+ fill: "white",
1268
+ height: "20",
1269
+ width: "20"
1270
+ })
1271
+ }) })] }));
1272
+ var IconUserCheck = createIcon("IconUserCheck", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("g", {
1273
+ clipPath: "url(#clip0_14236_425131)",
1274
+ children: /* @__PURE__ */ jsx("path", {
1275
+ d: "M8.4375 12.5C11.0263 12.5 13.125 10.4013 13.125 7.8125C13.125 5.22367 11.0263 3.125 8.4375 3.125C5.84867 3.125 3.75 5.22367 3.75 7.8125C3.75 10.4013 5.84867 12.5 8.4375 12.5ZM8.4375 12.5C5.74688 12.5 3.48047 13.7148 1.875 15.625M8.4375 12.5C11.1281 12.5 13.3945 13.7148 15 15.625M15.625 11.25L16.875 12.5L19.375 10",
1276
+ fill: "none",
1277
+ stroke: "currentColor",
1278
+ strokeLinecap: "round",
1279
+ strokeLinejoin: "round",
1280
+ strokeWidth: "1.5"
1281
+ })
1282
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
1283
+ id: "clip0_14236_425131",
1284
+ children: /* @__PURE__ */ jsx("rect", {
1285
+ fill: "white",
1286
+ height: "20",
1287
+ width: "20"
1288
+ })
1289
+ }) })] }));
1290
+ var IconUserRemove = createIcon("IconUserRemove", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("g", {
1291
+ clipPath: "url(#clip0_14246_434209)",
1292
+ children: /* @__PURE__ */ jsx("path", {
1293
+ d: "M15.625 10.625H19.375M8.4375 12.5C11.0263 12.5 13.125 10.4013 13.125 7.8125C13.125 5.22367 11.0263 3.125 8.4375 3.125C5.84867 3.125 3.75 5.22367 3.75 7.8125C3.75 10.4013 5.84867 12.5 8.4375 12.5ZM8.4375 12.5C5.74688 12.5 3.48047 13.7148 1.875 15.625M8.4375 12.5C11.1281 12.5 13.3945 13.7148 15 15.625",
1294
+ fill: "none",
1295
+ stroke: "currentColor",
1296
+ strokeLinecap: "round",
1297
+ strokeLinejoin: "round",
1298
+ strokeWidth: "1.5"
1299
+ })
1300
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
1301
+ id: "clip0_14246_434209",
1302
+ children: /* @__PURE__ */ jsx("rect", {
1303
+ fill: "white",
1304
+ height: "20",
1305
+ width: "20"
1306
+ })
1307
+ }) })] }));
1308
+ var IconPin = createIcon("IconPin", /* @__PURE__ */ jsx("path", {
1309
+ d: "M7.52271 12.4773L3.75006 16.25M17.9422 7.68279C18.0594 7.56559 18.1252 7.40668 18.1252 7.24099C18.1252 7.0753 18.0594 6.9164 17.9422 6.7992L13.2032 2.05779C13.086 1.94067 12.9271 1.87488 12.7614 1.87488C12.5957 1.87488 12.4368 1.94067 12.3196 2.05779L7.84303 6.54685C7.84303 6.54685 5.67506 5.46326 3.35943 7.33201C3.29077 7.38697 3.23447 7.45581 3.19424 7.53402C3.154 7.61224 3.13072 7.69806 3.12593 7.78589C3.12114 7.87371 3.13493 7.96156 3.16642 8.04369C3.19791 8.12581 3.24637 8.20037 3.30865 8.26248L11.7383 16.6914C11.8015 16.7541 11.8773 16.8025 11.9606 16.8336C12.044 16.8646 12.133 16.8775 12.2218 16.8713C12.3105 16.8652 12.3969 16.8402 12.4752 16.798C12.5535 16.7558 12.6219 16.6973 12.6758 16.6265C13.3313 15.7547 14.361 13.9633 13.4657 12.1734L17.9422 7.68279Z",
1310
+ fill: "none",
1311
+ stroke: "currentColor",
1312
+ strokeLinecap: "round",
1313
+ strokeLinejoin: "round",
1314
+ strokeWidth: "1.5"
1315
+ }));
1316
+ var IconPlayFill = createIcon("IconPlayFill", /* @__PURE__ */ jsx("path", { d: "M18.75 10C18.7505 10.2122 18.6961 10.4209 18.5921 10.6059C18.488 10.7908 18.3379 10.9457 18.1562 11.0555L6.9 17.9414C6.71022 18.0576 6.49287 18.1211 6.27037 18.1252C6.04788 18.1293 5.82832 18.0739 5.63438 17.9648C5.44227 17.8574 5.28225 17.7008 5.17075 17.511C5.05926 17.3213 5.00032 17.1052 5 16.8852V3.11484C5.00032 2.89475 5.05926 2.67872 5.17075 2.48896C5.28225 2.2992 5.44227 2.14257 5.63438 2.03516C5.82832 1.92605 6.04788 1.87071 6.27037 1.87483C6.49287 1.87895 6.71022 1.94239 6.9 2.05859L18.1562 8.94453C18.3379 9.05428 18.488 9.20916 18.5921 9.39411C18.6961 9.57906 18.7505 9.78779 18.75 10Z" }));
1317
+ var IconPlus = createIcon("IconPlus", /* @__PURE__ */ jsx("path", {
1318
+ d: "M3.125 10H16.875M10 3.125V16.875",
1319
+ fill: "none",
1320
+ stroke: "currentColor",
1321
+ strokeLinecap: "round",
1322
+ strokeLinejoin: "round",
1323
+ strokeWidth: "2"
1324
+ }));
1325
+ var IconPlusSmall = createIcon("IconPlusSmall", /* @__PURE__ */ jsx("path", {
1326
+ d: "M3.125 10H16.875M10 3.125V16.875",
1327
+ fill: "none",
1328
+ stroke: "currentColor",
1329
+ strokeLinecap: "round",
1330
+ strokeLinejoin: "round",
1331
+ strokeWidth: "1.5"
1332
+ }));
1333
+ var IconCommand = createIcon("IconCommand", /* @__PURE__ */ jsx("path", {
1334
+ d: "M6.25 7.5L9.375 10L6.25 12.5M10.625 12.5H13.75M3.125 3.75H16.875C17.2202 3.75 17.5 4.02982 17.5 4.375V15.625C17.5 15.9702 17.2202 16.25 16.875 16.25H3.125C2.77982 16.25 2.5 15.9702 2.5 15.625V4.375C2.5 4.02982 2.77982 3.75 3.125 3.75Z",
1335
+ fill: "none",
1336
+ stroke: "currentColor",
1337
+ strokeLinecap: "round",
1338
+ strokeLinejoin: "round",
1339
+ strokeWidth: "1.5"
1340
+ }));
1341
+ var IconCopy = createIcon("IconCopy", /* @__PURE__ */ jsx("path", {
1342
+ d: "M13.125 13.125H16.875V3.125H6.875V6.875M3.125 6.875H13.125V16.875H3.125V6.875Z",
1343
+ fill: "none",
1344
+ stroke: "currentColor",
1345
+ strokeLinecap: "round",
1346
+ strokeLinejoin: "round",
1347
+ strokeWidth: "1.5"
1348
+ }));
1349
+ var IconBolt = createIcon("IconBolt", /* @__PURE__ */ jsx("path", { d: "M16.7071 9.80157L7.95711 19.1766C7.86438 19.2755 7.74198 19.3416 7.60839 19.3649C7.47479 19.3882 7.33724 19.3674 7.2165 19.3057C7.09576 19.244 6.99837 19.1446 6.93904 19.0227C6.8797 18.9007 6.86164 18.7628 6.88757 18.6297L8.03289 12.9008L3.53054 11.2102C3.43385 11.174 3.34762 11.1144 3.27956 11.0368C3.2115 10.9592 3.16373 10.8659 3.14052 10.7653C3.1173 10.6647 3.11937 10.5599 3.14653 10.4603C3.17369 10.3607 3.2251 10.2694 3.29617 10.1945L12.0462 0.819538C12.1389 0.720581 12.2613 0.654468 12.3949 0.631176C12.5285 0.607884 12.666 0.628675 12.7868 0.690414C12.9075 0.752152 13.0049 0.851488 13.0642 0.97343C13.1236 1.09537 13.1416 1.2333 13.1157 1.36641L11.9673 7.10157L16.4696 8.78985C16.5656 8.82626 16.6511 8.88576 16.7187 8.96307C16.7862 9.04039 16.8336 9.13315 16.8568 9.23316C16.88 9.33317 16.8781 9.43734 16.8515 9.53648C16.8248 9.63562 16.7742 9.72666 16.704 9.80157H16.7071Z" }));
1350
+ var IconTranslate = createIcon("IconTranslate", /* @__PURE__ */ jsx("path", {
1351
+ d: "M18.75 16.875L14.375 8.125L10 16.875M11.25 14.375H17.5M7.5 2.5V4.375M2.5 4.375H12.5M10 4.375C10 6.36412 9.20982 8.27178 7.8033 9.6783C6.39678 11.0848 4.48912 11.875 2.5 11.875M5.42734 6.875C5.94442 8.33751 6.90226 9.60371 8.16893 10.4992C9.4356 11.3947 10.9488 11.8753 12.5 11.875",
1352
+ fill: "none",
1353
+ stroke: "currentColor",
1354
+ strokeLinecap: "round",
1355
+ strokeLinejoin: "round",
1356
+ strokeWidth: "1.5"
1357
+ }));
1358
+ var IconDelete = createIcon("IconDelete", /* @__PURE__ */ jsx("path", {
1359
+ d: "M16.875 4.375H3.125M8.125 8.125V13.125M11.875 8.125V13.125M15.625 4.375V16.25C15.625 16.4158 15.5592 16.5747 15.4419 16.6919C15.3247 16.8092 15.1658 16.875 15 16.875H5C4.83424 16.875 4.67527 16.8092 4.55806 16.6919C4.44085 16.5747 4.375 16.4158 4.375 16.25V4.375M13.125 4.375V3.125C13.125 2.79348 12.9933 2.47554 12.7589 2.24112C12.5245 2.0067 12.2065 1.875 11.875 1.875H8.125C7.79348 1.875 7.47554 2.0067 7.24112 2.24112C7.0067 2.47554 6.875 2.79348 6.875 3.125V4.375",
1360
+ fill: "none",
1361
+ stroke: "currentColor",
1362
+ strokeLinecap: "round",
1363
+ strokeLinejoin: "round",
1364
+ strokeWidth: "1.5"
1365
+ }));
1366
+ var IconTrophy = createIcon("IconTrophy", /* @__PURE__ */ jsx("path", {
1367
+ d: "M7.5 17.5H12.5M10 14.375V17.5M4.53125 10H3.75C3.08696 10 2.45107 9.73661 1.98223 9.26777C1.51339 8.79893 1.25 8.16304 1.25 7.5V6.25C1.25 6.08424 1.31585 5.92527 1.43306 5.80806C1.55027 5.69085 1.70924 5.625 1.875 5.625H4.375M15.4688 10H16.25C16.913 10 17.5489 9.73661 18.0178 9.26777C18.4866 8.79893 18.75 8.16304 18.75 7.5V6.25C18.75 6.08424 18.6842 5.92527 18.5669 5.80806C18.4497 5.69085 18.2908 5.625 18.125 5.625H15.625M4.375 3.75H15.625V8.67969C15.625 11.7812 13.1445 14.3516 10.043 14.375C9.30068 14.3807 8.5646 14.2394 7.87718 13.9592C7.18975 13.6791 6.56458 13.2656 6.03769 12.7427C5.5108 12.2198 5.09262 11.5978 4.80725 10.9126C4.52188 10.2273 4.37498 9.49231 4.375 8.75V3.75Z",
1368
+ fill: "none",
1369
+ stroke: "currentColor",
1370
+ strokeLinecap: "round",
1371
+ strokeLinejoin: "round",
1372
+ strokeWidth: "1.5"
1373
+ }));
1374
+ var IconUnpin = createIcon("IconUnpin", /* @__PURE__ */ jsx("path", {
1375
+ d: "M7.52271 12.4773L3.75006 16.25M3.75006 3.12498L16.2501 16.875M14.4532 11.1828L17.9415 7.68279C18.0586 7.56559 18.1244 7.40668 18.1244 7.24099C18.1244 7.0753 18.0586 6.9164 17.9415 6.7992L13.2032 2.05779C13.086 1.94067 12.9271 1.87488 12.7614 1.87488C12.5957 1.87488 12.4368 1.94067 12.3196 2.05779L9.09615 5.28904M6.58756 6.24998C5.74537 6.18435 4.57271 6.3531 3.35943 7.33201C3.29077 7.38697 3.23447 7.45581 3.19424 7.53402C3.154 7.61224 3.13072 7.69806 3.12593 7.78589C3.12114 7.87371 3.13493 7.96156 3.16642 8.04369C3.19791 8.12581 3.24637 8.20037 3.30865 8.26248L11.7383 16.6914C11.8015 16.7541 11.8773 16.8025 11.9606 16.8336C12.044 16.8646 12.133 16.8775 12.2218 16.8713C12.3105 16.8652 12.3969 16.8402 12.4752 16.798C12.5535 16.7558 12.6219 16.6973 12.6758 16.6265C13.0829 16.0851 13.6344 15.1898 13.779 14.1594",
1376
+ fill: "none",
1377
+ stroke: "currentColor",
1378
+ strokeLinecap: "round",
1379
+ strokeLinejoin: "round",
1380
+ strokeWidth: "1.5"
1381
+ }));
1382
+ var IconVideo = createIcon("IconVideo", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("g", {
1383
+ clipPath: "url(#clip0_14111_491476)",
1384
+ children: /* @__PURE__ */ jsx("path", {
1385
+ d: "M15.625 8.75L19.375 6.25V13.75L15.625 11.25M2.5 5H15C15.3452 5 15.625 5.27982 15.625 5.625V14.375C15.625 14.7202 15.3452 15 15 15H2.5C2.15482 15 1.875 14.7202 1.875 14.375V5.625C1.875 5.27982 2.15482 5 2.5 5Z",
1386
+ fill: "none",
1387
+ stroke: "currentColor",
1388
+ strokeLinecap: "round",
1389
+ strokeLinejoin: "round",
1390
+ strokeWidth: "1.5"
1391
+ })
1392
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
1393
+ id: "clip0_14111_491476",
1394
+ children: /* @__PURE__ */ jsx("rect", {
1395
+ fill: "white",
1396
+ height: "20",
1397
+ width: "20"
1398
+ })
1399
+ }) })] }), { "data-rtl-mirror": "" });
1400
+ var IconVideoFill = createIcon("IconVideoFill", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("g", {
1401
+ clipPath: "url(#clip0_14064_467281)",
1402
+ children: /* @__PURE__ */ jsx("path", { d: "M15 5.625V14.375C15 14.7065 14.8683 15.0245 14.6339 15.2589C14.3995 15.4933 14.0815 15.625 13.75 15.625H2.5C2.16848 15.625 1.85054 15.4933 1.61612 15.2589C1.3817 15.0245 1.25 14.7065 1.25 14.375V5.625C1.25 5.29348 1.3817 4.97554 1.61612 4.74112C1.85054 4.5067 2.16848 4.375 2.5 4.375H13.75C14.0815 4.375 14.3995 4.5067 14.6339 4.74112C14.8683 4.97554 15 5.29348 15 5.625ZM19.5312 5.64453C19.4431 5.62295 19.3513 5.62029 19.2621 5.63672C19.1728 5.65315 19.088 5.68829 19.0133 5.73984L16.3891 7.48906C16.3463 7.51762 16.3112 7.55631 16.2869 7.6017C16.2626 7.64708 16.25 7.69776 16.25 7.74922V12.2508C16.25 12.3022 16.2626 12.3529 16.2869 12.3983C16.3112 12.4437 16.3463 12.4824 16.3891 12.5109L19.0281 14.2703C19.1269 14.3362 19.2424 14.3726 19.3611 14.3752C19.4798 14.3779 19.5968 14.3466 19.6984 14.2852C19.7924 14.2254 19.8695 14.1425 19.9223 14.0444C19.9751 13.9464 20.0019 13.8364 20 13.725V6.25C20.0001 6.11139 19.9541 5.97668 19.8692 5.86708C19.7843 5.75747 19.6655 5.67918 19.5312 5.64453Z" })
1403
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
1404
+ id: "clip0_14064_467281",
1405
+ children: /* @__PURE__ */ jsx("rect", {
1406
+ fill: "white",
1407
+ height: "20",
1408
+ width: "20"
1409
+ })
1410
+ }) })] }), { "data-rtl-mirror": "" });
1411
+ var IconAudio = createIcon("IconAudio", /* @__PURE__ */ jsx("path", {
1412
+ d: "M15.625 8.125V11.875M18.125 6.875V13.125M6.875 13.125H3.125C2.95924 13.125 2.80027 13.0592 2.68306 12.9419C2.56585 12.8247 2.5 12.6658 2.5 12.5V7.5C2.5 7.33424 2.56585 7.17527 2.68306 7.05806C2.80027 6.94085 2.95924 6.875 3.125 6.875H6.875L12.5 2.5V17.5L6.875 13.125Z",
1413
+ fill: "none",
1414
+ stroke: "currentColor",
1415
+ strokeLinecap: "round",
1416
+ strokeLinejoin: "round",
1417
+ strokeWidth: "1.5"
1418
+ }), { "data-rtl-mirror": "" });
1419
+ var IconArchive = createIcon("IconArchive", /* @__PURE__ */ jsx("path", {
1420
+ d: "M16.875 7.5V15C16.875 15.1658 16.8092 15.3247 16.6919 15.4419C16.5747 15.5592 16.4158 15.625 16.25 15.625H3.75C3.58424 15.625 3.42527 15.5592 3.30806 15.4419C3.19085 15.3247 3.125 15.1658 3.125 15V7.5M8.125 10.625H11.875M2.5 4.375H17.5C17.8452 4.375 18.125 4.65482 18.125 5V6.875C18.125 7.22018 17.8452 7.5 17.5 7.5H2.5C2.15482 7.5 1.875 7.22018 1.875 6.875V5C1.875 4.65482 2.15482 4.375 2.5 4.375Z",
1421
+ fill: "none",
1422
+ stroke: "currentColor",
1423
+ strokeLinecap: "round",
1424
+ strokeLinejoin: "round",
1425
+ strokeWidth: "1.5"
1426
+ }));
1427
+ var IconLoading = createIcon("IconLoading", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", {
1428
+ d: "M17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85787 17.5 2.5 14.1422 2.5 10C2.5 5.85787 5.85787 2.5 10 2.5C14.1422 2.5 17.5 5.85787 17.5 10Z",
1429
+ fill: "none",
1430
+ stroke: "currentColor",
1431
+ strokeOpacity: "0.3",
1432
+ strokeWidth: "2"
1433
+ }), /* @__PURE__ */ jsx("path", {
1434
+ d: "M17.4544 10.8334C17.0701 14.3097 14.3098 17.07 10.8335 17.4543",
1435
+ fill: "none",
1436
+ stroke: "currentColor",
1437
+ strokeLinecap: "round",
1438
+ strokeWidth: "2"
1439
+ })] }));
1440
+ var IconGiphy = createIcon("IconGiphy", /* @__PURE__ */ jsxs(Fragment$1, { children: [
1441
+ /* @__PURE__ */ jsx("rect", {
1442
+ fill: "black",
1443
+ height: "20",
1444
+ rx: "10",
1445
+ width: "20"
1446
+ }),
1447
+ /* @__PURE__ */ jsx("path", {
1448
+ clipRule: "evenodd",
1449
+ d: "M6.5997 5.50024H13.4008V14.4999H6.59912L6.5997 5.50024Z",
1450
+ fill: "black",
1451
+ fillRule: "evenodd"
1452
+ }),
1453
+ /* @__PURE__ */ jsx("path", {
1454
+ d: "M5.24023 5.1665H6.59998V14.8335H5.24023V5.1665Z",
1455
+ fill: "#04FF8E"
1456
+ }),
1457
+ /* @__PURE__ */ jsx("path", {
1458
+ d: "M13.4004 7.8335H14.7601V14.8335H13.4004V7.8335Z",
1459
+ fill: "#8E2EFF"
1460
+ }),
1461
+ /* @__PURE__ */ jsx("path", {
1462
+ d: "M5.24023 14.4998H14.7602V15.8333H5.24023V14.4998Z",
1463
+ fill: "#00C5FF"
1464
+ }),
1465
+ /* @__PURE__ */ jsx("path", {
1466
+ d: "M5.24023 4.16675H10.6804V5.50025H5.24023V4.16675Z",
1467
+ fill: "#FFF152"
1468
+ }),
1469
+ /* @__PURE__ */ jsx("path", {
1470
+ d: "M13.4003 6.83316V5.50025H12.0399V4.16675H10.6802V8.16666H14.76V6.83316",
1471
+ fill: "#FF5B5B"
1472
+ }),
1473
+ /* @__PURE__ */ jsx("path", {
1474
+ d: "M13.4004 9.5V8.1665H14.7601",
1475
+ fill: "#551C99"
1476
+ }),
1477
+ /* @__PURE__ */ jsx("path", {
1478
+ clipRule: "evenodd",
1479
+ d: "M10.6802 4.16675V5.50025H9.31982",
1480
+ fill: "#999131",
1481
+ fillRule: "evenodd"
1482
+ })
1483
+ ] }));
1484
+ //#endregion
1485
+ //#region src/components/UtilityComponents/useStableId.ts
1486
+ var reactUseId = React.useId;
1487
+ var stripUseIdWrappers = (id) => id.replace(/[:«»]/g, "");
1488
+ /**
1489
+ * Returns a stable, unique string id.
1490
+ *
1491
+ * On React 18+ this delegates to `React.useId()` (with the surrounding wrapper
1492
+ * characters stripped so the value is safe to use anywhere an HTML id is expected)
1493
+ * and is SSR-stable. On React 17, it falls back to a client-only id generated via `nanoid`.
1494
+ */
1495
+ var useStableId = () => {
1496
+ if (reactUseId) return stripUseIdWrappers(reactUseId());
1497
+ return useMemo(() => nanoid(), []);
1498
+ };
1499
+ //#endregion
1500
+ //#region src/components/EmptyStateIndicator/EmptyStateIndicator.tsx
1501
+ var UnMemoizedEmptyStateIndicator = (props) => {
1502
+ const { listType, messageText } = props;
1503
+ const { t } = useTranslationContext("EmptyStateIndicator");
1504
+ if (listType === "thread") return null;
1505
+ if (listType === "channel") {
1506
+ const text = t("No conversations yet");
1507
+ return /* @__PURE__ */ jsxs("div", {
1508
+ className: "str-chat__channel-list-empty",
1509
+ children: [/* @__PURE__ */ jsx(IconMessageBubbles, {}), /* @__PURE__ */ jsx("p", {
1510
+ role: "listitem",
1511
+ children: text
1512
+ })]
1513
+ });
1514
+ }
1515
+ if (listType === "message") {
1516
+ const text = t(messageText || "Send a message to start the conversation");
1517
+ return /* @__PURE__ */ jsxs("div", {
1518
+ className: "str-chat__empty-channel",
1519
+ children: [/* @__PURE__ */ jsx(IconMessageBubble, {}), /* @__PURE__ */ jsx("p", {
1520
+ className: "str-chat__empty-channel-text",
1521
+ role: "listitem",
1522
+ children: text
1523
+ })]
1524
+ });
1525
+ }
1526
+ return /* @__PURE__ */ jsx("p", { children: t("No items exist") });
1527
+ };
1528
+ var EmptyStateIndicator = React.memo(UnMemoizedEmptyStateIndicator);
1529
+ //#endregion
1530
+ //#region src/components/Channel/channelState.ts
1531
+ var makeChannelReducer = () => (state, action) => {
1532
+ switch (action.type) {
1533
+ case "closeThread": return {
1534
+ ...state,
1535
+ thread: null,
1536
+ threadLoadingMore: false,
1537
+ threadMessages: []
1538
+ };
1539
+ case "copyMessagesFromChannel": {
1540
+ const { channel, parentId } = action;
1541
+ return {
1542
+ ...state,
1543
+ messages: [...channel.state.messages],
1544
+ pinnedMessages: [...channel.state.pinnedMessages],
1545
+ suppressAutoscroll: false,
1546
+ threadMessages: parentId ? { ...channel.state.threads }[parentId] || [] : state.threadMessages
1547
+ };
1548
+ }
1549
+ case "copyStateFromChannelOnEvent": {
1550
+ const { channel } = action;
1551
+ return {
1552
+ ...state,
1553
+ members: { ...channel.state.members },
1554
+ messages: [...channel.state.messages],
1555
+ pinnedMessages: [...channel.state.pinnedMessages],
1556
+ read: { ...channel.state.read },
1557
+ watcherCount: channel.state.watcher_count,
1558
+ watchers: { ...channel.state.watchers }
1559
+ };
1560
+ }
1561
+ case "initStateFromChannel": {
1562
+ const { channel, hasMore } = action;
1563
+ return {
1564
+ ...state,
1565
+ hasMore,
1566
+ loading: false,
1567
+ members: { ...channel.state.members },
1568
+ messages: [...channel.state.messages],
1569
+ pinnedMessages: [...channel.state.pinnedMessages],
1570
+ read: { ...channel.state.read },
1571
+ watcherCount: channel.state.watcher_count,
1572
+ watchers: { ...channel.state.watchers }
1573
+ };
1574
+ }
1575
+ case "jumpToLatestMessageFinished": {
1576
+ const { hasMore, hasMoreNewer, messages } = action;
1577
+ return {
1578
+ ...state,
1579
+ hasMore,
1580
+ hasMoreNewer,
1581
+ highlightedMessageId: void 0,
1582
+ loading: false,
1583
+ messages,
1584
+ suppressAutoscroll: false
1585
+ };
1586
+ }
1587
+ case "jumpToMessageFinished": return {
1588
+ ...state,
1589
+ hasMore: action.channel.state.messagePagination.hasPrev,
1590
+ hasMoreNewer: action.channel.state.messagePagination.hasNext,
1591
+ highlightedMessageId: action.highlightedMessageId,
1592
+ loadingMore: false,
1593
+ loadingMoreForJumpToChannelMessage: false,
1594
+ messages: action.channel.state.messages,
1595
+ suppressAutoscroll: false
1596
+ };
1597
+ case "clearHighlightedMessage": return {
1598
+ ...state,
1599
+ highlightedMessageId: void 0
1600
+ };
1601
+ case "loadMoreFinished": {
1602
+ const { hasMore, messages } = action;
1603
+ return {
1604
+ ...state,
1605
+ hasMore,
1606
+ loadingMore: false,
1607
+ messages,
1608
+ suppressAutoscroll: false
1609
+ };
1610
+ }
1611
+ case "loadMoreNewerFinished": {
1612
+ const { hasMoreNewer, messages } = action;
1613
+ return {
1614
+ ...state,
1615
+ hasMoreNewer,
1616
+ loadingMoreNewer: false,
1617
+ messages
1618
+ };
1619
+ }
1620
+ case "loadMoreThreadFinished": {
1621
+ const { threadHasMore, threadMessages } = action;
1622
+ return {
1623
+ ...state,
1624
+ threadHasMore,
1625
+ threadLoadingMore: false,
1626
+ threadMessages
1627
+ };
1628
+ }
1629
+ case "openThread": {
1630
+ const { channel, message } = action;
1631
+ return {
1632
+ ...state,
1633
+ thread: message,
1634
+ threadHasMore: true,
1635
+ threadMessages: message.id ? { ...channel.state.threads }[message.id] || [] : [],
1636
+ threadSuppressAutoscroll: false
1637
+ };
1638
+ }
1639
+ case "setError": {
1640
+ const { error } = action;
1641
+ return {
1642
+ ...state,
1643
+ error
1644
+ };
1645
+ }
1646
+ case "setLoadingMore": {
1647
+ const { loadingMore } = action;
1648
+ return {
1649
+ ...state,
1650
+ loadingMore,
1651
+ suppressAutoscroll: loadingMore
1652
+ };
1653
+ }
1654
+ case "setLoadingMoreForJumpToChannelMessage": {
1655
+ const { loadingMoreForJumpToChannelMessage } = action;
1656
+ return {
1657
+ ...state,
1658
+ loadingMoreForJumpToChannelMessage,
1659
+ suppressAutoscroll: loadingMoreForJumpToChannelMessage
1660
+ };
1661
+ }
1662
+ case "setLoadingMoreNewer": {
1663
+ const { loadingMoreNewer } = action;
1664
+ return {
1665
+ ...state,
1666
+ loadingMoreNewer
1667
+ };
1668
+ }
1669
+ case "setThread": {
1670
+ const { message } = action;
1671
+ return {
1672
+ ...state,
1673
+ thread: message
1674
+ };
1675
+ }
1676
+ case "setTyping": {
1677
+ const { channel } = action;
1678
+ return {
1679
+ ...state,
1680
+ typing: { ...channel.state.typing }
1681
+ };
1682
+ }
1683
+ case "startLoadingThread": return {
1684
+ ...state,
1685
+ threadLoadingMore: true,
1686
+ threadSuppressAutoscroll: true
1687
+ };
1688
+ case "updateThreadOnEvent": {
1689
+ const { channel, message } = action;
1690
+ if (!state.thread) return state;
1691
+ return {
1692
+ ...state,
1693
+ thread: message?.id === state.thread.id ? channel.state.formatMessage(message) : state.thread,
1694
+ threadMessages: state.thread?.id ? { ...channel.state.threads }[state.thread.id] || [] : []
1695
+ };
1696
+ }
1697
+ default: return state;
1698
+ }
1699
+ };
1700
+ var initialState = {
1701
+ error: null,
1702
+ hasMore: true,
1703
+ hasMoreNewer: false,
1704
+ loading: true,
1705
+ loadingMore: false,
1706
+ loadingMoreForJumpToChannelMessage: false,
1707
+ members: {},
1708
+ messages: [],
1709
+ pinnedMessages: [],
1710
+ read: {},
1711
+ suppressAutoscroll: false,
1712
+ thread: null,
1713
+ threadHasMore: true,
1714
+ threadLoadingMore: false,
1715
+ threadMessages: [],
1716
+ threadSuppressAutoscroll: false,
1717
+ typing: {},
1718
+ watcherCount: 0,
1719
+ watchers: {}
1720
+ };
1721
+ //#endregion
1722
+ //#region src/components/Channel/hooks/useCreateChannelStateContext.ts
1723
+ var useCreateChannelStateContext = (value) => {
1724
+ const { channel, channelCapabilitiesArray = [], channelConfig, channelUnreadUiState, error, giphyVersion, hasMore, hasMoreNewer, highlightedMessageId, imageAttachmentSizeHandler, loading, loadingMore, loadingMoreForJumpToChannelMessage, members, messages = [], mutes, notifications, pinnedMessages, read = {}, shouldGenerateVideoThumbnail, skipMessageDataMemoization, suppressAutoscroll, thread, threadHasMore, threadLoadingMore, threadMessages = [], videoAttachmentSizeHandler, watcher_count, watcherCount, watchers } = value;
1725
+ const channelId = channel.cid;
1726
+ const lastRead = channel.initialized && channel.lastRead()?.getTime();
1727
+ const membersLength = Object.keys(members || []).length;
1728
+ const notificationsLength = notifications.length;
1729
+ const readUsers = Object.values(read);
1730
+ const readUsersLength = readUsers.length;
1731
+ const readUsersLastReadDateStrings = [];
1732
+ for (const { last_read } of readUsers) {
1733
+ if (!lastRead) continue;
1734
+ readUsersLastReadDateStrings.push(last_read?.toISOString());
1735
+ }
1736
+ const readUsersLastReads = readUsersLastReadDateStrings.join();
1737
+ const threadMessagesLength = threadMessages?.length;
1738
+ const channelCapabilities = {};
1739
+ channelCapabilitiesArray.forEach((capability) => {
1740
+ channelCapabilities[capability] = true;
1741
+ });
1742
+ const memoizedMessageData = skipMessageDataMemoization ? messages : messages.map(({ deleted_at, latest_reactions, pinned, reply_count, status, type, updated_at, user }) => `${type}${deleted_at}${latest_reactions ? latest_reactions.map(({ type }) => type).join() : ""}${pinned}${reply_count}${status}${updated_at && (isDayOrMoment(updated_at) || isDate(updated_at)) ? updated_at.toISOString() : updated_at || ""}${user?.updated_at}`).join();
1743
+ const memoizedThreadMessageData = threadMessages.map(({ deleted_at, latest_reactions, pinned, status, updated_at, user }) => `${deleted_at}${latest_reactions ? latest_reactions.map(({ type }) => type).join() : ""}${pinned}${status}${updated_at && (isDayOrMoment(updated_at) || isDate(updated_at)) ? updated_at.toISOString() : updated_at || ""}${user?.updated_at}`).join();
1744
+ return useMemo(() => ({
1745
+ channel,
1746
+ channelCapabilities,
1747
+ channelConfig,
1748
+ channelUnreadUiState,
1749
+ error,
1750
+ giphyVersion,
1751
+ hasMore,
1752
+ hasMoreNewer,
1753
+ highlightedMessageId,
1754
+ imageAttachmentSizeHandler,
1755
+ loading,
1756
+ loadingMore,
1757
+ loadingMoreForJumpToChannelMessage,
1758
+ members,
1759
+ messages,
1760
+ mutes,
1761
+ notifications,
1762
+ pinnedMessages,
1763
+ read,
1764
+ shouldGenerateVideoThumbnail,
1765
+ suppressAutoscroll,
1766
+ thread,
1767
+ threadHasMore,
1768
+ threadLoadingMore,
1769
+ threadMessages,
1770
+ videoAttachmentSizeHandler,
1771
+ watcher_count,
1772
+ watcherCount,
1773
+ watchers
1774
+ }), [
1775
+ channel.data?.name,
1776
+ channelId,
1777
+ channelUnreadUiState,
1778
+ error,
1779
+ hasMore,
1780
+ hasMoreNewer,
1781
+ highlightedMessageId,
1782
+ lastRead,
1783
+ loading,
1784
+ loadingMore,
1785
+ loadingMoreForJumpToChannelMessage,
1786
+ membersLength,
1787
+ memoizedMessageData,
1788
+ memoizedThreadMessageData,
1789
+ notificationsLength,
1790
+ readUsersLength,
1791
+ readUsersLastReads,
1792
+ shouldGenerateVideoThumbnail,
1793
+ skipMessageDataMemoization,
1794
+ suppressAutoscroll,
1795
+ thread,
1796
+ threadHasMore,
1797
+ threadLoadingMore,
1798
+ threadMessagesLength,
1799
+ watcherCount
1800
+ ]);
1801
+ };
1802
+ //#endregion
1803
+ //#region src/components/Channel/hooks/useCreateTypingContext.ts
1804
+ var useCreateTypingContext = (value) => {
1805
+ const { typing } = value;
1806
+ return useMemo(() => ({ typing }), [Object.keys(typing || {}).join()]);
1807
+ };
1808
+ //#endregion
1809
+ //#region src/components/Channel/hooks/useEditMessageHandler.ts
1810
+ var useEditMessageHandler = (doUpdateMessageRequest) => {
1811
+ const { channel, client } = useChatContext("useEditMessageHandler");
1812
+ return (updatedMessage, options) => {
1813
+ if (doUpdateMessageRequest && channel) return Promise.resolve(doUpdateMessageRequest(channel.cid, updatedMessage, options));
1814
+ return client.updateMessage(updatedMessage, void 0, options);
1815
+ };
1816
+ };
1817
+ //#endregion
1818
+ //#region src/components/Channel/hooks/useIsMounted.ts
1819
+ var useIsMounted = () => {
1820
+ const isMounted = useRef(false);
1821
+ useEffect(() => {
1822
+ isMounted.current = true;
1823
+ return () => {
1824
+ isMounted.current = false;
1825
+ };
1826
+ }, []);
1827
+ return isMounted;
1828
+ };
1829
+ //#endregion
1830
+ //#region src/components/Channel/hooks/useMentionsHandlers.ts
1831
+ var useMentionsHandlers = (onMentionsHover, onMentionsClick) => useCallback((event, mentioned_users) => {
1832
+ if (!onMentionsHover && !onMentionsClick || !(event.target instanceof HTMLElement)) return;
1833
+ const textContent = event.target.innerHTML.replace("*", "");
1834
+ if (textContent[0] === "@") {
1835
+ const userName = textContent.replace("@", "");
1836
+ const user = mentioned_users?.find(({ id, name }) => name === userName || id === userName);
1837
+ if (onMentionsHover && typeof onMentionsHover === "function" && event.type === "mouseover") onMentionsHover(event, user);
1838
+ if (onMentionsClick && event.type === "click" && typeof onMentionsClick === "function") onMentionsClick(event, user);
1839
+ }
1840
+ }, [onMentionsClick, onMentionsHover]);
1841
+ //#endregion
1842
+ //#region src/components/Loading/LoadingChannel.tsx
1843
+ var LoadingMessage = ({ bubbleSize, metadataSize, outgoing = false }) => /* @__PURE__ */ jsxs("div", {
1844
+ className: `str-chat__loading-channel-message ${outgoing ? "str-chat__loading-channel-message--outgoing" : "str-chat__loading-channel-message--incoming"}`,
1845
+ children: [!outgoing ? /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-message-avatar" }) : null, /* @__PURE__ */ jsxs("div", {
1846
+ className: "str-chat__loading-channel-message-content",
1847
+ children: [/* @__PURE__ */ jsx("div", { className: `str-chat__loading-channel-message-bubble str-chat__loading-channel-message-bubble--${bubbleSize}` }), /* @__PURE__ */ jsx("div", { className: `str-chat__loading-channel-message-metadata str-chat__loading-channel-message-metadata--${metadataSize}` })]
1848
+ })]
1849
+ });
1850
+ var LoadingMessageInput = () => /* @__PURE__ */ jsx("div", {
1851
+ className: "str-chat__message-composer-container str-chat__message-composer-container--loading",
1852
+ children: /* @__PURE__ */ jsxs("div", {
1853
+ className: "str-chat__message-composer",
1854
+ children: [/* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-message-input-button" }), /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-message-input-pill" })]
1855
+ })
1856
+ });
1857
+ var LoadingChannelHeader = () => /* @__PURE__ */ jsxs("div", {
1858
+ className: "str-chat__channel-header str-chat__channel-header--loading",
1859
+ children: [/* @__PURE__ */ jsx("div", {
1860
+ className: "str-chat__channel-header__data str-chat__channel-header__data--loading",
1861
+ children: /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-header-name" })
1862
+ }), /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-header-avatar" })]
1863
+ });
1864
+ var LoadingChannel = () => /* @__PURE__ */ jsxs("div", {
1865
+ className: "str-chat__loading-channel",
1866
+ children: [
1867
+ /* @__PURE__ */ jsx(LoadingChannelHeader, {}),
1868
+ /* @__PURE__ */ jsx("div", {
1869
+ className: "str-chat__message-list str-chat__message-list--loading",
1870
+ children: /* @__PURE__ */ jsx("div", {
1871
+ className: "str-chat__message-list-scroll",
1872
+ children: /* @__PURE__ */ jsxs("div", {
1873
+ className: "str-chat__loading-channel-message-list",
1874
+ children: [
1875
+ /* @__PURE__ */ jsx(LoadingMessage, {
1876
+ bubbleSize: "lg",
1877
+ metadataSize: "md"
1878
+ }),
1879
+ /* @__PURE__ */ jsx(LoadingMessage, {
1880
+ bubbleSize: "md",
1881
+ metadataSize: "sm",
1882
+ outgoing: true
1883
+ }),
1884
+ /* @__PURE__ */ jsx(LoadingMessage, {
1885
+ bubbleSize: "lg",
1886
+ metadataSize: "md"
1887
+ })
1888
+ ]
1889
+ })
1890
+ })
1891
+ }),
1892
+ /* @__PURE__ */ jsx(LoadingMessageInput, {})
1893
+ ]
1894
+ });
1895
+ //#endregion
1896
+ //#region src/components/Loading/LoadingErrorIndicator.tsx
1897
+ /**
1898
+ * UI component for error indicator in a Channel
1899
+ */
1900
+ var UnMemoizedLoadingErrorIndicator = ({ error }) => {
1901
+ const { t } = useTranslationContext("LoadingErrorIndicator");
1902
+ if (!error) return null;
1903
+ return /* @__PURE__ */ jsx("div", { children: t("Error: {{ errorMessage }}", { errorMessage: error.message }) });
1904
+ };
1905
+ var LoadingErrorIndicator = React.memo(UnMemoizedLoadingErrorIndicator, (prevProps, nextProps) => prevProps.error?.message === nextProps.error?.message);
1906
+ //#endregion
1907
+ //#region src/components/Channel/constants.ts
1908
+ var CHANNEL_CONTAINER_ID = "str-chat__channel";
1909
+ //#endregion
1910
+ //#region src/components/Message/emojiRegex.ts
1911
+ /**
1912
+ * `emojiRegex()` compiles a ~15KB regex source on every call, so we build a
1913
+ * single shared instance at module load and reuse it everywhere an emoji match
1914
+ * is needed.
1915
+ *
1916
+ * The instance is global (carries the `g` flag and therefore a mutable
1917
+ * `lastIndex`), so it is only safe to reuse with consumers that reset
1918
+ * `lastIndex` before scanning:
1919
+ * - `String#match` / `String#replace` reset it internally;
1920
+ * - `hast-util-find-and-replace` resets it before each use.
1921
+ *
1922
+ * Do NOT use it directly with stateful `.test()` / `.exec()` loops.
1923
+ */
1924
+ var EMOJI_REGEX = emojiRegex();
1925
+ //#endregion
1926
+ //#region src/components/Message/utils.tsx
1927
+ /**
1928
+ * Following function validates a function which returns notification message.
1929
+ * It validates if the first parameter is function and also if return value of function is string or no.
1930
+ */
1931
+ var validateAndGetMessage = (func, args) => {
1932
+ if (!func || typeof func !== "function") return null;
1933
+ if (!Array.isArray(args)) args = [args];
1934
+ const returnValue = func(...args);
1935
+ if (typeof returnValue !== "string") return null;
1936
+ return returnValue;
1937
+ };
1938
+ /**
1939
+ * Tell if the owner of the current message is muted
1940
+ */
1941
+ var isUserMuted = (message, mutes) => {
1942
+ if (!mutes || !message) return false;
1943
+ return !!mutes.filter((el) => el.target.id === message.user?.id).length;
1944
+ };
1945
+ var OPTIONAL_MESSAGE_ACTIONS = { deleteForMe: "deleteForMe" };
1946
+ var MESSAGE_ACTIONS = {
1947
+ delete: "delete",
1948
+ download: "download",
1949
+ edit: "edit",
1950
+ flag: "flag",
1951
+ markUnread: "markUnread",
1952
+ mute: "mute",
1953
+ pin: "pin",
1954
+ quote: "quote",
1955
+ react: "react",
1956
+ remindMe: "remindMe",
1957
+ reply: "reply",
1958
+ saveForLater: "saveForLater"
1959
+ };
1960
+ var getMessageActions = (actions, { canDelete, canEdit, canFlag, canMarkUnread, canMute, canPin, canQuote, canReact, canReply }, channelConfig) => {
1961
+ const messageActionsAfterPermission = [];
1962
+ let messageActions = [];
1963
+ if (actions && typeof actions === "boolean") messageActions = Object.keys(MESSAGE_ACTIONS);
1964
+ else if (actions && Array.isArray(actions) && actions.length > 0) messageActions = [...actions];
1965
+ else return [];
1966
+ if (canDelete && messageActions.indexOf(MESSAGE_ACTIONS.delete) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.delete);
1967
+ if (messageActions.indexOf(MESSAGE_ACTIONS.download) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.download);
1968
+ if (canDelete && messageActions.indexOf(OPTIONAL_MESSAGE_ACTIONS.deleteForMe) > -1) messageActionsAfterPermission.push(OPTIONAL_MESSAGE_ACTIONS.deleteForMe);
1969
+ if (canEdit && messageActions.indexOf(MESSAGE_ACTIONS.edit) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.edit);
1970
+ if (canFlag && messageActions.indexOf(MESSAGE_ACTIONS.flag) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.flag);
1971
+ if (canMarkUnread && messageActions.indexOf(MESSAGE_ACTIONS.markUnread) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.markUnread);
1972
+ if (canMute && messageActions.indexOf(MESSAGE_ACTIONS.mute) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.mute);
1973
+ if (canPin && messageActions.indexOf(MESSAGE_ACTIONS.pin) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.pin);
1974
+ if (canQuote && messageActions.indexOf(MESSAGE_ACTIONS.quote) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.quote);
1975
+ if (canReact && messageActions.indexOf(MESSAGE_ACTIONS.react) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.react);
1976
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.remindMe);
1977
+ if (canReply && messageActions.indexOf(MESSAGE_ACTIONS.reply) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.reply);
1978
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater) > -1) messageActionsAfterPermission.push(MESSAGE_ACTIONS.saveForLater);
1979
+ return messageActionsAfterPermission;
1980
+ };
1981
+ var ACTIONS_NOT_WORKING_IN_THREAD = [
1982
+ MESSAGE_ACTIONS.pin,
1983
+ MESSAGE_ACTIONS.reply,
1984
+ MESSAGE_ACTIONS.markUnread
1985
+ ];
1986
+ function areMessagesEqual(prevMessage, nextMessage) {
1987
+ const areBaseMessagesEqual = (prevMessage, nextMessage) => prevMessage.deleted_at === nextMessage.deleted_at && prevMessage.latest_reactions?.length === nextMessage.latest_reactions?.length && prevMessage.own_reactions?.length === nextMessage.own_reactions?.length && prevMessage.pinned === nextMessage.pinned && prevMessage.reply_count === nextMessage.reply_count && prevMessage.show_in_channel === nextMessage.show_in_channel && prevMessage.status === nextMessage.status && prevMessage.text === nextMessage.text && prevMessage.type === nextMessage.type && prevMessage.updated_at === nextMessage.updated_at && prevMessage.user?.updated_at === nextMessage.user?.updated_at;
1988
+ return areBaseMessagesEqual(prevMessage, nextMessage) && Boolean(prevMessage.quoted_message) === Boolean(nextMessage.quoted_message) && (!prevMessage.quoted_message && !nextMessage.quoted_message || areBaseMessagesEqual(prevMessage.quoted_message, nextMessage.quoted_message));
1989
+ }
1990
+ var areMessagePropsEqual = (prevProps, nextProps) => {
1991
+ const { message: prevMessage, Message: prevMessageUI } = prevProps;
1992
+ const { message: nextMessage, Message: nextMessageUI } = nextProps;
1993
+ if (prevMessageUI !== nextMessageUI) return false;
1994
+ if (nextProps.showDetailedReactions !== prevProps.showDetailedReactions) return false;
1995
+ if (nextProps.closeReactionSelectorOnClick !== prevProps.closeReactionSelectorOnClick) return false;
1996
+ if (!areMessagesEqual(prevMessage, nextMessage)) return false;
1997
+ if (!(deepequal(nextProps.messageActions, prevProps.messageActions) && deepequal(nextProps.readBy, prevProps.readBy) && deepequal(nextProps.deliveredTo, prevProps.deliveredTo) && deepequal(nextProps.highlighted, prevProps.highlighted) && deepequal(nextProps.groupStyles, prevProps.groupStyles) && deepequal(nextProps.mutes, prevProps.mutes) && deepequal(nextProps.lastReceivedId, prevProps.lastReceivedId))) return false;
1998
+ return prevProps.messageListRect === nextProps.messageListRect;
1999
+ };
2000
+ var areMessageUIPropsEqual = (prevProps, nextProps) => {
2001
+ const { lastReceivedId: prevLastReceivedId, message: prevMessage } = prevProps;
2002
+ const { lastReceivedId: nextLastReceivedId, message: nextMessage } = nextProps;
2003
+ if (prevProps.highlighted !== nextProps.highlighted) return false;
2004
+ if (prevProps.threadList !== nextProps.threadList) return false;
2005
+ if (prevProps.endOfGroup !== nextProps.endOfGroup) return false;
2006
+ if (prevProps.mutes?.length !== nextProps.mutes?.length) return false;
2007
+ if (prevProps.readBy?.length !== nextProps.readBy?.length) return false;
2008
+ if (prevProps.deliveredTo?.length !== nextProps.deliveredTo?.length) return false;
2009
+ if (prevProps.groupStyles !== nextProps.groupStyles) return false;
2010
+ if (prevProps.showDetailedReactions !== nextProps.showDetailedReactions) return false;
2011
+ if ((prevMessage.id === prevLastReceivedId || prevMessage.id === nextLastReceivedId) && prevLastReceivedId !== nextLastReceivedId) return false;
2012
+ return areMessagesEqual(prevMessage, nextMessage);
2013
+ };
2014
+ var messageHasReactions = (message) => Object.values(message?.reaction_groups ?? {}).some(({ count }) => count > 0);
2015
+ var messageHasQuotedMessage = (message) => !!message?.quoted_message;
2016
+ var messageHasAttachments = (message) => !!message?.attachments && !!message.attachments.length;
2017
+ var messageHasSingleAttachment = (message) => message?.attachments?.length === 1;
2018
+ var messageHasGiphyAttachment = (message) => !!message?.attachments?.some((att) => att.type === "giphy");
2019
+ var getImages = (message) => {
2020
+ if (!message?.attachments) return [];
2021
+ return message.attachments.filter((item) => item.type === "image");
2022
+ };
2023
+ var getNonImageAttachments = (message) => {
2024
+ if (!message?.attachments) return [];
2025
+ return message.attachments.filter((item) => item.type !== "image");
2026
+ };
2027
+ /**
2028
+ * Default Tooltip Username mapper implementation.
2029
+ *
2030
+ * @param user the user.
2031
+ */
2032
+ var mapToUserNameOrId = (user) => user.name || user.id;
2033
+ var getReadByTooltipText = (users, t, client, tooltipUserNameMapper) => {
2034
+ let outStr = "";
2035
+ if (!t) throw new Error("getReadByTooltipText was called, but translation function is not available");
2036
+ if (!tooltipUserNameMapper) throw new Error("getReadByTooltipText was called, but tooltipUserNameMapper function is not available");
2037
+ const otherUsers = users.filter((item) => item && client?.user && item.id !== client.user.id).map(tooltipUserNameMapper);
2038
+ const slicedArr = otherUsers.slice(0, 5);
2039
+ const restLength = otherUsers.length - slicedArr.length;
2040
+ if (slicedArr.length === 1) outStr = `${slicedArr[0]} `;
2041
+ else if (slicedArr.length === 2) outStr = t("{{ firstUser }} and {{ secondUser }}", {
2042
+ firstUser: slicedArr[0],
2043
+ secondUser: slicedArr[1]
2044
+ });
2045
+ else if (slicedArr.length > 2) if (restLength === 0) {
2046
+ const lastUser = slicedArr.splice(slicedArr.length - 1, 1);
2047
+ outStr = t("{{ commaSeparatedUsers }}, and {{ lastUser }}", {
2048
+ commaSeparatedUsers: slicedArr.join(", "),
2049
+ lastUser
2050
+ });
2051
+ } else outStr = t("{{ commaSeparatedUsers }} and {{ moreCount }} more", {
2052
+ commaSeparatedUsers: slicedArr.join(", "),
2053
+ moreCount: restLength
2054
+ });
2055
+ return outStr;
2056
+ };
2057
+ var countEmojis = (text) => {
2058
+ const matches = text?.match(EMOJI_REGEX);
2059
+ return matches ? matches.length : 0;
2060
+ };
2061
+ var messageTextHasEmojisOnly = (message) => {
2062
+ if (!message.text) return false;
2063
+ return !message.text.replace(EMOJI_REGEX, "").replace(/[\s\n]/gm, "");
2064
+ };
2065
+ var isMessageErrorRetryable = (message) => message.status === "failed" && message.error?.status !== 403;
2066
+ var isNetworkSendFailure = (message) => message.status === "failed" && message.error?.status === 0;
2067
+ var isMessageBounced = (message) => message.type === "error" && (message.moderation_details?.action === "MESSAGE_RESPONSE_ACTION_BOUNCE" || message.moderation?.action === "bounce");
2068
+ var isMessageBlocked = (message) => message.shadowed || message.type === "error" && (message.moderation_details?.action === "MESSAGE_RESPONSE_ACTION_REMOVE" || message.moderation?.action === "remove");
2069
+ var isMessageDeleted = (message) => Boolean(message.deleted_at || message.type === "deleted" || message.deleted_for_me);
2070
+ var isMessageEdited = (message) => !!message.message_text_updated_at;
2071
+ //#endregion
2072
+ //#region src/components/Thread/LegacyThreadContext.ts
2073
+ var LegacyThreadContext = React.createContext({ legacyThread: void 0 });
2074
+ var useLegacyThreadContext = () => useContext(LegacyThreadContext);
2075
+ //#endregion
2076
+ //#region src/components/AudioPlayback/AudioPlayer.ts
2077
+ var DEFAULT_PLAYBACK_RATES = [
2078
+ 1,
2079
+ 1.5,
2080
+ 2
2081
+ ];
2082
+ var isSeekable = (audioElement) => !(audioElement.duration === Infinity || isNaN(audioElement.duration));
2083
+ var defaultRegisterAudioPlayerError = ({ error } = {}) => {
2084
+ if (!error) return;
2085
+ console.error("[AUDIO PLAYER]", error);
2086
+ };
2087
+ var elementIsPlaying = (audioElement) => audioElement && !(audioElement.paused || audioElement.ended);
2088
+ var AudioPlayer = class {
2089
+ constructor({ durationSeconds, fileSize, id, mimeType, playbackRates: customPlaybackRates, plugins, pool, src, title, waveformData }) {
2090
+ this._plugins = /* @__PURE__ */ new Map();
2091
+ this.playTimeout = void 0;
2092
+ this.unsubscribeEventListeners = null;
2093
+ this._disposed = false;
2094
+ this._metadataProbe = null;
2095
+ this._restoringPosition = false;
2096
+ this._removalTimeout = void 0;
2097
+ this.setDurationSeconds = (durationSeconds) => {
2098
+ this._data.durationSeconds = durationSeconds;
2099
+ this.state.partialNext({ durationSeconds });
2100
+ };
2101
+ this.setPlaybackStartSafetyTimeout = () => {
2102
+ clearTimeout(this.playTimeout);
2103
+ this.playTimeout = setTimeout(() => {
2104
+ if (!this.elementRef) return;
2105
+ try {
2106
+ this.elementRef.pause();
2107
+ this.state.partialNext({ isPlaying: false });
2108
+ } catch (e) {
2109
+ this.registerError({ errCode: "failed-to-start" });
2110
+ }
2111
+ }, 2e3);
2112
+ };
2113
+ this.updateDurationFromElement = (element) => {
2114
+ const duration = element.duration;
2115
+ if (typeof duration !== "number" || isNaN(duration) || !isFinite(duration) || duration <= 0) return;
2116
+ this.setDurationSeconds(duration);
2117
+ };
2118
+ this.clearMetadataProbe = () => {
2119
+ const probe = this._metadataProbe;
2120
+ this._metadataProbe = null;
2121
+ this._metadataProbePromise = void 0;
2122
+ if (!probe) return;
2123
+ try {
2124
+ probe.pause();
2125
+ } catch {}
2126
+ probe.removeAttribute("src");
2127
+ try {
2128
+ probe.load();
2129
+ } catch {}
2130
+ };
2131
+ this.preloadMetadata = () => {
2132
+ if (this._disposed || this.durationSeconds != null || !this.src || this._metadataProbePromise || typeof document === "undefined") return;
2133
+ const probe = document.createElement("audio");
2134
+ probe.preload = "metadata";
2135
+ this._metadataProbe = probe;
2136
+ this._metadataProbePromise = new Promise((resolve) => {
2137
+ const cleanup = () => {
2138
+ probe.removeEventListener("loadedmetadata", handleLoadedMetadata);
2139
+ probe.removeEventListener("error", handleError);
2140
+ if (this._metadataProbe === probe) this.clearMetadataProbe();
2141
+ else this._metadataProbePromise = void 0;
2142
+ resolve();
2143
+ };
2144
+ const handleLoadedMetadata = () => {
2145
+ this.updateDurationFromElement(probe);
2146
+ cleanup();
2147
+ };
2148
+ const handleError = () => {
2149
+ cleanup();
2150
+ };
2151
+ probe.addEventListener("loadedmetadata", handleLoadedMetadata, { once: true });
2152
+ probe.addEventListener("error", handleError, { once: true });
2153
+ probe.src = this.src;
2154
+ try {
2155
+ probe.load();
2156
+ } catch {
2157
+ cleanup();
2158
+ }
2159
+ });
2160
+ };
2161
+ this.clearPlaybackStartSafetyTimeout = () => {
2162
+ if (!this.elementRef) return;
2163
+ clearTimeout(this.playTimeout);
2164
+ this.playTimeout = void 0;
2165
+ };
2166
+ this.clearPendingLoadedMeta = () => {
2167
+ const pending = this._pendingLoadedMeta;
2168
+ if (pending?.element && pending.onLoaded) pending.element.removeEventListener("loadedmetadata", pending.onLoaded);
2169
+ this._pendingLoadedMeta = void 0;
2170
+ };
2171
+ this.restoreSavedPosition = (elementRef) => {
2172
+ const saved = this.secondsElapsed;
2173
+ if (!saved || saved <= 0) return;
2174
+ const apply = () => {
2175
+ const duration = elementRef.duration;
2176
+ const clamped = typeof duration === "number" && !isNaN(duration) && isFinite(duration) ? Math.min(saved, duration) : saved;
2177
+ try {
2178
+ if (elementRef.currentTime === clamped) return;
2179
+ elementRef.currentTime = clamped;
2180
+ this.setSecondsElapsed(clamped);
2181
+ } catch {}
2182
+ };
2183
+ if (elementRef.readyState < 1) {
2184
+ this.clearPendingLoadedMeta();
2185
+ this._restoringPosition = true;
2186
+ const onLoaded = () => {
2187
+ if (this._pendingLoadedMeta?.onLoaded !== onLoaded) return;
2188
+ this._pendingLoadedMeta = void 0;
2189
+ if (this.elementRef !== elementRef) {
2190
+ this._restoringPosition = false;
2191
+ return;
2192
+ }
2193
+ apply();
2194
+ this._restoringPosition = false;
2195
+ };
2196
+ elementRef.addEventListener("loadedmetadata", onLoaded, { once: true });
2197
+ this._pendingLoadedMeta = {
2198
+ element: elementRef,
2199
+ onLoaded
2200
+ };
2201
+ } else {
2202
+ this._restoringPosition = true;
2203
+ apply();
2204
+ this._restoringPosition = false;
2205
+ }
2206
+ };
2207
+ this.elementIsReady = () => {
2208
+ if (this._elementIsReadyPromise) return this._elementIsReadyPromise;
2209
+ this._elementIsReadyPromise = new Promise((resolve) => {
2210
+ if (!this.elementRef) return resolve(false);
2211
+ const element = this.elementRef;
2212
+ const handleLoaded = () => {
2213
+ element.removeEventListener("loadedmetadata", handleLoaded);
2214
+ resolve(element.readyState > 0);
2215
+ };
2216
+ element.addEventListener("loadedmetadata", handleLoaded);
2217
+ });
2218
+ return this._elementIsReadyPromise;
2219
+ };
2220
+ this.setRef = (elementRef) => {
2221
+ if (elementIsPlaying(this.elementRef)) this.releaseElement({ resetState: false });
2222
+ this.clearPendingLoadedMeta();
2223
+ this.clearMetadataProbe();
2224
+ this._restoringPosition = false;
2225
+ this._elementIsReadyPromise = void 0;
2226
+ this.state.partialNext({ elementRef });
2227
+ if (elementRef) this.registerSubscriptions();
2228
+ };
2229
+ this.setSecondsElapsed = (secondsElapsed) => {
2230
+ const duration = this.elementRef?.duration ?? this.durationSeconds;
2231
+ this.state.partialNext({
2232
+ progressPercent: duration && secondsElapsed ? secondsElapsed / duration * 100 : 0,
2233
+ secondsElapsed
2234
+ });
2235
+ };
2236
+ this.canPlayMimeType = (mimeType) => {
2237
+ if (!mimeType) return false;
2238
+ if (this.elementRef) return !!this.elementRef.canPlayType(mimeType);
2239
+ return !!new Audio().canPlayType(mimeType);
2240
+ };
2241
+ this.play = async (params) => {
2242
+ if (this._disposed) return;
2243
+ const elementRef = this.ensureElementRef();
2244
+ if (elementIsPlaying(this.elementRef)) {
2245
+ if (this.isPlaying) return;
2246
+ this.state.partialNext({ isPlaying: true });
2247
+ return;
2248
+ }
2249
+ const { currentPlaybackRate, playbackRates } = {
2250
+ currentPlaybackRate: this.currentPlaybackRate,
2251
+ playbackRates: this.playbackRates,
2252
+ ...params
2253
+ };
2254
+ if (!this.canPlayRecord) {
2255
+ this.registerError({ errCode: "not-playable" });
2256
+ return;
2257
+ }
2258
+ this.restoreSavedPosition(elementRef);
2259
+ elementRef.playbackRate = currentPlaybackRate ?? this.currentPlaybackRate;
2260
+ this.setPlaybackStartSafetyTimeout();
2261
+ try {
2262
+ await elementRef.play();
2263
+ this.state.partialNext({
2264
+ currentPlaybackRate,
2265
+ isPlaying: true,
2266
+ playbackRates
2267
+ });
2268
+ this._pool.setActiveAudioPlayer(this);
2269
+ } catch (e) {
2270
+ this.registerError({ error: e });
2271
+ this.state.partialNext({ isPlaying: false });
2272
+ } finally {
2273
+ this.clearPlaybackStartSafetyTimeout();
2274
+ }
2275
+ };
2276
+ this.pause = () => {
2277
+ if (!elementIsPlaying(this.elementRef)) return;
2278
+ this.clearPlaybackStartSafetyTimeout();
2279
+ this.elementRef.pause();
2280
+ this.state.partialNext({ isPlaying: false });
2281
+ };
2282
+ this.stop = () => {
2283
+ this.pause();
2284
+ this.state.partialNext({ isPlaying: false });
2285
+ this.setSecondsElapsed(0);
2286
+ if (this.elementRef) this.elementRef.currentTime = 0;
2287
+ };
2288
+ this.togglePlay = async () => this.isPlaying ? this.pause() : await this.play();
2289
+ this.increasePlaybackRate = () => {
2290
+ let currentPlaybackRateIndex = this.state.getLatestValue().playbackRates.findIndex((rate) => rate === this.currentPlaybackRate);
2291
+ if (currentPlaybackRateIndex === -1) currentPlaybackRateIndex = 0;
2292
+ const nextIndex = currentPlaybackRateIndex === this.playbackRates.length - 1 ? 0 : currentPlaybackRateIndex + 1;
2293
+ const currentPlaybackRate = this.playbackRates[nextIndex];
2294
+ this.state.partialNext({ currentPlaybackRate });
2295
+ if (this.elementRef) this.elementRef.playbackRate = currentPlaybackRate;
2296
+ };
2297
+ this.seek = throttle(async ({ clientX, currentTarget }) => {
2298
+ let element = this.elementRef;
2299
+ if (!this.elementRef) {
2300
+ element = this.ensureElementRef();
2301
+ if (!await this.elementIsReady()) return;
2302
+ }
2303
+ if (!currentTarget || !element) return;
2304
+ if (!isSeekable(element)) {
2305
+ this.registerError({ errCode: "seek-not-supported" });
2306
+ return;
2307
+ }
2308
+ const { width, x } = currentTarget.getBoundingClientRect();
2309
+ const ratio = (clientX - x) / width;
2310
+ if (ratio > 1 || ratio < 0) return;
2311
+ const currentTime = ratio * element.duration;
2312
+ this.setSecondsElapsed(currentTime);
2313
+ element.currentTime = currentTime;
2314
+ }, 16);
2315
+ this.registerError = (params) => {
2316
+ defaultRegisterAudioPlayerError(params);
2317
+ this.plugins.forEach(({ onError }) => onError?.({
2318
+ player: this,
2319
+ ...params
2320
+ }));
2321
+ };
2322
+ this.requestRemoval = () => {
2323
+ this._disposed = true;
2324
+ this.cancelScheduledRemoval();
2325
+ this.clearPendingLoadedMeta();
2326
+ this.clearMetadataProbe();
2327
+ this._restoringPosition = false;
2328
+ this.releaseElement({ resetState: true });
2329
+ this.unsubscribeEventListeners?.();
2330
+ this.unsubscribeEventListeners = null;
2331
+ this.plugins.forEach(({ onRemove }) => onRemove?.({ player: this }));
2332
+ this._pool.deregister(this.id);
2333
+ };
2334
+ this.cancelScheduledRemoval = () => {
2335
+ clearTimeout(this._removalTimeout);
2336
+ this._removalTimeout = void 0;
2337
+ };
2338
+ this.scheduleRemoval = (ms = 0) => {
2339
+ this.cancelScheduledRemoval();
2340
+ this._removalTimeout = setTimeout(() => {
2341
+ if (this.disposed) return;
2342
+ this.requestRemoval();
2343
+ }, ms);
2344
+ };
2345
+ this.releaseElementForHandoff = () => {
2346
+ if (!this.elementRef) return;
2347
+ this.releaseElement({ resetState: false });
2348
+ this.unsubscribeEventListeners?.();
2349
+ this.unsubscribeEventListeners = null;
2350
+ };
2351
+ this.registerSubscriptions = () => {
2352
+ this.unsubscribeEventListeners?.();
2353
+ const audioElement = this.elementRef;
2354
+ if (!audioElement) return;
2355
+ const handleEnded = () => {
2356
+ if (audioElement) this.updateDurationFromElement(audioElement);
2357
+ this.stop();
2358
+ };
2359
+ const handleError = (e) => {
2360
+ const audio = e.currentTarget;
2361
+ const state = { isPlaying: false };
2362
+ if (!audio?.error?.code) {
2363
+ this.state.partialNext(state);
2364
+ return;
2365
+ }
2366
+ if (audio.error.code === 4) {
2367
+ state.canPlayRecord = false;
2368
+ this.state.partialNext(state);
2369
+ }
2370
+ const errorMsg = [
2371
+ void 0,
2372
+ "MEDIA_ERR_ABORTED: fetch aborted by user",
2373
+ "MEDIA_ERR_NETWORK: network failed while fetching",
2374
+ "MEDIA_ERR_DECODE: audio fetched but couldn’t decode",
2375
+ "MEDIA_ERR_SRC_NOT_SUPPORTED: source not supported"
2376
+ ][audio?.error?.code];
2377
+ if (!errorMsg) return;
2378
+ defaultRegisterAudioPlayerError({ error: /* @__PURE__ */ new Error(errorMsg + ` (${audio.src})`) });
2379
+ };
2380
+ const handleTimeupdate = () => {
2381
+ const t = audioElement?.currentTime ?? 0;
2382
+ if (this._restoringPosition && t === 0) return;
2383
+ if (!this.isPlaying && t === 0 && this.secondsElapsed > 0) return;
2384
+ this.setSecondsElapsed(t);
2385
+ };
2386
+ const handleLoadedMetadata = () => {
2387
+ if (audioElement) this.updateDurationFromElement(audioElement);
2388
+ };
2389
+ audioElement.addEventListener("ended", handleEnded);
2390
+ audioElement.addEventListener("error", handleError);
2391
+ audioElement.addEventListener("loadedmetadata", handleLoadedMetadata);
2392
+ audioElement.addEventListener("timeupdate", handleTimeupdate);
2393
+ this.unsubscribeEventListeners = () => {
2394
+ audioElement.pause();
2395
+ audioElement.removeEventListener("ended", handleEnded);
2396
+ audioElement.removeEventListener("error", handleError);
2397
+ audioElement.removeEventListener("loadedmetadata", handleLoadedMetadata);
2398
+ audioElement.removeEventListener("timeupdate", handleTimeupdate);
2399
+ };
2400
+ };
2401
+ this._data = {
2402
+ durationSeconds,
2403
+ fileSize,
2404
+ id,
2405
+ mimeType,
2406
+ src,
2407
+ title,
2408
+ waveformData
2409
+ };
2410
+ this._pool = pool;
2411
+ this.setPlugins(() => plugins ?? []);
2412
+ const playbackRates = customPlaybackRates?.length ? customPlaybackRates : DEFAULT_PLAYBACK_RATES;
2413
+ const canPlayRecord = mimeType ? !!new Audio().canPlayType(mimeType) : true;
2414
+ this.state = new StateStore({
2415
+ canPlayRecord,
2416
+ currentPlaybackRate: playbackRates[0],
2417
+ durationSeconds,
2418
+ elementRef: null,
2419
+ isPlaying: false,
2420
+ playbackError: null,
2421
+ playbackRates,
2422
+ progressPercent: 0,
2423
+ secondsElapsed: 0
2424
+ });
2425
+ this.plugins.forEach((p) => p.onInit?.({ player: this }));
2426
+ this.preloadMetadata();
2427
+ }
2428
+ get plugins() {
2429
+ return Array.from(this._plugins.values());
2430
+ }
2431
+ get canPlayRecord() {
2432
+ return this.state.getLatestValue().canPlayRecord;
2433
+ }
2434
+ get elementRef() {
2435
+ return this.state.getLatestValue().elementRef;
2436
+ }
2437
+ get isPlaying() {
2438
+ return this.state.getLatestValue().isPlaying;
2439
+ }
2440
+ get currentPlaybackRate() {
2441
+ return this.state.getLatestValue().currentPlaybackRate;
2442
+ }
2443
+ get playbackRates() {
2444
+ return this.state.getLatestValue().playbackRates;
2445
+ }
2446
+ get durationSeconds() {
2447
+ return this.state.getLatestValue().durationSeconds;
2448
+ }
2449
+ get fileSize() {
2450
+ return this._data.fileSize;
2451
+ }
2452
+ get id() {
2453
+ return this._data.id;
2454
+ }
2455
+ get src() {
2456
+ return this._data.src;
2457
+ }
2458
+ get mimeType() {
2459
+ return this._data.mimeType;
2460
+ }
2461
+ get title() {
2462
+ return this._data.title;
2463
+ }
2464
+ get waveformData() {
2465
+ return this._data.waveformData;
2466
+ }
2467
+ get secondsElapsed() {
2468
+ return this.state.getLatestValue().secondsElapsed;
2469
+ }
2470
+ get progressPercent() {
2471
+ return this.state.getLatestValue().progressPercent;
2472
+ }
2473
+ get disposed() {
2474
+ return this._disposed;
2475
+ }
2476
+ ensureElementRef() {
2477
+ if (this._disposed) throw new Error("AudioPlayer is disposed");
2478
+ if (!this.elementRef) {
2479
+ const el = this._pool.acquireElement({
2480
+ ownerId: this.id,
2481
+ src: this.src
2482
+ });
2483
+ this.setRef(el);
2484
+ }
2485
+ return this.elementRef;
2486
+ }
2487
+ setDescriptor(descriptor) {
2488
+ const previousSrc = this.src;
2489
+ this._data = {
2490
+ ...this._data,
2491
+ ...descriptor
2492
+ };
2493
+ if (descriptor.src !== previousSrc && this.elementRef) this.elementRef.src = descriptor.src;
2494
+ if (descriptor.src && descriptor.src !== previousSrc) {
2495
+ this.clearMetadataProbe();
2496
+ if (descriptor.durationSeconds == null) {
2497
+ this.setDurationSeconds(void 0);
2498
+ this.preloadMetadata();
2499
+ } else this.setDurationSeconds(descriptor.durationSeconds);
2500
+ return;
2501
+ }
2502
+ if (descriptor.durationSeconds != null) this.setDurationSeconds(descriptor.durationSeconds);
2503
+ }
2504
+ releaseElement({ resetState }) {
2505
+ this.clearPendingLoadedMeta();
2506
+ this.clearMetadataProbe();
2507
+ this._restoringPosition = false;
2508
+ if (resetState) this.stop();
2509
+ else {
2510
+ this.state.partialNext({ isPlaying: false });
2511
+ if (this.elementRef) try {
2512
+ this.elementRef.pause();
2513
+ } catch {}
2514
+ }
2515
+ if (this.elementRef) {
2516
+ this._pool.releaseElement(this.id);
2517
+ this.setRef(null);
2518
+ }
2519
+ }
2520
+ setPlugins(setter) {
2521
+ this._plugins = setter(this.plugins).reduce((acc, plugin) => {
2522
+ if (plugin.id) acc.set(plugin.id, plugin);
2523
+ return acc;
2524
+ }, /* @__PURE__ */ new Map());
2525
+ }
2526
+ };
2527
+ //#endregion
2528
+ //#region src/components/AudioPlayback/AudioPlayerPool.ts
2529
+ var AudioPlayerPool = class {
2530
+ constructor(config) {
2531
+ this.state = new StateStore({ activeAudioPlayer: null });
2532
+ this.pool = /* @__PURE__ */ new Map();
2533
+ this.audios = /* @__PURE__ */ new Map();
2534
+ this.sharedAudio = null;
2535
+ this.sharedOwnerId = null;
2536
+ this.getOrAdd = (params) => {
2537
+ const { playbackRates, plugins, ...descriptor } = params;
2538
+ let player = this.pool.get(params.id);
2539
+ if (player) {
2540
+ if (!player.disposed) {
2541
+ player.setDescriptor(descriptor);
2542
+ return player;
2543
+ }
2544
+ this.deregister(params.id);
2545
+ }
2546
+ player = new AudioPlayer({
2547
+ playbackRates,
2548
+ plugins,
2549
+ ...descriptor,
2550
+ pool: this
2551
+ });
2552
+ this.pool.set(params.id, player);
2553
+ return player;
2554
+ };
2555
+ this.acquireElement = ({ ownerId, src }) => {
2556
+ if (!this.allowConcurrentPlayback) {
2557
+ if (!this.sharedAudio) this.sharedAudio = new Audio();
2558
+ if (this.sharedOwnerId && this.sharedOwnerId !== ownerId) {
2559
+ const previous = this.pool.get(this.sharedOwnerId);
2560
+ previous?.pause();
2561
+ previous?.releaseElementForHandoff();
2562
+ }
2563
+ this.sharedOwnerId = ownerId;
2564
+ if (this.sharedAudio.src !== src) this.sharedAudio.src = src;
2565
+ return this.sharedAudio;
2566
+ }
2567
+ let audio = this.audios.get(ownerId);
2568
+ if (!audio) {
2569
+ audio = new Audio();
2570
+ this.audios.set(ownerId, audio);
2571
+ }
2572
+ if (audio.src !== src) audio.src = src;
2573
+ return audio;
2574
+ };
2575
+ this.releaseElement = (ownerId) => {
2576
+ if (!this.allowConcurrentPlayback) {
2577
+ if (this.sharedOwnerId !== ownerId) return;
2578
+ const el = this.sharedAudio;
2579
+ if (el) {
2580
+ try {
2581
+ el.pause();
2582
+ } catch {}
2583
+ el.removeAttribute("src");
2584
+ el.load();
2585
+ }
2586
+ this.sharedOwnerId = null;
2587
+ return;
2588
+ }
2589
+ const el = this.audios.get(ownerId);
2590
+ if (!el) return;
2591
+ try {
2592
+ el.pause();
2593
+ } catch {}
2594
+ el.removeAttribute("src");
2595
+ el.load();
2596
+ this.audios.delete(ownerId);
2597
+ };
2598
+ this.setActiveAudioPlayer = (activeAudioPlayer) => {
2599
+ if (this.allowConcurrentPlayback) return;
2600
+ this.state.partialNext({ activeAudioPlayer });
2601
+ };
2602
+ this.remove = (id) => {
2603
+ const player = this.pool.get(id);
2604
+ if (!player) return;
2605
+ player.requestRemoval();
2606
+ };
2607
+ this.clear = () => {
2608
+ this.players.forEach((player) => {
2609
+ this.remove(player.id);
2610
+ });
2611
+ };
2612
+ this.registerSubscriptions = () => {
2613
+ this.players.forEach((p) => {
2614
+ if (p.elementRef) p.registerSubscriptions();
2615
+ });
2616
+ };
2617
+ this.allowConcurrentPlayback = !!config?.allowConcurrentPlayback;
2618
+ }
2619
+ get players() {
2620
+ return Array.from(this.pool.values());
2621
+ }
2622
+ get activeAudioPlayer() {
2623
+ return this.state.getLatestValue().activeAudioPlayer;
2624
+ }
2625
+ /** Removes the AudioPlayer instance from the pool of players */
2626
+ deregister(id) {
2627
+ if (this.pool.has(id)) this.pool.delete(id);
2628
+ if (this.activeAudioPlayer?.id === id) this.setActiveAudioPlayer(null);
2629
+ }
2630
+ };
2631
+ //#endregion
2632
+ //#region src/components/AudioPlayback/plugins/AudioPlayerNotificationsPlugin.ts
2633
+ var SEEK_NOT_SUPPORTED_NOTIFICATION_DEBOUNCE_INTERVAL_MS = 1e3;
2634
+ var audioPlayerNotificationsPluginFactory = ({ addNotification, panel = "channel", t }) => {
2635
+ const errors = {
2636
+ "failed-to-start": new Error(t("Failed to play the recording")),
2637
+ "not-playable": new Error(t("Recording format is not supported and cannot be reproduced")),
2638
+ "seek-not-supported": new Error(t("Cannot seek in the recording"))
2639
+ };
2640
+ let lastSeekNotSupportedNotificationAt;
2641
+ return {
2642
+ id: "AudioPlayerNotificationsPlugin",
2643
+ onError: ({ errCode, error: e }) => {
2644
+ if (errCode === "seek-not-supported") {
2645
+ const now = Date.now();
2646
+ if (typeof lastSeekNotSupportedNotificationAt === "number" && now - lastSeekNotSupportedNotificationAt < SEEK_NOT_SUPPORTED_NOTIFICATION_DEBOUNCE_INTERVAL_MS) return;
2647
+ lastSeekNotSupportedNotificationAt = now;
2648
+ }
2649
+ const error = (errCode && errors[errCode]) ?? e ?? new Error(t("Error reproducing the recording"));
2650
+ addNotification({
2651
+ emitter: "AudioPlayer",
2652
+ error,
2653
+ message: error.message,
2654
+ severity: "error",
2655
+ targetPanels: [panel],
2656
+ type: "browser:audio:playback:error"
2657
+ });
2658
+ }
2659
+ };
2660
+ };
2661
+ //#endregion
2662
+ //#region src/components/AudioPlayback/WithAudioPlayback.tsx
2663
+ var AudioPlayerContext = React.createContext({ audioPlayers: null });
2664
+ var WithAudioPlayback = ({ allowConcurrentPlayback, children }) => {
2665
+ const [audioPlayers] = useState(() => new AudioPlayerPool({ allowConcurrentPlayback }));
2666
+ useEffect(() => () => {
2667
+ audioPlayers.clear();
2668
+ }, [audioPlayers]);
2669
+ return /* @__PURE__ */ jsx(AudioPlayerContext.Provider, {
2670
+ value: { audioPlayers },
2671
+ children
2672
+ });
2673
+ };
2674
+ var makeAudioPlayerId = ({ requester, src }) => `${requester ?? "requester-unknown"}:${src}`;
2675
+ var useAudioPlayer = ({ durationSeconds, fileSize, mimeType, playbackRates, plugins, requester = "", src, title, waveformData }) => {
2676
+ const { addNotification } = useNotificationApi();
2677
+ const panel = useNotificationTarget();
2678
+ const { t } = useTranslationContext();
2679
+ const { audioPlayers } = useContext(AudioPlayerContext);
2680
+ const audioPlayer = src && audioPlayers ? audioPlayers.getOrAdd({
2681
+ durationSeconds,
2682
+ fileSize,
2683
+ id: makeAudioPlayerId({
2684
+ requester,
2685
+ src
2686
+ }),
2687
+ mimeType,
2688
+ playbackRates,
2689
+ plugins,
2690
+ src,
2691
+ title,
2692
+ waveformData
2693
+ }) : void 0;
2694
+ useEffect(() => {
2695
+ if (!audioPlayer) return;
2696
+ /**
2697
+ * Avoid having to pass client and translation function to AudioPlayer instances
2698
+ * and instead provide plugin that takes care of translated notifications.
2699
+ */
2700
+ const notificationsPlugin = audioPlayerNotificationsPluginFactory({
2701
+ addNotification,
2702
+ panel,
2703
+ t
2704
+ });
2705
+ audioPlayer.setPlugins((currentPlugins) => [...currentPlugins.filter((plugin) => plugin.id !== notificationsPlugin.id), notificationsPlugin]);
2706
+ }, [
2707
+ addNotification,
2708
+ audioPlayer,
2709
+ panel,
2710
+ t
2711
+ ]);
2712
+ return audioPlayer;
2713
+ };
2714
+ var activeAudioPlayerSelector = ({ activeAudioPlayer }) => ({ activeAudioPlayer });
2715
+ var useActiveAudioPlayer = () => {
2716
+ const { audioPlayers } = useContext(AudioPlayerContext);
2717
+ const { activeAudioPlayer } = useStateStore(audioPlayers?.state, activeAudioPlayerSelector) ?? {};
2718
+ return activeAudioPlayer;
2719
+ };
2720
+ //#endregion
2721
+ //#region src/components/MessageComposer/hooks/useIsCooldownActive.ts
2722
+ var cooldownTimerStateSelector = (state) => ({ isCooldownActive: !!state.cooldownRemaining });
2723
+ var useIsCooldownActive = () => {
2724
+ const { channel } = useChannelStateContext();
2725
+ return useStateStore(channel.cooldownTimer.state, cooldownTimerStateSelector).isCooldownActive;
2726
+ };
2727
+ //#endregion
2728
+ //#region src/components/MessageComposer/hooks/useMessageComposerController.ts
2729
+ var queueCache = new FixedSizeQueueCache(64);
2730
+ var useMessageComposerController = () => {
2731
+ const { client } = useChatContext();
2732
+ const { channel } = useChannelStateContext();
2733
+ const { legacyThread: parentMessage } = useLegacyThreadContext();
2734
+ const threadInstance = useThreadContext();
2735
+ const cachedParentMessage = useMemo(() => {
2736
+ if (!parentMessage) return void 0;
2737
+ return parentMessage;
2738
+ }, [parentMessage?.id]);
2739
+ const messageComposer = useMemo(() => {
2740
+ if (threadInstance) return threadInstance.messageComposer;
2741
+ else if (cachedParentMessage) {
2742
+ const compositionContext = {
2743
+ ...cachedParentMessage,
2744
+ legacyThreadId: cachedParentMessage.id
2745
+ };
2746
+ const tag = MessageComposer.constructTag(compositionContext);
2747
+ const cachedComposer = queueCache.get(tag);
2748
+ if (cachedComposer) return cachedComposer;
2749
+ return new MessageComposer({
2750
+ client,
2751
+ compositionContext
2752
+ });
2753
+ } else return channel.messageComposer;
2754
+ }, [
2755
+ cachedParentMessage,
2756
+ channel,
2757
+ client,
2758
+ threadInstance
2759
+ ]);
2760
+ if (["legacy_thread", "message"].includes(messageComposer.contextType) && !queueCache.peek(messageComposer.tag)) queueCache.add(messageComposer.tag, messageComposer);
2761
+ useEffect(() => {
2762
+ const unsubscribe = messageComposer.registerSubscriptions();
2763
+ return () => {
2764
+ unsubscribe();
2765
+ };
2766
+ }, [messageComposer]);
2767
+ return messageComposer;
2768
+ };
2769
+ //#endregion
2770
+ //#region src/constants/messageTypes.ts
2771
+ var CUSTOM_MESSAGE_TYPE = {
2772
+ date: "message.date",
2773
+ intro: "channel.intro"
2774
+ };
2775
+ //#endregion
2776
+ //#region src/components/MessageList/utils.ts
2777
+ /**
2778
+ * processMessages - Transform the input message list according to config parameters
2779
+ *
2780
+ * Inserts date separators btw. messages created on different dates or before unread incoming messages. By default:
2781
+ * - enabled in main message list
2782
+ * - disabled in virtualized message list
2783
+ * - disabled in thread
2784
+ *
2785
+ * Allows to filter out deleted messages, contolled by hideDeletedMessages param. This is disabled by default.
2786
+ *
2787
+ * Sets Giphy preview message for VirtualizedMessageList
2788
+ *
2789
+ * The only required params are messages and userId, the rest are config params:
2790
+ *
2791
+ * @return {LocalMessage[]} Transformed list of messages
2792
+ */
2793
+ var processMessages = (params) => {
2794
+ const { messages, reviewProcessedMessage, setGiphyPreviewMessage, ...context } = params;
2795
+ const { enableDateSeparator, hideDeletedMessages, hideNewMessageSeparator, lastRead, userId } = context;
2796
+ let unread = false;
2797
+ let ephemeralMessagePresent = false;
2798
+ let lastDateSeparator;
2799
+ const newMessages = [];
2800
+ for (let i = 0; i < messages.length; i += 1) {
2801
+ const message = messages[i];
2802
+ if (hideDeletedMessages && message.type === "deleted") continue;
2803
+ if (setGiphyPreviewMessage && message.type === "ephemeral" && message.command === "giphy") {
2804
+ ephemeralMessagePresent = true;
2805
+ setGiphyPreviewMessage(message);
2806
+ continue;
2807
+ }
2808
+ const changes = [];
2809
+ const messageDate = message.created_at && isDate(message.created_at) && message.created_at.toDateString() || "";
2810
+ const previousMessage = messages[i - 1];
2811
+ let prevMessageDate = messageDate;
2812
+ if (enableDateSeparator && previousMessage?.created_at && isDate(previousMessage.created_at)) prevMessageDate = previousMessage.created_at.toDateString();
2813
+ if (!unread && !hideNewMessageSeparator) {
2814
+ unread = lastRead && message.created_at && new Date(lastRead) < message.created_at || false;
2815
+ if (enableDateSeparator && unread && message.user?.id !== userId) changes.push({
2816
+ customType: CUSTOM_MESSAGE_TYPE.date,
2817
+ date: message.created_at,
2818
+ id: makeDateMessageId(message.created_at),
2819
+ unread
2820
+ });
2821
+ }
2822
+ if (enableDateSeparator && (i === 0 || messageDate !== prevMessageDate || hideDeletedMessages && previousMessage?.type === "deleted" && lastDateSeparator !== messageDate) && !isDateSeparatorMessage(changes[changes.length - 1])) {
2823
+ lastDateSeparator = messageDate;
2824
+ changes.push({
2825
+ customType: CUSTOM_MESSAGE_TYPE.date,
2826
+ date: message.created_at,
2827
+ id: makeDateMessageId(message.created_at)
2828
+ }, message);
2829
+ } else changes.push(message);
2830
+ newMessages.push(...reviewProcessedMessage?.({
2831
+ changes,
2832
+ context,
2833
+ index: i,
2834
+ messages,
2835
+ processedMessages: newMessages
2836
+ }) || changes);
2837
+ }
2838
+ if (setGiphyPreviewMessage && !ephemeralMessagePresent) setGiphyPreviewMessage(void 0);
2839
+ return newMessages;
2840
+ };
2841
+ var makeIntroMessage = () => ({
2842
+ customType: CUSTOM_MESSAGE_TYPE.intro,
2843
+ id: nanoid()
2844
+ });
2845
+ var makeDateMessageId = (date) => {
2846
+ let idSuffix;
2847
+ try {
2848
+ idSuffix = !date ? nanoid() : date instanceof Date ? date.toISOString() : date;
2849
+ } catch (e) {
2850
+ idSuffix = nanoid();
2851
+ }
2852
+ return `${CUSTOM_MESSAGE_TYPE.date}-${idSuffix}`;
2853
+ };
2854
+ var getLastReceived = (messages) => {
2855
+ for (let i = messages.length - 1; i > 0; i -= 1) if (messages[i].status === "received") return messages[i].id;
2856
+ return null;
2857
+ };
2858
+ var insertIntro = (messages, headerPosition) => {
2859
+ const newMessages = messages;
2860
+ const intro = makeIntroMessage();
2861
+ if (!headerPosition) {
2862
+ newMessages.unshift(intro);
2863
+ return newMessages;
2864
+ }
2865
+ if (!newMessages.length) {
2866
+ newMessages.unshift(intro);
2867
+ return newMessages;
2868
+ }
2869
+ for (let i = 0; i < messages.length; i += 1) {
2870
+ const messageTime = isDate(messages[i].created_at) ? messages[i].created_at.getTime() : null;
2871
+ const nextMessageTime = isDate(messages[i + 1].created_at) ? messages[i + 1].created_at.getTime() : null;
2872
+ if (messageTime && messageTime < headerPosition) if (nextMessageTime && nextMessageTime < headerPosition) {
2873
+ if (messages[i + 1] && isDateSeparatorMessage(messages[i + 1])) continue;
2874
+ if (!nextMessageTime) {
2875
+ newMessages.push(intro);
2876
+ return newMessages;
2877
+ }
2878
+ } else {
2879
+ newMessages.splice(i + 1, 0, intro);
2880
+ return newMessages;
2881
+ }
2882
+ }
2883
+ return newMessages;
2884
+ };
2885
+ var isNonEmptyRecord = (record) => {
2886
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key)) return true;
2887
+ return false;
2888
+ };
2889
+ var getGroupStyles = (message, previousMessage, nextMessage, noGroupByUser, maxTimeBetweenGroupedMessages) => {
2890
+ if (isDateSeparatorMessage(message) || isIntroMessage(message)) return "";
2891
+ if (noGroupByUser || message.attachments?.length !== 0) return "single";
2892
+ const isTopMessage = !previousMessage || isIntroMessage(previousMessage) || isDateSeparatorMessage(previousMessage) || previousMessage.type === "system" || previousMessage.type === "error" || previousMessage.attachments?.length !== 0 || message.user?.id !== previousMessage.user?.id || message.reaction_groups && isNonEmptyRecord(message.reaction_groups) || isMessageEdited(previousMessage) || maxTimeBetweenGroupedMessages !== void 0 && previousMessage.created_at && message.created_at && new Date(message.created_at).getTime() - new Date(previousMessage.created_at).getTime() > maxTimeBetweenGroupedMessages;
2893
+ const isBottomMessage = !nextMessage || isIntroMessage(nextMessage) || isDateSeparatorMessage(nextMessage) || nextMessage.type === "system" || nextMessage.type === "error" || nextMessage.attachments?.length !== 0 || message.user?.id !== nextMessage.user?.id || nextMessage.reaction_groups && isNonEmptyRecord(nextMessage.reaction_groups) || isMessageEdited(message) || maxTimeBetweenGroupedMessages !== void 0 && nextMessage.created_at && message.created_at && new Date(nextMessage.created_at).getTime() - new Date(message.created_at).getTime() > maxTimeBetweenGroupedMessages;
2894
+ if (!isTopMessage && !isBottomMessage) {
2895
+ if (message.type === "error") return "single";
2896
+ return "middle";
2897
+ }
2898
+ if (isBottomMessage) {
2899
+ if (isTopMessage || message.type === "error") return "single";
2900
+ return "bottom";
2901
+ }
2902
+ if (isTopMessage) return "top";
2903
+ return "";
2904
+ };
2905
+ var hasMoreMessagesProbably = (returnedCountMessages, limit) => returnedCountMessages >= limit;
2906
+ function isIntroMessage(message) {
2907
+ return message.customType === CUSTOM_MESSAGE_TYPE.intro;
2908
+ }
2909
+ function isDateSeparatorMessage(message) {
2910
+ return message !== null && typeof message === "object" && message.customType === CUSTOM_MESSAGE_TYPE.date && isDate(message.date);
2911
+ }
2912
+ function isLocalMessage(message) {
2913
+ return !isDateSeparatorMessage(message) && !isIntroMessage(message);
2914
+ }
2915
+ var getIsFirstUnreadMessage = ({ firstUnreadMessageId, isFirstMessage, lastReadDate, lastReadMessageId, message, previousMessage, unreadMessageCount = 0 }) => {
2916
+ if (message.parent_id) return false;
2917
+ const createdAtTimestamp = message.created_at && new Date(message.created_at).getTime();
2918
+ const lastReadTimestamp = lastReadDate?.getTime();
2919
+ const messageIsUnread = !!createdAtTimestamp && !!lastReadTimestamp && createdAtTimestamp > lastReadTimestamp;
2920
+ const previousMessageIsLastRead = !!lastReadMessageId && lastReadMessageId === previousMessage?.id;
2921
+ return firstUnreadMessageId === message.id || !!unreadMessageCount && messageIsUnread && (isFirstMessage || previousMessageIsLastRead);
2922
+ };
2923
+ //#endregion
2924
+ //#region src/components/Channel/hooks/useChannelContainerClasses.ts
2925
+ var useImageFlagEmojisOnWindowsClass = () => {
2926
+ const { useImageFlagEmojisOnWindows } = useChatContext("Channel");
2927
+ return useImageFlagEmojisOnWindows && navigator.userAgent.match(/Win/) ? "str-chat--windows-flags" : "";
2928
+ };
2929
+ var getChatContainerClass = (customClass) => customClass ?? "str-chat__container";
2930
+ var useChannelContainerClasses = ({ customClasses }) => {
2931
+ const windowsEmojiClass = useImageFlagEmojisOnWindowsClass();
2932
+ return {
2933
+ channelClass: customClasses?.channel ?? "str-chat__channel",
2934
+ chatClass: customClasses?.chat ?? "str-chat",
2935
+ chatContainerClass: getChatContainerClass(customClasses?.chatContainer),
2936
+ windowsEmojiClass
2937
+ };
2938
+ };
2939
+ //#endregion
2940
+ //#region src/components/Channel/utils.ts
2941
+ /**
2942
+ * Utility function for jumpToFirstUnreadMessage
2943
+ * @param targetId
2944
+ * @param msgSet
2945
+ */
2946
+ var findInMsgSetById = (targetId, msgSet) => {
2947
+ for (let i = msgSet.length - 1; i >= 0; i--) {
2948
+ const item = msgSet[i];
2949
+ if (item.id === targetId) return {
2950
+ index: i,
2951
+ target: item
2952
+ };
2953
+ }
2954
+ return { index: -1 };
2955
+ };
2956
+ /**
2957
+ * Utility function for jumpToFirstUnreadMessage
2958
+ * @param targetDate
2959
+ * @param msgSet
2960
+ * @param exact
2961
+ */
2962
+ var findInMsgSetByDate = (targetDate, msgSet, exact = false) => {
2963
+ const targetTimestamp = targetDate.getTime();
2964
+ let left = 0;
2965
+ let middle = 0;
2966
+ let right = msgSet.length - 1;
2967
+ while (left <= right) {
2968
+ middle = Math.floor((right + left) / 2);
2969
+ const middleTimestamp = new Date(msgSet[middle].created_at).getTime();
2970
+ const middleLeftTimestamp = msgSet[middle - 1]?.created_at && new Date(msgSet[middle - 1].created_at).getTime();
2971
+ const middleRightTimestamp = msgSet[middle + 1]?.created_at && new Date(msgSet[middle + 1].created_at).getTime();
2972
+ if (middleTimestamp === targetTimestamp || middleLeftTimestamp && middleRightTimestamp && middleLeftTimestamp < targetTimestamp && targetTimestamp < middleRightTimestamp) return {
2973
+ index: middle,
2974
+ target: msgSet[middle]
2975
+ };
2976
+ if (middleTimestamp < targetTimestamp) left = middle + 1;
2977
+ else right = middle - 1;
2978
+ }
2979
+ if (!exact || new Date(msgSet[left].created_at).getTime() === targetTimestamp) return {
2980
+ index: left,
2981
+ target: msgSet[left]
2982
+ };
2983
+ return { index: -1 };
2984
+ };
2985
+ /**
2986
+ * Compatibility adapter:
2987
+ * LocalMessage.error expects ErrorFromResponse<APIErrorResponse>, but some transport failures
2988
+ * (for example Axios ERR_NETWORK while offline) do not have an HTTP response payload.
2989
+ */
2990
+ var adaptMessageSendErrorToErrorFromResponse = (error) => {
2991
+ if (error instanceof ErrorFromResponse) return error;
2992
+ let message = error instanceof Error ? error.message : "Message send failed";
2993
+ let status = 0;
2994
+ let code = null;
2995
+ if (typeof error === "object" && error !== null) {
2996
+ const maybeAxiosError = error;
2997
+ if (maybeAxiosError.name === "AxiosError" && maybeAxiosError.code === "ERR_NETWORK") {
2998
+ message = typeof maybeAxiosError.message === "string" ? maybeAxiosError.message : "Network Error";
2999
+ status = maybeAxiosError.response?.status ?? 0;
3000
+ return new ErrorFromResponse(message, {
3001
+ code: null,
3002
+ response: maybeAxiosError.response ?? {
3003
+ data: {
3004
+ duration: "",
3005
+ message,
3006
+ more_info: "",
3007
+ StatusCode: status
3008
+ },
3009
+ status
3010
+ },
3011
+ status
3012
+ });
3013
+ }
3014
+ try {
3015
+ const stringError = JSON.stringify(error);
3016
+ const parsedError = stringError ? JSON.parse(stringError) : {};
3017
+ if (typeof parsedError.message === "string") message = parsedError.message;
3018
+ if (typeof parsedError.status === "number") status = parsedError.status;
3019
+ if (typeof parsedError.code === "number") code = parsedError.code;
3020
+ } catch {}
3021
+ }
3022
+ return new ErrorFromResponse(message, {
3023
+ code,
3024
+ response: {
3025
+ data: {
3026
+ duration: "",
3027
+ message,
3028
+ more_info: "",
3029
+ StatusCode: status
3030
+ },
3031
+ status
3032
+ },
3033
+ status
3034
+ });
3035
+ };
3036
+ //#endregion
3037
+ //#region src/utils/getChannel.ts
3038
+ /**
3039
+ * prevent from duplicate invocation of channel.watch()
3040
+ * when events 'notification.message_new' and 'notification.added_to_channel' arrive at the same time
3041
+ */
3042
+ var WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL = {};
3043
+ /**
3044
+ * Calls channel.watch() if it was not already recently called. Waits for watch promise to resolve even if it was invoked previously.
3045
+ * @param client
3046
+ * @param members
3047
+ * @param options
3048
+ * @param type
3049
+ * @param id
3050
+ * @param channel
3051
+ */
3052
+ var getChannel = async ({ channel, client, id, members, options, type }) => {
3053
+ if (!channel && !type) throw new Error("Channel or channel type have to be provided to query a channel.");
3054
+ const theChannel = channel || client.channel(type, id, { members });
3055
+ const originalCid = theChannel?.id ? theChannel.cid : members && members.length ? generateChannelTempCid(theChannel.type, members) : void 0;
3056
+ if (!originalCid) throw new Error("Channel ID or channel members array have to be provided to query a channel.");
3057
+ const queryPromise = WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
3058
+ if (queryPromise) await queryPromise;
3059
+ else try {
3060
+ WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid] = theChannel.watch(options);
3061
+ await WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
3062
+ } finally {
3063
+ delete WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
3064
+ }
3065
+ return theChannel;
3066
+ };
3067
+ var generateChannelTempCid = (channelType, members) => {
3068
+ if (!members) return;
3069
+ return `${channelType}:!members-${[...members].sort().join(",")}`;
3070
+ };
3071
+ //#endregion
3072
+ //#region src/components/Attachment/attachment-sizing.tsx
3073
+ var getImageAttachmentConfiguration = (attachment, element) => {
3074
+ let newUrl = void 0;
3075
+ const urlToTest = attachment.image_url || attachment.thumb_url || "";
3076
+ if (linkify.test(urlToTest, "url")) {
3077
+ const url = new URL(urlToTest);
3078
+ const resizeDimensions = getSizingRestrictions(url, element);
3079
+ if (resizeDimensions) {
3080
+ resizeDimensions.height *= 2;
3081
+ resizeDimensions.width *= 2;
3082
+ addResizingParamsToUrl(resizeDimensions, url);
3083
+ }
3084
+ newUrl = url.href;
3085
+ }
3086
+ return { url: newUrl || "" };
3087
+ };
3088
+ var getVideoAttachmentConfiguration = (attachment, element, shouldGenerateVideoThumbnail) => {
3089
+ let thumbUrl = void 0;
3090
+ if (attachment.thumb_url && shouldGenerateVideoThumbnail && linkify.test(attachment.thumb_url, "url")) {
3091
+ const url = new URL(attachment.thumb_url);
3092
+ const resizeDimensions = getSizingRestrictions(url, element);
3093
+ if (resizeDimensions) {
3094
+ resizeDimensions.height *= 2;
3095
+ resizeDimensions.width *= 2;
3096
+ addResizingParamsToUrl(resizeDimensions, url);
3097
+ }
3098
+ thumbUrl = url.href;
3099
+ }
3100
+ return {
3101
+ thumbUrl,
3102
+ url: attachment.asset_url || ""
3103
+ };
3104
+ };
3105
+ var getSizingRestrictions = (url, htmlElement) => {
3106
+ const urlParams = url.searchParams;
3107
+ const originalHeight = Number(urlParams.get("oh")) || 1;
3108
+ const originalWidth = Number(urlParams.get("ow")) || 1;
3109
+ const cssSizeRestriction = getCSSSizeRestrictions(htmlElement);
3110
+ let resizeDimensions;
3111
+ if ((cssSizeRestriction.maxHeight || cssSizeRestriction.height) && cssSizeRestriction.maxWidth) resizeDimensions = getResizeDimensions(originalHeight, originalWidth, cssSizeRestriction.maxHeight || cssSizeRestriction.height, cssSizeRestriction.maxWidth);
3112
+ else resizeDimensions = void 0;
3113
+ return resizeDimensions;
3114
+ };
3115
+ var getResizeDimensions = (originalHeight, originalWidth, maxHeight, maxWidth) => ({
3116
+ height: Math.round(Math.max(maxHeight, maxWidth / originalWidth * originalHeight)),
3117
+ width: Math.round(Math.max(maxHeight, maxWidth / originalHeight * originalWidth))
3118
+ });
3119
+ var getCSSSizeRestrictions = (htmlElement) => {
3120
+ const computedStylesheet = getComputedStyle(htmlElement);
3121
+ const height = getValueRepresentationOfCSSProperty(computedStylesheet.getPropertyValue("height"));
3122
+ const maxHeight = getValueRepresentationOfCSSProperty(computedStylesheet.getPropertyValue("max-height"));
3123
+ const maxWidth = getValueRepresentationOfCSSProperty(computedStylesheet.getPropertyValue("max-width"));
3124
+ if (!((height || maxHeight) && maxWidth)) console.warn(`Invalid value set for height/max-height and/or max-width for HTML element, this can cause scrolling issues inside the message list, more info https://getstream.io/chat/docs/sdk/react/message-components/attachment/#image-and-video-sizing`);
3125
+ return {
3126
+ height,
3127
+ maxHeight,
3128
+ maxWidth
3129
+ };
3130
+ };
3131
+ var getValueRepresentationOfCSSProperty = (property) => {
3132
+ if (!property.endsWith("px")) return;
3133
+ const number = parseFloat(property);
3134
+ return isNaN(number) ? void 0 : number;
3135
+ };
3136
+ var addResizingParamsToUrl = (resizeDimensions, url) => {
3137
+ url.searchParams.set("h", resizeDimensions.height.toString());
3138
+ url.searchParams.set("w", resizeDimensions.width.toString());
3139
+ };
3140
+ //#endregion
3141
+ //#region src/components/Search/hooks/useSearchFocusedMessage.ts
3142
+ var searchControllerStateSelector = (nextValue) => ({ focusedMessage: nextValue.focusedMessage });
3143
+ var useSearchFocusedMessage = () => {
3144
+ const { searchController } = useChatContext("Channel");
3145
+ const { focusedMessage } = useStateStore(searchController._internalState, searchControllerStateSelector);
3146
+ return focusedMessage;
3147
+ };
3148
+ //#endregion
3149
+ //#region src/components/Channel/Channel.tsx
3150
+ var ChannelContainer = ({ children, className: additionalClassName, ...props }) => {
3151
+ const { customClasses, theme } = useChatContext("Channel");
3152
+ const { channelClass, chatClass } = useChannelContainerClasses({ customClasses });
3153
+ const className = clsx(chatClass, theme, channelClass, additionalClassName);
3154
+ return /* @__PURE__ */ jsx("div", {
3155
+ id: CHANNEL_CONTAINER_ID,
3156
+ ...props,
3157
+ className,
3158
+ children
3159
+ });
3160
+ };
3161
+ var UnMemoizedChannel = (props) => {
3162
+ const { channel: propsChannel, EmptyPlaceholder } = props;
3163
+ const { EmptyStateIndicator: EmptyStateIndicator$2 = EmptyStateIndicator, LoadingErrorIndicator, LoadingIndicator = LoadingChannel } = useComponentContext("Channel");
3164
+ const { channel: contextChannel, channelsQueryState } = useChatContext("Channel");
3165
+ const channel = propsChannel || contextChannel;
3166
+ const emptyPlaceholder = "EmptyPlaceholder" in props ? EmptyPlaceholder : EmptyStateIndicator$2 && /* @__PURE__ */ jsx(EmptyStateIndicator$2, { listType: "message" });
3167
+ if (channelsQueryState.queryInProgress === "reload" && LoadingIndicator) return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingIndicator, {}) });
3168
+ if (channelsQueryState.error && !channel && LoadingErrorIndicator) return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingErrorIndicator, { error: channelsQueryState.error }) });
3169
+ if (channelsQueryState.error && !channel) return /* @__PURE__ */ jsx(ChannelContainer, {});
3170
+ if (!channel?.cid) return /* @__PURE__ */ jsx(ChannelContainer, { children: emptyPlaceholder });
3171
+ return /* @__PURE__ */ createElement(ChannelInner, {
3172
+ ...props,
3173
+ channel,
3174
+ key: channel.cid
3175
+ });
3176
+ };
3177
+ var ChannelInner = (props) => {
3178
+ const { activeUnreadHandler, allowConcurrentAudioPlayback, channel, channelQueryOptions, children, doDeleteMessageRequest, doMarkReadRequest, doSendMessageRequest, doUpdateMessageRequest, initializeOnMount = true, markReadOnMount = true, onMentionsClick, onMentionsHover, skipMessageDataMemoization } = props;
3179
+ const { LoadingErrorIndicator: LoadingErrorIndicator$1 = LoadingErrorIndicator, LoadingIndicator = LoadingChannel } = useComponentContext();
3180
+ const { client, customClasses, latestMessageDatesByChannels, mutes, searchController } = useChatContext("Channel");
3181
+ const { addNotification } = useNotificationApi();
3182
+ const { t } = useTranslationContext("Channel");
3183
+ const chatContainerClass = getChatContainerClass(customClasses?.chatContainer);
3184
+ const windowsEmojiClass = useImageFlagEmojisOnWindowsClass();
3185
+ const thread = useThreadContext();
3186
+ const [channelConfig, setChannelConfig] = useState(channel.getConfig());
3187
+ const [channelUnreadUiState, _setChannelUnreadUiState] = useState();
3188
+ const [state, dispatch] = useReducer(useMemo(() => makeChannelReducer(), []), {
3189
+ ...initialState,
3190
+ hasMore: channel.state.messagePagination.hasPrev,
3191
+ loading: !channel.initialized,
3192
+ messages: channel.state.messages
3193
+ });
3194
+ const jumpToMessageFromSearch = useSearchFocusedMessage();
3195
+ const isMounted = useIsMounted();
3196
+ const originalTitle = useRef("");
3197
+ const lastRead = useRef(void 0);
3198
+ const online = useRef(true);
3199
+ const clearHighlightedMessageTimeoutId = useRef(null);
3200
+ const channelCapabilitiesArray = channel.data?.own_capabilities;
3201
+ const throttledCopyStateFromChannel = useMemo(() => throttle(() => dispatch({
3202
+ channel,
3203
+ type: "copyStateFromChannelOnEvent"
3204
+ }), 500, {
3205
+ leading: true,
3206
+ trailing: true
3207
+ }), [channel]);
3208
+ const setChannelUnreadUiState = useMemo(() => throttle(_setChannelUnreadUiState, 200, {
3209
+ leading: true,
3210
+ trailing: false
3211
+ }), []);
3212
+ const markRead = useMemo(() => throttle(async (options) => {
3213
+ const { updateChannelUiUnreadState = true } = options ?? {};
3214
+ if (channel.disconnected || !channelConfig?.read_events) return;
3215
+ lastRead.current = /* @__PURE__ */ new Date();
3216
+ try {
3217
+ if (doMarkReadRequest) doMarkReadRequest(channel, updateChannelUiUnreadState ? setChannelUnreadUiState : void 0);
3218
+ else {
3219
+ const markReadResponse = await channel.markRead();
3220
+ if (updateChannelUiUnreadState && markReadResponse?.event) _setChannelUnreadUiState({
3221
+ last_read: lastRead.current,
3222
+ last_read_message_id: markReadResponse.event.last_read_message_id,
3223
+ unread_messages: 0
3224
+ });
3225
+ }
3226
+ if (activeUnreadHandler) activeUnreadHandler(0, originalTitle.current);
3227
+ else if (originalTitle.current) document.title = originalTitle.current;
3228
+ } catch (e) {
3229
+ console.error(t("Failed to mark channel as read"));
3230
+ }
3231
+ }, 500, {
3232
+ leading: true,
3233
+ trailing: false
3234
+ }), [
3235
+ activeUnreadHandler,
3236
+ channel,
3237
+ channelConfig,
3238
+ doMarkReadRequest,
3239
+ setChannelUnreadUiState,
3240
+ t
3241
+ ]);
3242
+ const handleEvent = async (event) => {
3243
+ if (event.message) dispatch({
3244
+ channel,
3245
+ message: event.message,
3246
+ type: "updateThreadOnEvent"
3247
+ });
3248
+ if (event.type === "user.messages.deleted" && event.cid && event.cid !== channel.cid) return;
3249
+ if (event.type === "user.watching.start" || event.type === "user.watching.stop") return;
3250
+ if (event.type === "typing.start" || event.type === "typing.stop") return dispatch({
3251
+ channel,
3252
+ type: "setTyping"
3253
+ });
3254
+ if (event.type === "connection.changed" && typeof event.online === "boolean") online.current = event.online;
3255
+ if (event.type === "message.new") {
3256
+ if (!event.message?.parent_id || event.message?.show_in_channel) {
3257
+ if (document.hidden && channelConfig?.read_events && !channel.muteStatus().muted) {
3258
+ const unread = channel.countUnread(lastRead.current);
3259
+ if (activeUnreadHandler) activeUnreadHandler(unread, originalTitle.current);
3260
+ else document.title = `(${unread}) ${originalTitle.current}`;
3261
+ }
3262
+ }
3263
+ if (event.message?.user?.id === client.userID && event?.message?.created_at && event?.message?.cid) {
3264
+ const messageDate = new Date(event.message.created_at);
3265
+ const cid = event.message.cid;
3266
+ if (!latestMessageDatesByChannels[cid] || latestMessageDatesByChannels[cid].getTime() < messageDate.getTime()) latestMessageDatesByChannels[cid] = messageDate;
3267
+ }
3268
+ }
3269
+ if (event.type === "user.deleted") {
3270
+ const oldestID = channel.state?.messages?.[0]?.id;
3271
+ /**
3272
+ * As the channel state is not normalized we re-fetch the channel data. Thus, we avoid having to search for user references in the channel state.
3273
+ */
3274
+ await channel.query({
3275
+ messages: {
3276
+ id_lt: oldestID,
3277
+ limit: 25
3278
+ },
3279
+ watchers: { limit: 25 }
3280
+ });
3281
+ }
3282
+ if (event.type === "notification.mark_unread") _setChannelUnreadUiState((prev) => {
3283
+ if (!(event.last_read_at && event.user)) return prev;
3284
+ return {
3285
+ first_unread_message_id: event.first_unread_message_id,
3286
+ last_read: new Date(event.last_read_at),
3287
+ last_read_message_id: event.last_read_message_id,
3288
+ unread_messages: event.unread_messages ?? 0
3289
+ };
3290
+ });
3291
+ if (event.type === "channel.truncated" && event.cid === channel.cid) _setChannelUnreadUiState(void 0);
3292
+ throttledCopyStateFromChannel();
3293
+ };
3294
+ useLayoutEffect(() => {
3295
+ let errored = false;
3296
+ let done = false;
3297
+ (async () => {
3298
+ if (!channel.initialized && initializeOnMount) try {
3299
+ const members = [];
3300
+ if (!channel.id && channel.data?.members) for (const member of channel.data.members) {
3301
+ let userId;
3302
+ if (typeof member === "string") userId = member;
3303
+ else if (typeof member === "object") {
3304
+ const { user, user_id } = member;
3305
+ userId = user_id || user?.id;
3306
+ }
3307
+ if (userId) members.push(userId);
3308
+ }
3309
+ await getChannel({
3310
+ channel,
3311
+ client,
3312
+ members,
3313
+ options: channelQueryOptions
3314
+ });
3315
+ setChannelConfig(channel.getConfig());
3316
+ } catch (e) {
3317
+ dispatch({
3318
+ error: e,
3319
+ type: "setError"
3320
+ });
3321
+ errored = true;
3322
+ }
3323
+ done = true;
3324
+ originalTitle.current = document.title;
3325
+ if (!errored) {
3326
+ dispatch({
3327
+ channel,
3328
+ hasMore: channel.state.messagePagination.hasPrev,
3329
+ type: "initStateFromChannel"
3330
+ });
3331
+ if (client.user?.id && channel.state.read[client.user.id]) {
3332
+ const { user, ...ownReadState } = channel.state.read[client.user.id];
3333
+ _setChannelUnreadUiState(ownReadState);
3334
+ }
3335
+ /**
3336
+ * TODO: maybe pass last_read to the countUnread method to get proper value
3337
+ * combined with channel.countUnread adjustment (_countMessageAsUnread)
3338
+ * to allow counting own messages too
3339
+ *
3340
+ * const lastRead = channel.state.read[client.userID as string].last_read;
3341
+ */
3342
+ if (channel.countUnread() > 0 && markReadOnMount) markRead({ updateChannelUiUnreadState: false });
3343
+ client.on("connection.changed", handleEvent);
3344
+ client.on("connection.recovered", handleEvent);
3345
+ client.on("user.updated", handleEvent);
3346
+ client.on("user.deleted", handleEvent);
3347
+ client.on("user.messages.deleted", handleEvent);
3348
+ channel.on(handleEvent);
3349
+ }
3350
+ })();
3351
+ return () => {
3352
+ if (errored || !done) return;
3353
+ channel?.off(handleEvent);
3354
+ client.off("connection.changed", handleEvent);
3355
+ client.off("connection.recovered", handleEvent);
3356
+ client.off("user.deleted", handleEvent);
3357
+ };
3358
+ }, [
3359
+ channel.cid,
3360
+ channelQueryOptions,
3361
+ doMarkReadRequest,
3362
+ channelConfig?.read_events,
3363
+ initializeOnMount
3364
+ ]);
3365
+ useEffect(() => {
3366
+ if (!state.thread) return;
3367
+ const message = state.messages?.find((m) => m.id === state.thread?.id);
3368
+ if (message) dispatch({
3369
+ message,
3370
+ type: "setThread"
3371
+ });
3372
+ }, [state.messages, state.thread]);
3373
+ const handleHighlightedMessageChange = useCallback(({ highlightDuration, highlightedMessageId }) => {
3374
+ dispatch({
3375
+ channel,
3376
+ highlightedMessageId,
3377
+ type: "jumpToMessageFinished"
3378
+ });
3379
+ if (clearHighlightedMessageTimeoutId.current) clearTimeout(clearHighlightedMessageTimeoutId.current);
3380
+ clearHighlightedMessageTimeoutId.current = setTimeout(() => {
3381
+ if (searchController._internalState.getLatestValue().focusedMessage) searchController._internalState.partialNext({ focusedMessage: void 0 });
3382
+ clearHighlightedMessageTimeoutId.current = null;
3383
+ dispatch({ type: "clearHighlightedMessage" });
3384
+ }, highlightDuration ?? 500);
3385
+ }, [channel, searchController]);
3386
+ useEffect(() => {
3387
+ if (!jumpToMessageFromSearch?.id) return;
3388
+ handleHighlightedMessageChange({ highlightedMessageId: jumpToMessageFromSearch.id });
3389
+ }, [jumpToMessageFromSearch, handleHighlightedMessageChange]);
3390
+ /** MESSAGE */
3391
+ const notifyJumpToFirstUnreadError = useCallback(() => {
3392
+ addNotification({
3393
+ context: { feature: "jumpToFirstUnread" },
3394
+ emitter: "Channel",
3395
+ message: t("Failed to jump to the first unread message"),
3396
+ severity: "error",
3397
+ targetPanels: ["channel"],
3398
+ type: "channel:jumpToFirstUnread:failed"
3399
+ });
3400
+ }, [addNotification, t]);
3401
+ const loadMoreFinished = useCallback(debounce((hasMore, messages) => {
3402
+ if (!isMounted.current) return;
3403
+ dispatch({
3404
+ hasMore,
3405
+ messages,
3406
+ type: "loadMoreFinished"
3407
+ });
3408
+ }, 2e3, {
3409
+ leading: true,
3410
+ trailing: true
3411
+ }), []);
3412
+ const finishLoadMore = useCallback((hasMore, messages) => {
3413
+ if (!isMounted.current) return;
3414
+ dispatch({
3415
+ hasMore,
3416
+ messages,
3417
+ type: "loadMoreFinished"
3418
+ });
3419
+ }, [isMounted]);
3420
+ const loadMore = async (limit = 25) => {
3421
+ if (!online.current || !window.navigator.onLine || !channel.state.messagePagination.hasPrev) return 0;
3422
+ const oldestMessage = state?.messages?.[0];
3423
+ if (state.loadingMore || state.loadingMoreNewer || oldestMessage?.status !== "received") return 0;
3424
+ dispatch({
3425
+ loadingMore: true,
3426
+ type: "setLoadingMore"
3427
+ });
3428
+ const oldestID = oldestMessage?.id;
3429
+ const perPage = limit;
3430
+ let queryResponse;
3431
+ try {
3432
+ queryResponse = await channel.query({
3433
+ messages: {
3434
+ id_lt: oldestID,
3435
+ limit: perPage
3436
+ },
3437
+ watchers: { limit: perPage }
3438
+ });
3439
+ } catch (e) {
3440
+ console.warn("message pagination request failed with error", e);
3441
+ dispatch({
3442
+ loadingMore: false,
3443
+ type: "setLoadingMore"
3444
+ });
3445
+ return 0;
3446
+ }
3447
+ loadMoreFinished.cancel();
3448
+ finishLoadMore(channel.state.messagePagination.hasPrev, channel.state.messages);
3449
+ return queryResponse.messages.length;
3450
+ };
3451
+ const loadMoreNewer = async (limit = 25) => {
3452
+ if (!online.current || !window.navigator.onLine || !channel.state.messagePagination.hasNext) return 0;
3453
+ const newestMessage = state?.messages?.[state?.messages?.length - 1];
3454
+ if (state.loadingMore || state.loadingMoreNewer) return 0;
3455
+ dispatch({
3456
+ loadingMoreNewer: true,
3457
+ type: "setLoadingMoreNewer"
3458
+ });
3459
+ const newestId = newestMessage?.id;
3460
+ const perPage = limit;
3461
+ let queryResponse;
3462
+ try {
3463
+ queryResponse = await channel.query({
3464
+ messages: {
3465
+ id_gt: newestId,
3466
+ limit: perPage
3467
+ },
3468
+ watchers: { limit: perPage }
3469
+ });
3470
+ } catch (e) {
3471
+ console.warn("message pagination request failed with error", e);
3472
+ dispatch({
3473
+ loadingMoreNewer: false,
3474
+ type: "setLoadingMoreNewer"
3475
+ });
3476
+ return 0;
3477
+ }
3478
+ dispatch({
3479
+ hasMoreNewer: channel.state.messagePagination.hasNext,
3480
+ messages: channel.state.messages,
3481
+ type: "loadMoreNewerFinished"
3482
+ });
3483
+ return queryResponse.messages.length;
3484
+ };
3485
+ const jumpToMessage = useCallback(async (messageId, messageLimit = 25, highlightDuration = 500) => {
3486
+ dispatch({
3487
+ loadingMoreForJumpToChannelMessage: true,
3488
+ type: "setLoadingMoreForJumpToChannelMessage"
3489
+ });
3490
+ loadMoreFinished.cancel();
3491
+ try {
3492
+ await channel.state.loadMessageIntoState(messageId, void 0, messageLimit);
3493
+ handleHighlightedMessageChange({
3494
+ highlightDuration,
3495
+ highlightedMessageId: messageId
3496
+ });
3497
+ } catch (error) {
3498
+ dispatch({
3499
+ loadingMoreForJumpToChannelMessage: false,
3500
+ type: "setLoadingMoreForJumpToChannelMessage"
3501
+ });
3502
+ throw error;
3503
+ }
3504
+ }, [
3505
+ channel,
3506
+ handleHighlightedMessageChange,
3507
+ loadMoreFinished
3508
+ ]);
3509
+ const jumpToLatestMessage = useCallback(async () => {
3510
+ loadMoreFinished.cancel();
3511
+ await channel.state.loadMessageIntoState("latest");
3512
+ dispatch({
3513
+ hasMore: channel.state.messagePagination.hasPrev,
3514
+ hasMoreNewer: channel.state.messagePagination.hasNext,
3515
+ messages: channel.state.messages,
3516
+ type: "jumpToLatestMessageFinished"
3517
+ });
3518
+ }, [channel, loadMoreFinished]);
3519
+ const jumpToFirstUnreadMessage = useCallback(async (queryMessageLimit = 25, highlightDuration = 500) => {
3520
+ if (!channelUnreadUiState?.unread_messages) return;
3521
+ let lastReadMessageId = channelUnreadUiState?.last_read_message_id;
3522
+ let firstUnreadMessageId = channelUnreadUiState?.first_unread_message_id;
3523
+ let isInCurrentMessageSet = false;
3524
+ if (firstUnreadMessageId) isInCurrentMessageSet = findInMsgSetById(firstUnreadMessageId, channel.state.messages).index !== -1;
3525
+ else if (lastReadMessageId) {
3526
+ const result = findInMsgSetById(lastReadMessageId, channel.state.messages);
3527
+ isInCurrentMessageSet = !!result.target;
3528
+ firstUnreadMessageId = result.index > -1 ? channel.state.messages[result.index + 1]?.id : void 0;
3529
+ } else {
3530
+ const lastReadTimestamp = channelUnreadUiState.last_read.getTime();
3531
+ const { index: lastReadMessageIndex, target: lastReadMessage } = findInMsgSetByDate(channelUnreadUiState.last_read, channel.state.messages, true);
3532
+ if (lastReadMessage) {
3533
+ firstUnreadMessageId = channel.state.messages[lastReadMessageIndex + 1]?.id;
3534
+ isInCurrentMessageSet = !!firstUnreadMessageId;
3535
+ lastReadMessageId = lastReadMessage.id;
3536
+ } else {
3537
+ dispatch({
3538
+ loadingMore: true,
3539
+ type: "setLoadingMore"
3540
+ });
3541
+ let messages;
3542
+ try {
3543
+ messages = (await channel.query({ messages: {
3544
+ created_at_around: channelUnreadUiState.last_read.toISOString(),
3545
+ limit: queryMessageLimit
3546
+ } }, "new")).messages;
3547
+ } catch (e) {
3548
+ notifyJumpToFirstUnreadError();
3549
+ finishLoadMore(channel.state.messagePagination.hasPrev, channel.state.messages);
3550
+ return;
3551
+ }
3552
+ const firstMessageWithCreationDate = messages.find((msg) => msg.created_at);
3553
+ if (!firstMessageWithCreationDate) {
3554
+ notifyJumpToFirstUnreadError();
3555
+ finishLoadMore(channel.state.messagePagination.hasPrev, channel.state.messages);
3556
+ return;
3557
+ }
3558
+ if (lastReadTimestamp < new Date(firstMessageWithCreationDate.created_at).getTime()) firstUnreadMessageId = firstMessageWithCreationDate.id;
3559
+ else lastReadMessageId = findInMsgSetByDate(channelUnreadUiState.last_read, messages).target?.id;
3560
+ finishLoadMore(channel.state.messagePagination.hasPrev, channel.state.messages);
3561
+ }
3562
+ }
3563
+ if (!firstUnreadMessageId && !lastReadMessageId) {
3564
+ notifyJumpToFirstUnreadError();
3565
+ return;
3566
+ }
3567
+ if (!isInCurrentMessageSet) {
3568
+ dispatch({
3569
+ loadingMore: true,
3570
+ type: "setLoadingMore"
3571
+ });
3572
+ try {
3573
+ const targetId = firstUnreadMessageId ?? lastReadMessageId;
3574
+ await channel.state.loadMessageIntoState(targetId, void 0, queryMessageLimit);
3575
+ /**
3576
+ * if the index of the last read message on the page is beyond the half of the page,
3577
+ * we have arrived to the oldest page of the channel
3578
+ */
3579
+ const indexOfTarget = channel.state.messages.findIndex((message) => message.id === targetId);
3580
+ finishLoadMore(channel.state.messagePagination.hasPrev, channel.state.messages);
3581
+ firstUnreadMessageId = firstUnreadMessageId ?? channel.state.messages[indexOfTarget + 1]?.id;
3582
+ } catch (e) {
3583
+ notifyJumpToFirstUnreadError();
3584
+ finishLoadMore(channel.state.messagePagination.hasPrev, channel.state.messages);
3585
+ return;
3586
+ }
3587
+ }
3588
+ if (!firstUnreadMessageId) {
3589
+ notifyJumpToFirstUnreadError();
3590
+ return;
3591
+ }
3592
+ if (!channelUnreadUiState.first_unread_message_id) _setChannelUnreadUiState({
3593
+ ...channelUnreadUiState,
3594
+ first_unread_message_id: firstUnreadMessageId,
3595
+ last_read_message_id: lastReadMessageId
3596
+ });
3597
+ handleHighlightedMessageChange({
3598
+ highlightDuration,
3599
+ highlightedMessageId: firstUnreadMessageId
3600
+ });
3601
+ }, [
3602
+ channel,
3603
+ finishLoadMore,
3604
+ handleHighlightedMessageChange,
3605
+ notifyJumpToFirstUnreadError,
3606
+ channelUnreadUiState
3607
+ ]);
3608
+ const deleteMessage = useCallback(async (message, options) => {
3609
+ if (!message?.id) throw new Error("Cannot delete a message - missing message ID.");
3610
+ let deletedMessage;
3611
+ if (doDeleteMessageRequest) deletedMessage = await doDeleteMessageRequest(message, options);
3612
+ else deletedMessage = (await client.deleteMessage(message.id, options)).message;
3613
+ return deletedMessage;
3614
+ }, [client, doDeleteMessageRequest]);
3615
+ const updateMessage = (updatedMessage) => {
3616
+ channel.state.addMessageSorted(updatedMessage, true);
3617
+ dispatch({
3618
+ channel,
3619
+ parentId: state.thread && updatedMessage.parent_id,
3620
+ type: "copyMessagesFromChannel"
3621
+ });
3622
+ };
3623
+ const doSendMessage = async ({ localMessage, message, options }) => {
3624
+ try {
3625
+ let messageResponse;
3626
+ if (doSendMessageRequest) messageResponse = await doSendMessageRequest(channel, message, options);
3627
+ else messageResponse = await channel.sendMessage(message, options);
3628
+ let existingMessage = void 0;
3629
+ for (let i = channel.state.messages.length - 1; i >= 0; i--) {
3630
+ const msg = channel.state.messages[i];
3631
+ if (msg.id && msg.id === message.id) {
3632
+ existingMessage = msg;
3633
+ break;
3634
+ }
3635
+ }
3636
+ const responseIsTheNewest = new Date(messageResponse?.message?.updated_at || 0).getTime() > (existingMessage?.updated_at?.getTime() || 0);
3637
+ if (messageResponse?.message && (responseIsTheNewest || existingMessage?.status === "sending")) updateMessage({
3638
+ ...messageResponse.message,
3639
+ status: "received"
3640
+ });
3641
+ } catch (error) {
3642
+ const parsedError = adaptMessageSendErrorToErrorFromResponse(error);
3643
+ if (parsedError.code === 4 && error instanceof Error && error.message.includes("already exists")) updateMessage({
3644
+ ...localMessage,
3645
+ status: "received"
3646
+ });
3647
+ else {
3648
+ updateMessage({
3649
+ ...localMessage,
3650
+ error: parsedError,
3651
+ status: "failed"
3652
+ });
3653
+ thread?.upsertReplyLocally({ message: {
3654
+ ...localMessage,
3655
+ error: parsedError,
3656
+ status: "failed"
3657
+ } });
3658
+ }
3659
+ }
3660
+ };
3661
+ const sendMessage = async ({ localMessage, message, options }) => {
3662
+ channel.state.filterErrorMessages();
3663
+ thread?.upsertReplyLocally({ message: localMessage });
3664
+ updateMessage(localMessage);
3665
+ await doSendMessage({
3666
+ localMessage,
3667
+ message,
3668
+ options
3669
+ });
3670
+ };
3671
+ const retrySendMessage = async (localMessage) => {
3672
+ /**
3673
+ * If type is not checked, and we for example send message.type === 'error',
3674
+ * then request fails with error: "message.type must be one of ['' regular system]".
3675
+ * For now, we re-send any other type to prevent breaking behavior.
3676
+ */
3677
+ const type = localMessage.type === "error" ? "regular" : localMessage.type;
3678
+ updateMessage({
3679
+ ...localMessage,
3680
+ error: void 0,
3681
+ status: "sending",
3682
+ type
3683
+ });
3684
+ await doSendMessage({
3685
+ localMessage,
3686
+ message: localMessageToNewMessagePayload({
3687
+ ...localMessage,
3688
+ type
3689
+ })
3690
+ });
3691
+ };
3692
+ const removeMessage = (message) => {
3693
+ channel.state.removeMessage(message);
3694
+ dispatch({
3695
+ channel,
3696
+ parentId: state.thread && message.parent_id,
3697
+ type: "copyMessagesFromChannel"
3698
+ });
3699
+ };
3700
+ /** THREAD */
3701
+ const openThread = (message, event) => {
3702
+ event?.preventDefault();
3703
+ dispatch({
3704
+ channel,
3705
+ message,
3706
+ type: "openThread"
3707
+ });
3708
+ };
3709
+ const closeThread = (event) => {
3710
+ event?.preventDefault();
3711
+ dispatch({ type: "closeThread" });
3712
+ };
3713
+ const loadMoreThreadFinished = useCallback(debounce((threadHasMore, threadMessages) => {
3714
+ dispatch({
3715
+ threadHasMore,
3716
+ threadMessages,
3717
+ type: "loadMoreThreadFinished"
3718
+ });
3719
+ }, 2e3, {
3720
+ leading: true,
3721
+ trailing: true
3722
+ }), []);
3723
+ const loadMoreThread = async (limit = 25) => {
3724
+ if (state.threadLoadingMore || !state.thread || !state.threadHasMore) return;
3725
+ dispatch({ type: "startLoadingThread" });
3726
+ const parentId = state.thread.id;
3727
+ if (!parentId) return dispatch({ type: "closeThread" });
3728
+ const oldMessages = channel.state.threads[parentId] || [];
3729
+ const oldestMessageId = oldMessages[0]?.id;
3730
+ try {
3731
+ loadMoreThreadFinished(hasMoreMessagesProbably((await channel.getReplies(parentId, {
3732
+ id_lt: oldestMessageId,
3733
+ limit
3734
+ })).messages.length, limit), channel.state.threads[parentId] || []);
3735
+ } catch (e) {
3736
+ loadMoreThreadFinished(false, oldMessages);
3737
+ }
3738
+ };
3739
+ const onMentionsHoverOrClick = useMentionsHandlers(onMentionsHover, onMentionsClick);
3740
+ const editMessage = useEditMessageHandler(doUpdateMessageRequest);
3741
+ const { typing, ...restState } = state;
3742
+ const channelStateContextValue = useCreateChannelStateContext({
3743
+ ...restState,
3744
+ channel,
3745
+ channelCapabilitiesArray,
3746
+ channelConfig,
3747
+ channelUnreadUiState,
3748
+ giphyVersion: props.giphyVersion || "fixed_height",
3749
+ imageAttachmentSizeHandler: props.imageAttachmentSizeHandler || getImageAttachmentConfiguration,
3750
+ mutes,
3751
+ notifications: [],
3752
+ shouldGenerateVideoThumbnail: props.shouldGenerateVideoThumbnail ?? true,
3753
+ videoAttachmentSizeHandler: props.videoAttachmentSizeHandler || getVideoAttachmentConfiguration,
3754
+ watcher_count: state.watcherCount
3755
+ });
3756
+ const channelActionContextValue = useMemo(() => ({
3757
+ closeThread,
3758
+ deleteMessage,
3759
+ dispatch,
3760
+ editMessage,
3761
+ jumpToFirstUnreadMessage,
3762
+ jumpToLatestMessage,
3763
+ jumpToMessage,
3764
+ loadMore,
3765
+ loadMoreNewer,
3766
+ loadMoreThread,
3767
+ markRead,
3768
+ onMentionsClick: onMentionsHoverOrClick,
3769
+ onMentionsHover: onMentionsHoverOrClick,
3770
+ openThread,
3771
+ removeMessage,
3772
+ retrySendMessage,
3773
+ sendMessage,
3774
+ setChannelUnreadUiState,
3775
+ skipMessageDataMemoization,
3776
+ updateMessage
3777
+ }), [
3778
+ channel.cid,
3779
+ deleteMessage,
3780
+ loadMore,
3781
+ loadMoreNewer,
3782
+ markRead,
3783
+ jumpToFirstUnreadMessage,
3784
+ jumpToMessage,
3785
+ jumpToLatestMessage,
3786
+ setChannelUnreadUiState
3787
+ ]);
3788
+ const typingContextValue = useCreateTypingContext({ typing });
3789
+ if (state.error) return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingErrorIndicator$1, { error: state.error }) });
3790
+ if (state.loading) return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingIndicator, {}) });
3791
+ if (!channel.watch) return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx("div", { children: t("Channel Missing") }) });
3792
+ return /* @__PURE__ */ jsx(ChannelContainer, {
3793
+ className: windowsEmojiClass,
3794
+ children: /* @__PURE__ */ jsx(ChannelStateProvider, {
3795
+ value: channelStateContextValue,
3796
+ children: /* @__PURE__ */ jsx(ChannelActionProvider, {
3797
+ value: channelActionContextValue,
3798
+ children: /* @__PURE__ */ jsx(TypingProvider, {
3799
+ value: typingContextValue,
3800
+ children: /* @__PURE__ */ jsx(WithAudioPlayback, {
3801
+ allowConcurrentPlayback: allowConcurrentAudioPlayback,
3802
+ children: /* @__PURE__ */ jsx("div", {
3803
+ className: clsx(chatContainerClass),
3804
+ children
3805
+ })
3806
+ })
3807
+ })
3808
+ })
3809
+ })
3810
+ });
3811
+ };
3812
+ /**
3813
+ * A wrapper component that provides channel data and renders children.
3814
+ * The Channel component provides the following contexts:
3815
+ * - [ChannelStateContext](https://getstream.io/chat/docs/sdk/react/contexts/channel_state_context/)
3816
+ * - [ChannelActionContext](https://getstream.io/chat/docs/sdk/react/contexts/channel_action_context/)
3817
+ * - [ComponentContext](https://getstream.io/chat/docs/sdk/react/contexts/component_context/)
3818
+ * - [TypingContext](https://getstream.io/chat/docs/sdk/react/contexts/typing_context/)
3819
+ */
3820
+ var Channel = React.memo(UnMemoizedChannel);
3821
+ //#endregion
3822
+ //#region src/components/Threads/ThreadContext.tsx
3823
+ var ThreadContext = createContext(void 0);
3824
+ var useThreadContext = () => useContext(ThreadContext);
3825
+ var ThreadProvider = ({ children, thread }) => /* @__PURE__ */ jsx(ThreadContext.Provider, {
3826
+ value: thread,
3827
+ children: /* @__PURE__ */ jsx(Channel, {
3828
+ channel: thread?.channel,
3829
+ children
3830
+ })
3831
+ });
3832
+ //#endregion
3833
+ //#region src/components/Threads/UnreadCountBadge.tsx
3834
+ var UnreadCountBadge = ({ children, count, position }) => /* @__PURE__ */ jsxs("div", {
3835
+ className: "str-chat__unread-count-badge-container",
3836
+ children: [children, count > 0 && /* @__PURE__ */ jsx("div", {
3837
+ className: clsx("str-chat__unread-count-badge", position && `str-chat__unread-count-badge--${position}`),
3838
+ children: count
3839
+ })]
3840
+ });
3841
+ //#endregion
3842
+ //#region src/components/ChatView/ChatView.a11y.utility.ts
3843
+ var DEFAULT_CHAT_VIEW_A11Y_CONTEXT_VALUE = {
3844
+ chatViewPanelIds: {
3845
+ channels: "str-chat__chat-view-panel-channels",
3846
+ threads: "str-chat__chat-view-panel-threads"
3847
+ },
3848
+ chatViewTabIds: {
3849
+ channels: "str-chat__chat-view-tab-channels",
3850
+ threads: "str-chat__chat-view-tab-threads"
3851
+ }
3852
+ };
3853
+ var createChatViewA11yContextValue = (chatViewId) => ({
3854
+ chatViewPanelIds: {
3855
+ channels: `str-chat__chat-view-${chatViewId}-panel-channels`,
3856
+ threads: `str-chat__chat-view-${chatViewId}-panel-threads`
3857
+ },
3858
+ chatViewTabIds: {
3859
+ channels: `str-chat__chat-view-${chatViewId}-tab-channels`,
3860
+ threads: `str-chat__chat-view-${chatViewId}-tab-threads`
3861
+ }
3862
+ });
3863
+ //#endregion
3864
+ //#region src/components/ChatView/ChatView.tsx
3865
+ var ChatViewContext = createContext(void 0);
3866
+ var ChatViewA11yContext = createContext(DEFAULT_CHAT_VIEW_A11Y_CONTEXT_VALUE);
3867
+ var useChatViewContext = () => {
3868
+ const value = useContext(ChatViewContext);
3869
+ if (!value) {
3870
+ console.warn("The useChatViewContext hook was called outside of the ChatView provider.");
3871
+ return {};
3872
+ }
3873
+ return value;
3874
+ };
3875
+ var useChatViewA11yContext = () => useContext(ChatViewA11yContext);
3876
+ var ChatView = ({ children }) => {
3877
+ const [activeChatView, setActiveChatView] = useState("channels");
3878
+ const chatViewId = useStableId();
3879
+ const { theme } = useChatContext();
3880
+ const a11yValue = useMemo(() => createChatViewA11yContextValue(chatViewId), [chatViewId]);
3881
+ const value = useMemo(() => ({
3882
+ activeChatView,
3883
+ setActiveChatView
3884
+ }), [activeChatView]);
3885
+ return /* @__PURE__ */ jsx(ChatViewA11yContext.Provider, {
3886
+ value: a11yValue,
3887
+ children: /* @__PURE__ */ jsx(ChatViewContext.Provider, {
3888
+ value,
3889
+ children: /* @__PURE__ */ jsx("div", {
3890
+ className: clsx("str-chat", theme, "str-chat__chat-view"),
3891
+ children
3892
+ })
3893
+ })
3894
+ });
3895
+ };
3896
+ var ChannelsView = ({ children }) => {
3897
+ const { activeChatView } = useChatViewContext();
3898
+ const { chatViewPanelIds, chatViewTabIds } = useChatViewA11yContext();
3899
+ if (!(activeChatView === "channels")) return null;
3900
+ return /* @__PURE__ */ jsx("div", {
3901
+ "aria-labelledby": chatViewTabIds.channels,
3902
+ className: "str-chat__chat-view__channels",
3903
+ id: chatViewPanelIds.channels,
3904
+ role: "tabpanel",
3905
+ children
3906
+ });
3907
+ };
3908
+ var ThreadsViewContext = createContext({
3909
+ activeThread: void 0,
3910
+ setActiveThread: () => void 0
3911
+ });
3912
+ var useThreadsViewContext = () => useContext(ThreadsViewContext);
3913
+ var ThreadsView = ({ children }) => {
3914
+ const { activeChatView } = useChatViewContext();
3915
+ const { chatViewPanelIds, chatViewTabIds } = useChatViewA11yContext();
3916
+ const [activeThread, setActiveThread] = useState(void 0);
3917
+ const value = useMemo(() => ({
3918
+ activeThread,
3919
+ setActiveThread
3920
+ }), [activeThread]);
3921
+ if (!(activeChatView === "threads")) return null;
3922
+ return /* @__PURE__ */ jsx(ThreadsViewContext.Provider, {
3923
+ value,
3924
+ children: /* @__PURE__ */ jsx("div", {
3925
+ "aria-labelledby": chatViewTabIds.threads,
3926
+ className: "str-chat__chat-view__threads",
3927
+ id: chatViewPanelIds.threads,
3928
+ role: "tabpanel",
3929
+ children
3930
+ })
3931
+ });
3932
+ };
3933
+ var useActiveThread = ({ activeThread }) => {
3934
+ useEffect(() => {
3935
+ if (!activeThread) return;
3936
+ const handleVisibilityChange = () => {
3937
+ if (document.visibilityState === "visible" && document.hasFocus()) activeThread.activate();
3938
+ if (document.visibilityState === "hidden" || !document.hasFocus()) activeThread.deactivate();
3939
+ };
3940
+ handleVisibilityChange();
3941
+ window.addEventListener("focus", handleVisibilityChange);
3942
+ window.addEventListener("blur", handleVisibilityChange);
3943
+ return () => {
3944
+ activeThread.deactivate();
3945
+ window.removeEventListener("blur", handleVisibilityChange);
3946
+ window.removeEventListener("focus", handleVisibilityChange);
3947
+ };
3948
+ }, [activeThread]);
3949
+ };
3950
+ /**
3951
+ * // this setup still works
3952
+ * const MyCustomComponent = () => {
3953
+ * const [activeThread, setActiveThread] = useState();
3954
+ *
3955
+ * return <>
3956
+ * // simplified
3957
+ * <ThreadList onItemPointerDown={setActiveThread} />
3958
+ * <ThreadProvider thread={activeThread}>
3959
+ * <Thread />
3960
+ * </ThreadProvider>
3961
+ * </>
3962
+ * }
3963
+ *
3964
+ */
3965
+ var ThreadAdapter = ({ children }) => {
3966
+ const { client } = useChatContext("ThreadAdapter");
3967
+ const { EmptyStateIndicator: EmptyStateIndicator$1 = EmptyStateIndicator } = useComponentContext("ThreadAdapter");
3968
+ const { activeThread } = useThreadsViewContext();
3969
+ const { t } = useTranslationContext("ThreadAdapter");
3970
+ const { isLoading, ready } = useStateStore(client.threads.state, threadAdapterSelector) ?? {
3971
+ isLoading: false,
3972
+ ready: false
3973
+ };
3974
+ useActiveThread({ activeThread });
3975
+ if (!activeThread && ready && !isLoading && EmptyStateIndicator$1) return /* @__PURE__ */ jsx("div", {
3976
+ className: "str-chat__thread-container str-chat__thread",
3977
+ children: /* @__PURE__ */ jsx(EmptyStateIndicator$1, {
3978
+ listType: "message",
3979
+ messageText: t("Select a thread to continue the conversation")
3980
+ })
3981
+ });
3982
+ return /* @__PURE__ */ jsx(ThreadProvider, {
3983
+ thread: activeThread,
3984
+ children
3985
+ });
3986
+ };
3987
+ var ChatViewSelectorButton = ({ ActiveIcon, children, className, Icon, iconOnly = true, isActive, text, ...props }) => {
3988
+ const SelectorIcon = isActive && ActiveIcon ? ActiveIcon : Icon;
3989
+ const shouldShowTooltip = !!text && iconOnly;
3990
+ return /* @__PURE__ */ jsxs("div", {
3991
+ className: "str-chat__chat-view__selector-button-container",
3992
+ children: [/* @__PURE__ */ jsxs(Button, {
3993
+ appearance: "ghost",
3994
+ "aria-label": props["aria-label"] ?? (shouldShowTooltip ? text : void 0),
3995
+ className: clsx("str-chat__chat-view__selector-button", className),
3996
+ role: "tab",
3997
+ variant: "secondary",
3998
+ ...props,
3999
+ children: [children ?? (SelectorIcon && /* @__PURE__ */ jsx(SelectorIcon, {})), !iconOnly && text && /* @__PURE__ */ jsx("div", {
4000
+ className: "str-chat__chat-view__selector-button-text",
4001
+ children: text
4002
+ })]
4003
+ }), shouldShowTooltip && /* @__PURE__ */ jsx("div", {
4004
+ "aria-hidden": "true",
4005
+ className: "str-chat__chat-view__selector-button-tooltip str-chat__tooltip",
4006
+ children: text
4007
+ })]
4008
+ });
4009
+ };
4010
+ var threadAdapterSelector = ({ pagination, ready }) => ({
4011
+ isLoading: pagination.isLoading,
4012
+ ready
4013
+ });
4014
+ var unreadThreadCountSelector = ({ unreadThreadCount }) => ({ unreadThreadCount });
4015
+ var ChatViewChannelsSelectorButton = ({ iconOnly = true }) => {
4016
+ const { activeChatView, setActiveChatView } = useChatViewContext();
4017
+ const { chatViewPanelIds, chatViewTabIds } = useChatViewA11yContext();
4018
+ const { t } = useTranslationContext();
4019
+ const isActive = activeChatView === "channels";
4020
+ return /* @__PURE__ */ jsx(ChatViewSelectorButton, {
4021
+ ActiveIcon: IconMessageBubbleFill,
4022
+ "aria-controls": chatViewPanelIds.channels,
4023
+ "aria-selected": isActive,
4024
+ Icon: IconMessageBubble,
4025
+ iconOnly,
4026
+ id: chatViewTabIds.channels,
4027
+ isActive,
4028
+ onClick: () => setActiveChatView("channels"),
4029
+ onPointerDown: () => setActiveChatView("channels"),
4030
+ tabIndex: 0,
4031
+ text: t("Channels")
4032
+ });
4033
+ };
4034
+ var ChatViewThreadsSelectorButton = ({ iconOnly = true }) => {
4035
+ const { client } = useChatContext();
4036
+ const { unreadThreadCount } = useStateStore(client.threads.state, unreadThreadCountSelector) ?? { unreadThreadCount: 0 };
4037
+ const { activeChatView, setActiveChatView } = useChatViewContext();
4038
+ const { chatViewPanelIds, chatViewTabIds } = useChatViewA11yContext();
4039
+ const { t } = useTranslationContext();
4040
+ const isActive = activeChatView === "threads";
4041
+ return /* @__PURE__ */ jsx(ChatViewSelectorButton, {
4042
+ ActiveIcon: IconThreadFill,
4043
+ "aria-controls": chatViewPanelIds.threads,
4044
+ "aria-selected": isActive,
4045
+ Icon: IconThread,
4046
+ iconOnly,
4047
+ id: chatViewTabIds.threads,
4048
+ isActive,
4049
+ onClick: () => setActiveChatView("threads"),
4050
+ onPointerDown: () => setActiveChatView("threads"),
4051
+ tabIndex: 0,
4052
+ text: t("Threads"),
4053
+ children: /* @__PURE__ */ jsx(UnreadCountBadge, {
4054
+ count: unreadThreadCount,
4055
+ position: "top-right",
4056
+ children: isActive ? /* @__PURE__ */ jsx(IconThreadFill, {}) : /* @__PURE__ */ jsx(IconThread, {})
4057
+ })
4058
+ });
4059
+ };
4060
+ var defaultChatViewSelectorItemSet = [{
4061
+ Component: ChatViewChannelsSelectorButton,
4062
+ type: "channels"
4063
+ }, {
4064
+ Component: ChatViewThreadsSelectorButton,
4065
+ type: "threads"
4066
+ }];
4067
+ var ChatViewSelector = ({ iconOnly = true, itemSet = defaultChatViewSelectorItemSet }) => {
4068
+ const { t } = useTranslationContext();
4069
+ return /* @__PURE__ */ jsx("div", {
4070
+ "aria-label": t("aria/Chat view tabs"),
4071
+ className: "str-chat__chat-view__selector",
4072
+ role: "tablist",
4073
+ children: itemSet.map(({ Component, type }) => /* @__PURE__ */ jsx(Component, { iconOnly }, type))
4074
+ });
4075
+ };
4076
+ ChatView.Channels = ChannelsView;
4077
+ ChatView.Threads = ThreadsView;
4078
+ ChatView.ThreadAdapter = ThreadAdapter;
4079
+ ChatView.Selector = ChatViewSelector;
4080
+ //#endregion
4081
+ //#region src/components/Notifications/hooks/useNotificationTarget.ts
4082
+ /**
4083
+ * Resolves the panel target where notifications emitted by the current component should be displayed.
4084
+ */
4085
+ var useNotificationTarget = () => {
4086
+ const chatViewContext = useContext(ChatViewContext);
4087
+ const { channels } = useChannelListContext();
4088
+ const { channel } = useChannelStateContext();
4089
+ const threadInstance = useThreadContext();
4090
+ const { legacyThread } = useLegacyThreadContext();
4091
+ if (threadInstance || legacyThread) return "thread";
4092
+ if (channel) return "channel";
4093
+ if (chatViewContext?.activeChatView === "threads") return "thread-list";
4094
+ if (channels) return "channel-list";
4095
+ };
4096
+ //#endregion
4097
+ //#region src/components/Notifications/hooks/useNotificationApi.ts
4098
+ var modalDialogIsOpenSelector = ({ dialogsById }) => ({ isOpen: !!dialogsById[modalDialogId]?.isOpen });
4099
+ /** Tag used for full-width system banners (e.g. connection status). Excluded from `NotificationList` by default. */
4100
+ var SYSTEM_NOTIFICATION_TAG = "system";
4101
+ var hasSystemNotificationTag = (notification) => notification.tags?.includes("system") ?? false;
4102
+ var getTargetTags = (targetPanels, inferredPanel, tags, modalIsOpen) => {
4103
+ if (targetPanels) {
4104
+ const effectiveTargetPanels = modalIsOpen && targetPanels.length > 0 ? [...targetPanels, "modal"] : targetPanels;
4105
+ return Array.from(new Set([...effectiveTargetPanels.map(getNotificationTargetTag), ...tags ?? []]));
4106
+ }
4107
+ if (modalIsOpen) return Array.from(new Set([
4108
+ ...inferredPanel ? [getNotificationTargetTag(inferredPanel)] : [],
4109
+ getNotificationTargetTag("modal"),
4110
+ ...tags ?? []
4111
+ ]));
4112
+ return addNotificationTargetTag(inferredPanel, tags);
4113
+ };
4114
+ var getTypeFromIncident = ({ incident, severity, type }) => {
4115
+ if (type) return type;
4116
+ if (!incident) return void 0;
4117
+ const status = incident.status ?? (severity === "error" ? "failed" : severity === "success" ? "success" : severity);
4118
+ return [
4119
+ incident.domain,
4120
+ incident.entity,
4121
+ incident.operation,
4122
+ status
4123
+ ].filter((segment) => !!segment).join(":");
4124
+ };
4125
+ var useNotificationApi = () => {
4126
+ const { client } = useChatContext();
4127
+ const inferredPanel = useNotificationTarget();
4128
+ const modalIsOpen = useStateStore(useModalDialogManager()?.state, modalDialogIsOpenSelector)?.isOpen ?? false;
4129
+ return {
4130
+ addNotification: useCallback(({ actions, context, duration, emitter, error, incident, message, severity, tags, targetPanels, type }) => {
4131
+ const notificationTags = getTargetTags(targetPanels, inferredPanel, tags, modalIsOpen);
4132
+ const resolvedType = getTypeFromIncident({
4133
+ incident,
4134
+ severity,
4135
+ type
4136
+ });
4137
+ const origin = context ? {
4138
+ context,
4139
+ emitter
4140
+ } : { emitter };
4141
+ const options = {
4142
+ ...actions ? { actions } : {},
4143
+ ...typeof duration === "number" ? { duration } : {},
4144
+ ...error ? { originalError: error } : {},
4145
+ ...notificationTags.length > 0 ? { tags: notificationTags } : {},
4146
+ ...severity ? { severity } : {},
4147
+ ...resolvedType ? { type: resolvedType } : {}
4148
+ };
4149
+ client.notifications.add({
4150
+ message,
4151
+ options,
4152
+ origin
4153
+ });
4154
+ }, [
4155
+ client,
4156
+ inferredPanel,
4157
+ modalIsOpen
4158
+ ]),
4159
+ addSystemNotification: useCallback(({ actions, context, duration, emitter, error, incident, message, severity, tags, type }) => {
4160
+ const notificationTags = Array.from(new Set([SYSTEM_NOTIFICATION_TAG, ...tags ?? []]));
4161
+ const resolvedType = getTypeFromIncident({
4162
+ incident,
4163
+ severity,
4164
+ type
4165
+ });
4166
+ const origin = context ? {
4167
+ context,
4168
+ emitter
4169
+ } : { emitter };
4170
+ const options = {
4171
+ ...actions ? { actions } : {},
4172
+ ...typeof duration === "number" ? { duration } : {},
4173
+ ...error ? { originalError: error } : {},
4174
+ ...notificationTags.length > 0 ? { tags: notificationTags } : {},
4175
+ ...severity ? { severity } : {},
4176
+ ...resolvedType ? { type: resolvedType } : {}
4177
+ };
4178
+ return client.notifications.add({
4179
+ message,
4180
+ options,
4181
+ origin
4182
+ });
4183
+ }, [client]),
4184
+ removeNotification: useCallback((id) => {
4185
+ client.notifications.remove(id);
4186
+ }, [client]),
4187
+ startNotificationTimeout: useCallback((id) => {
4188
+ client.notifications.startTimeout(id);
4189
+ }, [client])
4190
+ };
4191
+ };
4192
+ //#endregion
4193
+ export { isMessageEdited as $, isNotificationForPanel as $n, IconFlag as $t, useMessageComposerController as A, IconThreadFill as An, useDialogIsTopmost as Ar, IconBookmark as At, ACTIONS_NOT_WORKING_IN_THREAD as B, IconVideo as Bn, useComponentContext as Br, IconCommand as Bt, insertIntro as C, IconRefresh as Cn, useNearestDialogManagerContext as Cr, IconArrowUp as Ct, makeDateMessageId as D, IconSearch as Dn, modalDialogId as Dr, IconBell as Dt, isLocalMessage as E, IconRetry as En, Portal as Er, IconAudio as Et, AudioPlayer as F, IconUpload as Fn, useOpenedDialogCount as Fr, IconChecks as Ft, countEmojis as G, IconXmarkSmall as Gn, ChannelStateProvider as Gr, IconEmoji as Gt, OPTIONAL_MESSAGE_ACTIONS as H, IconVoice as Hn, ChatProvider as Hr, IconDelete as Ht, defaultRegisterAudioPlayerError as I, IconUser as In, useStateStore as Ir, IconChevronDown as It, getNonImageAttachments as J, usePopoverPosition as Jn, ChannelListContextProvider as Jr, IconExclamationMark as Jt, getImages as K, createIcon as Kn, useChannelStateContext as Kr, IconEmojiAdd as Kt, elementIsPlaying as L, IconUserAdd as Ln, DialogManager as Lr, IconChevronLeft as Lt, WithAudioPlayback as M, IconTrophy as Mn, useModalDialog as Mr, IconCamera as Mt, useActiveAudioPlayer as N, IconUnpin as Nn, useModalDialogIsOpen as Nr, IconCheckmark as Nt, makeIntroMessage as O, IconSend as On, useDialog as Or, IconBellOff as Ot, useAudioPlayer as P, IconUnsupportedAttachment as Pn, useModalDialogIsTopmost as Pr, IconCheckmark1Small as Pt, isMessageDeleted as Q, getNotificationTargetTag as Qn, useChannelActionContext as Qr, IconFile as Qt, LegacyThreadContext as R, IconUserCheck as Rn, ComponentContext as Rr, IconChevronRight as Rt, hasMoreMessagesProbably as S, IconQuote as Sn, useModalDialogManager as Sr, IconArrowLeft as St, isIntroMessage as T, IconReply as Tn, DialogPortalEntry as Tr, IconAttachment as Tt, areMessagePropsEqual as U, IconXCircle as Un, useChatContext as Ur, IconDownload as Ut, MESSAGE_ACTIONS as V, IconVideoFill as Vn, ChatContext as Vr, IconCopy as Vt, areMessageUIPropsEqual as W, IconXmark as Wn, ChannelStateContext as Wr, IconEdit as Wt, isMessageBlocked as X, getNotificationTargetPanel as Xn, ChannelActionContext as Xr, IconExclamationTriangleFill as Xt, getReadByTooltipText as Y, addNotificationTargetTag as Yn, useChannelListContext as Yr, IconExclamationMarkFill as Yt, isMessageBounced as Z, getNotificationTargetPanels as Zn, ChannelActionProvider as Zr, IconEyeFill as Zt, Channel as _, IconPin as _n, useMessageComposerContext as _r, EmptyStateIndicator as _t, ChatView as a, IconLocation as an, TranslationProvider as ar, messageHasGiphyAttachment as at, getIsFirstUnreadMessage as b, IconPlusSmall as bn, modalDialogManagerId as br, IconArrowDown as bt, ChatViewSelectorButton as c, IconMessageBubbles as cn, defaultTranslatorFunction as cr, messageHasSingleAttachment as ct, useActiveThread as d, IconMinusCircle as dn, isDayOrMoment as dr, EMOJI_REGEX as dt, IconGiphy as en, isNotificationTargetPanel as er, isMessageErrorRetryable as et, useChatViewContext as f, IconMore as fn, isLanguageSupported as fr, CHANNEL_CONTAINER_ID as ft, useThreadContext as g, IconPauseFill as gn, MessageComposerContextProvider as gr, useEditMessageHandler as gt, ThreadProvider as h, IconNotification as hn, MessageComposerContext as hr, useMentionsHandlers as ht, useNotificationTarget as i, IconLoading as in, TranslationContext as ir, messageHasAttachments as it, useIsCooldownActive as j, IconTranslate as jn, useDialogOnNearestManager as jr, IconBookmarkRemove as jt, processMessages as k, IconThread as kn, useDialogIsOpen as kr, IconBolt as kt, ChatViewThreadsSelectorButton as l, IconMicrophoneSolid as ln, getDateString as lr, messageTextHasEmojisOnly as lt, ThreadContext as m, IconNoSign as mn, predefinedFormatters as mr, LoadingChannel as mt, hasSystemNotificationTag as n, IconLeave as nn, TypingProvider as nr, isUserMuted as nt, ChatViewChannelsSelectorButton as o, IconMessageBubble as on, useTranslationContext as or, messageHasQuotedMessage as ot, useThreadsViewContext as p, IconMute as pn, isNumberOrString as pr, LoadingErrorIndicator as pt, getMessageActions as q, Button as qn, ChannelListContext as qr, IconExclamationCircleFill as qt, useNotificationApi as r, IconLink as rn, useTypingContext as rr, mapToUserNameOrId as rt, ChatViewContext as s, IconMessageBubbleFill as sn, defaultDateTimeParser as sr, messageHasReactions as st, SYSTEM_NOTIFICATION_TAG as t, IconImage as tn, TypingContext as tr, isNetworkSendFailure as tt, defaultChatViewSelectorItemSet as u, IconMinus as un, isDate as ur, validateAndGetMessage as ut, getChannel as v, IconPlayFill as vn, DialogManagerProvider as vr, useStableId as vt, isDateSeparatorMessage as w, IconReorder as wn, DialogPortalDestination as wr, IconArrowUpRight as wt, getLastReceived as x, IconPoll as xn, useDialogManager as xr, IconArrowDownCircle as xt, getGroupStyles as y, IconPlus as yn, ModalDialogManagerProvider as yr, IconArchive as yt, useLegacyThreadContext as z, IconUserRemove as zn, ComponentProvider as zr, IconClock as zt };
4194
+
4195
+ //# sourceMappingURL=useNotificationApi.6fdc3ce7.mjs.map