stream-chat-react 12.14.0 → 13.0.0-rc.1
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.
- package/dist/components/AIStateIndicator/AIStateIndicator.d.ts +4 -5
- package/dist/components/AIStateIndicator/hooks/useAIState.d.ts +2 -3
- package/dist/components/Attachment/Attachment.d.ts +8 -9
- package/dist/components/Attachment/Attachment.js +6 -5
- package/dist/components/Attachment/AttachmentActions.d.ts +2 -3
- package/dist/components/Attachment/AttachmentContainer.d.ts +15 -15
- package/dist/components/Attachment/AttachmentContainer.js +2 -2
- package/dist/components/Attachment/Audio.d.ts +3 -4
- package/dist/components/Attachment/Card.d.ts +1 -1
- package/dist/components/Attachment/FileAttachment.d.ts +3 -4
- package/dist/components/Attachment/FileAttachment.js +1 -1
- package/dist/components/Attachment/UnsupportedAttachment.d.ts +3 -4
- package/dist/components/Attachment/UnsupportedAttachment.js +1 -1
- package/dist/components/Attachment/VoiceRecording.d.ts +4 -5
- package/dist/components/Attachment/components/FileSizeIndicator.d.ts +1 -1
- package/dist/components/Attachment/components/FileSizeIndicator.js +4 -2
- package/dist/components/Attachment/utils.d.ts +8 -22
- package/dist/components/Attachment/utils.js +3 -18
- package/dist/components/Avatar/Avatar.d.ts +3 -4
- package/dist/components/Avatar/ChannelAvatar.d.ts +3 -4
- package/dist/components/Avatar/ChannelAvatar.js +1 -1
- package/dist/components/Avatar/GroupAvatar.d.ts +2 -2
- package/dist/components/Channel/Channel.d.ts +18 -37
- package/dist/components/Channel/Channel.js +25 -88
- package/dist/components/Channel/channelState.d.ts +17 -18
- package/dist/components/Channel/hooks/useChannelContainerClasses.d.ts +2 -3
- package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts +2 -3
- package/dist/components/Channel/hooks/useCreateChannelStateContext.js +1 -15
- package/dist/components/Channel/hooks/useCreateTypingContext.d.ts +1 -2
- package/dist/components/Channel/hooks/useEditMessageHandler.d.ts +3 -4
- package/dist/components/Channel/hooks/useMentionsHandlers.d.ts +3 -4
- package/dist/components/Channel/utils.d.ts +8 -6
- package/dist/components/Channel/utils.js +1 -0
- package/dist/components/ChannelHeader/ChannelHeader.d.ts +2 -3
- package/dist/components/ChannelList/ChannelList.d.ts +31 -30
- package/dist/components/ChannelList/ChannelList.js +8 -10
- package/dist/components/ChannelList/ChannelListMessenger.d.ts +6 -6
- package/dist/components/ChannelList/hooks/useChannelDeletedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelHiddenListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelListShape.d.ts +44 -44
- package/dist/components/ChannelList/hooks/useChannelListShape.js +0 -2
- package/dist/components/ChannelList/hooks/useChannelMembershipState.d.ts +3 -3
- package/dist/components/ChannelList/hooks/useChannelTruncatedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelUpdatedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelVisibleListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useMessageNewListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts +7 -8
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +3 -3
- package/dist/components/ChannelList/hooks/useSelectedChannelState.d.ts +7 -7
- package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.d.ts +1 -2
- package/dist/components/ChannelList/utils.d.ts +20 -21
- package/dist/components/ChannelList/utils.js +2 -2
- package/dist/components/ChannelPreview/ChannelPreview.d.ts +15 -16
- package/dist/components/ChannelPreview/ChannelPreview.js +1 -1
- package/dist/components/ChannelPreview/ChannelPreviewActionButtons.d.ts +4 -4
- package/dist/components/ChannelPreview/ChannelPreviewMessenger.d.ts +1 -2
- package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.d.ts +3 -4
- package/dist/components/ChannelPreview/hooks/useIsChannelMuted.d.ts +1 -2
- package/dist/components/ChannelPreview/hooks/useMessageDeliveryStatus.d.ts +5 -7
- package/dist/components/ChannelPreview/icons.d.ts +1 -1
- package/dist/components/ChannelPreview/utils.d.ts +7 -7
- package/dist/components/ChannelSearch/ChannelSearch.d.ts +5 -6
- package/dist/components/ChannelSearch/ChannelSearch.js +2 -2
- package/dist/components/ChannelSearch/SearchBar.d.ts +1 -1
- package/dist/components/ChannelSearch/SearchBar.js +1 -1
- package/dist/components/ChannelSearch/SearchResults.d.ts +13 -14
- package/dist/components/ChannelSearch/SearchResults.js +1 -1
- package/dist/components/ChannelSearch/hooks/useChannelSearch.d.ts +17 -18
- package/dist/components/ChannelSearch/hooks/useChannelSearch.js +2 -6
- package/dist/components/ChannelSearch/utils.d.ts +2 -3
- package/dist/components/Chat/Chat.d.ts +9 -9
- package/dist/components/Chat/hooks/useChannelsQueryState.d.ts +1 -1
- package/dist/components/Chat/hooks/useChat.d.ts +10 -10
- package/dist/components/Chat/hooks/useChat.js +3 -3
- package/dist/components/Chat/hooks/useCreateChatClient.d.ts +4 -4
- package/dist/components/Chat/hooks/useCreateChatContext.d.ts +1 -2
- package/dist/components/Dialog/DialogAnchor.d.ts +4 -3
- package/dist/components/Dialog/DialogAnchor.js +2 -2
- package/dist/components/Dialog/DialogMenu.d.ts +2 -1
- package/dist/components/Dialog/DialogPortal.d.ts +2 -1
- package/dist/components/Dialog/FormDialog.d.ts +2 -1
- package/dist/components/Dialog/FormDialog.js +1 -1
- package/dist/components/Dialog/PromptDialog.d.ts +2 -1
- package/dist/components/DragAndDrop/DragAndDropContainer.d.ts +2 -1
- package/dist/components/EventComponent/EventComponent.d.ts +7 -6
- package/dist/components/Form/FieldError.d.ts +2 -1
- package/dist/components/Form/SwitchField.d.ts +2 -1
- package/dist/components/Form/SwitchField.js +1 -1
- package/dist/components/Gallery/Gallery.d.ts +5 -5
- package/dist/components/Gallery/Image.d.ts +6 -5
- package/dist/components/Gallery/ModalGallery.d.ts +3 -4
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +2 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScrollPaginator.d.ts +2 -1
- package/dist/components/LoadMore/LoadMoreButton.d.ts +2 -1
- package/dist/components/LoadMore/LoadMorePaginator.d.ts +3 -2
- package/dist/components/LoadMore/LoadMorePaginator.js +1 -1
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecorder.js +3 -2
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecordingInProgress.js +1 -1
- package/dist/components/MediaRecorder/RecordingPermissionDeniedNotification.d.ts +1 -1
- package/dist/components/MediaRecorder/classes/MediaRecorderController.d.ts +11 -23
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.d.ts +8 -8
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.js +6 -4
- package/dist/components/MediaRecorder/observable/BehaviorSubject.d.ts +2 -2
- package/dist/components/MediaRecorder/observable/Observable.d.ts +1 -1
- package/dist/components/MediaRecorder/observable/Subject.d.ts +3 -2
- package/dist/components/Message/FixedHeightMessage.d.ts +4 -5
- package/dist/components/Message/Message.d.ts +1 -2
- package/dist/components/Message/MessageDeleted.d.ts +4 -5
- package/dist/components/Message/MessageEditedTimestamp.d.ts +2 -3
- package/dist/components/Message/MessageErrorText.d.ts +4 -5
- package/dist/components/Message/MessageErrorText.js +2 -2
- package/dist/components/Message/MessageOptions.d.ts +3 -3
- package/dist/components/Message/MessageRepliesCountButton.d.ts +2 -1
- package/dist/components/Message/MessageSimple.d.ts +1 -2
- package/dist/components/Message/MessageSimple.js +8 -10
- package/dist/components/Message/MessageStatus.d.ts +3 -4
- package/dist/components/Message/MessageText.d.ts +6 -6
- package/dist/components/Message/MessageTimestamp.d.ts +4 -5
- package/dist/components/Message/QuotedMessage.d.ts +2 -3
- package/dist/components/Message/QuotedMessage.js +1 -1
- package/dist/components/Message/StreamedMessageText.d.ts +3 -4
- package/dist/components/Message/hooks/useActionHandler.d.ts +2 -3
- package/dist/components/Message/hooks/useActionHandler.js +1 -1
- package/dist/components/Message/hooks/useDeleteHandler.d.ts +4 -5
- package/dist/components/Message/hooks/useFlagHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useMarkUnreadHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useMentionsHandler.d.ts +6 -8
- package/dist/components/Message/hooks/useMessageTextStreaming.d.ts +2 -3
- package/dist/components/Message/hooks/useMuteHandler.d.ts +5 -7
- package/dist/components/Message/hooks/useMuteHandler.js +1 -1
- package/dist/components/Message/hooks/useOpenThreadHandler.d.ts +2 -3
- package/dist/components/Message/hooks/usePinHandler.d.ts +4 -5
- package/dist/components/Message/hooks/usePinHandler.js +1 -1
- package/dist/components/Message/hooks/useReactionHandler.d.ts +3 -4
- package/dist/components/Message/hooks/useReactionHandler.js +2 -4
- package/dist/components/Message/hooks/useReactionsFetcher.d.ts +5 -7
- package/dist/components/Message/hooks/useRetryHandler.d.ts +2 -3
- package/dist/components/Message/hooks/useRetryHandler.js +1 -1
- package/dist/components/Message/hooks/useUserHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useUserRole.d.ts +2 -3
- package/dist/components/Message/hooks/useUserRole.js +1 -1
- package/dist/components/Message/icons.d.ts +2 -2
- package/dist/components/Message/icons.js +1 -1
- package/dist/components/Message/renderText/componentRenderers/Anchor.d.ts +2 -1
- package/dist/components/Message/renderText/componentRenderers/Emoji.d.ts +1 -1
- package/dist/components/Message/renderText/componentRenderers/Mention.d.ts +5 -5
- package/dist/components/Message/renderText/componentRenderers/Mention.js +1 -1
- package/dist/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts +1 -2
- package/dist/components/Message/renderText/renderText.d.ts +6 -6
- package/dist/components/Message/renderText/types.d.ts +1 -1
- package/dist/components/Message/types.d.ts +27 -28
- package/dist/components/Message/utils.d.ts +21 -22
- package/dist/components/Message/utils.js +5 -4
- package/dist/components/MessageActions/CustomMessageActionsList.d.ts +6 -7
- package/dist/components/MessageActions/MessageActions.d.ts +6 -5
- package/dist/components/MessageActions/MessageActions.js +1 -1
- package/dist/components/MessageActions/MessageActionsBox.d.ts +5 -5
- package/dist/components/MessageActions/MessageActionsBox.js +4 -3
- package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.d.ts +1 -1
- package/dist/components/MessageBounce/MessageBounceModal.d.ts +4 -3
- package/dist/components/MessageBounce/MessageBouncePrompt.d.ts +1 -2
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.d.ts +11 -11
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.js +17 -14
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.d.ts +4 -12
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.js +8 -5
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.d.ts +4 -5
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.js +2 -2
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.d.ts +7 -5
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.js +5 -2
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.d.ts +4 -5
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.js +5 -2
- package/dist/components/MessageInput/AttachmentPreviewList/index.d.ts +1 -1
- package/dist/components/MessageInput/AttachmentPreviewList/types.d.ts +3 -4
- package/dist/components/MessageInput/AttachmentSelector.d.ts +1 -2
- package/dist/components/MessageInput/AttachmentSelector.js +5 -3
- package/dist/components/MessageInput/EditMessageForm.d.ts +3 -2
- package/dist/components/MessageInput/EditMessageForm.js +30 -6
- package/dist/components/MessageInput/LinkPreviewList.d.ts +6 -4
- package/dist/components/MessageInput/LinkPreviewList.js +24 -10
- package/dist/components/MessageInput/MessageInput.d.ts +23 -45
- package/dist/components/MessageInput/MessageInput.js +25 -15
- package/dist/components/MessageInput/MessageInputFlat.d.ts +1 -2
- package/dist/components/MessageInput/MessageInputFlat.js +31 -76
- package/dist/components/MessageInput/QuotedMessagePreview.d.ts +4 -7
- package/dist/components/MessageInput/QuotedMessagePreview.js +22 -16
- package/dist/components/MessageInput/SendButton.d.ts +4 -5
- package/dist/components/MessageInput/SendButton.js +6 -2
- package/dist/components/MessageInput/WithDragAndDropUpload.d.ts +38 -0
- package/dist/components/MessageInput/WithDragAndDropUpload.js +96 -0
- package/dist/components/MessageInput/hooks/index.d.ts +5 -1
- package/dist/components/MessageInput/hooks/index.js +5 -1
- package/dist/components/MessageInput/hooks/useAttachmentManagerState.d.ts +10 -0
- package/dist/components/MessageInput/hooks/useAttachmentManagerState.js +19 -0
- package/dist/components/MessageInput/hooks/useCanCreatePoll.d.ts +1 -0
- package/dist/components/MessageInput/hooks/useCanCreatePoll.js +10 -0
- package/dist/components/MessageInput/hooks/useCooldownTimer.d.ts +2 -3
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts +1 -2
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +1 -55
- package/dist/components/MessageInput/hooks/useMessageComposer.d.ts +2 -0
- package/dist/components/MessageInput/hooks/useMessageComposer.js +80 -0
- package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.d.ts +1 -0
- package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.js +8 -0
- package/dist/components/MessageInput/hooks/useMessageInputControls.d.ts +12 -0
- package/dist/components/MessageInput/hooks/useMessageInputControls.js +23 -0
- package/dist/components/MessageInput/hooks/useMessageInputText.d.ts +1 -5
- package/dist/components/MessageInput/hooks/useMessageInputText.js +19 -53
- package/dist/components/MessageInput/hooks/usePasteHandler.d.ts +1 -3
- package/dist/components/MessageInput/hooks/usePasteHandler.js +6 -8
- package/dist/components/MessageInput/hooks/useSubmitHandler.d.ts +2 -6
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +30 -98
- package/dist/components/MessageInput/hooks/utils.d.ts +0 -27
- package/dist/components/MessageInput/hooks/utils.js +0 -124
- package/dist/components/MessageInput/index.d.ts +1 -2
- package/dist/components/MessageInput/index.js +1 -2
- package/dist/components/MessageList/ConnectionStatus.d.ts +1 -2
- package/dist/components/MessageList/ConnectionStatus.js +1 -1
- package/dist/components/MessageList/CustomNotification.d.ts +2 -1
- package/dist/components/MessageList/GiphyPreviewMessage.d.ts +4 -5
- package/dist/components/MessageList/MessageList.d.ts +11 -12
- package/dist/components/MessageList/MessageList.js +4 -4
- package/dist/components/MessageList/MessageNotification.d.ts +2 -1
- package/dist/components/MessageList/VirtualizedMessageList.d.ts +22 -21
- package/dist/components/MessageList/VirtualizedMessageList.js +6 -6
- package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts +10 -10
- package/dist/components/MessageList/VirtualizedMessageListComponents.js +7 -7
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts +8 -10
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.js +1 -1
- package/dist/components/MessageList/hooks/MessageList/useMessageListElements.d.ts +11 -12
- package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.d.ts +4 -5
- package/dist/components/MessageList/hooks/MessageList/useScrollLocationLogic.d.ts +5 -6
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.js +3 -2
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.js +1 -1
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.js +6 -2
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.d.ts +3 -4
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.js +5 -6
- package/dist/components/MessageList/hooks/useLastReadData.d.ts +5 -6
- package/dist/components/MessageList/hooks/useLastReadData.js +5 -1
- package/dist/components/MessageList/hooks/useMarkRead.d.ts +1 -2
- package/dist/components/MessageList/renderMessages.d.ts +14 -14
- package/dist/components/MessageList/renderMessages.js +8 -7
- package/dist/components/MessageList/utils.d.ts +34 -28
- package/dist/components/MessageList/utils.js +26 -21
- package/dist/components/Modal/Modal.d.ts +2 -1
- package/dist/components/Poll/Poll.d.ts +2 -3
- package/dist/components/Poll/Poll.js +1 -1
- package/dist/components/Poll/PollActions/AddCommentForm.d.ts +1 -2
- package/dist/components/Poll/PollActions/AddCommentForm.js +4 -2
- package/dist/components/Poll/PollActions/EndPollDialog.d.ts +1 -2
- package/dist/components/Poll/PollActions/EndPollDialog.js +1 -1
- package/dist/components/Poll/PollActions/PollAction.d.ts +2 -1
- package/dist/components/Poll/PollActions/PollActions.d.ts +7 -8
- package/dist/components/Poll/PollActions/PollActions.js +5 -5
- package/dist/components/Poll/PollActions/PollAnswerList.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollOptionsFullList.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollOptionsFullList.js +4 -2
- package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.d.ts +3 -4
- package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.js +1 -1
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithLatestVotes.d.ts +3 -4
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.d.ts +4 -5
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.js +1 -1
- package/dist/components/Poll/PollActions/PollResults/PollResults.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollResults/PollResults.js +1 -1
- package/dist/components/Poll/PollActions/SuggestPollOptionForm.d.ts +1 -2
- package/dist/components/Poll/PollActions/SuggestPollOptionForm.js +3 -1
- package/dist/components/Poll/PollContent.d.ts +1 -2
- package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.d.ts +2 -0
- package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.js +35 -0
- package/dist/components/Poll/PollCreationDialog/NameField.d.ts +2 -0
- package/dist/components/Poll/PollCreationDialog/NameField.js +26 -0
- package/dist/components/Poll/PollCreationDialog/OptionFieldSet.d.ts +1 -8
- package/dist/components/Poll/PollCreationDialog/OptionFieldSet.js +33 -65
- package/dist/components/Poll/PollCreationDialog/PollCreationDialog.js +31 -85
- package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.d.ts +1 -4
- package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.js +15 -41
- package/dist/components/Poll/PollCreationDialog/types.d.ts +0 -14
- package/dist/components/Poll/PollHeader.d.ts +1 -2
- package/dist/components/Poll/PollOptionList.d.ts +1 -2
- package/dist/components/Poll/PollOptionList.js +4 -2
- package/dist/components/Poll/PollOptionSelector.d.ts +3 -4
- package/dist/components/Poll/PollVote.d.ts +6 -7
- package/dist/components/Poll/PollVote.js +3 -3
- package/dist/components/Poll/QuotedPoll.d.ts +1 -2
- package/dist/components/Poll/constants.d.ts +0 -1
- package/dist/components/Poll/constants.js +0 -1
- package/dist/components/Poll/hooks/useManagePollVotesRealtime.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollAnswerPagination.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollAnswerPagination.js +2 -2
- package/dist/components/Poll/hooks/usePollOptionVotesPagination.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollOptionVotesPagination.js +1 -1
- package/dist/components/Portal/Portal.d.ts +1 -1
- package/dist/components/ReactFileUtilities/FileIcon/FileIcon.d.ts +1 -1
- package/dist/components/ReactFileUtilities/FileIcon/FileIconSet.d.ts +2 -1
- package/dist/components/ReactFileUtilities/FileIcon/iconMap.d.ts +1 -1
- package/dist/components/ReactFileUtilities/UploadButton.d.ts +3 -2
- package/dist/components/ReactFileUtilities/UploadButton.js +16 -6
- package/dist/components/ReactFileUtilities/index.d.ts +0 -1
- package/dist/components/ReactFileUtilities/index.js +0 -1
- package/dist/components/ReactFileUtilities/utils.d.ts +2 -2
- package/dist/components/Reactions/ReactionSelector.d.ts +4 -5
- package/dist/components/Reactions/ReactionSelectorWithButton.d.ts +1 -2
- package/dist/components/Reactions/ReactionsList.d.ts +6 -7
- package/dist/components/Reactions/ReactionsList.js +2 -2
- package/dist/components/Reactions/ReactionsListModal.d.ts +9 -10
- package/dist/components/Reactions/SimpleReactionsList.d.ts +5 -6
- package/dist/components/Reactions/StreamEmoji.d.ts +1 -1
- package/dist/components/Reactions/hooks/useFetchReactions.d.ts +9 -10
- package/dist/components/Reactions/hooks/useProcessReactions.d.ts +1 -2
- package/dist/components/Reactions/types.d.ts +3 -4
- package/dist/components/Reactions/utils/utils.d.ts +1 -1
- package/dist/components/SafeAnchor/SafeAnchor.d.ts +2 -1
- package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.d.ts +2 -1
- package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.js +1 -2
- package/dist/components/{EmoticonItem → TextareaComposer/SuggestionList}/EmoticonItem.d.ts +7 -7
- package/dist/components/TextareaComposer/SuggestionList/EmoticonItem.js +12 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.d.ts +16 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.js +49 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.d.ts +18 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.js +25 -0
- package/dist/components/{UserItem → TextareaComposer/SuggestionList}/UserItem.d.ts +7 -4
- package/dist/components/TextareaComposer/SuggestionList/UserItem.js +24 -0
- package/dist/components/TextareaComposer/SuggestionList/index.d.ts +5 -0
- package/dist/components/TextareaComposer/SuggestionList/index.js +5 -0
- package/dist/components/TextareaComposer/TextareaComposer.d.ts +13 -0
- package/dist/components/TextareaComposer/TextareaComposer.js +155 -0
- package/dist/components/TextareaComposer/index.d.ts +2 -0
- package/dist/components/TextareaComposer/index.js +2 -0
- package/dist/components/Thread/Thread.d.ts +13 -10
- package/dist/components/Thread/Thread.js +23 -12
- package/dist/components/Thread/ThreadHead.d.ts +2 -3
- package/dist/components/Thread/ThreadHeader.d.ts +5 -6
- package/dist/components/Thread/ThreadHeader.js +1 -1
- package/dist/components/Threads/ThreadContext.d.ts +2 -2
- package/dist/components/Threads/ThreadContext.js +1 -4
- package/dist/components/Threads/ThreadList/ThreadList.d.ts +1 -1
- package/dist/components/Threads/ThreadList/ThreadListItem.d.ts +1 -1
- package/dist/components/Threads/hooks/useThreadManagerState.d.ts +1 -1
- package/dist/components/Threads/hooks/useThreadState.d.ts +1 -1
- package/dist/components/Threads/icons.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +1 -1
- package/dist/components/TypingIndicator/TypingIndicator.d.ts +1 -2
- package/dist/components/Window/Window.d.ts +6 -6
- package/dist/components/index.d.ts +1 -5
- package/dist/components/index.js +1 -5
- package/dist/context/AttachmentSelectorContext.d.ts +2 -1
- package/dist/context/ChannelActionContext.d.ts +26 -35
- package/dist/context/ChannelListContext.d.ts +9 -9
- package/dist/context/ChannelListContext.js +1 -1
- package/dist/context/ChannelStateContext.d.ts +24 -34
- package/dist/context/ChatContext.d.ts +18 -17
- package/dist/context/ComponentContext.d.ts +39 -37
- package/dist/context/DialogManagerContext.d.ts +2 -1
- package/dist/context/MessageBounceContext.d.ts +8 -7
- package/dist/context/MessageBounceContext.js +1 -1
- package/dist/context/MessageContext.d.ts +23 -23
- package/dist/context/MessageInputContext.d.ts +8 -26
- package/dist/context/MessageInputContext.js +3 -2
- package/dist/context/MessageListContext.d.ts +2 -1
- package/dist/context/PollContext.d.ts +8 -8
- package/dist/context/TranslationContext.d.ts +2 -1
- package/dist/context/TypingContext.d.ts +11 -10
- package/dist/context/VirtualizedMessageListContext.d.ts +2 -1
- package/dist/context/WithComponents.d.ts +3 -2
- package/dist/css/v2/index.css +1 -1
- package/dist/css/v2/index.layout.css +1 -1
- package/dist/experimental/MessageActions/MessageActions.d.ts +1 -1
- package/dist/experimental/MessageActions/MessageActions.js +1 -1
- package/dist/experimental/MessageActions/defaults.js +4 -3
- package/dist/experimental/Search/Search.d.ts +1 -2
- package/dist/experimental/Search/SearchContext.d.ts +8 -8
- package/dist/experimental/Search/SearchResults/SearchResultItem.d.ts +11 -11
- package/dist/experimental/Search/SearchResults/SearchResultItem.js +3 -3
- package/dist/experimental/Search/SearchResults/SearchResults.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchResultsHeader.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchResultsHeader.js +1 -1
- package/dist/experimental/Search/SearchResults/SearchSourceResultList.d.ts +2 -3
- package/dist/experimental/Search/SearchResults/SearchSourceResultListFooter.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchSourceResults.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchSourceResults.js +1 -1
- package/dist/experimental/Search/SearchSourceResultsContext.d.ts +2 -1
- package/dist/experimental/Search/hooks/useSearchFocusedMessage.d.ts +1 -2
- package/dist/experimental/Search/hooks/useSearchFocusedMessage.js +3 -1
- package/dist/experimental/Search/hooks/useSearchQueriesInProgress.d.ts +3 -4
- package/dist/experimental/index.browser.cjs +1139 -1075
- package/dist/experimental/index.browser.cjs.map +4 -4
- package/dist/experimental/index.node.cjs +1139 -1075
- package/dist/experimental/index.node.cjs.map +4 -4
- package/dist/i18n/Streami18n.d.ts +1 -1
- package/dist/i18n/types.d.ts +2 -2
- package/dist/i18n/utils.d.ts +1 -1
- package/dist/i18n/utils.js +3 -1
- package/dist/index.browser.cjs +28545 -30631
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +30774 -32868
- package/dist/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/index.browser.cjs +133 -5
- package/dist/plugins/Emojis/index.browser.cjs.map +4 -4
- package/dist/plugins/Emojis/index.d.ts +1 -0
- package/dist/plugins/Emojis/index.js +1 -0
- package/dist/plugins/Emojis/index.node.cjs +135 -6
- package/dist/plugins/Emojis/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/middleware/index.d.ts +1 -0
- package/dist/plugins/Emojis/middleware/index.js +1 -0
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.d.ts +66 -0
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.js +143 -0
- package/dist/plugins/encoders/mp3.browser.cjs.map +2 -2
- package/dist/plugins/encoders/mp3.node.cjs.map +2 -2
- package/dist/scss/v2/Autocomplete/Autocomplete-layout.scss +14 -0
- package/dist/scss/v2/Autocomplete/Autocomplete-theme.scss +11 -0
- package/dist/scss/v2/DropzoneContainer/DropzoneContainer-layout.scss +14 -0
- package/dist/scss/v2/DropzoneContainer/DropzoneContainer-theme.scss +17 -0
- package/dist/scss/v2/LinkPreview/LinkPreview-layout.scss +18 -0
- package/dist/scss/v2/LinkPreview/LinkPreview-theme.scss +15 -0
- package/dist/scss/v2/MessageInput/MessageInput-layout.scss +0 -13
- package/dist/scss/v2/MessageInput/MessageInput-theme.scss +8 -19
- package/dist/scss/v2/index.layout.scss +2 -1
- package/dist/scss/v2/index.scss +1 -0
- package/dist/types/defaultDataInterfaces.d.ts +25 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types.d.ts +2 -62
- package/dist/utils/getChannel.d.ts +5 -6
- package/dist/utils/mergeDeep.d.ts +2 -3
- package/package.json +5 -5
- package/dist/components/AutoCompleteTextarea/Item.d.ts +0 -2
- package/dist/components/AutoCompleteTextarea/Item.js +0 -10
- package/dist/components/AutoCompleteTextarea/List.d.ts +0 -17
- package/dist/components/AutoCompleteTextarea/List.js +0 -89
- package/dist/components/AutoCompleteTextarea/Textarea.d.ts +0 -114
- package/dist/components/AutoCompleteTextarea/Textarea.js +0 -593
- package/dist/components/AutoCompleteTextarea/index.d.ts +0 -4
- package/dist/components/AutoCompleteTextarea/index.js +0 -4
- package/dist/components/AutoCompleteTextarea/types.d.ts +0 -15
- package/dist/components/AutoCompleteTextarea/utils.d.ts +0 -6
- package/dist/components/AutoCompleteTextarea/utils.js +0 -40
- package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts +0 -78
- package/dist/components/ChatAutoComplete/ChatAutoComplete.js +0 -33
- package/dist/components/ChatAutoComplete/index.d.ts +0 -1
- package/dist/components/ChatAutoComplete/index.js +0 -1
- package/dist/components/CommandItem/index.d.ts +0 -1
- package/dist/components/CommandItem/index.js +0 -1
- package/dist/components/EmoticonItem/EmoticonItem.js +0 -16
- package/dist/components/EmoticonItem/index.d.ts +0 -1
- package/dist/components/EmoticonItem/index.js +0 -1
- package/dist/components/MessageInput/DefaultTriggerProvider.d.ts +0 -35
- package/dist/components/MessageInput/DefaultTriggerProvider.js +0 -24
- package/dist/components/MessageInput/DropzoneProvider.d.ts +0 -4
- package/dist/components/MessageInput/DropzoneProvider.js +0 -23
- package/dist/components/MessageInput/hooks/useAttachments.d.ts +0 -14
- package/dist/components/MessageInput/hooks/useAttachments.js +0 -209
- package/dist/components/MessageInput/hooks/useCommandTrigger.d.ts +0 -3
- package/dist/components/MessageInput/hooks/useCommandTrigger.js +0 -62
- package/dist/components/MessageInput/hooks/useEmojiTrigger.d.ts +0 -3
- package/dist/components/MessageInput/hooks/useEmojiTrigger.js +0 -29
- package/dist/components/MessageInput/hooks/useLinkPreviews.d.ts +0 -30
- package/dist/components/MessageInput/hooks/useLinkPreviews.js +0 -109
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts +0 -71
- package/dist/components/MessageInput/hooks/useMessageInputState.js +0 -200
- package/dist/components/MessageInput/hooks/useUserTrigger.d.ts +0 -12
- package/dist/components/MessageInput/hooks/useUserTrigger.js +0 -130
- package/dist/components/MessageInput/types.d.ts +0 -87
- package/dist/components/MessageInput/types.js +0 -19
- package/dist/components/ReactFileUtilities/ImageDropzone.d.ts +0 -16
- package/dist/components/ReactFileUtilities/ImageDropzone.js +0 -42
- package/dist/components/UserItem/UserItem.js +0 -26
- package/dist/components/UserItem/index.d.ts +0 -1
- package/dist/components/UserItem/index.js +0 -1
- /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.d.ts +0 -0
- /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.js +0 -0
- /package/dist/scss/v2/DragAndDropContainer/{DragAmdDropContainer-layout.scss → DragAndDropContainer-layout.scss} +0 -0
- /package/dist/{components/AutoCompleteTextarea/types.js → types/defaultDataInterfaces.js} +0 -0
|
@@ -326,30 +326,16 @@ __export(experimental_exports, {
|
|
|
326
326
|
module.exports = __toCommonJS(experimental_exports);
|
|
327
327
|
|
|
328
328
|
// src/experimental/MessageActions/MessageActions.tsx
|
|
329
|
-
var
|
|
330
|
-
var
|
|
331
|
-
|
|
332
|
-
// src/context/ChannelActionContext.tsx
|
|
333
|
-
var import_react = __toESM(require("react"));
|
|
334
|
-
var ChannelActionContext = import_react.default.createContext(void 0);
|
|
335
|
-
var useChannelActionContext = (componentName) => {
|
|
336
|
-
const contextValue = (0, import_react.useContext)(ChannelActionContext);
|
|
337
|
-
if (!contextValue) {
|
|
338
|
-
console.warn(
|
|
339
|
-
`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.`
|
|
340
|
-
);
|
|
341
|
-
return {};
|
|
342
|
-
}
|
|
343
|
-
return contextValue;
|
|
344
|
-
};
|
|
329
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
330
|
+
var import_react39 = __toESM(require("react"));
|
|
345
331
|
|
|
346
332
|
// src/context/ChannelListContext.tsx
|
|
347
|
-
var
|
|
348
|
-
var ChannelListContext = (0,
|
|
333
|
+
var import_react = __toESM(require("react"));
|
|
334
|
+
var ChannelListContext = (0, import_react.createContext)(
|
|
349
335
|
void 0
|
|
350
336
|
);
|
|
351
337
|
var useChannelListContext = (componentName) => {
|
|
352
|
-
const contextValue = (0,
|
|
338
|
+
const contextValue = (0, import_react.useContext)(ChannelListContext);
|
|
353
339
|
if (!contextValue) {
|
|
354
340
|
console.warn(
|
|
355
341
|
`The useChannelListContext hook was called outside of the ChannelListContext provider. Make sure this hook is called within the ChannelList component. The errored call is located in the ${componentName} component.`
|
|
@@ -360,10 +346,10 @@ var useChannelListContext = (componentName) => {
|
|
|
360
346
|
};
|
|
361
347
|
|
|
362
348
|
// src/context/ChannelStateContext.tsx
|
|
363
|
-
var
|
|
364
|
-
var ChannelStateContext =
|
|
349
|
+
var import_react2 = __toESM(require("react"));
|
|
350
|
+
var ChannelStateContext = import_react2.default.createContext(void 0);
|
|
365
351
|
var useChannelStateContext = (componentName) => {
|
|
366
|
-
const contextValue = (0,
|
|
352
|
+
const contextValue = (0, import_react2.useContext)(ChannelStateContext);
|
|
367
353
|
if (!contextValue) {
|
|
368
354
|
console.warn(
|
|
369
355
|
`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.`
|
|
@@ -374,10 +360,10 @@ var useChannelStateContext = (componentName) => {
|
|
|
374
360
|
};
|
|
375
361
|
|
|
376
362
|
// src/context/ChatContext.tsx
|
|
377
|
-
var
|
|
378
|
-
var ChatContext =
|
|
363
|
+
var import_react3 = __toESM(require("react"));
|
|
364
|
+
var ChatContext = import_react3.default.createContext(void 0);
|
|
379
365
|
var useChatContext = (componentName) => {
|
|
380
|
-
const contextValue = (0,
|
|
366
|
+
const contextValue = (0, import_react3.useContext)(ChatContext);
|
|
381
367
|
if (!contextValue) {
|
|
382
368
|
console.warn(
|
|
383
369
|
`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.`
|
|
@@ -388,33 +374,33 @@ var useChatContext = (componentName) => {
|
|
|
388
374
|
};
|
|
389
375
|
|
|
390
376
|
// src/context/ComponentContext.tsx
|
|
391
|
-
var
|
|
392
|
-
var ComponentContext =
|
|
393
|
-
var useComponentContext = (_componentName) => (0,
|
|
377
|
+
var import_react4 = __toESM(require("react"));
|
|
378
|
+
var ComponentContext = import_react4.default.createContext({});
|
|
379
|
+
var useComponentContext = (_componentName) => (0, import_react4.useContext)(ComponentContext);
|
|
394
380
|
|
|
395
381
|
// src/context/DialogManagerContext.tsx
|
|
396
|
-
var
|
|
382
|
+
var import_react9 = __toESM(require("react"));
|
|
397
383
|
|
|
398
384
|
// src/components/Dialog/DialogPortal.tsx
|
|
399
|
-
var
|
|
385
|
+
var import_react8 = __toESM(require("react"));
|
|
400
386
|
|
|
401
387
|
// src/components/Dialog/hooks/useDialog.ts
|
|
402
|
-
var
|
|
388
|
+
var import_react6 = require("react");
|
|
403
389
|
|
|
404
390
|
// src/store/hooks/useStateStore.ts
|
|
405
|
-
var
|
|
391
|
+
var import_react5 = require("react");
|
|
406
392
|
var import_shim = require("use-sync-external-store/shim");
|
|
407
393
|
var noop = () => {
|
|
408
394
|
};
|
|
409
395
|
function useStateStore(store, selector2) {
|
|
410
|
-
const wrappedSubscription = (0,
|
|
396
|
+
const wrappedSubscription = (0, import_react5.useCallback)(
|
|
411
397
|
(onStoreChange) => {
|
|
412
398
|
const unsubscribe = store?.subscribeWithSelector(selector2, onStoreChange);
|
|
413
399
|
return unsubscribe ?? noop;
|
|
414
400
|
},
|
|
415
401
|
[store, selector2]
|
|
416
402
|
);
|
|
417
|
-
const wrappedSnapshot = (0,
|
|
403
|
+
const wrappedSnapshot = (0, import_react5.useMemo)(() => {
|
|
418
404
|
let cachedTuple;
|
|
419
405
|
return () => {
|
|
420
406
|
const currentValue = store?.getLatestValue();
|
|
@@ -443,7 +429,7 @@ function useStateStore(store, selector2) {
|
|
|
443
429
|
// src/components/Dialog/hooks/useDialog.ts
|
|
444
430
|
var useDialog = ({ id }) => {
|
|
445
431
|
const { dialogManager } = useDialogManager();
|
|
446
|
-
(0,
|
|
432
|
+
(0, import_react6.useEffect)(
|
|
447
433
|
() => () => {
|
|
448
434
|
dialogManager.markForRemoval(id);
|
|
449
435
|
},
|
|
@@ -453,7 +439,7 @@ var useDialog = ({ id }) => {
|
|
|
453
439
|
};
|
|
454
440
|
var useDialogIsOpen = (id) => {
|
|
455
441
|
const { dialogManager } = useDialogManager();
|
|
456
|
-
const dialogIsOpenSelector = (0,
|
|
442
|
+
const dialogIsOpenSelector = (0, import_react6.useCallback)(
|
|
457
443
|
({ dialogsById }) => ({ isOpen: !!dialogsById[id]?.isOpen }),
|
|
458
444
|
[id]
|
|
459
445
|
);
|
|
@@ -461,15 +447,15 @@ var useDialogIsOpen = (id) => {
|
|
|
461
447
|
};
|
|
462
448
|
|
|
463
449
|
// src/components/Portal/Portal.ts
|
|
464
|
-
var
|
|
450
|
+
var import_react7 = require("react");
|
|
465
451
|
var import_react_dom = require("react-dom");
|
|
466
452
|
var Portal = ({
|
|
467
453
|
children,
|
|
468
454
|
getPortalDestination,
|
|
469
455
|
isOpen
|
|
470
456
|
}) => {
|
|
471
|
-
const [portalDestination, setPortalDestination] = (0,
|
|
472
|
-
(0,
|
|
457
|
+
const [portalDestination, setPortalDestination] = (0, import_react7.useState)(null);
|
|
458
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
473
459
|
const destination = getPortalDestination();
|
|
474
460
|
if (!destination || !isOpen) return;
|
|
475
461
|
setPortalDestination(destination);
|
|
@@ -485,40 +471,35 @@ var DialogPortalEntry = ({
|
|
|
485
471
|
}) => {
|
|
486
472
|
const { dialogManager } = useDialogManager();
|
|
487
473
|
const dialogIsOpen = useDialogIsOpen(dialogId);
|
|
488
|
-
const getPortalDestination = (0,
|
|
474
|
+
const getPortalDestination = (0, import_react8.useCallback)(
|
|
489
475
|
() => document.querySelector(`div[data-str-chat__portal-id="${dialogManager.id}"]`),
|
|
490
476
|
[dialogManager.id]
|
|
491
477
|
);
|
|
492
|
-
return /* @__PURE__ */
|
|
478
|
+
return /* @__PURE__ */ import_react8.default.createElement(Portal, { getPortalDestination, isOpen: dialogIsOpen }, children);
|
|
493
479
|
};
|
|
494
480
|
|
|
495
481
|
// src/context/DialogManagerContext.tsx
|
|
496
|
-
var DialogManagerProviderContext =
|
|
482
|
+
var DialogManagerProviderContext = import_react9.default.createContext(void 0);
|
|
497
483
|
var useDialogManager = () => {
|
|
498
|
-
const value = (0,
|
|
484
|
+
const value = (0, import_react9.useContext)(DialogManagerProviderContext);
|
|
499
485
|
return value;
|
|
500
486
|
};
|
|
501
487
|
|
|
502
488
|
// src/context/MessageContext.tsx
|
|
503
|
-
var
|
|
504
|
-
var MessageContext =
|
|
489
|
+
var import_react10 = __toESM(require("react"));
|
|
490
|
+
var MessageContext = import_react10.default.createContext(
|
|
505
491
|
void 0
|
|
506
492
|
);
|
|
507
493
|
var useMessageContext = (_componentName) => {
|
|
508
|
-
const contextValue = (0,
|
|
494
|
+
const contextValue = (0, import_react10.useContext)(MessageContext);
|
|
509
495
|
if (!contextValue) {
|
|
510
496
|
return {};
|
|
511
497
|
}
|
|
512
498
|
return contextValue;
|
|
513
499
|
};
|
|
514
500
|
|
|
515
|
-
// src/constants/limits.ts
|
|
516
|
-
var DEFAULT_JUMP_TO_PAGE_SIZE = 100;
|
|
517
|
-
var DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
518
|
-
var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
519
|
-
|
|
520
501
|
// src/context/TranslationContext.tsx
|
|
521
|
-
var
|
|
502
|
+
var import_react11 = __toESM(require("react"));
|
|
522
503
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
523
504
|
var import_calendar = __toESM(require("dayjs/plugin/calendar"));
|
|
524
505
|
var import_localizedFormat = __toESM(require("dayjs/plugin/localizedFormat"));
|
|
@@ -531,13 +512,13 @@ var defaultDateTimeParser = (input) => (0, import_dayjs.default)(input);
|
|
|
531
512
|
// src/context/TranslationContext.tsx
|
|
532
513
|
import_dayjs2.default.extend(import_calendar.default);
|
|
533
514
|
import_dayjs2.default.extend(import_localizedFormat.default);
|
|
534
|
-
var TranslationContext =
|
|
515
|
+
var TranslationContext = import_react11.default.createContext({
|
|
535
516
|
t: defaultTranslatorFunction,
|
|
536
517
|
tDateTimeParser: defaultDateTimeParser,
|
|
537
518
|
userLanguage: "en"
|
|
538
519
|
});
|
|
539
520
|
var useTranslationContext = (componentName) => {
|
|
540
|
-
const contextValue = (0,
|
|
521
|
+
const contextValue = (0, import_react11.useContext)(TranslationContext);
|
|
541
522
|
if (!contextValue) {
|
|
542
523
|
console.warn(
|
|
543
524
|
`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.`
|
|
@@ -547,408 +528,597 @@ var useTranslationContext = (componentName) => {
|
|
|
547
528
|
return contextValue;
|
|
548
529
|
};
|
|
549
530
|
|
|
550
|
-
//
|
|
551
|
-
var
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
531
|
+
// src/components/MessageInput/hooks/useMessageComposer.ts
|
|
532
|
+
var import_react34 = require("react");
|
|
533
|
+
var import_stream_chat = require("stream-chat");
|
|
534
|
+
|
|
535
|
+
// src/components/Threads/ThreadContext.tsx
|
|
536
|
+
var import_react12 = __toESM(require("react"));
|
|
537
|
+
var ThreadContext = (0, import_react12.createContext)(void 0);
|
|
538
|
+
var useThreadContext = () => (0, import_react12.useContext)(ThreadContext);
|
|
539
|
+
|
|
540
|
+
// src/components/Avatar/Avatar.tsx
|
|
541
|
+
var import_clsx = __toESM(require("clsx"));
|
|
542
|
+
var import_react14 = __toESM(require("react"));
|
|
543
|
+
|
|
544
|
+
// src/components/Threads/icons.tsx
|
|
545
|
+
var import_react13 = __toESM(require("react"));
|
|
546
|
+
var Icon = {
|
|
547
|
+
MessageBubble: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
548
|
+
"svg",
|
|
549
|
+
{
|
|
550
|
+
className: "str-chat__icon str-chat__icon--message-bubble",
|
|
551
|
+
fill: "none",
|
|
552
|
+
height: "14",
|
|
553
|
+
viewBox: "0 0 14 14",
|
|
554
|
+
width: "14",
|
|
555
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
556
|
+
...props
|
|
557
|
+
},
|
|
558
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
559
|
+
"path",
|
|
560
|
+
{
|
|
561
|
+
d: "M1.66659 1.66665H12.3333V9.66665H2.44659L1.66659 10.4466V1.66665ZM1.66659 0.333313C0.933252 0.333313 0.339919 0.933313 0.339919 1.66665L0.333252 13.6666L2.99992 11H12.3333C13.0666 11 13.6666 10.4 13.6666 9.66665V1.66665C13.6666 0.933313 13.0666 0.333313 12.3333 0.333313H1.66659ZM2.99992 6.99998H10.9999V8.33331H2.99992V6.99998ZM2.99992 4.99998H10.9999V6.33331H2.99992V4.99998ZM2.99992 2.99998H10.9999V4.33331H2.99992V2.99998Z",
|
|
562
|
+
fill: "currentColor"
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
),
|
|
566
|
+
MessageBubbleEmpty: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
567
|
+
"svg",
|
|
568
|
+
{
|
|
569
|
+
className: "str-chat__icon str-chat__icon--message-bubble-empty",
|
|
570
|
+
fill: "none",
|
|
571
|
+
height: "20",
|
|
572
|
+
viewBox: "0 0 20 20",
|
|
573
|
+
width: "20",
|
|
574
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
575
|
+
...props
|
|
576
|
+
},
|
|
577
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
578
|
+
"path",
|
|
579
|
+
{
|
|
580
|
+
d: "M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0ZM18 14H4L2 16V2H18V14Z",
|
|
581
|
+
fill: "currentColor"
|
|
582
|
+
}
|
|
583
|
+
)
|
|
584
|
+
),
|
|
585
|
+
Reload: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
586
|
+
"svg",
|
|
587
|
+
{
|
|
588
|
+
className: "str-chat__icon str-chat__icon--reload",
|
|
589
|
+
fill: "none",
|
|
590
|
+
height: "22",
|
|
591
|
+
viewBox: "0 0 16 22",
|
|
592
|
+
width: "16",
|
|
593
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
594
|
+
...props
|
|
595
|
+
},
|
|
596
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
597
|
+
"path",
|
|
598
|
+
{
|
|
599
|
+
d: "M8 3V0L4 4L8 8V5C11.31 5 14 7.69 14 11C14 12.01 13.75 12.97 13.3 13.8L14.76 15.26C15.54 14.03 16 12.57 16 11C16 6.58 12.42 3 8 3ZM8 17C4.69 17 2 14.31 2 11C2 9.99 2.25 9.03 2.7 8.2L1.24 6.74C0.46 7.97 0 9.43 0 11C0 15.42 3.58 19 8 19V22L12 18L8 14V17Z",
|
|
600
|
+
fill: "currentColor"
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
),
|
|
604
|
+
User: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
605
|
+
"svg",
|
|
606
|
+
{
|
|
607
|
+
className: "str-chat__icon str-chat__icon--user",
|
|
608
|
+
fill: "none",
|
|
609
|
+
height: "16",
|
|
610
|
+
viewBox: "0 0 16 16",
|
|
611
|
+
width: "16",
|
|
612
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
613
|
+
...props
|
|
614
|
+
},
|
|
615
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
616
|
+
"path",
|
|
617
|
+
{
|
|
618
|
+
d: "M8 2C9.1 2 10 2.9 10 4C10 5.1 9.1 6 8 6C6.9 6 6 5.1 6 4C6 2.9 6.9 2 8 2ZM8 12C10.7 12 13.8 13.29 14 14H2C2.23 13.28 5.31 12 8 12ZM8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0ZM8 10C5.33 10 0 11.34 0 14V16H16V14C16 11.34 10.67 10 8 10Z",
|
|
619
|
+
fill: "currentColor"
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
)
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
// src/utils/getWholeChar.ts
|
|
626
|
+
var getWholeChar = (str, i) => {
|
|
627
|
+
const code2 = str.charCodeAt(i);
|
|
628
|
+
if (Number.isNaN(code2)) return "";
|
|
629
|
+
if (code2 < 55296 || code2 > 57343) return str.charAt(i);
|
|
630
|
+
if (55296 <= code2 && code2 <= 56319) {
|
|
631
|
+
if (str.length <= i + 1) {
|
|
632
|
+
throw "High surrogate without following low surrogate";
|
|
593
633
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
function propsFactory(check) {
|
|
598
|
-
const checkAsRecord = (
|
|
599
|
-
/** @type {Record<string, unknown>} */
|
|
600
|
-
check
|
|
601
|
-
);
|
|
602
|
-
return castFactory(all2);
|
|
603
|
-
function all2(node2) {
|
|
604
|
-
const nodeAsRecord = (
|
|
605
|
-
/** @type {Record<string, unknown>} */
|
|
606
|
-
/** @type {unknown} */
|
|
607
|
-
node2
|
|
608
|
-
);
|
|
609
|
-
let key;
|
|
610
|
-
for (key in check) {
|
|
611
|
-
if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
634
|
+
const next = str.charCodeAt(i + 1);
|
|
635
|
+
if (56320 > next || next > 57343) {
|
|
636
|
+
throw "High surrogate without following low surrogate";
|
|
612
637
|
}
|
|
613
|
-
return
|
|
638
|
+
return str.charAt(i) + str.charAt(i + 1);
|
|
614
639
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
return castFactory(type);
|
|
618
|
-
function type(node2) {
|
|
619
|
-
return node2 && node2.type === check;
|
|
640
|
+
if (i === 0) {
|
|
641
|
+
throw "Low surrogate without preceding high surrogate";
|
|
620
642
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
function check(value, index3, parent) {
|
|
625
|
-
return Boolean(
|
|
626
|
-
looksLikeANode(value) && testFunction.call(
|
|
627
|
-
this,
|
|
628
|
-
value,
|
|
629
|
-
typeof index3 === "number" ? index3 : void 0,
|
|
630
|
-
parent || void 0
|
|
631
|
-
)
|
|
632
|
-
);
|
|
643
|
+
const prev = str.charCodeAt(i - 1);
|
|
644
|
+
if (55296 > prev || prev > 56319) {
|
|
645
|
+
throw "Low surrogate without preceding high surrogate";
|
|
633
646
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return true;
|
|
637
|
-
}
|
|
638
|
-
function looksLikeANode(value) {
|
|
639
|
-
return value !== null && typeof value === "object" && "type" in value;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// node_modules/unist-util-visit-parents/lib/color.js
|
|
643
|
-
function color(d) {
|
|
644
|
-
return d;
|
|
645
|
-
}
|
|
647
|
+
return "";
|
|
648
|
+
};
|
|
646
649
|
|
|
647
|
-
//
|
|
648
|
-
var
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
const
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
let grandparents;
|
|
686
|
-
if (!test || is2(node2, index3, parents[parents.length - 1] || void 0)) {
|
|
687
|
-
result = toResult(visitor(node2, parents));
|
|
688
|
-
if (result[0] === EXIT) {
|
|
689
|
-
return result;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
if ("children" in node2 && node2.children) {
|
|
693
|
-
const nodeAsParent = (
|
|
694
|
-
/** @type {UnistParent} */
|
|
695
|
-
node2
|
|
696
|
-
);
|
|
697
|
-
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
698
|
-
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
699
|
-
grandparents = parents.concat(nodeAsParent);
|
|
700
|
-
while (offset > -1 && offset < nodeAsParent.children.length) {
|
|
701
|
-
const child = nodeAsParent.children[offset];
|
|
702
|
-
subresult = factory(child, offset, grandparents)();
|
|
703
|
-
if (subresult[0] === EXIT) {
|
|
704
|
-
return subresult;
|
|
705
|
-
}
|
|
706
|
-
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
650
|
+
// src/components/Avatar/Avatar.tsx
|
|
651
|
+
var Avatar = (props) => {
|
|
652
|
+
const {
|
|
653
|
+
className,
|
|
654
|
+
image: image2,
|
|
655
|
+
name: name2,
|
|
656
|
+
onClick = () => void 0,
|
|
657
|
+
onMouseOver = () => void 0
|
|
658
|
+
} = props;
|
|
659
|
+
const [error, setError] = (0, import_react14.useState)(false);
|
|
660
|
+
(0, import_react14.useEffect)(() => {
|
|
661
|
+
setError(false);
|
|
662
|
+
}, [image2]);
|
|
663
|
+
const nameStr = name2?.toString() || "";
|
|
664
|
+
const initials = getWholeChar(nameStr, 0);
|
|
665
|
+
const showImage = image2 && !error;
|
|
666
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
667
|
+
"div",
|
|
668
|
+
{
|
|
669
|
+
className: (0, import_clsx.default)(`str-chat__avatar str-chat__message-sender-avatar`, className, {
|
|
670
|
+
["str-chat__avatar--multiple-letters"]: initials.length > 1,
|
|
671
|
+
["str-chat__avatar--no-letters"]: !initials.length,
|
|
672
|
+
["str-chat__avatar--one-letter"]: initials.length === 1
|
|
673
|
+
}),
|
|
674
|
+
"data-testid": "avatar",
|
|
675
|
+
onClick,
|
|
676
|
+
onMouseOver,
|
|
677
|
+
role: "button",
|
|
678
|
+
title: name2
|
|
679
|
+
},
|
|
680
|
+
showImage ? /* @__PURE__ */ import_react14.default.createElement(
|
|
681
|
+
"img",
|
|
682
|
+
{
|
|
683
|
+
alt: initials,
|
|
684
|
+
className: "str-chat__avatar-image",
|
|
685
|
+
"data-testid": "avatar-img",
|
|
686
|
+
onError: () => setError(true),
|
|
687
|
+
src: image2
|
|
709
688
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}
|
|
721
|
-
return value === null || value === void 0 ? empty : [value];
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
// node_modules/unist-util-visit/lib/index.js
|
|
725
|
-
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
726
|
-
let reverse;
|
|
727
|
-
let test;
|
|
728
|
-
let visitor;
|
|
729
|
-
if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
|
|
730
|
-
test = void 0;
|
|
731
|
-
visitor = testOrVisitor;
|
|
732
|
-
reverse = visitorOrReverse;
|
|
733
|
-
} else {
|
|
734
|
-
test = testOrVisitor;
|
|
735
|
-
visitor = visitorOrReverse;
|
|
736
|
-
reverse = maybeReverse;
|
|
737
|
-
}
|
|
738
|
-
visitParents(tree, test, overload, reverse);
|
|
739
|
-
function overload(node2, parents) {
|
|
740
|
-
const parent = parents[parents.length - 1];
|
|
741
|
-
const index3 = parent ? parent.children.indexOf(node2) : void 0;
|
|
742
|
-
return visitor(node2, index3, parent);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
689
|
+
) : /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, !!initials.length && /* @__PURE__ */ import_react14.default.createElement(
|
|
690
|
+
"div",
|
|
691
|
+
{
|
|
692
|
+
className: (0, import_clsx.default)("str-chat__avatar-fallback"),
|
|
693
|
+
"data-testid": "avatar-fallback"
|
|
694
|
+
},
|
|
695
|
+
initials
|
|
696
|
+
), !initials.length && /* @__PURE__ */ import_react14.default.createElement(Icon.User, null))
|
|
697
|
+
);
|
|
698
|
+
};
|
|
745
699
|
|
|
746
|
-
//
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
function unreachable() {
|
|
750
|
-
}
|
|
700
|
+
// src/components/ChannelPreview/ChannelPreview.tsx
|
|
701
|
+
var import_lodash = __toESM(require("lodash.throttle"));
|
|
702
|
+
var import_react23 = __toESM(require("react"));
|
|
751
703
|
|
|
752
|
-
//
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
const input = values[values.length - 1] === "" ? [...values, ""] : values;
|
|
756
|
-
return input.join(
|
|
757
|
-
(settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
|
|
758
|
-
).trim();
|
|
759
|
-
}
|
|
704
|
+
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
705
|
+
var import_react18 = __toESM(require("react"));
|
|
706
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
760
707
|
|
|
761
|
-
//
|
|
762
|
-
var
|
|
763
|
-
var
|
|
764
|
-
var emptyOptions = {};
|
|
765
|
-
function name(name2, options) {
|
|
766
|
-
const settings = options || emptyOptions;
|
|
767
|
-
const re2 = settings.jsx ? nameReJsx : nameRe;
|
|
768
|
-
return re2.test(name2);
|
|
769
|
-
}
|
|
708
|
+
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
709
|
+
var import_react17 = __toESM(require("react"));
|
|
710
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
770
711
|
|
|
771
|
-
//
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
function empty2(value) {
|
|
777
|
-
return value.replace(re, "") === "";
|
|
778
|
-
}
|
|
712
|
+
// src/constants/limits.ts
|
|
713
|
+
var DEFAULT_JUMP_TO_PAGE_SIZE = 100;
|
|
714
|
+
var DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
715
|
+
var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
779
716
|
|
|
780
|
-
//
|
|
781
|
-
var
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
* @param {Properties} property
|
|
785
|
-
* @param {Normal} normal
|
|
786
|
-
* @param {string} [space]
|
|
787
|
-
*/
|
|
788
|
-
constructor(property, normal, space2) {
|
|
789
|
-
this.property = property;
|
|
790
|
-
this.normal = normal;
|
|
791
|
-
if (space2) {
|
|
792
|
-
this.space = space2;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
717
|
+
// src/components/ChannelList/hooks/useSelectedChannelState.ts
|
|
718
|
+
var import_react15 = require("react");
|
|
719
|
+
var import_shim2 = require("use-sync-external-store/shim");
|
|
720
|
+
var noop2 = () => {
|
|
795
721
|
};
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
722
|
+
function useSelectedChannelState({
|
|
723
|
+
channel,
|
|
724
|
+
selector: selector2,
|
|
725
|
+
stateChangeEventKeys = ["all"]
|
|
726
|
+
}) {
|
|
727
|
+
const subscribe = (0, import_react15.useCallback)(
|
|
728
|
+
(onStoreChange) => {
|
|
729
|
+
if (!channel) return noop2;
|
|
730
|
+
const subscriptions = stateChangeEventKeys.map(
|
|
731
|
+
(et) => channel.on(et, () => {
|
|
732
|
+
onStoreChange(selector2(channel));
|
|
733
|
+
})
|
|
734
|
+
);
|
|
735
|
+
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
736
|
+
},
|
|
737
|
+
[channel, selector2, stateChangeEventKeys]
|
|
738
|
+
);
|
|
739
|
+
const getSnapshot = (0, import_react15.useCallback)(() => {
|
|
740
|
+
if (!channel) return void 0;
|
|
741
|
+
return selector2(channel);
|
|
742
|
+
}, [channel, selector2]);
|
|
743
|
+
return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot);
|
|
810
744
|
}
|
|
811
745
|
|
|
812
|
-
//
|
|
813
|
-
|
|
814
|
-
|
|
746
|
+
// src/components/ChannelList/hooks/useChannelMembershipState.ts
|
|
747
|
+
var selector = (c) => c.state.membership;
|
|
748
|
+
var keys = ["member.updated"];
|
|
749
|
+
function useChannelMembershipState(channel) {
|
|
750
|
+
return useSelectedChannelState({ channel, selector, stateChangeEventKeys: keys });
|
|
815
751
|
}
|
|
816
752
|
|
|
817
|
-
//
|
|
818
|
-
var
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
753
|
+
// src/components/ChannelPreview/icons.tsx
|
|
754
|
+
var import_react16 = __toESM(require("react"));
|
|
755
|
+
var Icon2 = {
|
|
756
|
+
ArchiveBox: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
757
|
+
"svg",
|
|
758
|
+
{
|
|
759
|
+
className: "str-chat__icon str-chat__icon--archive-box",
|
|
760
|
+
fill: "currentColor",
|
|
761
|
+
viewBox: "0 0 512 512",
|
|
762
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
763
|
+
...props
|
|
764
|
+
},
|
|
765
|
+
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32l448 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96L0 64C0 46.3 14.3 32 32 32zm0 128l448 0 0 256c0 35.3-28.7 64-64 64L96 480c-35.3 0-64-28.7-64-64l0-256zm128 80c0 8.8 7.2 16 16 16l160 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-160 0c-8.8 0-16 7.2-16 16z" })
|
|
766
|
+
),
|
|
767
|
+
Pin: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
768
|
+
"svg",
|
|
769
|
+
{
|
|
770
|
+
className: "str-chat__icon str-chat__icon--pin",
|
|
771
|
+
fill: "currentColor",
|
|
772
|
+
viewBox: "0 0 384 512",
|
|
773
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
774
|
+
...props
|
|
775
|
+
},
|
|
776
|
+
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32C32 14.3 46.3 0 64 0L320 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-29.5 0 11.4 148.2c36.7 19.9 65.7 53.2 79.5 94.7l1 3c3.3 9.8 1.6 20.5-4.4 28.8s-15.7 13.3-26 13.3L32 352c-10.3 0-19.9-4.9-26-13.3s-7.7-19.1-4.4-28.8l1-3c13.8-41.5 42.8-74.8 79.5-94.7L93.5 64 64 64C46.3 64 32 49.7 32 32zM160 384l64 0 0 96c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-96z" })
|
|
777
|
+
)
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
781
|
+
function ChannelPreviewActionButtons({
|
|
782
|
+
channel
|
|
783
|
+
}) {
|
|
784
|
+
const membership = useChannelMembershipState(channel);
|
|
785
|
+
const { t } = useTranslationContext();
|
|
786
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "str-chat__channel-preview__action-buttons" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
787
|
+
"button",
|
|
788
|
+
{
|
|
789
|
+
"aria-label": membership.pinned_at ? t("Unpin") : t("Pin"),
|
|
790
|
+
className: (0, import_clsx2.default)(
|
|
791
|
+
"str-chat__channel-preview__action-button",
|
|
792
|
+
"str-chat__channel-preview__action-button--pin",
|
|
793
|
+
membership.pinned_at && "str-chat__channel-preview__action-button--active"
|
|
794
|
+
),
|
|
795
|
+
onClick: (e) => {
|
|
796
|
+
e.stopPropagation();
|
|
797
|
+
if (membership.pinned_at) {
|
|
798
|
+
channel.unpin();
|
|
799
|
+
} else {
|
|
800
|
+
channel.pin();
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
title: membership.pinned_at ? t("Unpin") : t("Pin")
|
|
804
|
+
},
|
|
805
|
+
/* @__PURE__ */ import_react17.default.createElement(Icon2.Pin, null)
|
|
806
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
807
|
+
"button",
|
|
808
|
+
{
|
|
809
|
+
"aria-label": membership.archived_at ? t("Unarchive") : t("Archive"),
|
|
810
|
+
className: (0, import_clsx2.default)(
|
|
811
|
+
"str-chat__channel-preview__action-button",
|
|
812
|
+
"str-chat__channel-preview__action-button--archive",
|
|
813
|
+
membership.archived_at && "str-chat__channel-preview__action-button--active"
|
|
814
|
+
),
|
|
815
|
+
onClick: (e) => {
|
|
816
|
+
e.stopPropagation();
|
|
817
|
+
if (membership.archived_at) {
|
|
818
|
+
channel.unarchive();
|
|
819
|
+
} else {
|
|
820
|
+
channel.archive();
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
title: membership.archived_at ? t("Unarchive") : t("Archive")
|
|
824
|
+
},
|
|
825
|
+
/* @__PURE__ */ import_react17.default.createElement(Icon2.ArchiveBox, null)
|
|
826
|
+
));
|
|
861
827
|
}
|
|
862
828
|
|
|
863
|
-
//
|
|
864
|
-
var
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
829
|
+
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
830
|
+
var UnMemoizedChannelPreviewMessenger = (props) => {
|
|
831
|
+
const {
|
|
832
|
+
active,
|
|
833
|
+
Avatar: Avatar2 = Avatar,
|
|
834
|
+
channel,
|
|
835
|
+
className: customClassName = "",
|
|
836
|
+
displayImage,
|
|
837
|
+
displayTitle,
|
|
838
|
+
groupChannelDisplayInfo,
|
|
839
|
+
latestMessagePreview,
|
|
840
|
+
onSelect: customOnSelectChannel,
|
|
841
|
+
setActiveChannel,
|
|
842
|
+
unread,
|
|
843
|
+
watchers
|
|
844
|
+
} = props;
|
|
845
|
+
const { ChannelPreviewActionButtons: ChannelPreviewActionButtons2 = ChannelPreviewActionButtons } = useComponentContext();
|
|
846
|
+
const channelPreviewButton = (0, import_react18.useRef)(null);
|
|
847
|
+
const avatarName = displayTitle || channel.state.messages[channel.state.messages.length - 1]?.user?.id;
|
|
848
|
+
const onSelectChannel = (e) => {
|
|
849
|
+
if (customOnSelectChannel) {
|
|
850
|
+
customOnSelectChannel(e);
|
|
851
|
+
} else if (setActiveChannel) {
|
|
852
|
+
setActiveChannel(channel, watchers);
|
|
882
853
|
}
|
|
883
|
-
|
|
854
|
+
if (channelPreviewButton?.current) {
|
|
855
|
+
channelPreviewButton.current.blur();
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-container" }, /* @__PURE__ */ import_react18.default.createElement(ChannelPreviewActionButtons2, { channel }), /* @__PURE__ */ import_react18.default.createElement(
|
|
859
|
+
"button",
|
|
860
|
+
{
|
|
861
|
+
"aria-label": `Select Channel: ${displayTitle || ""}`,
|
|
862
|
+
"aria-selected": active,
|
|
863
|
+
className: (0, import_clsx3.default)(
|
|
864
|
+
`str-chat__channel-preview-messenger str-chat__channel-preview`,
|
|
865
|
+
active && "str-chat__channel-preview-messenger--active",
|
|
866
|
+
unread && unread >= 1 && "str-chat__channel-preview-messenger--unread",
|
|
867
|
+
customClassName
|
|
868
|
+
),
|
|
869
|
+
"data-testid": "channel-preview-button",
|
|
870
|
+
onClick: onSelectChannel,
|
|
871
|
+
ref: channelPreviewButton,
|
|
872
|
+
role: "option"
|
|
873
|
+
},
|
|
874
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--left" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
875
|
+
Avatar2,
|
|
876
|
+
{
|
|
877
|
+
className: "str-chat__avatar--channel-preview",
|
|
878
|
+
groupChannelDisplayInfo,
|
|
879
|
+
image: displayImage,
|
|
880
|
+
name: avatarName
|
|
881
|
+
}
|
|
882
|
+
)),
|
|
883
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-end" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-end-first-row" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--name" }, /* @__PURE__ */ import_react18.default.createElement("span", null, displayTitle)), !!unread && /* @__PURE__ */ import_react18.default.createElement(
|
|
884
|
+
"div",
|
|
885
|
+
{
|
|
886
|
+
className: "str-chat__channel-preview-unread-badge",
|
|
887
|
+
"data-testid": "unread-badge"
|
|
888
|
+
},
|
|
889
|
+
unread
|
|
890
|
+
)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--last-message" }, latestMessagePreview))
|
|
891
|
+
));
|
|
884
892
|
};
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
values[key] = value;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
893
|
+
var ChannelPreviewMessenger = import_react18.default.memo(
|
|
894
|
+
UnMemoizedChannelPreviewMessenger
|
|
895
|
+
);
|
|
891
896
|
|
|
892
|
-
//
|
|
893
|
-
var
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
value,
|
|
905
|
-
definition2.space
|
|
906
|
-
);
|
|
907
|
-
if (definition2.mustUseProperty && definition2.mustUseProperty.includes(prop)) {
|
|
908
|
-
info.mustUseProperty = true;
|
|
909
|
-
}
|
|
910
|
-
property[prop] = info;
|
|
911
|
-
normal[normalize(prop)] = prop;
|
|
912
|
-
normal[normalize(info.attribute)] = prop;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
return new Schema(property, normal, definition2.space);
|
|
916
|
-
}
|
|
897
|
+
// src/components/ChannelPreview/hooks/useIsChannelMuted.ts
|
|
898
|
+
var import_react19 = require("react");
|
|
899
|
+
var useIsChannelMuted = (channel) => {
|
|
900
|
+
const { client } = useChatContext("useIsChannelMuted");
|
|
901
|
+
const [muted, setMuted] = (0, import_react19.useState)(channel.muteStatus());
|
|
902
|
+
(0, import_react19.useEffect)(() => {
|
|
903
|
+
const handleEvent = () => setMuted(channel.muteStatus());
|
|
904
|
+
client.on("notification.channel_mutes_updated", handleEvent);
|
|
905
|
+
return () => client.off("notification.channel_mutes_updated", handleEvent);
|
|
906
|
+
}, [muted]);
|
|
907
|
+
return muted;
|
|
908
|
+
};
|
|
917
909
|
|
|
918
|
-
//
|
|
919
|
-
var
|
|
920
|
-
space: "xlink",
|
|
921
|
-
transform(_, prop) {
|
|
922
|
-
return "xlink:" + prop.slice(5).toLowerCase();
|
|
923
|
-
},
|
|
924
|
-
properties: {
|
|
925
|
-
xLinkActuate: null,
|
|
926
|
-
xLinkArcRole: null,
|
|
927
|
-
xLinkHref: null,
|
|
928
|
-
xLinkRole: null,
|
|
929
|
-
xLinkShow: null,
|
|
930
|
-
xLinkTitle: null,
|
|
931
|
-
xLinkType: null
|
|
932
|
-
}
|
|
933
|
-
});
|
|
910
|
+
// src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts
|
|
911
|
+
var import_react21 = require("react");
|
|
934
912
|
|
|
935
|
-
//
|
|
936
|
-
var
|
|
937
|
-
space: "xml",
|
|
938
|
-
transform(_, prop) {
|
|
939
|
-
return "xml:" + prop.slice(3).toLowerCase();
|
|
940
|
-
},
|
|
941
|
-
properties: { xmlLang: null, xmlBase: null, xmlSpace: null }
|
|
942
|
-
});
|
|
913
|
+
// src/components/ChannelPreview/utils.tsx
|
|
914
|
+
var import_react20 = __toESM(require("react"));
|
|
943
915
|
|
|
944
|
-
// node_modules/
|
|
945
|
-
function
|
|
946
|
-
|
|
916
|
+
// node_modules/devlop/lib/default.js
|
|
917
|
+
function ok() {
|
|
918
|
+
}
|
|
919
|
+
function unreachable() {
|
|
947
920
|
}
|
|
948
921
|
|
|
949
|
-
// node_modules/
|
|
950
|
-
function
|
|
951
|
-
|
|
922
|
+
// node_modules/comma-separated-tokens/index.js
|
|
923
|
+
function stringify(values, options) {
|
|
924
|
+
const settings = options || {};
|
|
925
|
+
const input = values[values.length - 1] === "" ? [...values, ""] : values;
|
|
926
|
+
return input.join(
|
|
927
|
+
(settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
|
|
928
|
+
).trim();
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// node_modules/estree-util-is-identifier-name/lib/index.js
|
|
932
|
+
var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
933
|
+
var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
934
|
+
var emptyOptions = {};
|
|
935
|
+
function name(name2, options) {
|
|
936
|
+
const settings = options || emptyOptions;
|
|
937
|
+
const re2 = settings.jsx ? nameReJsx : nameRe;
|
|
938
|
+
return re2.test(name2);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// node_modules/hast-util-whitespace/lib/index.js
|
|
942
|
+
var re = /[ \t\n\f\r]/g;
|
|
943
|
+
function whitespace(thing) {
|
|
944
|
+
return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing);
|
|
945
|
+
}
|
|
946
|
+
function empty(value) {
|
|
947
|
+
return value.replace(re, "") === "";
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// node_modules/property-information/lib/util/schema.js
|
|
951
|
+
var Schema = class {
|
|
952
|
+
/**
|
|
953
|
+
* @constructor
|
|
954
|
+
* @param {Properties} property
|
|
955
|
+
* @param {Normal} normal
|
|
956
|
+
* @param {string} [space]
|
|
957
|
+
*/
|
|
958
|
+
constructor(property, normal, space2) {
|
|
959
|
+
this.property = property;
|
|
960
|
+
this.normal = normal;
|
|
961
|
+
if (space2) {
|
|
962
|
+
this.space = space2;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
Schema.prototype.property = {};
|
|
967
|
+
Schema.prototype.normal = {};
|
|
968
|
+
Schema.prototype.space = null;
|
|
969
|
+
|
|
970
|
+
// node_modules/property-information/lib/util/merge.js
|
|
971
|
+
function merge(definitions, space2) {
|
|
972
|
+
const property = {};
|
|
973
|
+
const normal = {};
|
|
974
|
+
let index3 = -1;
|
|
975
|
+
while (++index3 < definitions.length) {
|
|
976
|
+
Object.assign(property, definitions[index3].property);
|
|
977
|
+
Object.assign(normal, definitions[index3].normal);
|
|
978
|
+
}
|
|
979
|
+
return new Schema(property, normal, space2);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
// node_modules/property-information/lib/normalize.js
|
|
983
|
+
function normalize(value) {
|
|
984
|
+
return value.toLowerCase();
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// node_modules/property-information/lib/util/info.js
|
|
988
|
+
var Info = class {
|
|
989
|
+
/**
|
|
990
|
+
* @constructor
|
|
991
|
+
* @param {string} property
|
|
992
|
+
* @param {string} attribute
|
|
993
|
+
*/
|
|
994
|
+
constructor(property, attribute) {
|
|
995
|
+
this.property = property;
|
|
996
|
+
this.attribute = attribute;
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
Info.prototype.space = null;
|
|
1000
|
+
Info.prototype.boolean = false;
|
|
1001
|
+
Info.prototype.booleanish = false;
|
|
1002
|
+
Info.prototype.overloadedBoolean = false;
|
|
1003
|
+
Info.prototype.number = false;
|
|
1004
|
+
Info.prototype.commaSeparated = false;
|
|
1005
|
+
Info.prototype.spaceSeparated = false;
|
|
1006
|
+
Info.prototype.commaOrSpaceSeparated = false;
|
|
1007
|
+
Info.prototype.mustUseProperty = false;
|
|
1008
|
+
Info.prototype.defined = false;
|
|
1009
|
+
|
|
1010
|
+
// node_modules/property-information/lib/util/types.js
|
|
1011
|
+
var types_exports = {};
|
|
1012
|
+
__export(types_exports, {
|
|
1013
|
+
boolean: () => boolean,
|
|
1014
|
+
booleanish: () => booleanish,
|
|
1015
|
+
commaOrSpaceSeparated: () => commaOrSpaceSeparated,
|
|
1016
|
+
commaSeparated: () => commaSeparated,
|
|
1017
|
+
number: () => number,
|
|
1018
|
+
overloadedBoolean: () => overloadedBoolean,
|
|
1019
|
+
spaceSeparated: () => spaceSeparated
|
|
1020
|
+
});
|
|
1021
|
+
var powers = 0;
|
|
1022
|
+
var boolean = increment();
|
|
1023
|
+
var booleanish = increment();
|
|
1024
|
+
var overloadedBoolean = increment();
|
|
1025
|
+
var number = increment();
|
|
1026
|
+
var spaceSeparated = increment();
|
|
1027
|
+
var commaSeparated = increment();
|
|
1028
|
+
var commaOrSpaceSeparated = increment();
|
|
1029
|
+
function increment() {
|
|
1030
|
+
return 2 ** ++powers;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// node_modules/property-information/lib/util/defined-info.js
|
|
1034
|
+
var checks = Object.keys(types_exports);
|
|
1035
|
+
var DefinedInfo = class extends Info {
|
|
1036
|
+
/**
|
|
1037
|
+
* @constructor
|
|
1038
|
+
* @param {string} property
|
|
1039
|
+
* @param {string} attribute
|
|
1040
|
+
* @param {number|null} [mask]
|
|
1041
|
+
* @param {string} [space]
|
|
1042
|
+
*/
|
|
1043
|
+
constructor(property, attribute, mask, space2) {
|
|
1044
|
+
let index3 = -1;
|
|
1045
|
+
super(property, attribute);
|
|
1046
|
+
mark(this, "space", space2);
|
|
1047
|
+
if (typeof mask === "number") {
|
|
1048
|
+
while (++index3 < checks.length) {
|
|
1049
|
+
const check = checks[index3];
|
|
1050
|
+
mark(this, checks[index3], (mask & types_exports[check]) === types_exports[check]);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
DefinedInfo.prototype.defined = true;
|
|
1056
|
+
function mark(values, key, value) {
|
|
1057
|
+
if (value) {
|
|
1058
|
+
values[key] = value;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// node_modules/property-information/lib/util/create.js
|
|
1063
|
+
var own = {}.hasOwnProperty;
|
|
1064
|
+
function create(definition2) {
|
|
1065
|
+
const property = {};
|
|
1066
|
+
const normal = {};
|
|
1067
|
+
let prop;
|
|
1068
|
+
for (prop in definition2.properties) {
|
|
1069
|
+
if (own.call(definition2.properties, prop)) {
|
|
1070
|
+
const value = definition2.properties[prop];
|
|
1071
|
+
const info = new DefinedInfo(
|
|
1072
|
+
prop,
|
|
1073
|
+
definition2.transform(definition2.attributes || {}, prop),
|
|
1074
|
+
value,
|
|
1075
|
+
definition2.space
|
|
1076
|
+
);
|
|
1077
|
+
if (definition2.mustUseProperty && definition2.mustUseProperty.includes(prop)) {
|
|
1078
|
+
info.mustUseProperty = true;
|
|
1079
|
+
}
|
|
1080
|
+
property[prop] = info;
|
|
1081
|
+
normal[normalize(prop)] = prop;
|
|
1082
|
+
normal[normalize(info.attribute)] = prop;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return new Schema(property, normal, definition2.space);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
// node_modules/property-information/lib/xlink.js
|
|
1089
|
+
var xlink = create({
|
|
1090
|
+
space: "xlink",
|
|
1091
|
+
transform(_, prop) {
|
|
1092
|
+
return "xlink:" + prop.slice(5).toLowerCase();
|
|
1093
|
+
},
|
|
1094
|
+
properties: {
|
|
1095
|
+
xLinkActuate: null,
|
|
1096
|
+
xLinkArcRole: null,
|
|
1097
|
+
xLinkHref: null,
|
|
1098
|
+
xLinkRole: null,
|
|
1099
|
+
xLinkShow: null,
|
|
1100
|
+
xLinkTitle: null,
|
|
1101
|
+
xLinkType: null
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
// node_modules/property-information/lib/xml.js
|
|
1106
|
+
var xml = create({
|
|
1107
|
+
space: "xml",
|
|
1108
|
+
transform(_, prop) {
|
|
1109
|
+
return "xml:" + prop.slice(3).toLowerCase();
|
|
1110
|
+
},
|
|
1111
|
+
properties: { xmlLang: null, xmlBase: null, xmlSpace: null }
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
// node_modules/property-information/lib/util/case-sensitive-transform.js
|
|
1115
|
+
function caseSensitiveTransform(attributes, attribute) {
|
|
1116
|
+
return attribute in attributes ? attributes[attribute] : attribute;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// node_modules/property-information/lib/util/case-insensitive-transform.js
|
|
1120
|
+
function caseInsensitiveTransform(attributes, property) {
|
|
1121
|
+
return caseSensitiveTransform(attributes, property.toLowerCase());
|
|
952
1122
|
}
|
|
953
1123
|
|
|
954
1124
|
// node_modules/property-information/lib/xmlns.js
|
|
@@ -2299,7 +2469,7 @@ function mdxExpression(state, node2) {
|
|
|
2299
2469
|
if (node2.data && node2.data.estree && state.evaluater) {
|
|
2300
2470
|
const program = node2.data.estree;
|
|
2301
2471
|
const expression = program.body[0];
|
|
2302
|
-
|
|
2472
|
+
ok(expression.type === "ExpressionStatement");
|
|
2303
2473
|
return (
|
|
2304
2474
|
/** @type {Child | undefined} */
|
|
2305
2475
|
state.evaluater.evaluateExpression(expression.expression)
|
|
@@ -2414,11 +2584,11 @@ function createJsxElementProps(state, node2) {
|
|
|
2414
2584
|
if (attribute.data && attribute.data.estree && state.evaluater) {
|
|
2415
2585
|
const program = attribute.data.estree;
|
|
2416
2586
|
const expression = program.body[0];
|
|
2417
|
-
|
|
2587
|
+
ok(expression.type === "ExpressionStatement");
|
|
2418
2588
|
const objectExpression = expression.expression;
|
|
2419
|
-
|
|
2589
|
+
ok(objectExpression.type === "ObjectExpression");
|
|
2420
2590
|
const property = objectExpression.properties[0];
|
|
2421
|
-
|
|
2591
|
+
ok(property.type === "SpreadElement");
|
|
2422
2592
|
Object.assign(
|
|
2423
2593
|
props,
|
|
2424
2594
|
state.evaluater.evaluateExpression(property.argument)
|
|
@@ -2433,7 +2603,7 @@ function createJsxElementProps(state, node2) {
|
|
|
2433
2603
|
if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
|
|
2434
2604
|
const program = attribute.value.data.estree;
|
|
2435
2605
|
const expression = program.body[0];
|
|
2436
|
-
|
|
2606
|
+
ok(expression.type === "ExpressionStatement");
|
|
2437
2607
|
value = state.evaluater.evaluateExpression(expression.expression);
|
|
2438
2608
|
} else {
|
|
2439
2609
|
crashEstree(state, node2.position);
|
|
@@ -2536,7 +2706,7 @@ function findComponentFromName(state, name2, allowExpression) {
|
|
|
2536
2706
|
optional: false
|
|
2537
2707
|
} : prop;
|
|
2538
2708
|
}
|
|
2539
|
-
|
|
2709
|
+
ok(node2, "always a result");
|
|
2540
2710
|
result = node2;
|
|
2541
2711
|
} else {
|
|
2542
2712
|
result = name(name2) && !/^[a-z]/.test(name2) ? { type: "Identifier", name: name2 } : { type: "Literal", value: name2 };
|
|
@@ -8088,7 +8258,7 @@ var deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serial
|
|
|
8088
8258
|
// node_modules/@ungap/structured-clone/esm/serialize.js
|
|
8089
8259
|
var EMPTY = "";
|
|
8090
8260
|
var { toString: toString2 } = {};
|
|
8091
|
-
var { keys } = Object;
|
|
8261
|
+
var { keys: keys2 } = Object;
|
|
8092
8262
|
var typeOf = (value) => {
|
|
8093
8263
|
const type = typeof value;
|
|
8094
8264
|
if (type !== "object" || !value)
|
|
@@ -8177,7 +8347,7 @@ var serializer = (strict, json, $, _) => {
|
|
|
8177
8347
|
return pair(value.toJSON());
|
|
8178
8348
|
const entries = [];
|
|
8179
8349
|
const index3 = as([TYPE, entries], value);
|
|
8180
|
-
for (const key of
|
|
8350
|
+
for (const key of keys2(value)) {
|
|
8181
8351
|
if (strict || !shouldSkip(typeOf(value[key])))
|
|
8182
8352
|
entries.push([pair(key), pair(value[key])]);
|
|
8183
8353
|
}
|
|
@@ -8334,52 +8504,248 @@ function footer(state) {
|
|
|
8334
8504
|
};
|
|
8335
8505
|
}
|
|
8336
8506
|
|
|
8337
|
-
// node_modules/
|
|
8338
|
-
var
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
patch,
|
|
8357
|
-
wrap
|
|
8358
|
-
};
|
|
8359
|
-
visit(tree, function(node2) {
|
|
8360
|
-
if (node2.type === "definition" || node2.type === "footnoteDefinition") {
|
|
8361
|
-
const map = node2.type === "definition" ? definitionById : footnoteById;
|
|
8362
|
-
const id = String(node2.identifier).toUpperCase();
|
|
8363
|
-
if (!map.has(id)) {
|
|
8364
|
-
map.set(id, node2);
|
|
8365
|
-
}
|
|
8366
|
-
}
|
|
8367
|
-
});
|
|
8368
|
-
return state;
|
|
8369
|
-
function one3(node2, parent) {
|
|
8370
|
-
const type = node2.type;
|
|
8371
|
-
const handle = state.handlers[type];
|
|
8372
|
-
if (own4.call(state.handlers, type) && handle) {
|
|
8373
|
-
return handle(state, node2, parent);
|
|
8507
|
+
// node_modules/unist-util-is/lib/index.js
|
|
8508
|
+
var convert = (
|
|
8509
|
+
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
8510
|
+
/**
|
|
8511
|
+
* @type {(
|
|
8512
|
+
* (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
|
8513
|
+
* (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
|
8514
|
+
* (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
|
8515
|
+
* ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
|
|
8516
|
+
* ((test?: Test) => Check)
|
|
8517
|
+
* )}
|
|
8518
|
+
*/
|
|
8519
|
+
/**
|
|
8520
|
+
* @param {Test} [test]
|
|
8521
|
+
* @returns {Check}
|
|
8522
|
+
*/
|
|
8523
|
+
function(test) {
|
|
8524
|
+
if (test === null || test === void 0) {
|
|
8525
|
+
return ok2;
|
|
8374
8526
|
}
|
|
8375
|
-
if (
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
return
|
|
8527
|
+
if (typeof test === "function") {
|
|
8528
|
+
return castFactory(test);
|
|
8529
|
+
}
|
|
8530
|
+
if (typeof test === "object") {
|
|
8531
|
+
return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
|
|
8532
|
+
}
|
|
8533
|
+
if (typeof test === "string") {
|
|
8534
|
+
return typeFactory(test);
|
|
8535
|
+
}
|
|
8536
|
+
throw new Error("Expected function, string, or object as test");
|
|
8537
|
+
}
|
|
8538
|
+
);
|
|
8539
|
+
function anyFactory(tests) {
|
|
8540
|
+
const checks2 = [];
|
|
8541
|
+
let index3 = -1;
|
|
8542
|
+
while (++index3 < tests.length) {
|
|
8543
|
+
checks2[index3] = convert(tests[index3]);
|
|
8544
|
+
}
|
|
8545
|
+
return castFactory(any);
|
|
8546
|
+
function any(...parameters) {
|
|
8547
|
+
let index4 = -1;
|
|
8548
|
+
while (++index4 < checks2.length) {
|
|
8549
|
+
if (checks2[index4].apply(this, parameters)) return true;
|
|
8550
|
+
}
|
|
8551
|
+
return false;
|
|
8552
|
+
}
|
|
8553
|
+
}
|
|
8554
|
+
function propsFactory(check) {
|
|
8555
|
+
const checkAsRecord = (
|
|
8556
|
+
/** @type {Record<string, unknown>} */
|
|
8557
|
+
check
|
|
8558
|
+
);
|
|
8559
|
+
return castFactory(all2);
|
|
8560
|
+
function all2(node2) {
|
|
8561
|
+
const nodeAsRecord = (
|
|
8562
|
+
/** @type {Record<string, unknown>} */
|
|
8563
|
+
/** @type {unknown} */
|
|
8564
|
+
node2
|
|
8565
|
+
);
|
|
8566
|
+
let key;
|
|
8567
|
+
for (key in check) {
|
|
8568
|
+
if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
8569
|
+
}
|
|
8570
|
+
return true;
|
|
8571
|
+
}
|
|
8572
|
+
}
|
|
8573
|
+
function typeFactory(check) {
|
|
8574
|
+
return castFactory(type);
|
|
8575
|
+
function type(node2) {
|
|
8576
|
+
return node2 && node2.type === check;
|
|
8577
|
+
}
|
|
8578
|
+
}
|
|
8579
|
+
function castFactory(testFunction) {
|
|
8580
|
+
return check;
|
|
8581
|
+
function check(value, index3, parent) {
|
|
8582
|
+
return Boolean(
|
|
8583
|
+
looksLikeANode(value) && testFunction.call(
|
|
8584
|
+
this,
|
|
8585
|
+
value,
|
|
8586
|
+
typeof index3 === "number" ? index3 : void 0,
|
|
8587
|
+
parent || void 0
|
|
8588
|
+
)
|
|
8589
|
+
);
|
|
8590
|
+
}
|
|
8591
|
+
}
|
|
8592
|
+
function ok2() {
|
|
8593
|
+
return true;
|
|
8594
|
+
}
|
|
8595
|
+
function looksLikeANode(value) {
|
|
8596
|
+
return value !== null && typeof value === "object" && "type" in value;
|
|
8597
|
+
}
|
|
8598
|
+
|
|
8599
|
+
// node_modules/unist-util-visit-parents/lib/color.js
|
|
8600
|
+
function color(d) {
|
|
8601
|
+
return d;
|
|
8602
|
+
}
|
|
8603
|
+
|
|
8604
|
+
// node_modules/unist-util-visit-parents/lib/index.js
|
|
8605
|
+
var empty2 = [];
|
|
8606
|
+
var CONTINUE = true;
|
|
8607
|
+
var EXIT = false;
|
|
8608
|
+
var SKIP = "skip";
|
|
8609
|
+
function visitParents(tree, test, visitor, reverse) {
|
|
8610
|
+
let check;
|
|
8611
|
+
if (typeof test === "function" && typeof visitor !== "function") {
|
|
8612
|
+
reverse = visitor;
|
|
8613
|
+
visitor = test;
|
|
8614
|
+
} else {
|
|
8615
|
+
check = test;
|
|
8616
|
+
}
|
|
8617
|
+
const is2 = convert(check);
|
|
8618
|
+
const step = reverse ? -1 : 1;
|
|
8619
|
+
factory(tree, void 0, [])();
|
|
8620
|
+
function factory(node2, index3, parents) {
|
|
8621
|
+
const value = (
|
|
8622
|
+
/** @type {Record<string, unknown>} */
|
|
8623
|
+
node2 && typeof node2 === "object" ? node2 : {}
|
|
8624
|
+
);
|
|
8625
|
+
if (typeof value.type === "string") {
|
|
8626
|
+
const name2 = (
|
|
8627
|
+
// `hast`
|
|
8628
|
+
typeof value.tagName === "string" ? value.tagName : (
|
|
8629
|
+
// `xast`
|
|
8630
|
+
typeof value.name === "string" ? value.name : void 0
|
|
8631
|
+
)
|
|
8632
|
+
);
|
|
8633
|
+
Object.defineProperty(visit2, "name", {
|
|
8634
|
+
value: "node (" + color(node2.type + (name2 ? "<" + name2 + ">" : "")) + ")"
|
|
8635
|
+
});
|
|
8636
|
+
}
|
|
8637
|
+
return visit2;
|
|
8638
|
+
function visit2() {
|
|
8639
|
+
let result = empty2;
|
|
8640
|
+
let subresult;
|
|
8641
|
+
let offset;
|
|
8642
|
+
let grandparents;
|
|
8643
|
+
if (!test || is2(node2, index3, parents[parents.length - 1] || void 0)) {
|
|
8644
|
+
result = toResult(visitor(node2, parents));
|
|
8645
|
+
if (result[0] === EXIT) {
|
|
8646
|
+
return result;
|
|
8647
|
+
}
|
|
8648
|
+
}
|
|
8649
|
+
if ("children" in node2 && node2.children) {
|
|
8650
|
+
const nodeAsParent = (
|
|
8651
|
+
/** @type {UnistParent} */
|
|
8652
|
+
node2
|
|
8653
|
+
);
|
|
8654
|
+
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
8655
|
+
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
8656
|
+
grandparents = parents.concat(nodeAsParent);
|
|
8657
|
+
while (offset > -1 && offset < nodeAsParent.children.length) {
|
|
8658
|
+
const child = nodeAsParent.children[offset];
|
|
8659
|
+
subresult = factory(child, offset, grandparents)();
|
|
8660
|
+
if (subresult[0] === EXIT) {
|
|
8661
|
+
return subresult;
|
|
8662
|
+
}
|
|
8663
|
+
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
|
8664
|
+
}
|
|
8665
|
+
}
|
|
8666
|
+
}
|
|
8667
|
+
return result;
|
|
8668
|
+
}
|
|
8669
|
+
}
|
|
8670
|
+
}
|
|
8671
|
+
function toResult(value) {
|
|
8672
|
+
if (Array.isArray(value)) {
|
|
8673
|
+
return value;
|
|
8674
|
+
}
|
|
8675
|
+
if (typeof value === "number") {
|
|
8676
|
+
return [CONTINUE, value];
|
|
8677
|
+
}
|
|
8678
|
+
return value === null || value === void 0 ? empty2 : [value];
|
|
8679
|
+
}
|
|
8680
|
+
|
|
8681
|
+
// node_modules/unist-util-visit/lib/index.js
|
|
8682
|
+
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
8683
|
+
let reverse;
|
|
8684
|
+
let test;
|
|
8685
|
+
let visitor;
|
|
8686
|
+
if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
|
|
8687
|
+
test = void 0;
|
|
8688
|
+
visitor = testOrVisitor;
|
|
8689
|
+
reverse = visitorOrReverse;
|
|
8690
|
+
} else {
|
|
8691
|
+
test = testOrVisitor;
|
|
8692
|
+
visitor = visitorOrReverse;
|
|
8693
|
+
reverse = maybeReverse;
|
|
8694
|
+
}
|
|
8695
|
+
visitParents(tree, test, overload, reverse);
|
|
8696
|
+
function overload(node2, parents) {
|
|
8697
|
+
const parent = parents[parents.length - 1];
|
|
8698
|
+
const index3 = parent ? parent.children.indexOf(node2) : void 0;
|
|
8699
|
+
return visitor(node2, index3, parent);
|
|
8700
|
+
}
|
|
8701
|
+
}
|
|
8702
|
+
|
|
8703
|
+
// node_modules/mdast-util-to-hast/lib/state.js
|
|
8704
|
+
var own4 = {}.hasOwnProperty;
|
|
8705
|
+
var emptyOptions3 = {};
|
|
8706
|
+
function createState(tree, options) {
|
|
8707
|
+
const settings = options || emptyOptions3;
|
|
8708
|
+
const definitionById = /* @__PURE__ */ new Map();
|
|
8709
|
+
const footnoteById = /* @__PURE__ */ new Map();
|
|
8710
|
+
const footnoteCounts = /* @__PURE__ */ new Map();
|
|
8711
|
+
const handlers2 = { ...handlers, ...settings.handlers };
|
|
8712
|
+
const state = {
|
|
8713
|
+
all: all2,
|
|
8714
|
+
applyData,
|
|
8715
|
+
definitionById,
|
|
8716
|
+
footnoteById,
|
|
8717
|
+
footnoteCounts,
|
|
8718
|
+
footnoteOrder: [],
|
|
8719
|
+
handlers: handlers2,
|
|
8720
|
+
one: one3,
|
|
8721
|
+
options: settings,
|
|
8722
|
+
patch,
|
|
8723
|
+
wrap
|
|
8724
|
+
};
|
|
8725
|
+
visit(tree, function(node2) {
|
|
8726
|
+
if (node2.type === "definition" || node2.type === "footnoteDefinition") {
|
|
8727
|
+
const map = node2.type === "definition" ? definitionById : footnoteById;
|
|
8728
|
+
const id = String(node2.identifier).toUpperCase();
|
|
8729
|
+
if (!map.has(id)) {
|
|
8730
|
+
map.set(id, node2);
|
|
8731
|
+
}
|
|
8732
|
+
}
|
|
8733
|
+
});
|
|
8734
|
+
return state;
|
|
8735
|
+
function one3(node2, parent) {
|
|
8736
|
+
const type = node2.type;
|
|
8737
|
+
const handle = state.handlers[type];
|
|
8738
|
+
if (own4.call(state.handlers, type) && handle) {
|
|
8739
|
+
return handle(state, node2, parent);
|
|
8740
|
+
}
|
|
8741
|
+
if (state.options.passThrough && state.options.passThrough.includes(type)) {
|
|
8742
|
+
if ("children" in node2) {
|
|
8743
|
+
const { children, ...shallow } = node2;
|
|
8744
|
+
const result = esm_default2(shallow);
|
|
8745
|
+
result.children = state.all(node2);
|
|
8746
|
+
return result;
|
|
8747
|
+
}
|
|
8748
|
+
return esm_default2(node2);
|
|
8383
8749
|
}
|
|
8384
8750
|
const unknown = state.options.unknownHandler || defaultUnknownHandler;
|
|
8385
8751
|
return unknown(state, node2, parent);
|
|
@@ -8483,7 +8849,7 @@ function toHast(tree, options) {
|
|
|
8483
8849
|
const foot = footer(state);
|
|
8484
8850
|
const result = Array.isArray(node2) ? { type: "root", children: node2 } : node2 || { type: "root", children: [] };
|
|
8485
8851
|
if (foot) {
|
|
8486
|
-
|
|
8852
|
+
ok("children" in result);
|
|
8487
8853
|
result.children.push({ type: "text", value: "\n" }, foot);
|
|
8488
8854
|
}
|
|
8489
8855
|
return result;
|
|
@@ -9629,7 +9995,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
9629
9995
|
} else if (resolve) {
|
|
9630
9996
|
resolve(file2);
|
|
9631
9997
|
} else {
|
|
9632
|
-
|
|
9998
|
+
ok(done, "`done` is defined if `resolve` is not");
|
|
9633
9999
|
done(void 0, file2);
|
|
9634
10000
|
}
|
|
9635
10001
|
}
|
|
@@ -9674,7 +10040,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
9674
10040
|
assertCompiler("processSync", this.compiler || this.Compiler);
|
|
9675
10041
|
this.process(file, realDone);
|
|
9676
10042
|
assertDone("processSync", "process", complete);
|
|
9677
|
-
|
|
10043
|
+
ok(result, "we either bailed on an error or have a tree");
|
|
9678
10044
|
return result;
|
|
9679
10045
|
function realDone(error, file2) {
|
|
9680
10046
|
complete = true;
|
|
@@ -9730,7 +10096,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
9730
10096
|
}
|
|
9731
10097
|
return done ? executor(void 0, done) : new Promise(executor);
|
|
9732
10098
|
function executor(resolve, reject) {
|
|
9733
|
-
|
|
10099
|
+
ok(
|
|
9734
10100
|
typeof file !== "function",
|
|
9735
10101
|
"`file` can\u2019t be a `done` anymore, we checked"
|
|
9736
10102
|
);
|
|
@@ -9746,7 +10112,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
9746
10112
|
} else if (resolve) {
|
|
9747
10113
|
resolve(resultingTree);
|
|
9748
10114
|
} else {
|
|
9749
|
-
|
|
10115
|
+
ok(done, "`done` is defined if `resolve` is not");
|
|
9750
10116
|
done(void 0, resultingTree, file2);
|
|
9751
10117
|
}
|
|
9752
10118
|
}
|
|
@@ -9774,7 +10140,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
9774
10140
|
let result;
|
|
9775
10141
|
this.run(tree, file, realDone);
|
|
9776
10142
|
assertDone("runSync", "run", complete);
|
|
9777
|
-
|
|
10143
|
+
ok(result, "we either bailed on an error or have a tree");
|
|
9778
10144
|
return result;
|
|
9779
10145
|
function realDone(error, tree2) {
|
|
9780
10146
|
bail(error);
|
|
@@ -10110,445 +10476,51 @@ function Markdown(options) {
|
|
|
10110
10476
|
}
|
|
10111
10477
|
return index3;
|
|
10112
10478
|
}
|
|
10113
|
-
if (node2.type === "element") {
|
|
10114
|
-
let key;
|
|
10115
|
-
for (key in urlAttributes) {
|
|
10116
|
-
if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
|
|
10117
|
-
const value = node2.properties[key];
|
|
10118
|
-
const test = urlAttributes[key];
|
|
10119
|
-
if (test === null || test.includes(node2.tagName)) {
|
|
10120
|
-
node2.properties[key] = urlTransform(String(value || ""), key, node2);
|
|
10121
|
-
}
|
|
10122
|
-
}
|
|
10123
|
-
}
|
|
10124
|
-
}
|
|
10125
|
-
if (node2.type === "element") {
|
|
10126
|
-
let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
|
|
10127
|
-
if (!remove && allowElement && typeof index3 === "number") {
|
|
10128
|
-
remove = !allowElement(node2, index3, parent);
|
|
10129
|
-
}
|
|
10130
|
-
if (remove && parent && typeof index3 === "number") {
|
|
10131
|
-
if (unwrapDisallowed && node2.children) {
|
|
10132
|
-
parent.children.splice(index3, 1, ...node2.children);
|
|
10133
|
-
} else {
|
|
10134
|
-
parent.children.splice(index3, 1);
|
|
10135
|
-
}
|
|
10136
|
-
return index3;
|
|
10137
|
-
}
|
|
10138
|
-
}
|
|
10139
|
-
}
|
|
10140
|
-
}
|
|
10141
|
-
function defaultUrlTransform(value) {
|
|
10142
|
-
const colon = value.indexOf(":");
|
|
10143
|
-
const questionMark = value.indexOf("?");
|
|
10144
|
-
const numberSign = value.indexOf("#");
|
|
10145
|
-
const slash = value.indexOf("/");
|
|
10146
|
-
if (
|
|
10147
|
-
// If there is no protocol, it’s relative.
|
|
10148
|
-
colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
10149
|
-
slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
|
|
10150
|
-
safeProtocol.test(value.slice(0, colon))
|
|
10151
|
-
) {
|
|
10152
|
-
return value;
|
|
10153
|
-
}
|
|
10154
|
-
return "";
|
|
10155
|
-
}
|
|
10156
|
-
|
|
10157
|
-
// src/components/Avatar/Avatar.tsx
|
|
10158
|
-
var import_clsx = __toESM(require("clsx"));
|
|
10159
|
-
var import_react14 = __toESM(require("react"));
|
|
10160
|
-
|
|
10161
|
-
// src/components/Threads/icons.tsx
|
|
10162
|
-
var import_react13 = __toESM(require("react"));
|
|
10163
|
-
var Icon = {
|
|
10164
|
-
MessageBubble: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
10165
|
-
"svg",
|
|
10166
|
-
{
|
|
10167
|
-
className: "str-chat__icon str-chat__icon--message-bubble",
|
|
10168
|
-
fill: "none",
|
|
10169
|
-
height: "14",
|
|
10170
|
-
viewBox: "0 0 14 14",
|
|
10171
|
-
width: "14",
|
|
10172
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10173
|
-
...props
|
|
10174
|
-
},
|
|
10175
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
10176
|
-
"path",
|
|
10177
|
-
{
|
|
10178
|
-
d: "M1.66659 1.66665H12.3333V9.66665H2.44659L1.66659 10.4466V1.66665ZM1.66659 0.333313C0.933252 0.333313 0.339919 0.933313 0.339919 1.66665L0.333252 13.6666L2.99992 11H12.3333C13.0666 11 13.6666 10.4 13.6666 9.66665V1.66665C13.6666 0.933313 13.0666 0.333313 12.3333 0.333313H1.66659ZM2.99992 6.99998H10.9999V8.33331H2.99992V6.99998ZM2.99992 4.99998H10.9999V6.33331H2.99992V4.99998ZM2.99992 2.99998H10.9999V4.33331H2.99992V2.99998Z",
|
|
10179
|
-
fill: "currentColor"
|
|
10180
|
-
}
|
|
10181
|
-
)
|
|
10182
|
-
),
|
|
10183
|
-
MessageBubbleEmpty: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
10184
|
-
"svg",
|
|
10185
|
-
{
|
|
10186
|
-
className: "str-chat__icon str-chat__icon--message-bubble-empty",
|
|
10187
|
-
fill: "none",
|
|
10188
|
-
height: "20",
|
|
10189
|
-
viewBox: "0 0 20 20",
|
|
10190
|
-
width: "20",
|
|
10191
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10192
|
-
...props
|
|
10193
|
-
},
|
|
10194
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
10195
|
-
"path",
|
|
10196
|
-
{
|
|
10197
|
-
d: "M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0ZM18 14H4L2 16V2H18V14Z",
|
|
10198
|
-
fill: "currentColor"
|
|
10199
|
-
}
|
|
10200
|
-
)
|
|
10201
|
-
),
|
|
10202
|
-
Reload: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
10203
|
-
"svg",
|
|
10204
|
-
{
|
|
10205
|
-
className: "str-chat__icon str-chat__icon--reload",
|
|
10206
|
-
fill: "none",
|
|
10207
|
-
height: "22",
|
|
10208
|
-
viewBox: "0 0 16 22",
|
|
10209
|
-
width: "16",
|
|
10210
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10211
|
-
...props
|
|
10212
|
-
},
|
|
10213
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
10214
|
-
"path",
|
|
10215
|
-
{
|
|
10216
|
-
d: "M8 3V0L4 4L8 8V5C11.31 5 14 7.69 14 11C14 12.01 13.75 12.97 13.3 13.8L14.76 15.26C15.54 14.03 16 12.57 16 11C16 6.58 12.42 3 8 3ZM8 17C4.69 17 2 14.31 2 11C2 9.99 2.25 9.03 2.7 8.2L1.24 6.74C0.46 7.97 0 9.43 0 11C0 15.42 3.58 19 8 19V22L12 18L8 14V17Z",
|
|
10217
|
-
fill: "currentColor"
|
|
10218
|
-
}
|
|
10219
|
-
)
|
|
10220
|
-
),
|
|
10221
|
-
User: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
10222
|
-
"svg",
|
|
10223
|
-
{
|
|
10224
|
-
className: "str-chat__icon str-chat__icon--user",
|
|
10225
|
-
fill: "none",
|
|
10226
|
-
height: "16",
|
|
10227
|
-
viewBox: "0 0 16 16",
|
|
10228
|
-
width: "16",
|
|
10229
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10230
|
-
...props
|
|
10231
|
-
},
|
|
10232
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
10233
|
-
"path",
|
|
10234
|
-
{
|
|
10235
|
-
d: "M8 2C9.1 2 10 2.9 10 4C10 5.1 9.1 6 8 6C6.9 6 6 5.1 6 4C6 2.9 6.9 2 8 2ZM8 12C10.7 12 13.8 13.29 14 14H2C2.23 13.28 5.31 12 8 12ZM8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0ZM8 10C5.33 10 0 11.34 0 14V16H16V14C16 11.34 10.67 10 8 10Z",
|
|
10236
|
-
fill: "currentColor"
|
|
10237
|
-
}
|
|
10238
|
-
)
|
|
10239
|
-
)
|
|
10240
|
-
};
|
|
10241
|
-
|
|
10242
|
-
// src/utils/getWholeChar.ts
|
|
10243
|
-
var getWholeChar = (str, i) => {
|
|
10244
|
-
const code2 = str.charCodeAt(i);
|
|
10245
|
-
if (Number.isNaN(code2)) return "";
|
|
10246
|
-
if (code2 < 55296 || code2 > 57343) return str.charAt(i);
|
|
10247
|
-
if (55296 <= code2 && code2 <= 56319) {
|
|
10248
|
-
if (str.length <= i + 1) {
|
|
10249
|
-
throw "High surrogate without following low surrogate";
|
|
10250
|
-
}
|
|
10251
|
-
const next = str.charCodeAt(i + 1);
|
|
10252
|
-
if (56320 > next || next > 57343) {
|
|
10253
|
-
throw "High surrogate without following low surrogate";
|
|
10254
|
-
}
|
|
10255
|
-
return str.charAt(i) + str.charAt(i + 1);
|
|
10256
|
-
}
|
|
10257
|
-
if (i === 0) {
|
|
10258
|
-
throw "Low surrogate without preceding high surrogate";
|
|
10259
|
-
}
|
|
10260
|
-
const prev = str.charCodeAt(i - 1);
|
|
10261
|
-
if (55296 > prev || prev > 56319) {
|
|
10262
|
-
throw "Low surrogate without preceding high surrogate";
|
|
10263
|
-
}
|
|
10264
|
-
return "";
|
|
10265
|
-
};
|
|
10266
|
-
|
|
10267
|
-
// src/components/Avatar/Avatar.tsx
|
|
10268
|
-
var Avatar = (props) => {
|
|
10269
|
-
const {
|
|
10270
|
-
className,
|
|
10271
|
-
image: image2,
|
|
10272
|
-
name: name2,
|
|
10273
|
-
onClick = () => void 0,
|
|
10274
|
-
onMouseOver = () => void 0
|
|
10275
|
-
} = props;
|
|
10276
|
-
const [error, setError] = (0, import_react14.useState)(false);
|
|
10277
|
-
(0, import_react14.useEffect)(() => {
|
|
10278
|
-
setError(false);
|
|
10279
|
-
}, [image2]);
|
|
10280
|
-
const nameStr = name2?.toString() || "";
|
|
10281
|
-
const initials = getWholeChar(nameStr, 0);
|
|
10282
|
-
const showImage = image2 && !error;
|
|
10283
|
-
return /* @__PURE__ */ import_react14.default.createElement(
|
|
10284
|
-
"div",
|
|
10285
|
-
{
|
|
10286
|
-
className: (0, import_clsx.default)(`str-chat__avatar str-chat__message-sender-avatar`, className, {
|
|
10287
|
-
["str-chat__avatar--multiple-letters"]: initials.length > 1,
|
|
10288
|
-
["str-chat__avatar--no-letters"]: !initials.length,
|
|
10289
|
-
["str-chat__avatar--one-letter"]: initials.length === 1
|
|
10290
|
-
}),
|
|
10291
|
-
"data-testid": "avatar",
|
|
10292
|
-
onClick,
|
|
10293
|
-
onMouseOver,
|
|
10294
|
-
role: "button",
|
|
10295
|
-
title: name2
|
|
10296
|
-
},
|
|
10297
|
-
showImage ? /* @__PURE__ */ import_react14.default.createElement(
|
|
10298
|
-
"img",
|
|
10299
|
-
{
|
|
10300
|
-
alt: initials,
|
|
10301
|
-
className: "str-chat__avatar-image",
|
|
10302
|
-
"data-testid": "avatar-img",
|
|
10303
|
-
onError: () => setError(true),
|
|
10304
|
-
src: image2
|
|
10305
|
-
}
|
|
10306
|
-
) : /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, !!initials.length && /* @__PURE__ */ import_react14.default.createElement(
|
|
10307
|
-
"div",
|
|
10308
|
-
{
|
|
10309
|
-
className: (0, import_clsx.default)("str-chat__avatar-fallback"),
|
|
10310
|
-
"data-testid": "avatar-fallback"
|
|
10311
|
-
},
|
|
10312
|
-
initials
|
|
10313
|
-
), !initials.length && /* @__PURE__ */ import_react14.default.createElement(Icon.User, null))
|
|
10314
|
-
);
|
|
10315
|
-
};
|
|
10316
|
-
|
|
10317
|
-
// src/components/Message/utils.tsx
|
|
10318
|
-
var import_react_fast_compare = __toESM(require("react-fast-compare"));
|
|
10319
|
-
var import_emoji_regex = __toESM(require("emoji-regex"));
|
|
10320
|
-
var isUserMuted = (message, mutes) => {
|
|
10321
|
-
if (!mutes || !message) return false;
|
|
10322
|
-
const userMuted = mutes.filter((el) => el.target.id === message.user?.id);
|
|
10323
|
-
return !!userMuted.length;
|
|
10324
|
-
};
|
|
10325
|
-
var MESSAGE_ACTIONS = {
|
|
10326
|
-
delete: "delete",
|
|
10327
|
-
edit: "edit",
|
|
10328
|
-
flag: "flag",
|
|
10329
|
-
markUnread: "markUnread",
|
|
10330
|
-
mute: "mute",
|
|
10331
|
-
pin: "pin",
|
|
10332
|
-
quote: "quote",
|
|
10333
|
-
react: "react",
|
|
10334
|
-
reply: "reply"
|
|
10335
|
-
};
|
|
10336
|
-
var ACTIONS_NOT_WORKING_IN_THREAD = [
|
|
10337
|
-
MESSAGE_ACTIONS.pin,
|
|
10338
|
-
MESSAGE_ACTIONS.reply,
|
|
10339
|
-
MESSAGE_ACTIONS.markUnread
|
|
10340
|
-
];
|
|
10341
|
-
|
|
10342
|
-
// src/components/ChannelPreview/ChannelPreview.tsx
|
|
10343
|
-
var import_lodash = __toESM(require("lodash.throttle"));
|
|
10344
|
-
var import_react23 = __toESM(require("react"));
|
|
10345
|
-
|
|
10346
|
-
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
10347
|
-
var import_react18 = __toESM(require("react"));
|
|
10348
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
10349
|
-
|
|
10350
|
-
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
10351
|
-
var import_react17 = __toESM(require("react"));
|
|
10352
|
-
var import_clsx2 = __toESM(require("clsx"));
|
|
10353
|
-
|
|
10354
|
-
// src/components/ChannelList/hooks/useSelectedChannelState.ts
|
|
10355
|
-
var import_react15 = require("react");
|
|
10356
|
-
var import_shim2 = require("use-sync-external-store/shim");
|
|
10357
|
-
var noop2 = () => {
|
|
10358
|
-
};
|
|
10359
|
-
function useSelectedChannelState({
|
|
10360
|
-
channel,
|
|
10361
|
-
selector: selector2,
|
|
10362
|
-
stateChangeEventKeys = ["all"]
|
|
10363
|
-
}) {
|
|
10364
|
-
const subscribe = (0, import_react15.useCallback)(
|
|
10365
|
-
(onStoreChange) => {
|
|
10366
|
-
if (!channel) return noop2;
|
|
10367
|
-
const subscriptions = stateChangeEventKeys.map(
|
|
10368
|
-
(et) => channel.on(et, () => {
|
|
10369
|
-
onStoreChange(selector2(channel));
|
|
10370
|
-
})
|
|
10371
|
-
);
|
|
10372
|
-
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
10373
|
-
},
|
|
10374
|
-
[channel, selector2, stateChangeEventKeys]
|
|
10375
|
-
);
|
|
10376
|
-
const getSnapshot = (0, import_react15.useCallback)(() => {
|
|
10377
|
-
if (!channel) return void 0;
|
|
10378
|
-
return selector2(channel);
|
|
10379
|
-
}, [channel, selector2]);
|
|
10380
|
-
return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot);
|
|
10381
|
-
}
|
|
10382
|
-
|
|
10383
|
-
// src/components/ChannelList/hooks/useChannelMembershipState.ts
|
|
10384
|
-
var selector = (c) => c.state.membership;
|
|
10385
|
-
var keys2 = ["member.updated"];
|
|
10386
|
-
function useChannelMembershipState(channel) {
|
|
10387
|
-
return useSelectedChannelState({ channel, selector, stateChangeEventKeys: keys2 });
|
|
10388
|
-
}
|
|
10389
|
-
|
|
10390
|
-
// src/components/ChannelPreview/icons.tsx
|
|
10391
|
-
var import_react16 = __toESM(require("react"));
|
|
10392
|
-
var Icon2 = {
|
|
10393
|
-
ArchiveBox: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
10394
|
-
"svg",
|
|
10395
|
-
{
|
|
10396
|
-
className: "str-chat__icon str-chat__icon--archive-box",
|
|
10397
|
-
fill: "currentColor",
|
|
10398
|
-
viewBox: "0 0 512 512",
|
|
10399
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10400
|
-
...props
|
|
10401
|
-
},
|
|
10402
|
-
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32l448 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96L0 64C0 46.3 14.3 32 32 32zm0 128l448 0 0 256c0 35.3-28.7 64-64 64L96 480c-35.3 0-64-28.7-64-64l0-256zm128 80c0 8.8 7.2 16 16 16l160 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-160 0c-8.8 0-16 7.2-16 16z" })
|
|
10403
|
-
),
|
|
10404
|
-
Pin: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
10405
|
-
"svg",
|
|
10406
|
-
{
|
|
10407
|
-
className: "str-chat__icon str-chat__icon--pin",
|
|
10408
|
-
fill: "currentColor",
|
|
10409
|
-
viewBox: "0 0 384 512",
|
|
10410
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10411
|
-
...props
|
|
10412
|
-
},
|
|
10413
|
-
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32C32 14.3 46.3 0 64 0L320 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-29.5 0 11.4 148.2c36.7 19.9 65.7 53.2 79.5 94.7l1 3c3.3 9.8 1.6 20.5-4.4 28.8s-15.7 13.3-26 13.3L32 352c-10.3 0-19.9-4.9-26-13.3s-7.7-19.1-4.4-28.8l1-3c13.8-41.5 42.8-74.8 79.5-94.7L93.5 64 64 64C46.3 64 32 49.7 32 32zM160 384l64 0 0 96c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-96z" })
|
|
10414
|
-
)
|
|
10415
|
-
};
|
|
10416
|
-
|
|
10417
|
-
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
10418
|
-
function ChannelPreviewActionButtons({
|
|
10419
|
-
channel
|
|
10420
|
-
}) {
|
|
10421
|
-
const membership = useChannelMembershipState(channel);
|
|
10422
|
-
const { t } = useTranslationContext();
|
|
10423
|
-
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "str-chat__channel-preview__action-buttons" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
10424
|
-
"button",
|
|
10425
|
-
{
|
|
10426
|
-
"aria-label": membership.pinned_at ? t("Unpin") : t("Pin"),
|
|
10427
|
-
className: (0, import_clsx2.default)(
|
|
10428
|
-
"str-chat__channel-preview__action-button",
|
|
10429
|
-
"str-chat__channel-preview__action-button--pin",
|
|
10430
|
-
membership.pinned_at && "str-chat__channel-preview__action-button--active"
|
|
10431
|
-
),
|
|
10432
|
-
onClick: (e) => {
|
|
10433
|
-
e.stopPropagation();
|
|
10434
|
-
if (membership.pinned_at) {
|
|
10435
|
-
channel.unpin();
|
|
10436
|
-
} else {
|
|
10437
|
-
channel.pin();
|
|
10438
|
-
}
|
|
10439
|
-
},
|
|
10440
|
-
title: membership.pinned_at ? t("Unpin") : t("Pin")
|
|
10441
|
-
},
|
|
10442
|
-
/* @__PURE__ */ import_react17.default.createElement(Icon2.Pin, null)
|
|
10443
|
-
), /* @__PURE__ */ import_react17.default.createElement(
|
|
10444
|
-
"button",
|
|
10445
|
-
{
|
|
10446
|
-
"aria-label": membership.archived_at ? t("Unarchive") : t("Archive"),
|
|
10447
|
-
className: (0, import_clsx2.default)(
|
|
10448
|
-
"str-chat__channel-preview__action-button",
|
|
10449
|
-
"str-chat__channel-preview__action-button--archive",
|
|
10450
|
-
membership.archived_at && "str-chat__channel-preview__action-button--active"
|
|
10451
|
-
),
|
|
10452
|
-
onClick: (e) => {
|
|
10453
|
-
e.stopPropagation();
|
|
10454
|
-
if (membership.archived_at) {
|
|
10455
|
-
channel.unarchive();
|
|
10456
|
-
} else {
|
|
10457
|
-
channel.archive();
|
|
10458
|
-
}
|
|
10459
|
-
},
|
|
10460
|
-
title: membership.archived_at ? t("Unarchive") : t("Archive")
|
|
10461
|
-
},
|
|
10462
|
-
/* @__PURE__ */ import_react17.default.createElement(Icon2.ArchiveBox, null)
|
|
10463
|
-
));
|
|
10464
|
-
}
|
|
10465
|
-
|
|
10466
|
-
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
10467
|
-
var UnMemoizedChannelPreviewMessenger = (props) => {
|
|
10468
|
-
const {
|
|
10469
|
-
active,
|
|
10470
|
-
Avatar: Avatar2 = Avatar,
|
|
10471
|
-
channel,
|
|
10472
|
-
className: customClassName = "",
|
|
10473
|
-
displayImage,
|
|
10474
|
-
displayTitle,
|
|
10475
|
-
groupChannelDisplayInfo,
|
|
10476
|
-
latestMessagePreview,
|
|
10477
|
-
onSelect: customOnSelectChannel,
|
|
10478
|
-
setActiveChannel,
|
|
10479
|
-
unread,
|
|
10480
|
-
watchers
|
|
10481
|
-
} = props;
|
|
10482
|
-
const { ChannelPreviewActionButtons: ChannelPreviewActionButtons2 = ChannelPreviewActionButtons } = useComponentContext();
|
|
10483
|
-
const channelPreviewButton = (0, import_react18.useRef)(null);
|
|
10484
|
-
const avatarName = displayTitle || channel.state.messages[channel.state.messages.length - 1]?.user?.id;
|
|
10485
|
-
const onSelectChannel = (e) => {
|
|
10486
|
-
if (customOnSelectChannel) {
|
|
10487
|
-
customOnSelectChannel(e);
|
|
10488
|
-
} else if (setActiveChannel) {
|
|
10489
|
-
setActiveChannel(channel, watchers);
|
|
10490
|
-
}
|
|
10491
|
-
if (channelPreviewButton?.current) {
|
|
10492
|
-
channelPreviewButton.current.blur();
|
|
10479
|
+
if (node2.type === "element") {
|
|
10480
|
+
let key;
|
|
10481
|
+
for (key in urlAttributes) {
|
|
10482
|
+
if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
|
|
10483
|
+
const value = node2.properties[key];
|
|
10484
|
+
const test = urlAttributes[key];
|
|
10485
|
+
if (test === null || test.includes(node2.tagName)) {
|
|
10486
|
+
node2.properties[key] = urlTransform(String(value || ""), key, node2);
|
|
10487
|
+
}
|
|
10488
|
+
}
|
|
10489
|
+
}
|
|
10493
10490
|
}
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
"aria-label": `Select Channel: ${displayTitle || ""}`,
|
|
10499
|
-
"aria-selected": active,
|
|
10500
|
-
className: (0, import_clsx3.default)(
|
|
10501
|
-
`str-chat__channel-preview-messenger str-chat__channel-preview`,
|
|
10502
|
-
active && "str-chat__channel-preview-messenger--active",
|
|
10503
|
-
unread && unread >= 1 && "str-chat__channel-preview-messenger--unread",
|
|
10504
|
-
customClassName
|
|
10505
|
-
),
|
|
10506
|
-
"data-testid": "channel-preview-button",
|
|
10507
|
-
onClick: onSelectChannel,
|
|
10508
|
-
ref: channelPreviewButton,
|
|
10509
|
-
role: "option"
|
|
10510
|
-
},
|
|
10511
|
-
/* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--left" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
10512
|
-
Avatar2,
|
|
10513
|
-
{
|
|
10514
|
-
className: "str-chat__avatar--channel-preview",
|
|
10515
|
-
groupChannelDisplayInfo,
|
|
10516
|
-
image: displayImage,
|
|
10517
|
-
name: avatarName
|
|
10491
|
+
if (node2.type === "element") {
|
|
10492
|
+
let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
|
|
10493
|
+
if (!remove && allowElement && typeof index3 === "number") {
|
|
10494
|
+
remove = !allowElement(node2, index3, parent);
|
|
10518
10495
|
}
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
}
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
);
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
};
|
|
10546
|
-
|
|
10547
|
-
// src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts
|
|
10548
|
-
var import_react21 = require("react");
|
|
10496
|
+
if (remove && parent && typeof index3 === "number") {
|
|
10497
|
+
if (unwrapDisallowed && node2.children) {
|
|
10498
|
+
parent.children.splice(index3, 1, ...node2.children);
|
|
10499
|
+
} else {
|
|
10500
|
+
parent.children.splice(index3, 1);
|
|
10501
|
+
}
|
|
10502
|
+
return index3;
|
|
10503
|
+
}
|
|
10504
|
+
}
|
|
10505
|
+
}
|
|
10506
|
+
}
|
|
10507
|
+
function defaultUrlTransform(value) {
|
|
10508
|
+
const colon = value.indexOf(":");
|
|
10509
|
+
const questionMark = value.indexOf("?");
|
|
10510
|
+
const numberSign = value.indexOf("#");
|
|
10511
|
+
const slash = value.indexOf("/");
|
|
10512
|
+
if (
|
|
10513
|
+
// If there is no protocol, it’s relative.
|
|
10514
|
+
colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
10515
|
+
slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
|
|
10516
|
+
safeProtocol.test(value.slice(0, colon))
|
|
10517
|
+
) {
|
|
10518
|
+
return value;
|
|
10519
|
+
}
|
|
10520
|
+
return "";
|
|
10521
|
+
}
|
|
10549
10522
|
|
|
10550
10523
|
// src/components/ChannelPreview/utils.tsx
|
|
10551
|
-
var import_react20 = __toESM(require("react"));
|
|
10552
10524
|
var renderPreviewText = (text5) => /* @__PURE__ */ import_react20.default.createElement(Markdown, { skipHtml: true }, text5);
|
|
10553
10525
|
var getLatestPollVote = (latestVotesByOption) => {
|
|
10554
10526
|
let latestVote;
|
|
@@ -10815,6 +10787,35 @@ var ChannelPreview = (props) => {
|
|
|
10815
10787
|
);
|
|
10816
10788
|
};
|
|
10817
10789
|
|
|
10790
|
+
// src/components/Thread/Thread.tsx
|
|
10791
|
+
var import_react33 = __toESM(require("react"));
|
|
10792
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
10793
|
+
|
|
10794
|
+
// src/components/Message/utils.tsx
|
|
10795
|
+
var import_react_fast_compare = __toESM(require("react-fast-compare"));
|
|
10796
|
+
var import_emoji_regex = __toESM(require("emoji-regex"));
|
|
10797
|
+
var isUserMuted = (message, mutes) => {
|
|
10798
|
+
if (!mutes || !message) return false;
|
|
10799
|
+
const userMuted = mutes.filter((el) => el.target.id === message.user?.id);
|
|
10800
|
+
return !!userMuted.length;
|
|
10801
|
+
};
|
|
10802
|
+
var MESSAGE_ACTIONS = {
|
|
10803
|
+
delete: "delete",
|
|
10804
|
+
edit: "edit",
|
|
10805
|
+
flag: "flag",
|
|
10806
|
+
markUnread: "markUnread",
|
|
10807
|
+
mute: "mute",
|
|
10808
|
+
pin: "pin",
|
|
10809
|
+
quote: "quote",
|
|
10810
|
+
react: "react",
|
|
10811
|
+
reply: "reply"
|
|
10812
|
+
};
|
|
10813
|
+
var ACTIONS_NOT_WORKING_IN_THREAD = [
|
|
10814
|
+
MESSAGE_ACTIONS.pin,
|
|
10815
|
+
MESSAGE_ACTIONS.reply,
|
|
10816
|
+
MESSAGE_ACTIONS.markUnread
|
|
10817
|
+
];
|
|
10818
|
+
|
|
10818
10819
|
// src/components/Message/hooks/useUserRole.ts
|
|
10819
10820
|
var useUserRole = (message, onlySenderCanEdit, disableQuotedMessages) => {
|
|
10820
10821
|
const { channel, channelCapabilities = {} } = useChannelStateContext("useUserRole");
|
|
@@ -10847,51 +10848,13 @@ var useUserRole = (message, onlySenderCanEdit, disableQuotedMessages) => {
|
|
|
10847
10848
|
};
|
|
10848
10849
|
};
|
|
10849
10850
|
|
|
10850
|
-
// src/components/Message/icons.tsx
|
|
10851
|
-
var import_react24 = __toESM(require("react"));
|
|
10852
|
-
var ActionsIcon = ({ className = "" }) => /* @__PURE__ */ import_react24.default.createElement(
|
|
10853
|
-
"svg",
|
|
10854
|
-
{
|
|
10855
|
-
className,
|
|
10856
|
-
height: "4",
|
|
10857
|
-
viewBox: "0 0 11 4",
|
|
10858
|
-
width: "11",
|
|
10859
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
10860
|
-
},
|
|
10861
|
-
/* @__PURE__ */ import_react24.default.createElement(
|
|
10862
|
-
"path",
|
|
10863
|
-
{
|
|
10864
|
-
d: "M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",
|
|
10865
|
-
fillRule: "nonzero"
|
|
10866
|
-
}
|
|
10867
|
-
)
|
|
10868
|
-
);
|
|
10869
|
-
var ReactionIcon = ({ className = "" }) => /* @__PURE__ */ import_react24.default.createElement(
|
|
10870
|
-
"svg",
|
|
10871
|
-
{
|
|
10872
|
-
className,
|
|
10873
|
-
height: "12",
|
|
10874
|
-
viewBox: "0 0 12 12",
|
|
10875
|
-
width: "12",
|
|
10876
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
10877
|
-
},
|
|
10878
|
-
/* @__PURE__ */ import_react24.default.createElement("g", { clipRule: "evenodd", fillRule: "evenodd" }, /* @__PURE__ */ import_react24.default.createElement("path", { d: "M6 1.2C3.3 1.2 1.2 3.3 1.2 6c0 2.7 2.1 4.8 4.8 4.8 2.7 0 4.8-2.1 4.8-4.8 0-2.7-2.1-4.8-4.8-4.8zM0 6c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6-6-2.7-6-6z" }), /* @__PURE__ */ import_react24.default.createElement("path", { d: "M5.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM8.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM3.3 6.7c.3-.2.6-.1.8.1.3.4.8.9 1.5 1 .6.2 1.4.1 2.4-1 .2-.2.6-.3.8 0 .2.2.3.6 0 .8-1.1 1.3-2.4 1.7-3.5 1.5-1-.2-1.8-.9-2.2-1.5-.2-.3-.1-.7.2-.9z" }))
|
|
10879
|
-
);
|
|
10880
|
-
var ThreadIcon = ({ className = "" }) => /* @__PURE__ */ import_react24.default.createElement("svg", { className, height: "10", width: "14", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react24.default.createElement(
|
|
10881
|
-
"path",
|
|
10882
|
-
{
|
|
10883
|
-
d: "M8.516 3c4.78 0 4.972 6.5 4.972 6.5-1.6-2.906-2.847-3.184-4.972-3.184v2.872L3.772 4.994 8.516.5V3zM.484 5l4.5-4.237v1.78L2.416 5l2.568 2.125v1.828L.484 5z",
|
|
10884
|
-
fillRule: "evenodd"
|
|
10885
|
-
}
|
|
10886
|
-
));
|
|
10887
|
-
|
|
10888
10851
|
// src/components/MessageActions/MessageActions.tsx
|
|
10889
10852
|
var import_clsx5 = __toESM(require("clsx"));
|
|
10890
10853
|
var import_react26 = __toESM(require("react"));
|
|
10891
10854
|
|
|
10892
10855
|
// src/components/Dialog/DialogAnchor.tsx
|
|
10893
10856
|
var import_clsx4 = __toESM(require("clsx"));
|
|
10894
|
-
var
|
|
10857
|
+
var import_react24 = __toESM(require("react"));
|
|
10895
10858
|
var import_focus = require("@react-aria/focus");
|
|
10896
10859
|
var import_react_popper = require("react-popper");
|
|
10897
10860
|
function useDialogAnchor({
|
|
@@ -10899,7 +10862,7 @@ function useDialogAnchor({
|
|
|
10899
10862
|
placement,
|
|
10900
10863
|
referenceElement
|
|
10901
10864
|
}) {
|
|
10902
|
-
const [popperElement, setPopperElement] = (0,
|
|
10865
|
+
const [popperElement, setPopperElement] = (0, import_react24.useState)(null);
|
|
10903
10866
|
const { attributes, styles, update } = (0, import_react_popper.usePopper)(referenceElement, popperElement, {
|
|
10904
10867
|
modifiers: [
|
|
10905
10868
|
{
|
|
@@ -10914,7 +10877,7 @@ function useDialogAnchor({
|
|
|
10914
10877
|
],
|
|
10915
10878
|
placement
|
|
10916
10879
|
});
|
|
10917
|
-
(0,
|
|
10880
|
+
(0, import_react24.useEffect)(() => {
|
|
10918
10881
|
if (open && popperElement) {
|
|
10919
10882
|
update?.();
|
|
10920
10883
|
}
|
|
@@ -10935,6 +10898,7 @@ var DialogAnchor = ({
|
|
|
10935
10898
|
id,
|
|
10936
10899
|
placement = "auto",
|
|
10937
10900
|
referenceElement = null,
|
|
10901
|
+
tabIndex,
|
|
10938
10902
|
trapFocus,
|
|
10939
10903
|
...restDivProps
|
|
10940
10904
|
}) => {
|
|
@@ -10945,7 +10909,7 @@ var DialogAnchor = ({
|
|
|
10945
10909
|
placement,
|
|
10946
10910
|
referenceElement
|
|
10947
10911
|
});
|
|
10948
|
-
(0,
|
|
10912
|
+
(0, import_react24.useEffect)(() => {
|
|
10949
10913
|
if (!open) return;
|
|
10950
10914
|
const hideOnEscape = (event) => {
|
|
10951
10915
|
if (event.key !== "Escape") return;
|
|
@@ -10959,7 +10923,7 @@ var DialogAnchor = ({
|
|
|
10959
10923
|
if (!open) {
|
|
10960
10924
|
return null;
|
|
10961
10925
|
}
|
|
10962
|
-
return /* @__PURE__ */
|
|
10926
|
+
return /* @__PURE__ */ import_react24.default.createElement(DialogPortalEntry, { dialogId: id }, /* @__PURE__ */ import_react24.default.createElement(import_focus.FocusScope, { autoFocus: focus, contain: trapFocus, restoreFocus: true }, /* @__PURE__ */ import_react24.default.createElement(
|
|
10963
10927
|
"div",
|
|
10964
10928
|
{
|
|
10965
10929
|
...restDivProps,
|
|
@@ -10968,12 +10932,50 @@ var DialogAnchor = ({
|
|
|
10968
10932
|
"data-testid": "str-chat__dialog-contents",
|
|
10969
10933
|
ref: setPopperElement,
|
|
10970
10934
|
style: styles.popper,
|
|
10971
|
-
tabIndex: 0
|
|
10935
|
+
tabIndex: typeof tabIndex !== "undefined" ? tabIndex : 0
|
|
10972
10936
|
},
|
|
10973
10937
|
children
|
|
10974
10938
|
)));
|
|
10975
10939
|
};
|
|
10976
10940
|
|
|
10941
|
+
// src/components/Message/icons.tsx
|
|
10942
|
+
var import_react25 = __toESM(require("react"));
|
|
10943
|
+
var ActionsIcon = ({ className = "" }) => /* @__PURE__ */ import_react25.default.createElement(
|
|
10944
|
+
"svg",
|
|
10945
|
+
{
|
|
10946
|
+
className,
|
|
10947
|
+
height: "4",
|
|
10948
|
+
viewBox: "0 0 11 4",
|
|
10949
|
+
width: "11",
|
|
10950
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
10951
|
+
},
|
|
10952
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
10953
|
+
"path",
|
|
10954
|
+
{
|
|
10955
|
+
d: "M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",
|
|
10956
|
+
fillRule: "nonzero"
|
|
10957
|
+
}
|
|
10958
|
+
)
|
|
10959
|
+
);
|
|
10960
|
+
var ReactionIcon = ({ className = "" }) => /* @__PURE__ */ import_react25.default.createElement(
|
|
10961
|
+
"svg",
|
|
10962
|
+
{
|
|
10963
|
+
className,
|
|
10964
|
+
height: "12",
|
|
10965
|
+
viewBox: "0 0 12 12",
|
|
10966
|
+
width: "12",
|
|
10967
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
10968
|
+
},
|
|
10969
|
+
/* @__PURE__ */ import_react25.default.createElement("g", { clipRule: "evenodd", fillRule: "evenodd" }, /* @__PURE__ */ import_react25.default.createElement("path", { d: "M6 1.2C3.3 1.2 1.2 3.3 1.2 6c0 2.7 2.1 4.8 4.8 4.8 2.7 0 4.8-2.1 4.8-4.8 0-2.7-2.1-4.8-4.8-4.8zM0 6c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6-6-2.7-6-6z" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M5.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM8.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM3.3 6.7c.3-.2.6-.1.8.1.3.4.8.9 1.5 1 .6.2 1.4.1 2.4-1 .2-.2.6-.3.8 0 .2.2.3.6 0 .8-1.1 1.3-2.4 1.7-3.5 1.5-1-.2-1.8-.9-2.2-1.5-.2-.3-.1-.7.2-.9z" }))
|
|
10970
|
+
);
|
|
10971
|
+
var ThreadIcon = ({ className = "" }) => /* @__PURE__ */ import_react25.default.createElement("svg", { className, height: "10", width: "14", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react25.default.createElement(
|
|
10972
|
+
"path",
|
|
10973
|
+
{
|
|
10974
|
+
d: "M8.516 3c4.78 0 4.972 6.5 4.972 6.5-1.6-2.906-2.847-3.184-4.972-3.184v2.872L3.772 4.994 8.516.5V3zM.484 5l4.5-4.237v1.78L2.416 5l2.568 2.125v1.828L.484 5z",
|
|
10975
|
+
fillRule: "evenodd"
|
|
10976
|
+
}
|
|
10977
|
+
));
|
|
10978
|
+
|
|
10977
10979
|
// src/components/MessageActions/MessageActions.tsx
|
|
10978
10980
|
var MessageActionsWrapper = (props) => {
|
|
10979
10981
|
const { children, customWrapperClass, inline, toggleOpen } = props;
|
|
@@ -11388,18 +11390,87 @@ var InfiniteScrollPaginator = (props) => {
|
|
|
11388
11390
|
);
|
|
11389
11391
|
};
|
|
11390
11392
|
|
|
11393
|
+
// src/components/Thread/Thread.tsx
|
|
11394
|
+
var LegacyThreadContext = import_react33.default.createContext({ legacyThread: void 0 });
|
|
11395
|
+
var useLegacyThreadContext = () => (0, import_react33.useContext)(LegacyThreadContext);
|
|
11396
|
+
|
|
11397
|
+
// src/components/MessageInput/hooks/useMessageComposer.ts
|
|
11398
|
+
var queueCache = new import_stream_chat.FixedSizeQueueCache(64);
|
|
11399
|
+
var useMessageComposer = () => {
|
|
11400
|
+
const { client } = useChatContext();
|
|
11401
|
+
const { channel } = useChannelStateContext();
|
|
11402
|
+
const { editing, message: editedMessage } = useMessageContext();
|
|
11403
|
+
const { legacyThread: parentMessage } = useLegacyThreadContext();
|
|
11404
|
+
const threadInstance = useThreadContext();
|
|
11405
|
+
const cachedEditedMessage = (0, import_react34.useMemo)(() => {
|
|
11406
|
+
if (!editedMessage) return void 0;
|
|
11407
|
+
return editedMessage;
|
|
11408
|
+
}, [editedMessage?.id]);
|
|
11409
|
+
const cachedParentMessage = (0, import_react34.useMemo)(() => {
|
|
11410
|
+
if (!parentMessage) return void 0;
|
|
11411
|
+
return parentMessage;
|
|
11412
|
+
}, [parentMessage?.id]);
|
|
11413
|
+
const messageComposer = (0, import_react34.useMemo)(() => {
|
|
11414
|
+
if (editing && cachedEditedMessage) {
|
|
11415
|
+
const tag = import_stream_chat.MessageComposer.constructTag(cachedEditedMessage);
|
|
11416
|
+
const cachedComposer = queueCache.get(tag);
|
|
11417
|
+
if (cachedComposer) return cachedComposer;
|
|
11418
|
+
return new import_stream_chat.MessageComposer({
|
|
11419
|
+
client,
|
|
11420
|
+
composition: cachedEditedMessage,
|
|
11421
|
+
compositionContext: cachedEditedMessage
|
|
11422
|
+
});
|
|
11423
|
+
} else if (threadInstance) {
|
|
11424
|
+
return threadInstance.messageComposer;
|
|
11425
|
+
} else if (cachedParentMessage) {
|
|
11426
|
+
const compositionContext = {
|
|
11427
|
+
...cachedParentMessage,
|
|
11428
|
+
legacyThreadId: cachedParentMessage.id
|
|
11429
|
+
};
|
|
11430
|
+
const tag = import_stream_chat.MessageComposer.constructTag(compositionContext);
|
|
11431
|
+
const cachedComposer = queueCache.get(tag);
|
|
11432
|
+
if (cachedComposer) return cachedComposer;
|
|
11433
|
+
return new import_stream_chat.MessageComposer({
|
|
11434
|
+
client,
|
|
11435
|
+
compositionContext
|
|
11436
|
+
});
|
|
11437
|
+
} else {
|
|
11438
|
+
return channel.messageComposer;
|
|
11439
|
+
}
|
|
11440
|
+
}, [
|
|
11441
|
+
cachedEditedMessage,
|
|
11442
|
+
cachedParentMessage,
|
|
11443
|
+
channel,
|
|
11444
|
+
client,
|
|
11445
|
+
editing,
|
|
11446
|
+
threadInstance
|
|
11447
|
+
]);
|
|
11448
|
+
if (["legacy_thread", "message"].includes(
|
|
11449
|
+
messageComposer.contextType
|
|
11450
|
+
) && !queueCache.peek(messageComposer.tag)) {
|
|
11451
|
+
queueCache.add(messageComposer.tag, messageComposer);
|
|
11452
|
+
}
|
|
11453
|
+
(0, import_react34.useEffect)(() => {
|
|
11454
|
+
const unsubscribe = messageComposer.registerSubscriptions();
|
|
11455
|
+
return () => {
|
|
11456
|
+
unsubscribe();
|
|
11457
|
+
};
|
|
11458
|
+
}, [messageComposer]);
|
|
11459
|
+
return messageComposer;
|
|
11460
|
+
};
|
|
11461
|
+
|
|
11391
11462
|
// src/experimental/Search/hooks/useSearchQueriesInProgress.ts
|
|
11392
|
-
var
|
|
11463
|
+
var import_react35 = require("react");
|
|
11393
11464
|
var searchControllerStateSelector = (value) => ({
|
|
11394
11465
|
sources: value.sources
|
|
11395
11466
|
});
|
|
11396
11467
|
var useSearchQueriesInProgress = (searchController) => {
|
|
11397
|
-
const [queriesInProgress, setQueriesInProgress] = (0,
|
|
11468
|
+
const [queriesInProgress, setQueriesInProgress] = (0, import_react35.useState)([]);
|
|
11398
11469
|
const { sources } = useStateStore(
|
|
11399
11470
|
searchController.state,
|
|
11400
11471
|
searchControllerStateSelector
|
|
11401
11472
|
);
|
|
11402
|
-
(0,
|
|
11473
|
+
(0, import_react35.useEffect)(() => {
|
|
11403
11474
|
const subscriptions = sources.map(
|
|
11404
11475
|
(source) => source.state.subscribeWithSelector(
|
|
11405
11476
|
(value) => ({ isLoading: value.isLoading }),
|
|
@@ -11419,7 +11490,7 @@ var useSearchQueriesInProgress = (searchController) => {
|
|
|
11419
11490
|
};
|
|
11420
11491
|
|
|
11421
11492
|
// src/experimental/MessageActions/hooks/useBaseMessageActionSetFilter.ts
|
|
11422
|
-
var
|
|
11493
|
+
var import_react36 = require("react");
|
|
11423
11494
|
var useBaseMessageActionSetFilter = (messageActionSet, disable2 = false) => {
|
|
11424
11495
|
const { initialMessage: isInitialMessage, message } = useMessageContext();
|
|
11425
11496
|
const {
|
|
@@ -11433,7 +11504,7 @@ var useBaseMessageActionSetFilter = (messageActionSet, disable2 = false) => {
|
|
|
11433
11504
|
canReply
|
|
11434
11505
|
} = useUserRole(message);
|
|
11435
11506
|
const isMessageThreadReply = typeof message.parent_id === "string";
|
|
11436
|
-
return (0,
|
|
11507
|
+
return (0, import_react36.useMemo)(() => {
|
|
11437
11508
|
if (disable2) return messageActionSet;
|
|
11438
11509
|
if (isInitialMessage || // not sure whether this thing even works anymore
|
|
11439
11510
|
!message.type || message.type === "error" || message.type === "system" || message.type === "ephemeral" || message.status === "failed" || message.status === "sending")
|
|
@@ -11464,8 +11535,8 @@ var useBaseMessageActionSetFilter = (messageActionSet, disable2 = false) => {
|
|
|
11464
11535
|
};
|
|
11465
11536
|
|
|
11466
11537
|
// src/experimental/MessageActions/hooks/useSplitMessageActionSet.ts
|
|
11467
|
-
var
|
|
11468
|
-
var useSplitMessageActionSet = (messageActionSet) => (0,
|
|
11538
|
+
var import_react37 = require("react");
|
|
11539
|
+
var useSplitMessageActionSet = (messageActionSet) => (0, import_react37.useMemo)(() => {
|
|
11469
11540
|
const quickActionSet = [];
|
|
11470
11541
|
const dropdownActionSet = [];
|
|
11471
11542
|
for (const action of messageActionSet) {
|
|
@@ -11476,70 +11547,70 @@ var useSplitMessageActionSet = (messageActionSet) => (0, import_react35.useMemo)
|
|
|
11476
11547
|
}, [messageActionSet]);
|
|
11477
11548
|
|
|
11478
11549
|
// src/experimental/MessageActions/defaults.tsx
|
|
11479
|
-
var
|
|
11550
|
+
var import_react38 = __toESM(require("react"));
|
|
11480
11551
|
var DefaultDropdownActionButton = ({
|
|
11481
11552
|
"aria-selected": ariaSelected = "false",
|
|
11482
11553
|
children,
|
|
11483
11554
|
className = "str-chat__message-actions-list-item-button",
|
|
11484
11555
|
role = "option",
|
|
11485
11556
|
...rest
|
|
11486
|
-
}) => /* @__PURE__ */
|
|
11557
|
+
}) => /* @__PURE__ */ import_react38.default.createElement("button", { "aria-selected": ariaSelected, className, role, ...rest }, children);
|
|
11487
11558
|
var DefaultMessageActionComponents = {
|
|
11488
11559
|
dropdown: {
|
|
11489
11560
|
Quote() {
|
|
11490
|
-
const { setQuotedMessage } = useChannelActionContext();
|
|
11491
11561
|
const { message } = useMessageContext();
|
|
11492
11562
|
const { t } = useTranslationContext();
|
|
11563
|
+
const messageComposer = useMessageComposer();
|
|
11493
11564
|
const handleQuote = () => {
|
|
11494
|
-
setQuotedMessage(message);
|
|
11565
|
+
messageComposer.setQuotedMessage(message);
|
|
11495
11566
|
const elements = message.parent_id ? document.querySelectorAll(".str-chat__thread .str-chat__textarea__textarea") : document.getElementsByClassName("str-chat__textarea__textarea");
|
|
11496
11567
|
const textarea = elements.item(0);
|
|
11497
11568
|
if (textarea instanceof HTMLTextAreaElement) {
|
|
11498
11569
|
textarea.focus();
|
|
11499
11570
|
}
|
|
11500
11571
|
};
|
|
11501
|
-
return /* @__PURE__ */
|
|
11572
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleQuote }, t("Quote"));
|
|
11502
11573
|
},
|
|
11503
11574
|
Pin() {
|
|
11504
11575
|
const { handlePin, message } = useMessageContext();
|
|
11505
11576
|
const { t } = useTranslationContext();
|
|
11506
|
-
return /* @__PURE__ */
|
|
11577
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handlePin }, !message.pinned ? t("Pin") : t("Unpin"));
|
|
11507
11578
|
},
|
|
11508
11579
|
MarkUnread() {
|
|
11509
11580
|
const { handleMarkUnread } = useMessageContext();
|
|
11510
11581
|
const { t } = useTranslationContext();
|
|
11511
|
-
return /* @__PURE__ */
|
|
11582
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleMarkUnread }, t("Mark as unread"));
|
|
11512
11583
|
},
|
|
11513
11584
|
Flag() {
|
|
11514
11585
|
const { handleFlag } = useMessageContext();
|
|
11515
11586
|
const { t } = useTranslationContext();
|
|
11516
|
-
return /* @__PURE__ */
|
|
11587
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleFlag }, t("Flag"));
|
|
11517
11588
|
},
|
|
11518
11589
|
Mute() {
|
|
11519
11590
|
const { handleMute, message } = useMessageContext();
|
|
11520
11591
|
const { mutes } = useChatContext();
|
|
11521
11592
|
const { t } = useTranslationContext();
|
|
11522
|
-
return /* @__PURE__ */
|
|
11593
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleMute }, isUserMuted(message, mutes) ? t("Unmute") : t("Mute"));
|
|
11523
11594
|
},
|
|
11524
11595
|
Edit() {
|
|
11525
11596
|
const { handleEdit } = useMessageContext();
|
|
11526
11597
|
const { t } = useTranslationContext();
|
|
11527
|
-
return /* @__PURE__ */
|
|
11598
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleEdit }, t("Edit Message"));
|
|
11528
11599
|
},
|
|
11529
11600
|
Delete() {
|
|
11530
11601
|
const { handleDelete } = useMessageContext();
|
|
11531
11602
|
const { t } = useTranslationContext();
|
|
11532
|
-
return /* @__PURE__ */
|
|
11603
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleDelete }, t("Delete"));
|
|
11533
11604
|
}
|
|
11534
11605
|
},
|
|
11535
11606
|
quick: {
|
|
11536
11607
|
React() {
|
|
11537
|
-
return /* @__PURE__ */
|
|
11608
|
+
return /* @__PURE__ */ import_react38.default.createElement(ReactionSelectorWithButton, { ReactionIcon });
|
|
11538
11609
|
},
|
|
11539
11610
|
Reply() {
|
|
11540
11611
|
const { handleOpenThread } = useMessageContext();
|
|
11541
11612
|
const { t } = useTranslationContext();
|
|
11542
|
-
return /* @__PURE__ */
|
|
11613
|
+
return /* @__PURE__ */ import_react38.default.createElement(
|
|
11543
11614
|
"button",
|
|
11544
11615
|
{
|
|
11545
11616
|
"aria-label": t("aria/Open Thread"),
|
|
@@ -11547,7 +11618,7 @@ var DefaultMessageActionComponents = {
|
|
|
11547
11618
|
"data-testid": "thread-action",
|
|
11548
11619
|
onClick: handleOpenThread
|
|
11549
11620
|
},
|
|
11550
|
-
/* @__PURE__ */
|
|
11621
|
+
/* @__PURE__ */ import_react38.default.createElement(ThreadIcon, { className: "str-chat__message-action-icon" })
|
|
11551
11622
|
);
|
|
11552
11623
|
}
|
|
11553
11624
|
}
|
|
@@ -11609,7 +11680,7 @@ var MessageActions = ({
|
|
|
11609
11680
|
const { theme } = useChatContext();
|
|
11610
11681
|
const { isMyMessage, message } = useMessageContext();
|
|
11611
11682
|
const { t } = useTranslationContext();
|
|
11612
|
-
const [actionsBoxButtonElement, setActionsBoxButtonElement] = (0,
|
|
11683
|
+
const [actionsBoxButtonElement, setActionsBoxButtonElement] = (0, import_react39.useState)(null);
|
|
11613
11684
|
const filteredMessageActionSet = useBaseMessageActionSetFilter(
|
|
11614
11685
|
messageActionSet,
|
|
11615
11686
|
disableBaseMessageActionSetFilter
|
|
@@ -11625,14 +11696,14 @@ var MessageActions = ({
|
|
|
11625
11696
|
if (dropdownActionSet.length + quickActionSet.length === 0) {
|
|
11626
11697
|
return null;
|
|
11627
11698
|
}
|
|
11628
|
-
return /* @__PURE__ */
|
|
11699
|
+
return /* @__PURE__ */ import_react39.default.createElement(
|
|
11629
11700
|
"div",
|
|
11630
11701
|
{
|
|
11631
|
-
className: (0,
|
|
11702
|
+
className: (0, import_clsx9.default)(`str-chat__message-${theme}__actions str-chat__message-options`, {
|
|
11632
11703
|
"str-chat__message-options--active": dropdownDialogIsOpen || reactionSelectorDialogIsOpen
|
|
11633
11704
|
})
|
|
11634
11705
|
},
|
|
11635
|
-
dropdownActionSet.length > 0 && /* @__PURE__ */
|
|
11706
|
+
dropdownActionSet.length > 0 && /* @__PURE__ */ import_react39.default.createElement(MessageActionsWrapper, { inline: false, toggleOpen: dialog?.toggle }, /* @__PURE__ */ import_react39.default.createElement(
|
|
11636
11707
|
"button",
|
|
11637
11708
|
{
|
|
11638
11709
|
"aria-expanded": dropdownDialogIsOpen,
|
|
@@ -11642,30 +11713,31 @@ var MessageActions = ({
|
|
|
11642
11713
|
"data-testid": "message-actions-toggle-button",
|
|
11643
11714
|
ref: setActionsBoxButtonElement
|
|
11644
11715
|
},
|
|
11645
|
-
/* @__PURE__ */
|
|
11646
|
-
), /* @__PURE__ */
|
|
11716
|
+
/* @__PURE__ */ import_react39.default.createElement(ActionsIcon, { className: "str-chat__message-action-icon" })
|
|
11717
|
+
), /* @__PURE__ */ import_react39.default.createElement(
|
|
11647
11718
|
DialogAnchor,
|
|
11648
11719
|
{
|
|
11649
11720
|
id: dropdownDialogId,
|
|
11650
11721
|
placement: isMyMessage() ? "top-end" : "top-start",
|
|
11651
11722
|
referenceElement: actionsBoxButtonElement,
|
|
11723
|
+
tabIndex: -1,
|
|
11652
11724
|
trapFocus: true
|
|
11653
11725
|
},
|
|
11654
|
-
/* @__PURE__ */
|
|
11726
|
+
/* @__PURE__ */ import_react39.default.createElement(DropdownBox, { open: dropdownDialogIsOpen }, dropdownActionSet.map(({ Component: DropdownActionComponent, type }) => /* @__PURE__ */ import_react39.default.createElement(DropdownActionComponent, { key: type })))
|
|
11655
11727
|
)),
|
|
11656
|
-
quickActionSet.map(({ Component: QuickActionComponent, type }) => /* @__PURE__ */
|
|
11728
|
+
quickActionSet.map(({ Component: QuickActionComponent, type }) => /* @__PURE__ */ import_react39.default.createElement(QuickActionComponent, { key: type }))
|
|
11657
11729
|
);
|
|
11658
11730
|
};
|
|
11659
11731
|
var DropdownBox = ({ children, open }) => {
|
|
11660
11732
|
const { t } = useTranslationContext();
|
|
11661
|
-
return /* @__PURE__ */
|
|
11733
|
+
return /* @__PURE__ */ import_react39.default.createElement(
|
|
11662
11734
|
"div",
|
|
11663
11735
|
{
|
|
11664
|
-
className: (0,
|
|
11736
|
+
className: (0, import_clsx9.default)("str-chat__message-actions-box", {
|
|
11665
11737
|
"str-chat__message-actions-box--open": open
|
|
11666
11738
|
})
|
|
11667
11739
|
},
|
|
11668
|
-
/* @__PURE__ */
|
|
11740
|
+
/* @__PURE__ */ import_react39.default.createElement(
|
|
11669
11741
|
"div",
|
|
11670
11742
|
{
|
|
11671
11743
|
"aria-label": t("aria/Message Options"),
|
|
@@ -11678,22 +11750,22 @@ var DropdownBox = ({ children, open }) => {
|
|
|
11678
11750
|
};
|
|
11679
11751
|
|
|
11680
11752
|
// src/experimental/Search/Search.tsx
|
|
11681
|
-
var
|
|
11682
|
-
var
|
|
11753
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
11754
|
+
var import_react52 = __toESM(require("react"));
|
|
11683
11755
|
|
|
11684
11756
|
// src/experimental/Search/SearchBar/SearchBar.tsx
|
|
11685
|
-
var
|
|
11686
|
-
var
|
|
11757
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
11758
|
+
var import_react41 = __toESM(require("react"));
|
|
11687
11759
|
|
|
11688
11760
|
// src/experimental/Search/SearchContext.tsx
|
|
11689
|
-
var
|
|
11690
|
-
var SearchContext = (0,
|
|
11761
|
+
var import_react40 = __toESM(require("react"));
|
|
11762
|
+
var SearchContext = (0, import_react40.createContext)(void 0);
|
|
11691
11763
|
var SearchContextProvider = ({
|
|
11692
11764
|
children,
|
|
11693
11765
|
value
|
|
11694
|
-
}) => /* @__PURE__ */
|
|
11766
|
+
}) => /* @__PURE__ */ import_react40.default.createElement(SearchContext.Provider, { value }, children);
|
|
11695
11767
|
var useSearchContext = () => {
|
|
11696
|
-
const contextValue = (0,
|
|
11768
|
+
const contextValue = (0, import_react40.useContext)(SearchContext);
|
|
11697
11769
|
return contextValue;
|
|
11698
11770
|
};
|
|
11699
11771
|
|
|
@@ -11706,12 +11778,12 @@ var SearchBar = () => {
|
|
|
11706
11778
|
const { t } = useTranslationContext();
|
|
11707
11779
|
const { disabled, exitSearchOnInputBlur, placeholder, searchController } = useSearchContext();
|
|
11708
11780
|
const queriesInProgress = useSearchQueriesInProgress(searchController);
|
|
11709
|
-
const [input, setInput] = (0,
|
|
11781
|
+
const [input, setInput] = (0, import_react41.useState)(null);
|
|
11710
11782
|
const { isActive, searchQuery } = useStateStore(
|
|
11711
11783
|
searchController.state,
|
|
11712
11784
|
searchControllerStateSelector2
|
|
11713
11785
|
);
|
|
11714
|
-
(0,
|
|
11786
|
+
(0, import_react41.useEffect)(() => {
|
|
11715
11787
|
if (!input) return;
|
|
11716
11788
|
const handleKeyDown = (event) => {
|
|
11717
11789
|
if (event.key === "Escape") {
|
|
@@ -11724,15 +11796,15 @@ var SearchBar = () => {
|
|
|
11724
11796
|
document.removeEventListener("keydown", handleKeyDown);
|
|
11725
11797
|
};
|
|
11726
11798
|
}, [searchController, input]);
|
|
11727
|
-
return /* @__PURE__ */
|
|
11799
|
+
return /* @__PURE__ */ import_react41.default.createElement("div", { className: "str-chat__search-bar", "data-testid": "search-bar" }, /* @__PURE__ */ import_react41.default.createElement(
|
|
11728
11800
|
"div",
|
|
11729
11801
|
{
|
|
11730
|
-
className: (0,
|
|
11802
|
+
className: (0, import_clsx10.default)("str-chat__search-input--wrapper", {
|
|
11731
11803
|
"str-chat__search-input--wrapper-active": isActive
|
|
11732
11804
|
})
|
|
11733
11805
|
},
|
|
11734
|
-
/* @__PURE__ */
|
|
11735
|
-
/* @__PURE__ */
|
|
11806
|
+
/* @__PURE__ */ import_react41.default.createElement("div", { className: "str-chat__search-input--icon" }),
|
|
11807
|
+
/* @__PURE__ */ import_react41.default.createElement(
|
|
11736
11808
|
"input",
|
|
11737
11809
|
{
|
|
11738
11810
|
className: "str-chat__search-input",
|
|
@@ -11755,7 +11827,7 @@ var SearchBar = () => {
|
|
|
11755
11827
|
value: searchQuery
|
|
11756
11828
|
}
|
|
11757
11829
|
),
|
|
11758
|
-
searchQuery && /* @__PURE__ */
|
|
11830
|
+
searchQuery && /* @__PURE__ */ import_react41.default.createElement(
|
|
11759
11831
|
"button",
|
|
11760
11832
|
{
|
|
11761
11833
|
className: "str-chat__search-input--clear-button",
|
|
@@ -11766,12 +11838,12 @@ var SearchBar = () => {
|
|
|
11766
11838
|
input?.focus();
|
|
11767
11839
|
}
|
|
11768
11840
|
},
|
|
11769
|
-
/* @__PURE__ */
|
|
11841
|
+
/* @__PURE__ */ import_react41.default.createElement("div", { className: "str-chat__search-input--clear-button-icon" })
|
|
11770
11842
|
)
|
|
11771
|
-
), isActive ? /* @__PURE__ */
|
|
11843
|
+
), isActive ? /* @__PURE__ */ import_react41.default.createElement(
|
|
11772
11844
|
"button",
|
|
11773
11845
|
{
|
|
11774
|
-
className: (0,
|
|
11846
|
+
className: (0, import_clsx10.default)(
|
|
11775
11847
|
"str-chat__search-bar-button str-chat__search-bar-button--exit-search"
|
|
11776
11848
|
),
|
|
11777
11849
|
"data-testid": "search-bar-button",
|
|
@@ -11785,27 +11857,25 @@ var SearchBar = () => {
|
|
|
11785
11857
|
};
|
|
11786
11858
|
|
|
11787
11859
|
// src/experimental/Search/SearchResults/SearchResults.tsx
|
|
11788
|
-
var
|
|
11860
|
+
var import_react51 = __toESM(require("react"));
|
|
11789
11861
|
|
|
11790
11862
|
// src/experimental/Search/SearchResults/SearchSourceResults.tsx
|
|
11791
|
-
var
|
|
11863
|
+
var import_react48 = __toESM(require("react"));
|
|
11792
11864
|
|
|
11793
11865
|
// src/experimental/Search/SearchResults/SearchSourceResultList.tsx
|
|
11794
|
-
var
|
|
11866
|
+
var import_react46 = __toESM(require("react"));
|
|
11795
11867
|
|
|
11796
11868
|
// src/experimental/Search/SearchResults/SearchResultItem.tsx
|
|
11869
|
+
var import_react42 = __toESM(require("react"));
|
|
11797
11870
|
var import_lodash3 = __toESM(require("lodash.uniqby"));
|
|
11798
|
-
var
|
|
11799
|
-
var ChannelSearchResultItem = ({
|
|
11800
|
-
item
|
|
11801
|
-
}) => {
|
|
11871
|
+
var ChannelSearchResultItem = ({ item }) => {
|
|
11802
11872
|
const { setActiveChannel } = useChatContext();
|
|
11803
11873
|
const { setChannels } = useChannelListContext();
|
|
11804
|
-
const onSelect = (0,
|
|
11874
|
+
const onSelect = (0, import_react42.useCallback)(() => {
|
|
11805
11875
|
setActiveChannel(item);
|
|
11806
11876
|
setChannels?.((channels) => (0, import_lodash3.default)([item, ...channels], "cid"));
|
|
11807
11877
|
}, [item, setActiveChannel, setChannels]);
|
|
11808
|
-
return /* @__PURE__ */
|
|
11878
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
11809
11879
|
ChannelPreview,
|
|
11810
11880
|
{
|
|
11811
11881
|
channel: item,
|
|
@@ -11824,13 +11894,13 @@ var MessageSearchResultItem = ({
|
|
|
11824
11894
|
setActiveChannel
|
|
11825
11895
|
} = useChatContext();
|
|
11826
11896
|
const { setChannels } = useChannelListContext();
|
|
11827
|
-
const channel = (0,
|
|
11897
|
+
const channel = (0, import_react42.useMemo)(() => {
|
|
11828
11898
|
const { channel: channelData } = item;
|
|
11829
11899
|
const type = channelData?.type ?? "unknown";
|
|
11830
11900
|
const id = channelData?.id ?? "unknown";
|
|
11831
11901
|
return client.channel(type, id);
|
|
11832
11902
|
}, [client, item]);
|
|
11833
|
-
const onSelect = (0,
|
|
11903
|
+
const onSelect = (0, import_react42.useCallback)(async () => {
|
|
11834
11904
|
if (!channel) return;
|
|
11835
11905
|
await channel.state.loadMessageIntoState(
|
|
11836
11906
|
item.id,
|
|
@@ -11841,9 +11911,9 @@ var MessageSearchResultItem = ({
|
|
|
11841
11911
|
setActiveChannel(channel);
|
|
11842
11912
|
setChannels?.((channels) => (0, import_lodash3.default)([channel, ...channels], "cid"));
|
|
11843
11913
|
}, [channel, item, searchController, setActiveChannel, setChannels]);
|
|
11844
|
-
const getLatestMessagePreview2 = (0,
|
|
11914
|
+
const getLatestMessagePreview2 = (0, import_react42.useCallback)(() => item.text, [item]);
|
|
11845
11915
|
if (!channel) return;
|
|
11846
|
-
return /* @__PURE__ */
|
|
11916
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
11847
11917
|
ChannelPreview,
|
|
11848
11918
|
{
|
|
11849
11919
|
active: channel.cid === activeChannel?.cid && item.id === searchController._internalState.getLatestValue().focusedMessage?.id,
|
|
@@ -11854,13 +11924,11 @@ var MessageSearchResultItem = ({
|
|
|
11854
11924
|
}
|
|
11855
11925
|
);
|
|
11856
11926
|
};
|
|
11857
|
-
var UserSearchResultItem = ({
|
|
11858
|
-
item
|
|
11859
|
-
}) => {
|
|
11927
|
+
var UserSearchResultItem = ({ item }) => {
|
|
11860
11928
|
const { client, setActiveChannel } = useChatContext();
|
|
11861
11929
|
const { setChannels } = useChannelListContext();
|
|
11862
11930
|
const { directMessagingChannelType } = useSearchContext();
|
|
11863
|
-
const onClick = (0,
|
|
11931
|
+
const onClick = (0, import_react42.useCallback)(() => {
|
|
11864
11932
|
const newChannel = client.channel(directMessagingChannelType, {
|
|
11865
11933
|
members: [client.userID, item.id]
|
|
11866
11934
|
});
|
|
@@ -11868,7 +11936,7 @@ var UserSearchResultItem = ({
|
|
|
11868
11936
|
setActiveChannel(newChannel);
|
|
11869
11937
|
setChannels?.((channels) => (0, import_lodash3.default)([newChannel, ...channels], "cid"));
|
|
11870
11938
|
}, [client, item, setActiveChannel, setChannels, directMessagingChannelType]);
|
|
11871
|
-
return /* @__PURE__ */
|
|
11939
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
11872
11940
|
"button",
|
|
11873
11941
|
{
|
|
11874
11942
|
"aria-label": `Select User Channel: ${item.name || ""}`,
|
|
@@ -11877,7 +11945,7 @@ var UserSearchResultItem = ({
|
|
|
11877
11945
|
onClick,
|
|
11878
11946
|
role: "option"
|
|
11879
11947
|
},
|
|
11880
|
-
/* @__PURE__ */
|
|
11948
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
11881
11949
|
Avatar,
|
|
11882
11950
|
{
|
|
11883
11951
|
className: "str-chat__avatar--channel-preview",
|
|
@@ -11886,7 +11954,7 @@ var UserSearchResultItem = ({
|
|
|
11886
11954
|
user: item
|
|
11887
11955
|
}
|
|
11888
11956
|
),
|
|
11889
|
-
/* @__PURE__ */
|
|
11957
|
+
/* @__PURE__ */ import_react42.default.createElement("div", { className: "str-chat__search-result--display-name" }, item.name || item.id)
|
|
11890
11958
|
);
|
|
11891
11959
|
};
|
|
11892
11960
|
var DefaultSearchResultItems = {
|
|
@@ -11896,18 +11964,18 @@ var DefaultSearchResultItems = {
|
|
|
11896
11964
|
};
|
|
11897
11965
|
|
|
11898
11966
|
// src/experimental/Search/SearchResults/SearchSourceResultListFooter.tsx
|
|
11899
|
-
var
|
|
11967
|
+
var import_react45 = __toESM(require("react"));
|
|
11900
11968
|
|
|
11901
11969
|
// src/experimental/Search/SearchResults/SearchSourceResultsLoadingIndicator.tsx
|
|
11902
|
-
var
|
|
11970
|
+
var import_react44 = __toESM(require("react"));
|
|
11903
11971
|
|
|
11904
11972
|
// src/experimental/Search/SearchSourceResultsContext.tsx
|
|
11905
|
-
var
|
|
11906
|
-
var SearchSourceResultsContext = (0,
|
|
11973
|
+
var import_react43 = __toESM(require("react"));
|
|
11974
|
+
var SearchSourceResultsContext = (0, import_react43.createContext)(void 0);
|
|
11907
11975
|
var SearchSourceResultsContextProvider = ({
|
|
11908
11976
|
children,
|
|
11909
11977
|
value
|
|
11910
|
-
}) => /* @__PURE__ */
|
|
11978
|
+
}) => /* @__PURE__ */ import_react43.default.createElement(
|
|
11911
11979
|
SearchSourceResultsContext.Provider,
|
|
11912
11980
|
{
|
|
11913
11981
|
value
|
|
@@ -11915,7 +11983,7 @@ var SearchSourceResultsContextProvider = ({
|
|
|
11915
11983
|
children
|
|
11916
11984
|
);
|
|
11917
11985
|
var useSearchSourceResultsContext = () => {
|
|
11918
|
-
const contextValue = (0,
|
|
11986
|
+
const contextValue = (0, import_react43.useContext)(SearchSourceResultsContext);
|
|
11919
11987
|
return contextValue;
|
|
11920
11988
|
};
|
|
11921
11989
|
|
|
@@ -11923,7 +11991,7 @@ var useSearchSourceResultsContext = () => {
|
|
|
11923
11991
|
var SearchSourceResultsLoadingIndicator = () => {
|
|
11924
11992
|
const { t } = useTranslationContext();
|
|
11925
11993
|
const { searchSource } = useSearchSourceResultsContext();
|
|
11926
|
-
return /* @__PURE__ */
|
|
11994
|
+
return /* @__PURE__ */ import_react44.default.createElement(
|
|
11927
11995
|
"div",
|
|
11928
11996
|
{
|
|
11929
11997
|
className: "str-chat__search-source-results__loading-indicator",
|
|
@@ -11948,13 +12016,13 @@ var SearchSourceResultListFooter = () => {
|
|
|
11948
12016
|
searchSource.state,
|
|
11949
12017
|
searchSourceStateSelector
|
|
11950
12018
|
);
|
|
11951
|
-
return /* @__PURE__ */
|
|
12019
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
|
11952
12020
|
"div",
|
|
11953
12021
|
{
|
|
11954
12022
|
className: "str-chat__search-source-result-list__footer",
|
|
11955
12023
|
"data-testid": "search-footer"
|
|
11956
12024
|
},
|
|
11957
|
-
isLoading ? /* @__PURE__ */
|
|
12025
|
+
isLoading ? /* @__PURE__ */ import_react45.default.createElement(SearchSourceResultsLoadingIndicator2, null) : !hasNext ? /* @__PURE__ */ import_react45.default.createElement("div", { className: "str-chat__search-source-results---empty" }, t("All results loaded")) : null
|
|
11958
12026
|
);
|
|
11959
12027
|
};
|
|
11960
12028
|
|
|
@@ -11972,36 +12040,36 @@ var SearchSourceResultList = ({
|
|
|
11972
12040
|
const { items } = useStateStore(searchSource.state, searchSourceStateSelector2);
|
|
11973
12041
|
const SearchResultItem = SearchResultItems[searchSource.type];
|
|
11974
12042
|
if (!SearchResultItem) return null;
|
|
11975
|
-
return /* @__PURE__ */
|
|
12043
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
11976
12044
|
"div",
|
|
11977
12045
|
{
|
|
11978
12046
|
className: "str-chat__search-source-result-list",
|
|
11979
12047
|
"data-testid": "search-source-result-list"
|
|
11980
12048
|
},
|
|
11981
|
-
/* @__PURE__ */
|
|
12049
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
11982
12050
|
InfiniteScrollPaginator,
|
|
11983
12051
|
{
|
|
11984
12052
|
loadNextDebounceMs: loadMoreDebounceMs,
|
|
11985
12053
|
loadNextOnScrollToBottom: searchSource.search,
|
|
11986
12054
|
threshold: loadMoreThresholdPx
|
|
11987
12055
|
},
|
|
11988
|
-
items?.map((item, i) => /* @__PURE__ */
|
|
12056
|
+
items?.map((item, i) => /* @__PURE__ */ import_react46.default.createElement(
|
|
11989
12057
|
SearchResultItem,
|
|
11990
12058
|
{
|
|
11991
12059
|
item,
|
|
11992
12060
|
key: `source-search-result-${searchSource.type}-${i}`
|
|
11993
12061
|
}
|
|
11994
12062
|
)),
|
|
11995
|
-
/* @__PURE__ */
|
|
12063
|
+
/* @__PURE__ */ import_react46.default.createElement(SearchSourceResultListFooter2, null)
|
|
11996
12064
|
)
|
|
11997
12065
|
);
|
|
11998
12066
|
};
|
|
11999
12067
|
|
|
12000
12068
|
// src/experimental/Search/SearchResults/SearchSourceResultsEmpty.tsx
|
|
12001
|
-
var
|
|
12069
|
+
var import_react47 = __toESM(require("react"));
|
|
12002
12070
|
var SearchSourceResultsEmpty = () => {
|
|
12003
12071
|
const { t } = useTranslationContext();
|
|
12004
|
-
return /* @__PURE__ */
|
|
12072
|
+
return /* @__PURE__ */ import_react47.default.createElement("div", { className: "str-chat__search-source-results-empty" }, t("No results found"));
|
|
12005
12073
|
};
|
|
12006
12074
|
|
|
12007
12075
|
// src/experimental/Search/SearchResults/SearchSourceResultsHeader.tsx
|
|
@@ -12012,9 +12080,7 @@ var searchSourceStateSelector3 = (nextValue) => ({
|
|
|
12012
12080
|
isLoading: nextValue.isLoading,
|
|
12013
12081
|
items: nextValue.items
|
|
12014
12082
|
});
|
|
12015
|
-
var SearchSourceResults = ({
|
|
12016
|
-
searchSource
|
|
12017
|
-
}) => {
|
|
12083
|
+
var SearchSourceResults = ({ searchSource }) => {
|
|
12018
12084
|
const {
|
|
12019
12085
|
SearchSourceResultList: SearchSourceResultList2 = SearchSourceResultList,
|
|
12020
12086
|
SearchSourceResultsEmpty: SearchSourceResultsEmpty2 = SearchSourceResultsEmpty,
|
|
@@ -12025,35 +12091,33 @@ var SearchSourceResults = ({
|
|
|
12025
12091
|
searchSourceStateSelector3
|
|
12026
12092
|
);
|
|
12027
12093
|
if (!items && !isLoading) return null;
|
|
12028
|
-
return /* @__PURE__ */
|
|
12094
|
+
return /* @__PURE__ */ import_react48.default.createElement(SearchSourceResultsContextProvider, { value: { searchSource } }, /* @__PURE__ */ import_react48.default.createElement(
|
|
12029
12095
|
"div",
|
|
12030
12096
|
{
|
|
12031
12097
|
className: "str-chat__search-source-results",
|
|
12032
12098
|
"data-testid": "search-source-results"
|
|
12033
12099
|
},
|
|
12034
|
-
/* @__PURE__ */
|
|
12035
|
-
items?.length || isLoading ? /* @__PURE__ */
|
|
12100
|
+
/* @__PURE__ */ import_react48.default.createElement(SearchSourceResultsHeader2, null),
|
|
12101
|
+
items?.length || isLoading ? /* @__PURE__ */ import_react48.default.createElement(SearchSourceResultList2, null) : /* @__PURE__ */ import_react48.default.createElement(SearchSourceResultsEmpty2, null)
|
|
12036
12102
|
));
|
|
12037
12103
|
};
|
|
12038
12104
|
|
|
12039
12105
|
// src/experimental/Search/SearchResults/SearchResultsHeader.tsx
|
|
12040
|
-
var
|
|
12041
|
-
var
|
|
12106
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
12107
|
+
var import_react49 = __toESM(require("react"));
|
|
12042
12108
|
var searchSourceStateSelector4 = (nextValue) => ({
|
|
12043
12109
|
isActive: nextValue.isActive
|
|
12044
12110
|
});
|
|
12045
|
-
var SearchSourceFilterButton = ({
|
|
12046
|
-
source
|
|
12047
|
-
}) => {
|
|
12111
|
+
var SearchSourceFilterButton = ({ source }) => {
|
|
12048
12112
|
const { t } = useTranslationContext();
|
|
12049
12113
|
const { searchController } = useSearchContext();
|
|
12050
12114
|
const { isActive } = useStateStore(source.state, searchSourceStateSelector4);
|
|
12051
12115
|
const label = `search-results-header-filter-source-button-label--${source.type}`;
|
|
12052
|
-
return /* @__PURE__ */
|
|
12116
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
12053
12117
|
"button",
|
|
12054
12118
|
{
|
|
12055
12119
|
"aria-label": t("aria/Search results header filter button"),
|
|
12056
|
-
className: (0,
|
|
12120
|
+
className: (0, import_clsx11.default)("str-chat__search-results-header__filter-source-button", {
|
|
12057
12121
|
"str-chat__search-results-header__filter-source-button--active": isActive
|
|
12058
12122
|
}),
|
|
12059
12123
|
key: label,
|
|
@@ -12072,13 +12136,13 @@ var SearchSourceFilterButton = ({
|
|
|
12072
12136
|
};
|
|
12073
12137
|
var SearchResultsHeader = () => {
|
|
12074
12138
|
const { searchController } = useSearchContext();
|
|
12075
|
-
return /* @__PURE__ */
|
|
12139
|
+
return /* @__PURE__ */ import_react49.default.createElement("div", { className: "str-chat__search-results-header", "data-testid": "search-results-header" }, /* @__PURE__ */ import_react49.default.createElement(
|
|
12076
12140
|
"div",
|
|
12077
12141
|
{
|
|
12078
12142
|
className: "str-chat__search-results-header__filter-source-buttons",
|
|
12079
12143
|
"data-testid": "filter-source-buttons"
|
|
12080
12144
|
},
|
|
12081
|
-
searchController.sources.map((source) => /* @__PURE__ */
|
|
12145
|
+
searchController.sources.map((source) => /* @__PURE__ */ import_react49.default.createElement(
|
|
12082
12146
|
SearchSourceFilterButton,
|
|
12083
12147
|
{
|
|
12084
12148
|
key: `search-source-filter-button-${source.type}`,
|
|
@@ -12089,10 +12153,10 @@ var SearchResultsHeader = () => {
|
|
|
12089
12153
|
};
|
|
12090
12154
|
|
|
12091
12155
|
// src/experimental/Search/SearchResults/SearchResultsPresearch.tsx
|
|
12092
|
-
var
|
|
12156
|
+
var import_react50 = __toESM(require("react"));
|
|
12093
12157
|
var SearchResultsPresearch = () => {
|
|
12094
12158
|
const { t } = useTranslationContext();
|
|
12095
|
-
return /* @__PURE__ */
|
|
12159
|
+
return /* @__PURE__ */ import_react50.default.createElement("div", { className: "str-chat__search-results-presearch" }, t("Start typing to search"));
|
|
12096
12160
|
};
|
|
12097
12161
|
|
|
12098
12162
|
// src/experimental/Search/SearchResults/SearchResults.tsx
|
|
@@ -12113,7 +12177,7 @@ var SearchResults = () => {
|
|
|
12113
12177
|
searchController.state,
|
|
12114
12178
|
searchControllerStateSelector3
|
|
12115
12179
|
);
|
|
12116
|
-
return !isActive ? null : /* @__PURE__ */
|
|
12180
|
+
return !isActive ? null : /* @__PURE__ */ import_react51.default.createElement("div", { "aria-label": t("aria/Search results"), className: "str-chat__search-results" }, /* @__PURE__ */ import_react51.default.createElement(SearchResultsHeader2, null), !searchQuery ? /* @__PURE__ */ import_react51.default.createElement(SearchResultsPresearch2, { activeSources }) : activeSources.map((source) => /* @__PURE__ */ import_react51.default.createElement(SearchSourceResults2, { key: source.type, searchSource: source })));
|
|
12117
12181
|
};
|
|
12118
12182
|
|
|
12119
12183
|
// src/experimental/Search/Search.tsx
|
|
@@ -12127,7 +12191,7 @@ var Search = ({
|
|
|
12127
12191
|
const { SearchBar: SearchBar2 = SearchBar, SearchResults: SearchResults2 = SearchResults } = useComponentContext();
|
|
12128
12192
|
const { searchController } = useChatContext();
|
|
12129
12193
|
const { isActive } = useStateStore(searchController.state, searchControllerStateSelector4);
|
|
12130
|
-
return /* @__PURE__ */
|
|
12194
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
12131
12195
|
SearchContextProvider,
|
|
12132
12196
|
{
|
|
12133
12197
|
value: {
|
|
@@ -12138,16 +12202,16 @@ var Search = ({
|
|
|
12138
12202
|
searchController
|
|
12139
12203
|
}
|
|
12140
12204
|
},
|
|
12141
|
-
/* @__PURE__ */
|
|
12205
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
12142
12206
|
"div",
|
|
12143
12207
|
{
|
|
12144
|
-
className: (0,
|
|
12208
|
+
className: (0, import_clsx12.default)("str-chat__search", {
|
|
12145
12209
|
"str-chat__search--active": isActive
|
|
12146
12210
|
}),
|
|
12147
12211
|
"data-testid": "search"
|
|
12148
12212
|
},
|
|
12149
|
-
/* @__PURE__ */
|
|
12150
|
-
/* @__PURE__ */
|
|
12213
|
+
/* @__PURE__ */ import_react52.default.createElement(SearchBar2, null),
|
|
12214
|
+
/* @__PURE__ */ import_react52.default.createElement(SearchResults2, null)
|
|
12151
12215
|
)
|
|
12152
12216
|
);
|
|
12153
12217
|
};
|