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webpack://telegram-t/./src/components/mediaViewer/helpers/ghostAnimation.ts","webpack://telegram-t/./src/hooks/useBlur.ts","webpack://telegram-t/./src/hooks/useBlurSync.ts","webpack://telegram-t/./src/components/mediaViewer/MediaViewerActions.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewerFooter.tsx","webpack://telegram-t/./src/hooks/useFullscreen.ts","webpack://telegram-t/./src/components/mediaViewer/helpers/formatFileSize.ts","webpack://telegram-t/./src/components/mediaViewer/VideoPlayerControls.tsx","webpack://telegram-t/./src/components/mediaViewer/VideoPlayer.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewerContent.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewerSlides.tsx","webpack://telegram-t/./src/components/mediaViewer/SenderInfo.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewer.tsx","webpack://telegram-t/./src/components/common/ChatOrUserPicker.tsx","webpack://telegram-t/./src/components/main/ForwardPicker.tsx","webpack://telegram-t/./src/components/main/Dialogs.tsx","webpack://telegram-t/./src/components/main/Notifications.tsx","webpack://telegram-t/./src/components/main/SafeLinkModal.tsx","webpack://telegram-t/./src/components/common/CalendarModal.tsx","webpack://telegram-t/./src/components/main/HistoryCalendar.tsx","webpack://telegram-t/./src/components/main/NewContactModal.tsx","webpack://telegram-t/./src/components/main/hooks/useWebAppFrame.ts","webpack://telegram-t/./src/components/main/WebAppModal.tsx","webpack://telegram-t/./src/components/main/BotTrustModal.tsx","webpack://telegram-t/./src/components/main/BotAttachModal.tsx","webpack://telegram-t/./src/components/common/DeleteMessageModal.tsx","webpack://telegram-t/./src/components/common/PinMessageModal.tsx","webpack://telegram-t/./src/components/common/UnpinAllMessagesModal.tsx","webpack://telegram-t/./src/components/middle/hooks/useCopySelectedMessages.ts","webpack://telegram-t/./src/components/middle/DeleteSelectedMessageModal.tsx","webpack://telegram-t/./src/components/middle/MessageSelectToolbar.tsx","webpack://telegram-t/./src/components/common/SeenByModal.tsx","webpack://telegram-t/./src/components/middle/ReactorListModal.tsx","webpack://telegram-t/./src/components/middle/EmojiInteractionAnimation.tsx","webpack://telegram-t/./src/hooks/useSelectWithEnter.ts","webpack://telegram-t/./src/components/left/search/LeftSearchResultChat.tsx","webpack://telegram-t/./src/components/left/search/RecentContacts.tsx","webpack://telegram-t/./src/components/left/search/ChatMessage.tsx","webpack://telegram-t/./src/components/left/search/DateSuggest.tsx","webpack://telegram-t/./src/components/left/search/ChatResults.tsx","webpack://telegram-t/./src/components/left/search/ChatMessageResults.tsx","webpack://telegram-t/./src/components/left/search/helpers/createMapStateToProps.ts","webpack://telegram-t/./src/components/left/search/MediaResults.tsx","webpack://telegram-t/./src/components/left/search/LinkResults.tsx","webpack://telegram-t/./src/components/left/search/FileResults.tsx","webpack://telegram-t/./src/components/left/search/AudioResults.tsx","webpack://telegram-t/./src/components/left/search/LeftSearch.tsx","webpack://telegram-t/./src/hooks/reducers/useTwoFaReducer.ts","webpack://telegram-t/./src/components/left/settings/SettingsHeader.tsx","webpack://telegram-t/./src/components/left/settings/SettingsMain.tsx","webpack://telegram-t/./src/components/common/UsernameInput.tsx","webpack://telegram-t/./src/components/left/settings/SettingsEditProfile.tsx","webpack://telegram-t/./src/components/left/settings/SettingsDataStorage.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersMain.tsx","webpack://telegram-t/./src/components/ui/ShowMoreButton.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersEdit.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersChatsPicker.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersChatFilters.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFolders.tsx","webpack://telegram-t/./src/components/middle/composer/StickerSetCoverAnimated.tsx","webpack://telegram-t/./src/components/middle/composer/StickerSetCover.tsx","webpack://telegram-t/./src/components/left/settings/SettingsStickerSet.tsx","webpack://telegram-t/./src/components/left/settings/SettingsGeneral.tsx","webpack://telegram-t/./src/util/colors.ts","webpack://telegram-t/./src/components/left/settings/WallpaperTile.tsx","webpack://telegram-t/./src/components/left/settings/SettingsGeneralBackground.tsx","webpack://telegram-t/./src/components/left/settings/SettingsGeneralBackgroundColor.tsx","webpack://telegram-t/./src/components/left/settings/SettingsNotifications.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPrivacy.tsx","webpack://telegram-t/./src/components/left/settings/SettingsLanguage.tsx","webpack://telegram-t/./src/components/left/settings/helpers/privacy.ts","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyVisibility.tsx","webpack://telegram-t/./src/components/left/settings/helpers/getSessionIcon.ts","webpack://telegram-t/./src/components/left/settings/SettingsActiveSession.module.scss?ead4","webpack://telegram-t/./src/components/left/settings/SettingsActiveSession.tsx","webpack://telegram-t/./src/components/left/settings/SettingsActiveSessions.tsx","webpack://telegram-t/./src/components/left/settings/BlockUserModal.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyBlockedUsers.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaEnabled.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPasswordForm.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaStart.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaSkippableForm.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaCongratulations.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaEmailCode.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFa.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyVisibilityExceptionList.tsx","webpack://telegram-t/./src/components/left/settings/SettingsQuickReaction.tsx","webpack://telegram-t/./src/components/left/settings/passcode/SettingsPasscodeStart.tsx","webpack://telegram-t/./src/components/left/settings/passcode/SettingsPasscodeEnabled.tsx","webpack://telegram-t/./src/components/left/settings/passcode/SettingsPasscodeCongratulations.tsx","webpack://telegram-t/./src/components/left/settings/passcode/SettingsPasscode.tsx","webpack://telegram-t/./src/components/left/settings/Settings.tsx","webpack://telegram-t/./src/components/left/main/ContactList.tsx","webpack://telegram-t/./src/components/left/newChat/NewChatStep1.tsx","webpack://telegram-t/./src/components/left/newChat/NewChatStep2.tsx","webpack://telegram-t/./src/components/left/newChat/NewChat.tsx","webpack://telegram-t/./src/components/left/ArchivedChats.tsx","webpack://telegram-t/./src/components/left/ChatFolderModal.tsx","webpack://telegram-t/./src/components/middle/message/helpers/copyOptions.ts","webpack://telegram-t/./src/util/scrollLock.ts","webpack://telegram-t/./src/components/middle/message/ReactionSelectorReaction.tsx","webpack://telegram-t/./src/components/middle/message/ReactionSelector.tsx","webpack://telegram-t/./src/components/middle/message/MessageContextMenu.tsx","webpack://telegram-t/./src/components/middle/message/ContextMenuContainer.tsx","webpack://telegram-t/./src/components/common/StickerSetModal.tsx","webpack://telegram-t/./src/components/middle/HeaderMenuContainer.tsx","webpack://telegram-t/./src/components/middle/MobileSearch.tsx","webpack://telegram-t/./src/util/findInViewport.ts","webpack://telegram-t/./src/util/isFullyVisible.ts","webpack://telegram-t/./src/util/setTooltipItemVisible.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useKeyboardNavigation.ts","webpack://telegram-t/./src/components/middle/composer/MentionTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/AttachmentModal.tsx","webpack://telegram-t/./src/components/middle/composer/PollModal.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiButton.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiCategory.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiPicker.tsx","webpack://telegram-t/./src/components/middle/composer/StickerSet.tsx","webpack://telegram-t/./src/components/middle/composer/StickerPicker.tsx","webpack://telegram-t/./src/components/common/GifButton.tsx","webpack://telegram-t/./src/components/middle/composer/GifPicker.tsx","webpack://telegram-t/./src/components/middle/composer/SymbolMenuFooter.tsx","webpack://telegram-t/./src/components/middle/composer/SymbolMenu.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommand.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommandTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommandMenu.tsx","webpack://telegram-t/./src/components/middle/composer/StickerTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/CustomSendMenu.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/BaseResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/MediaResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/ArticleResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/GifResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/StickerResult.tsx","webpack://telegram-t/./src/components/middle/composer/InlineBotTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/SendAsMenu.tsx","webpack://telegram-t/./src/components/right/RightSearch.tsx","webpack://telegram-t/./src/components/right/StickerSetResult.tsx","webpack://telegram-t/./src/components/right/StickerSearch.tsx","webpack://telegram-t/./src/components/right/GifSearch.tsx","webpack://telegram-t/./src/components/right/statistics/StatisticsOverview.tsx","webpack://telegram-t/./src/components/right/statistics/StatisticsRecentMessage.tsx","webpack://telegram-t/./src/components/right/statistics/Statistics.tsx","webpack://telegram-t/./src/components/right/statistics/StatisticsPublicForward.tsx","webpack://telegram-t/./src/components/right/statistics/MessageStatistics.tsx","webpack://telegram-t/./src/components/right/PollAnswerResults.tsx","webpack://telegram-t/./src/components/right/PollResults.tsx","webpack://telegram-t/./src/components/right/management/ManageUser.tsx","webpack://telegram-t/./src/components/right/management/ManageGroup.tsx","webpack://telegram-t/./src/components/right/management/ManageGroupPermissions.tsx","webpack://telegram-t/./src/components/right/management/RemoveGroupUserModal.tsx","webpack://telegram-t/./src/components/right/management/ManageChatRemovedUsers.tsx","webpack://telegram-t/./src/components/right/management/ManageChannel.tsx","webpack://telegram-t/./src/components/right/management/ManageChatPrivacyType.tsx","webpack://telegram-t/./src/components/right/management/ManageDiscussion.tsx","webpack://telegram-t/./src/components/right/management/ManageGroupUserPermissions.tsx","webpack://telegram-t/./src/components/right/management/ManageChatAdministrators.tsx","webpack://telegram-t/./src/components/right/management/ManageGroupRecentActions.tsx","webpack://telegram-t/./src/components/right/management/ManageGroupAdminRights.tsx","webpack://telegram-t/./src/components/right/management/ManageGroupMembers.tsx","webpack://telegram-t/./src/components/right/management/ManageGroupUserPermissionsCreate.tsx","webpack://telegram-t/./src/components/right/management/ManageInvites.tsx","webpack://telegram-t/./src/components/right/management/ManageInvite.tsx","webpack://telegram-t/./src/components/right/management/ManageReactions.tsx","webpack://telegram-t/./src/components/right/management/ManageInviteInfo.tsx","webpack://telegram-t/./src/components/right/management/JoinRequest.tsx","webpack://telegram-t/./src/components/right/management/ManageJoinRequests.tsx","webpack://telegram-t/./src/components/right/management/Management.tsx","webpack://telegram-t/./src/components/common/helpers/detectCardType.ts","webpack://telegram-t/./src/hooks/reducers/usePaymentReducer.ts","webpack://telegram-t/./src/hooks/useFocusAfterAnimation.tsx","webpack://telegram-t/./src/components/ui/Select.tsx","webpack://telegram-t/./src/components/payment/ShippingInfo.tsx","webpack://telegram-t/./src/components/payment/Shipping.tsx","webpack://telegram-t/./src/components/payment/Checkout.tsx","webpack://telegram-t/./src/components/payment/ExpiryInput.tsx","webpack://telegram-t/./src/components/middle/helpers/inputFormatters.ts","webpack://telegram-t/./src/components/payment/CardInput.tsx","webpack://telegram-t/./src/components/payment/PaymentInfo.tsx","webpack://telegram-t/./src/components/payment/ConfirmPayment.tsx","webpack://telegram-t/./src/components/payment/PaymentModal.tsx","webpack://telegram-t/./src/components/payment/ReceiptModal.tsx","webpack://telegram-t/./src/components/common/PasswordMonkey.tsx","webpack://telegram-t/./src/components/ui/CropModal.tsx","webpack://telegram-t/./src/components/ui/AvatarEditable.tsx"],"sourcesContent":["import type { ApiMessage, ApiDimensions } from '../../../api/types';\n\nimport { MediaViewerOrigin } from '../../../types';\n\nimport { ANIMATION_END_DELAY } from '../../../config';\nimport {\n calculateDimensions,\n getMediaViewerAvailableDimensions,\n MEDIA_VIEWER_MEDIA_QUERY,\n REM,\n} from '../../common/helpers/mediaDimensions';\nimport windowSize from '../../../util/windowSize';\nimport stopEvent from '../../../util/stopEvent';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport { getMessageHtmlId } from '../../../global/helpers';\nimport { isElementInViewport } from '../../../util/isElementInViewport';\n\nconst ANIMATION_DURATION = 200;\n\nexport function animateOpening(\n hasFooter: boolean,\n origin: MediaViewerOrigin,\n bestImageData: string,\n dimensions: ApiDimensions,\n isVideo: boolean,\n message?: ApiMessage,\n) {\n const { mediaEl: fromImage } = getNodes(origin, message);\n if (!fromImage) {\n return;\n }\n\n const { width: windowWidth } = windowSize.get();\n const {\n width: availableWidth, height: availableHeight,\n } = getMediaViewerAvailableDimensions(hasFooter, isVideo);\n const { width: toWidth, height: toHeight } = calculateDimensions(\n availableWidth, availableHeight, dimensions.width, dimensions.height,\n );\n const toLeft = (windowWidth - toWidth) / 2;\n const toTop = getTopOffset(hasFooter) + (availableHeight - toHeight) / 2;\n\n let {\n top: fromTop, left: fromLeft, width: fromWidth, height: fromHeight,\n } = fromImage.getBoundingClientRect();\n\n if ([\n MediaViewerOrigin.SharedMedia,\n MediaViewerOrigin.Album,\n MediaViewerOrigin.ScheduledAlbum,\n MediaViewerOrigin.SearchResult,\n ].includes(origin)) {\n const uncovered = uncover(toWidth, toHeight, fromTop, fromLeft, fromWidth, fromHeight);\n fromTop = uncovered.top;\n fromLeft = uncovered.left;\n fromWidth = uncovered.width;\n fromHeight = uncovered.height;\n }\n\n const fromTranslateX = (fromLeft + fromWidth / 2) - (toLeft + toWidth / 2);\n const fromTranslateY = (fromTop + fromHeight / 2) - (toTop + toHeight / 2);\n const fromScaleX = fromWidth / toWidth;\n const fromScaleY = fromHeight / toHeight;\n\n const ghost = createGhost(bestImageData || fromImage);\n applyStyles(ghost, {\n top: `${toTop}px`,\n left: `${toLeft}px`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n transform: `translate3d(${fromTranslateX}px, ${fromTranslateY}px, 0) scale(${fromScaleX}, ${fromScaleY})`,\n });\n applyShape(ghost, origin);\n\n document.body.classList.add('ghost-animating');\n\n requestAnimationFrame(() => {\n document.body.appendChild(ghost);\n\n requestAnimationFrame(() => {\n ghost.style.transform = '';\n clearShape(ghost);\n\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (document.body.contains(ghost)) {\n document.body.removeChild(ghost);\n }\n document.body.classList.remove('ghost-animating');\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n });\n });\n}\n\nexport function animateClosing(origin: MediaViewerOrigin, bestImageData: string, message?: ApiMessage) {\n const { container, mediaEl: toImage } = getNodes(origin, message);\n if (!toImage) {\n return;\n }\n\n const fromImage = document.getElementById('MediaViewer')!.querySelector<HTMLImageElement>(\n '.MediaViewerSlide--active img, .MediaViewerSlide--active video',\n );\n if (!fromImage || !toImage) {\n return;\n }\n\n const {\n top: fromTop, left: fromLeft, width: fromWidth, height: fromHeight,\n } = fromImage.getBoundingClientRect();\n const {\n top: targetTop, left: toLeft, width: toWidth, height: toHeight,\n } = toImage.getBoundingClientRect();\n\n let toTop = targetTop;\n if (!isElementInViewport(container)) {\n const { height: windowHeight } = windowSize.get();\n toTop = targetTop < fromTop ? -toHeight : windowHeight;\n }\n\n const fromTranslateX = (fromLeft + fromWidth / 2) - (toLeft + toWidth / 2);\n const fromTranslateY = (fromTop + fromHeight / 2) - (toTop + toHeight / 2);\n let fromScaleX = fromWidth / toWidth;\n let fromScaleY = fromHeight / toHeight;\n\n const shouldFadeOut = (\n [MediaViewerOrigin.Inline, MediaViewerOrigin.ScheduledInline].includes(origin)\n && !isMessageImageFullyVisible(container, toImage)\n ) || (\n [MediaViewerOrigin.Album, MediaViewerOrigin.ScheduledAlbum].includes(origin)\n && !isMessageImageFullyVisible(container, toImage)\n );\n\n if ([\n MediaViewerOrigin.SharedMedia,\n MediaViewerOrigin.Album,\n MediaViewerOrigin.ScheduledAlbum,\n MediaViewerOrigin.SearchResult,\n ].includes(origin)) {\n if (fromScaleX > fromScaleY) {\n fromScaleX = fromScaleY;\n } else if (fromScaleY > fromScaleX) {\n fromScaleY = fromScaleX;\n }\n }\n\n const existingGhost = document.getElementsByClassName('ghost')[0] as HTMLDivElement;\n\n const ghost = existingGhost || createGhost(bestImageData || toImage, origin);\n if (!existingGhost) {\n applyStyles(ghost, {\n top: `${toTop}px`,\n left: `${toLeft}px`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n transform: `translate3d(${fromTranslateX}px, ${fromTranslateY}px, 0) scale(${fromScaleX}, ${fromScaleY})`,\n });\n }\n\n requestAnimationFrame(() => {\n if (existingGhost) {\n const {\n top,\n left,\n width,\n height,\n } = existingGhost.getBoundingClientRect();\n const scaleX = width / toWidth;\n const scaleY = height / toHeight;\n\n applyStyles(ghost, {\n transition: 'none',\n top: `${toTop}px`,\n left: `${toLeft}px`,\n transformOrigin: 'top left',\n transform: `translate3d(${left - toLeft}px, ${top - toTop}px, 0) scale(${scaleX}, ${scaleY})`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n });\n }\n document.body.classList.add('ghost-animating');\n if (!existingGhost) document.body.appendChild(ghost);\n\n requestAnimationFrame(() => {\n if (existingGhost) {\n existingGhost.style.transition = '';\n }\n\n ghost.style.transform = '';\n\n if (shouldFadeOut) {\n ghost.style.opacity = '0';\n }\n\n applyShape(ghost, origin);\n\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (document.body.contains(ghost)) {\n document.body.removeChild(ghost);\n }\n document.body.classList.remove('ghost-animating');\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n });\n });\n}\n\nfunction createGhost(source: string | HTMLImageElement | HTMLVideoElement, origin?: MediaViewerOrigin) {\n const ghost = document.createElement('div');\n ghost.classList.add('ghost');\n\n const img = new Image();\n img.draggable = false;\n img.oncontextmenu = stopEvent;\n\n if (typeof source === 'string') {\n img.src = source;\n } else if (source instanceof HTMLVideoElement) {\n img.src = source.poster;\n } else {\n img.src = source.src;\n }\n\n ghost.appendChild(img);\n\n if (origin === MediaViewerOrigin.ProfileAvatar || origin === MediaViewerOrigin.SettingsAvatar) {\n ghost.classList.add('ProfileInfo');\n if (origin === MediaViewerOrigin.SettingsAvatar) {\n ghost.classList.add('self');\n }\n const profileInfo = document.querySelector(\n origin === MediaViewerOrigin.ProfileAvatar\n ? '#RightColumn .ProfileInfo .info'\n : '#Settings .ProfileInfo .info',\n );\n if (profileInfo) {\n ghost.appendChild(profileInfo.cloneNode(true));\n }\n }\n\n return ghost;\n}\n\nfunction uncover(realWidth: number, realHeight: number, top: number, left: number, width: number, height: number) {\n if (realWidth === realHeight) {\n const size = Math.max(width, height) * (realWidth / realHeight);\n left -= (size - width) / 2;\n top -= (size - height) / 2;\n width = size;\n height = size;\n } else if (realWidth > realHeight) {\n const srcWidth = width;\n width = height * (realWidth / realHeight);\n left -= (width - srcWidth) / 2;\n } else if (realHeight > realWidth) {\n const srcHeight = height;\n height = width * (realHeight / realWidth);\n top -= (height - srcHeight) / 2;\n }\n\n return {\n top, left, width, height,\n };\n}\n\nfunction isMessageImageFullyVisible(container: HTMLElement, imageEl: HTMLElement) {\n const messageListElement = document.querySelector<HTMLDivElement>('.Transition__slide--active > .MessageList')!;\n let imgOffsetTop = container.offsetTop + imageEl.closest<HTMLDivElement>('.content-inner, .WebPage')!.offsetTop;\n if (container.id.includes('album-media-')) {\n imgOffsetTop += container.parentElement!.offsetTop + container.closest<HTMLDivElement>('.Message')!.offsetTop;\n }\n\n return imgOffsetTop > messageListElement.scrollTop\n && imgOffsetTop + imageEl.offsetHeight < messageListElement.scrollTop + messageListElement.offsetHeight;\n}\n\nfunction getTopOffset(hasFooter: boolean) {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n let topOffsetRem = 4.125;\n if (hasFooter && !IS_TOUCH_ENV) {\n topOffsetRem += mql.matches ? 0.875 : 2.125;\n }\n\n return topOffsetRem * REM;\n}\n\nfunction applyStyles(element: HTMLElement, styles: Record<string, string>) {\n Object.assign(element.style, styles);\n}\n\nfunction getNodes(origin: MediaViewerOrigin, message?: ApiMessage) {\n let containerSelector;\n let mediaSelector;\n\n switch (origin) {\n case MediaViewerOrigin.Album:\n case MediaViewerOrigin.ScheduledAlbum:\n containerSelector = `.Transition__slide--active > .MessageList #album-media-${getMessageHtmlId(message!.id)}`;\n mediaSelector = '.full-media';\n break;\n\n case MediaViewerOrigin.SharedMedia:\n containerSelector = `#shared-media${getMessageHtmlId(message!.id)}`;\n mediaSelector = 'img';\n break;\n\n case MediaViewerOrigin.SearchResult:\n containerSelector = `#search-media${getMessageHtmlId(message!.id)}`;\n mediaSelector = 'img';\n break;\n\n case MediaViewerOrigin.MiddleHeaderAvatar:\n containerSelector = '.MiddleHeader .Transition__slide--active .ChatInfo .Avatar';\n mediaSelector = '.avatar-media';\n break;\n\n case MediaViewerOrigin.SettingsAvatar:\n containerSelector = '#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto';\n mediaSelector = '.avatar-media';\n break;\n\n case MediaViewerOrigin.ProfileAvatar:\n containerSelector = '#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto';\n mediaSelector = '.avatar-media';\n break;\n\n case MediaViewerOrigin.ScheduledInline:\n case MediaViewerOrigin.Inline:\n default:\n containerSelector = `.Transition__slide--active > .MessageList #${getMessageHtmlId(message!.id)}`;\n mediaSelector = '.message-content .full-media, .message-content .thumbnail';\n }\n\n const container = document.querySelector<HTMLElement>(containerSelector)!;\n const mediaEls = container && container.querySelectorAll<HTMLImageElement | HTMLVideoElement>(mediaSelector);\n\n return {\n container,\n mediaEl: mediaEls?.[mediaEls.length - 1],\n };\n}\n\nfunction applyShape(ghost: HTMLDivElement, origin: MediaViewerOrigin) {\n switch (origin) {\n case MediaViewerOrigin.Album:\n case MediaViewerOrigin.ScheduledAlbum:\n case MediaViewerOrigin.Inline:\n case MediaViewerOrigin.ScheduledInline:\n ghost.classList.add('rounded-corners');\n break;\n\n case MediaViewerOrigin.SharedMedia:\n case MediaViewerOrigin.SettingsAvatar:\n case MediaViewerOrigin.ProfileAvatar:\n case MediaViewerOrigin.SearchResult:\n (ghost.firstChild as HTMLElement).style.objectFit = 'cover';\n break;\n\n case MediaViewerOrigin.MiddleHeaderAvatar:\n ghost.classList.add('circle');\n break;\n }\n}\n\nfunction clearShape(ghost: HTMLDivElement) {\n (ghost.firstChild as HTMLElement).style.objectFit = 'default';\n ghost.classList.remove('rounded-corners', 'circle');\n}\n","import { useEffect, useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport { imgToCanvas } from '../util/files';\nimport useForceUpdate from './useForceUpdate';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\nconst MAX_CACHE_SIZE = 1000;\n\nconst cache = new Map<string, string>();\n\nexport default function useBlur(dataUri?: string, isDisabled = false, delay?: number) {\n const blurredRef = useRef<string | undefined>(dataUri ? cache.get(dataUri) : undefined);\n const timeoutRef = useRef<number>();\n const forceUpdate = useForceUpdate();\n\n if (timeoutRef.current && isDisabled) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n\n useEffect(() => {\n if (!dataUri || blurredRef.current || isDisabled) {\n return;\n }\n\n const img = new Image();\n\n img.onload = () => {\n const canvas = imgToCanvas(img);\n fastBlur(canvas.getContext('2d'), 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n const blurredDataUri = canvas.toDataURL();\n\n blurredRef.current = blurredDataUri;\n forceUpdate();\n\n if (cache.size >= MAX_CACHE_SIZE) {\n cache.clear();\n }\n cache.set(dataUri, blurredDataUri);\n };\n\n if (delay) {\n timeoutRef.current = window.setTimeout(() => {\n img.src = dataUri;\n }, delay);\n } else {\n img.src = dataUri;\n }\n }, [dataUri, delay, forceUpdate, isDisabled]);\n\n return blurredRef.current;\n}\n","import { useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport useOnChange from './useOnChange';\nimport useBlur from './useBlur';\nimport { imgToCanvas } from '../util/files';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\n\nexport default function useBlurSync(dataUri: string | false | undefined) {\n const blurredRef = useRef<string>();\n\n let isChanged = false;\n\n useOnChange(() => {\n isChanged = true;\n\n blurredRef.current = undefined;\n\n if (!dataUri) {\n return;\n }\n\n const img = new Image();\n img.src = dataUri;\n if (!img.width) {\n return;\n }\n\n const canvas = imgToCanvas(img);\n fastBlur(canvas.getContext('2d'), 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n\n blurredRef.current = canvas.toDataURL();\n }, [dataUri]);\n\n // Sometimes `Image` do not manage to load synchronously,\n // so we fall back the non-blurred variant and prepare the async one at least for the next time\n const blurredAsync = useBlur(dataUri || undefined, Boolean(blurredRef.current));\n\n return blurredRef.current || (!isChanged && blurredAsync) || dataUri || undefined;\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo,\n useCallback,\n useMemo,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiMessage } from '../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { getMessageMediaHash } from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport { selectIsDownloading, selectIsMessageProtected } from '../../global/selectors';\n\nimport Button from '../ui/Button';\nimport DropdownMenu from '../ui/DropdownMenu';\nimport MenuItem from '../ui/MenuItem';\nimport ProgressSpinner from '../ui/ProgressSpinner';\n\nimport './MediaViewerActions.scss';\n\ntype StateProps = {\n isDownloading: boolean;\n isProtected?: boolean;\n};\n\ntype OwnProps = {\n mediaData?: string;\n isVideo: boolean;\n zoomLevelChange: number;\n message?: ApiMessage;\n fileName?: string;\n isAvatar?: boolean;\n canReport?: boolean;\n onReport: NoneToVoidFunction;\n onCloseMediaViewer: NoneToVoidFunction;\n onForward: NoneToVoidFunction;\n setZoomLevelChange: (change: number) => void;\n};\n\nconst MediaViewerActions: FC<OwnProps & StateProps> = ({\n mediaData,\n isVideo,\n message,\n fileName,\n isAvatar,\n isDownloading,\n isProtected,\n canReport,\n onReport,\n onCloseMediaViewer,\n zoomLevelChange,\n setZoomLevelChange,\n onForward,\n}) => {\n const {\n downloadMessageMedia,\n cancelMessageMediaDownload,\n } = getActions();\n\n const { loadProgress: downloadProgress } = useMediaWithLoadProgress(\n message && getMessageMediaHash(message, 'download'),\n !isDownloading,\n );\n\n const handleDownloadClick = useCallback(() => {\n if (isDownloading) {\n cancelMessageMediaDownload({ message: message! });\n } else {\n downloadMessageMedia({ message: message! });\n }\n }, [cancelMessageMediaDownload, downloadMessageMedia, isDownloading, message]);\n\n const handleZoomOut = useCallback(() => {\n const change = zoomLevelChange < 0 ? zoomLevelChange : 0;\n setZoomLevelChange(change - 1);\n }, [setZoomLevelChange, zoomLevelChange]);\n\n const handleZoomIn = useCallback(() => {\n const change = zoomLevelChange > 0 ? zoomLevelChange : 0;\n setZoomLevelChange(change + 1);\n }, [setZoomLevelChange, zoomLevelChange]);\n\n const lang = useLang();\n\n const MenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : undefined}\n onClick={onTrigger}\n ariaLabel=\"More actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n function renderDownloadButton() {\n if (isProtected) {\n return undefined;\n }\n\n return isVideo ? (\n <Button\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang('AccActionDownload')}\n onClick={handleDownloadClick}\n >\n {isDownloading ? (\n <ProgressSpinner progress={downloadProgress} size=\"s\" onClick={handleDownloadClick} />\n ) : (\n <i className=\"icon-download\" />\n )}\n </Button>\n ) : (\n <Button\n href={mediaData}\n download={fileName}\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang('AccActionDownload')}\n >\n <i className=\"icon-download\" />\n </Button>\n );\n }\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n if (isProtected) {\n return undefined;\n }\n\n return (\n <div className=\"MediaViewerActions-mobile\">\n <DropdownMenu\n trigger={MenuButton}\n positionX=\"right\"\n >\n {!isAvatar && (\n <MenuItem\n icon=\"forward\"\n onClick={onForward}\n >\n {lang('Forward')}\n </MenuItem>\n )}\n {isVideo ? (\n <MenuItem\n icon={isDownloading ? 'close' : 'download'}\n onClick={handleDownloadClick}\n >\n {isDownloading ? `${Math.round(downloadProgress * 100)}% Downloading...` : 'Download'}\n </MenuItem>\n ) : (\n <MenuItem\n icon=\"download\"\n href={mediaData}\n download={fileName}\n >\n {lang('AccActionDownload')}\n </MenuItem>\n )}\n {canReport && (\n <MenuItem\n icon=\"flag\"\n onClick={onReport}\n >\n {lang('ReportPeer.Report')}\n </MenuItem>\n )}\n </DropdownMenu>\n {isDownloading && <ProgressSpinner progress={downloadProgress} size=\"s\" noCross />}\n </div>\n );\n }\n\n return (\n <div className=\"MediaViewerActions\">\n {!isAvatar && !isProtected && (\n <Button\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang('Forward')}\n onClick={onForward}\n >\n <i className=\"icon-forward\" />\n </Button>\n )}\n {renderDownloadButton()}\n <Button\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang('MediaZoomOut')}\n onClick={handleZoomOut}\n >\n <i className=\"icon-zoom-out\" />\n </Button>\n <Button\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang('MediaZoomIn')}\n onClick={handleZoomIn}\n >\n <i className=\"icon-zoom-in\" />\n </Button>\n {canReport && (\n <Button\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang(isVideo ? 'PeerInfo.ReportProfileVideo' : 'PeerInfo.ReportProfilePhoto')}\n onClick={onReport}\n >\n <i className=\"icon-flag\" />\n </Button>\n )}\n <Button\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang('Close')}\n onClick={onCloseMediaViewer}\n >\n <i className=\"icon-close\" />\n </Button>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { message }): StateProps => {\n const isDownloading = message ? selectIsDownloading(global, message) : false;\n const isProtected = selectIsMessageProtected(global, message);\n\n return {\n isDownloading,\n isProtected,\n };\n },\n)(MediaViewerActions));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useEffect, useState } from '../../lib/teact/teact';\n\nimport type { TextPart } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { throttle } from '../../util/schedulers';\nimport buildClassName from '../../util/buildClassName';\nimport { REM } from '../common/helpers/mediaDimensions';\n\nimport './MediaViewerFooter.scss';\n\nconst RESIZE_THROTTLE_MS = 500;\n\ntype OwnProps = {\n text: TextPart | TextPart[];\n onClick: () => void;\n isHidden?: boolean;\n isForVideo: boolean;\n};\n\nconst MediaViewerFooter: FC<OwnProps> = ({\n text = '', isHidden, isForVideo, onClick,\n}) => {\n const [isMultiline, setIsMultiline] = useState(false);\n useEffect(() => {\n const footerContent = document.querySelector('.MediaViewerFooter .media-text') as HTMLDivElement | null;\n\n const checkIsMultiline = () => {\n const height = footerContent ? footerContent.clientHeight : 0;\n\n setIsMultiline(height > REM * 2);\n };\n\n // First run for initial detection of multiline footer text\n checkIsMultiline();\n\n const handleResize = throttle(checkIsMultiline, RESIZE_THROTTLE_MS, true);\n\n window.addEventListener('resize', handleResize, false);\n\n return () => {\n window.removeEventListener('resize', handleResize, false);\n };\n }, []);\n\n function stopEvent(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (text) {\n e.stopPropagation();\n }\n }\n\n const classNames = buildClassName(\n 'MediaViewerFooter',\n isForVideo && 'is-for-video',\n isHidden && 'is-hidden',\n );\n\n return (\n <div className={classNames} onClick={stopEvent}>\n {text && (\n <div className=\"media-viewer-footer-content\" onClick={!IS_SINGLE_COLUMN_LAYOUT ? onClick : undefined}>\n <p className={`media-text custom-scroll ${isMultiline ? 'multiline' : ''}`} dir=\"auto\">{text}</p>\n </div>\n )}\n </div>\n );\n};\n\nexport default MediaViewerFooter;\n","import { useLayoutEffect, useState } from '../lib/teact/teact';\nimport { PLATFORM_ENV } from '../util/environment';\n\ntype RefType = {\n current: HTMLElement | null;\n};\n\ntype ReturnType = [boolean, () => void, () => void] | [false];\ntype CallbackType = (isPlayed: boolean) => void;\n\nconst prop = getBrowserFullscreenElementProp();\n\nexport default function useFullscreenStatus(elRef: RefType, setIsPlayed: CallbackType): ReturnType {\n const [isFullscreen, setIsFullscreen] = useState(Boolean(prop && document[prop]));\n\n const setFullscreen = () => {\n if (!elRef.current || !(prop || PLATFORM_ENV === 'iOS')) {\n return;\n }\n\n if (elRef.current.requestFullscreen) {\n elRef.current.requestFullscreen();\n } else if (elRef.current.webkitRequestFullscreen) {\n elRef.current.webkitRequestFullscreen();\n } else if (elRef.current.webkitEnterFullscreen) {\n elRef.current.webkitEnterFullscreen();\n } else if (elRef.current.mozRequestFullScreen) {\n elRef.current.mozRequestFullScreen();\n }\n\n setIsFullscreen(true);\n };\n\n const exitFullscreen = () => {\n if (!elRef.current) {\n return;\n }\n\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.webkitCancelFullScreen) {\n document.webkitCancelFullScreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n }\n\n setIsFullscreen(false);\n };\n\n useLayoutEffect(() => {\n const listener = () => { setIsFullscreen(Boolean(prop && document[prop])); };\n const listenerEnter = () => { setIsFullscreen(true); };\n const listenerExit = () => {\n setIsFullscreen(false);\n setIsPlayed(false);\n };\n const video = elRef.current;\n\n document.addEventListener('fullscreenchange', listener, false);\n document.addEventListener('webkitfullscreenchange', listener, false);\n document.addEventListener('mozfullscreenchange', listener, false);\n\n if (video) {\n video.addEventListener('webkitbeginfullscreen', listenerEnter, false);\n video.addEventListener('webkitendfullscreen', listenerExit, false);\n }\n\n return () => {\n document.removeEventListener('fullscreenchange', listener, false);\n document.removeEventListener('webkitfullscreenchange', listener, false);\n document.removeEventListener('mozfullscreenchange', listener, false);\n if (video) {\n video.removeEventListener('webkitbeginfullscreen', listenerEnter, false);\n video.removeEventListener('webkitendfullscreen', listenerExit, false);\n }\n };\n // eslint-disable-next-line\n }, []);\n\n if (!prop && PLATFORM_ENV !== 'iOS') {\n return [false];\n }\n\n return [isFullscreen, setFullscreen, exitFullscreen];\n}\n\nfunction getBrowserFullscreenElementProp() {\n if (typeof document.fullscreenElement !== 'undefined') {\n return 'fullscreenElement';\n } else if (typeof document.mozFullScreenElement !== 'undefined') {\n return 'mozFullScreenElement';\n } else if (typeof document.webkitFullscreenElement !== 'undefined') {\n return 'webkitFullscreenElement';\n }\n\n return '';\n}\n","const units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'];\n\nconst formatFileSize = (bytes: number) => {\n const number = bytes === 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024));\n\n return `${(bytes / 1024 ** Math.floor(number)).toFixed(1)} ${units[number]}`;\n};\n\nexport default formatFileSize;\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useEffect, useRef, useCallback, useMemo,\n} from '../../lib/teact/teact';\nimport buildClassName from '../../util/buildClassName';\n\nimport useFlag from '../../hooks/useFlag';\nimport { IS_IOS, IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { formatMediaDuration } from '../../util/dateFormat';\nimport formatFileSize from './helpers/formatFileSize';\nimport useLang from '../../hooks/useLang';\nimport type { BufferedRange } from '../../hooks/useBuffering';\nimport { captureEvents } from '../../util/captureEvents';\n\nimport Button from '../ui/Button';\nimport RangeSlider from '../ui/RangeSlider';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\n\nimport './VideoPlayerControls.scss';\n\ntype OwnProps = {\n bufferedRanges: BufferedRange[];\n bufferedProgress: number;\n currentTime: number;\n duration: number;\n fileSize: number;\n isForceMobileVersion?: boolean;\n isPlayed: boolean;\n isFullscreenSupported: boolean;\n isFullscreen: boolean;\n isVisible: boolean;\n isBuffered: boolean;\n volume: number;\n isMuted: boolean;\n playbackRate: number;\n onChangeFullscreen: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n onVolumeClick: () => void;\n onVolumeChange: (volume: number) => void;\n onPlaybackRateChange: (playbackRate: number) => void;\n onPlayPause: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n setVisibility: (isVisible: boolean) => void;\n onSeek: (position: number) => void;\n};\n\nconst stopEvent = (e: React.MouseEvent<HTMLElement>) => {\n e.stopPropagation();\n};\n\nconst PLAYBACK_RATES = [\n 0.5,\n 1,\n 1.5,\n 2,\n];\n\nconst HIDE_CONTROLS_TIMEOUT_MS = 1500;\n\nconst VideoPlayerControls: FC<OwnProps> = ({\n bufferedRanges,\n bufferedProgress,\n currentTime,\n duration,\n fileSize,\n isForceMobileVersion,\n isPlayed,\n isFullscreenSupported,\n isFullscreen,\n isVisible,\n isBuffered,\n volume,\n isMuted,\n playbackRate,\n onChangeFullscreen,\n onVolumeClick,\n onVolumeChange,\n onPlaybackRateChange,\n onPlayPause,\n setVisibility,\n onSeek,\n}) => {\n const [isPlaybackMenuOpen, openPlaybackMenu, closePlaybackMenu] = useFlag();\n // eslint-disable-next-line no-null/no-null\n const seekerRef = useRef<HTMLDivElement>(null);\n const isSeekingRef = useRef<boolean>(false);\n const isSeeking = isSeekingRef.current;\n\n useEffect(() => {\n let timeout: number | undefined;\n if (!isVisible || !isPlayed || isSeeking || isPlaybackMenuOpen) {\n if (timeout) window.clearTimeout(timeout);\n return undefined;\n }\n timeout = window.setTimeout(() => {\n setVisibility(false);\n }, HIDE_CONTROLS_TIMEOUT_MS);\n return () => {\n if (timeout) window.clearTimeout(timeout);\n };\n }, [isPlayed, isVisible, isSeeking, setVisibility, isPlaybackMenuOpen]);\n\n useEffect(() => {\n if (isVisible) {\n document.body.classList.add('video-controls-visible');\n } else {\n document.body.classList.remove('video-controls-visible');\n }\n return () => {\n document.body.classList.remove('video-controls-visible');\n };\n }, [isVisible]);\n\n useEffect(() => {\n if (!isVisible) {\n closePlaybackMenu();\n }\n }, [closePlaybackMenu, isVisible]);\n\n const lang = useLang();\n\n const handleSeek = useCallback((e: MouseEvent | TouchEvent) => {\n if (isSeekingRef.current && seekerRef.current) {\n const {\n width,\n left,\n } = seekerRef.current.getBoundingClientRect();\n const clientX = e instanceof MouseEvent ? e.clientX : e.targetTouches[0].clientX;\n onSeek(Math.max(Math.min(duration * ((clientX - left) / width), duration), 0));\n }\n }, [duration, onSeek]);\n\n const handleStartSeek = useCallback((e: MouseEvent | TouchEvent) => {\n isSeekingRef.current = true;\n handleSeek(e);\n }, [handleSeek]);\n\n const handleStopSeek = useCallback(() => {\n isSeekingRef.current = false;\n }, []);\n\n useEffect(() => {\n if (!seekerRef.current || !isVisible) return undefined;\n return captureEvents(seekerRef.current, {\n onCapture: handleStartSeek,\n onRelease: handleStopSeek,\n onClick: handleStopSeek,\n onDrag: handleSeek,\n });\n }, [isVisible, handleStartSeek, handleSeek, handleStopSeek]);\n\n const volumeIcon = useMemo(() => {\n if (volume === 0 || isMuted) return 'icon-muted';\n if (volume < 0.3) return 'icon-volume-1';\n if (volume < 0.6) return 'icon-volume-2';\n return 'icon-volume-3';\n }, [volume, isMuted]);\n\n return (\n <div\n className={buildClassName('VideoPlayerControls', isForceMobileVersion && 'mobile', isVisible && 'active')}\n onClick={stopEvent}\n >\n {renderSeekLine(currentTime, duration, bufferedRanges, seekerRef)}\n <div className=\"buttons\">\n <Button\n ariaLabel={lang('AccActionPlay')}\n size=\"tiny\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n color=\"translucent-white\"\n className=\"play\"\n round\n onClick={onPlayPause}\n >\n <i className={isPlayed ? 'icon-pause' : 'icon-play'} />\n </Button>\n <Button\n ariaLabel=\"Volume\"\n size=\"tiny\"\n color=\"translucent-white\"\n className=\"volume\"\n round\n onClick={onVolumeClick}\n >\n <i className={volumeIcon} />\n </Button>\n {!IS_IOS && (\n <RangeSlider bold className=\"volume-slider\" value={isMuted ? 0 : volume * 100} onChange={onVolumeChange} />\n )}\n {renderTime(currentTime, duration)}\n {!isBuffered && renderFileSize(bufferedProgress, fileSize)}\n <div className=\"spacer\" />\n <Button\n ariaLabel=\"Playback rate\"\n size=\"tiny\"\n color=\"translucent-white\"\n className=\"playback-rate\"\n round\n onClick={openPlaybackMenu}\n >\n {`${playbackRate}x`}\n </Button>\n {isFullscreenSupported && (\n <Button\n ariaLabel=\"Fullscreen\"\n size=\"tiny\"\n color=\"translucent-white\"\n className=\"fullscreen\"\n round\n onClick={onChangeFullscreen}\n >\n <i className={isFullscreen ? 'icon-smallscreen' : 'icon-fullscreen'} />\n </Button>\n )}\n </div>\n <Menu\n isOpen={isPlaybackMenuOpen}\n className=\"playback-rate-menu\"\n positionX=\"right\"\n positionY=\"bottom\"\n autoClose\n onClose={closePlaybackMenu}\n >\n {PLAYBACK_RATES.map((rate) => (\n // eslint-disable-next-line react/jsx-no-bind\n <MenuItem disabled={playbackRate === rate} onClick={() => onPlaybackRateChange(rate)}>\n {`${rate}x`}\n </MenuItem>\n ))}\n </Menu>\n </div>\n );\n};\n\nfunction renderTime(currentTime: number, duration: number) {\n return (\n <div className=\"player-time\">\n {`${formatMediaDuration(currentTime)} / ${formatMediaDuration(duration)}`}\n </div>\n );\n}\n\nfunction renderFileSize(loadedPercent: number, totalSize: number) {\n return (\n <div className=\"player-file-size\">\n {`${formatFileSize(totalSize * loadedPercent)} / ${formatFileSize(totalSize)}`}\n </div>\n );\n}\n\nfunction renderSeekLine(\n currentTime: number, duration: number, bufferedRanges: BufferedRange[], seekerRef: React.RefObject<HTMLDivElement>,\n) {\n const percentagePlayed = (currentTime / duration) * 100;\n\n return (\n <div className=\"player-seekline\" ref={seekerRef}>\n <div className=\"player-seekline-track\">\n {bufferedRanges.map(({ start, end }) => (\n <div\n className=\"player-seekline-buffered\"\n style={`left: ${start * 100}%; right: ${100 - end * 100}%`}\n />\n ))}\n <div\n className=\"player-seekline-played\"\n style={`width: ${percentagePlayed || 0}%`}\n />\n </div>\n </div>\n );\n}\n\nexport default VideoPlayerControls;\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { ApiDimensions } from '../../api/types';\n\nimport useBuffering from '../../hooks/useBuffering';\nimport useFullscreenStatus from '../../hooks/useFullscreen';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useVideoCleanup from '../../hooks/useVideoCleanup';\nimport { IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport safePlay from '../../util/safePlay';\n\nimport Button from '../ui/Button';\nimport ProgressSpinner from '../ui/ProgressSpinner';\n\nimport './VideoPlayer.scss';\n\nimport VideoPlayerControls from './VideoPlayerControls';\n\ntype OwnProps = {\n url?: string;\n isGif?: boolean;\n posterData?: string;\n posterSize?: ApiDimensions;\n loadProgress?: number;\n fileSize: number;\n isMediaViewerOpen?: boolean;\n noPlay?: boolean;\n areControlsVisible: boolean;\n volume: number;\n isMuted: boolean;\n playbackRate: number;\n toggleControls: (isVisible: boolean) => void;\n onClose: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n};\n\nconst MOBILE_VERSION_CONTROL_WIDTH = 400;\n\nconst VideoPlayer: FC<OwnProps> = ({\n url,\n isGif,\n posterData,\n posterSize,\n loadProgress,\n fileSize,\n isMediaViewerOpen,\n noPlay,\n volume,\n isMuted,\n playbackRate,\n onClose,\n toggleControls,\n areControlsVisible,\n}) => {\n const {\n setMediaViewerVolume,\n setMediaViewerMuted,\n setMediaViewerPlaybackRate,\n } = getActions();\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isPlayed, setIsPlayed] = useState(!IS_TOUCH_ENV || !IS_IOS);\n const [currentTime, setCurrentTime] = useState(0);\n\n const [isFullscreen, setFullscreen, exitFullscreen] = useFullscreenStatus(videoRef, setIsPlayed);\n\n const {\n isBuffered, bufferedRanges, bufferingHandlers, bufferedProgress,\n } = useBuffering();\n const {\n shouldRender: shouldRenderSpinner,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(!isBuffered, undefined, undefined, 'slow');\n const {\n shouldRender: shouldRenderPlayButton,\n transitionClassNames: playButtonClassNames,\n } = useShowTransition(IS_IOS && !isPlayed && !shouldRenderSpinner, undefined, undefined, 'slow');\n\n useEffect(() => {\n if (noPlay || !isMediaViewerOpen) {\n videoRef.current!.pause();\n } else if (url && !IS_TOUCH_ENV) {\n // Chrome does not automatically start playing when `url` becomes available (even with `autoPlay`),\n // so we force it here. Contrary, iOS does not allow to call `play` without mouse event,\n // so we need to use `autoPlay` instead to allow pre-buffering.\n safePlay(videoRef.current!);\n }\n }, [noPlay, isMediaViewerOpen, url]);\n\n useEffect(() => {\n if (videoRef.current!.currentTime === videoRef.current!.duration) {\n setCurrentTime(0);\n setIsPlayed(false);\n } else {\n setCurrentTime(videoRef.current!.currentTime);\n }\n }, [currentTime]);\n\n useEffect(() => {\n videoRef.current!.volume = volume;\n }, [volume]);\n\n useEffect(() => {\n videoRef.current!.playbackRate = playbackRate;\n }, [playbackRate]);\n\n const togglePlayState = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent> | KeyboardEvent) => {\n e.stopPropagation();\n if (isPlayed) {\n videoRef.current!.pause();\n setIsPlayed(false);\n } else {\n safePlay(videoRef.current!);\n setIsPlayed(true);\n }\n }, [isPlayed]);\n\n useVideoCleanup(videoRef, []);\n\n const handleMouseMove = useCallback(() => {\n toggleControls(true);\n }, [toggleControls]);\n\n const handleMouseOut = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (e.target === videoRef.current) {\n toggleControls(false);\n }\n }, [toggleControls]);\n\n const handleTimeUpdate = useCallback((e: React.SyntheticEvent<HTMLVideoElement>) => {\n setCurrentTime(e.currentTarget.currentTime);\n }, []);\n\n const handleEnded = useCallback(() => {\n setCurrentTime(0);\n setIsPlayed(false);\n toggleControls(true);\n }, [toggleControls]);\n\n const handleFullscreenChange = useCallback(() => {\n if (isFullscreen && exitFullscreen) {\n exitFullscreen();\n } else if (!isFullscreen && setFullscreen) {\n setFullscreen();\n }\n }, [exitFullscreen, isFullscreen, setFullscreen]);\n\n const handleSeek = useCallback((position: number) => {\n videoRef.current!.currentTime = position;\n }, []);\n\n const handleVolumeChange = useCallback((newVolume: number) => {\n setMediaViewerVolume({ volume: newVolume / 100 });\n }, [setMediaViewerVolume]);\n\n const handleVolumeMuted = useCallback(() => {\n setMediaViewerMuted({ isMuted: !isMuted });\n }, [isMuted, setMediaViewerMuted]);\n\n const handlePlaybackRateChange = useCallback((newPlaybackRate: number) => {\n setMediaViewerPlaybackRate({ playbackRate: newPlaybackRate });\n }, [setMediaViewerPlaybackRate]);\n\n useEffect(() => {\n if (!isMediaViewerOpen) return undefined;\n const togglePayingStateBySpace = (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n togglePlayState(e);\n }\n };\n\n document.addEventListener('keydown', togglePayingStateBySpace, false);\n\n return () => {\n document.removeEventListener('keydown', togglePayingStateBySpace, false);\n };\n }, [togglePlayState, isMediaViewerOpen]);\n\n const wrapperStyle = posterSize && `width: ${posterSize.width}px; height: ${posterSize.height}px`;\n const videoStyle = `background-image: url(${posterData})`;\n\n return (\n <div\n className=\"VideoPlayer\"\n onMouseMove={!isGif && !IS_TOUCH_ENV ? handleMouseMove : undefined}\n onMouseOut={!isGif && !IS_TOUCH_ENV ? handleMouseOut : undefined}\n >\n <div\n style={wrapperStyle}\n >\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <video\n ref={videoRef}\n autoPlay={IS_TOUCH_ENV}\n playsInline\n loop={isGif}\n // This is to force auto playing on mobiles\n muted={isGif || isMuted}\n id=\"media-viewer-video\"\n style={videoStyle}\n onPlay={IS_IOS ? () => setIsPlayed(true) : undefined}\n onEnded={handleEnded}\n onClick={!IS_SINGLE_COLUMN_LAYOUT ? togglePlayState : undefined}\n onDoubleClick={!IS_TOUCH_ENV ? handleFullscreenChange : undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...bufferingHandlers}\n onTimeUpdate={handleTimeUpdate}\n >\n {url && <source src={url} />}\n </video>\n </div>\n {shouldRenderPlayButton && (\n <Button round className={`play-button ${playButtonClassNames}`} onClick={togglePlayState}>\n <i className=\"icon-play\" />\n </Button>\n )}\n {shouldRenderSpinner && (\n <div className={['spinner-container', spinnerClassNames].join(' ')}>\n {!isBuffered && <div className=\"buffering\">Buffering...</div>}\n <ProgressSpinner\n size=\"xl\"\n progress={isBuffered ? 1 : loadProgress}\n square\n onClick={onClose}\n />\n </div>\n )}\n {!isGif && !shouldRenderSpinner && (\n <VideoPlayerControls\n isPlayed={isPlayed}\n bufferedRanges={bufferedRanges}\n bufferedProgress={bufferedProgress}\n isBuffered={isBuffered}\n currentTime={currentTime}\n isFullscreenSupported={Boolean(setFullscreen)}\n isFullscreen={isFullscreen}\n fileSize={fileSize}\n duration={videoRef.current ? videoRef.current.duration || 0 : 0}\n isVisible={areControlsVisible}\n setVisibility={toggleControls}\n isForceMobileVersion={posterSize && posterSize.width < MOBILE_VERSION_CONTROL_WIDTH}\n onSeek={handleSeek}\n onChangeFullscreen={handleFullscreenChange}\n onPlayPause={togglePlayState}\n volume={volume}\n playbackRate={playbackRate}\n isMuted={isMuted}\n onVolumeClick={handleVolumeMuted}\n onVolumeChange={handleVolumeChange}\n onPlaybackRateChange={handlePlaybackRateChange}\n />\n )}\n </div>\n );\n};\n\nexport default memo(VideoPlayer);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport type {\n ApiChat, ApiDimensions, ApiMessage, ApiUser,\n} from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport useBlurSync from '../../hooks/useBlurSync';\nimport useMedia from '../../hooks/useMedia';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport {\n getChatAvatarHash,\n getMessageDocument,\n getMessageFileSize,\n getMessageMediaFormat,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessagePhoto,\n getMessageVideo,\n getMessageWebPagePhoto,\n getMessageWebPageVideo,\n getPhotoFullDimensions,\n getVideoDimensions,\n isMessageDocumentPhoto,\n isMessageDocumentVideo,\n} from '../../global/helpers';\nimport {\n selectChat, selectChatMessage, selectIsMessageProtected, selectScheduledMessage, selectUser,\n} from '../../global/selectors';\nimport { AVATAR_FULL_DIMENSIONS, calculateMediaViewerDimensions } from '../common/helpers/mediaDimensions';\nimport { renderMessageText } from '../common/helpers/renderMessageText';\nimport stopEvent from '../../util/stopEvent';\n\nimport Spinner from '../ui/Spinner';\nimport MediaViewerFooter from './MediaViewerFooter';\nimport VideoPlayer from './VideoPlayer';\n\nimport './MediaViewerContent.scss';\n\ntype OwnProps = {\n messageId?: number;\n chatId?: string;\n threadId?: number;\n avatarOwnerId?: string;\n profilePhotoIndex?: number;\n origin?: MediaViewerOrigin;\n isActive?: boolean;\n animationLevel: 0 | 1 | 2;\n onClose: () => void;\n onFooterClick: () => void;\n setIsFooterHidden?: (isHidden: boolean) => void;\n isFooterHidden?: boolean;\n};\n\ntype StateProps = {\n chatId?: string;\n messageId?: number;\n senderId?: string;\n threadId?: number;\n avatarOwner?: ApiChat | ApiUser;\n profilePhotoIndex?: number;\n message?: ApiMessage;\n origin?: MediaViewerOrigin;\n isProtected?: boolean;\n volume: number;\n isMuted: boolean;\n playbackRate: number;\n};\n\nconst ANIMATION_DURATION = 350;\n\nconst MediaViewerContent: FC<OwnProps & StateProps> = (props) => {\n const {\n messageId,\n isActive,\n avatarOwner,\n chatId,\n message,\n profilePhotoIndex,\n origin,\n animationLevel,\n isFooterHidden,\n isProtected,\n volume,\n playbackRate,\n isMuted,\n onClose,\n onFooterClick,\n setIsFooterHidden,\n } = props;\n /* Content */\n const photo = message ? getMessagePhoto(message) : undefined;\n const video = message ? getMessageVideo(message) : undefined;\n const webPagePhoto = message ? getMessageWebPagePhoto(message) : undefined;\n const webPageVideo = message ? getMessageWebPageVideo(message) : undefined;\n const isDocumentPhoto = message ? isMessageDocumentPhoto(message) : false;\n const isDocumentVideo = message ? isMessageDocumentVideo(message) : false;\n const isVideo = Boolean(video || webPageVideo || isDocumentVideo);\n const isPhoto = Boolean(!isVideo && (photo || webPagePhoto || isDocumentPhoto));\n const { isGif } = video || webPageVideo || {};\n\n const isOpen = Boolean(avatarOwner || messageId);\n const isAvatar = Boolean(avatarOwner);\n\n const isFromSharedMedia = origin === MediaViewerOrigin.SharedMedia;\n const isFromSearch = origin === MediaViewerOrigin.SearchResult;\n\n const isGhostAnimation = animationLevel === 2;\n\n /* Media data */\n function getMediaHash(isFull?: boolean) {\n if (isAvatar && profilePhotoIndex !== undefined) {\n const { photos } = avatarOwner!;\n return photos && photos[profilePhotoIndex]\n ? `photo${photos[profilePhotoIndex].id}?size=c`\n : getChatAvatarHash(avatarOwner!, isFull ? 'big' : 'normal');\n }\n\n return message && getMessageMediaHash(message, isFull ? 'viewerFull' : 'viewerPreview');\n }\n\n const pictogramBlobUrl = useMedia(\n message && (isFromSharedMedia || isFromSearch) && getMessageMediaHash(message, 'pictogram'),\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const previewMediaHash = getMediaHash();\n const previewBlobUrl = useMedia(\n previewMediaHash,\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const {\n mediaData: fullMediaBlobUrl,\n loadProgress,\n } = useMediaWithLoadProgress(\n getMediaHash(true),\n undefined,\n message && getMessageMediaFormat(message, 'viewerFull'),\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n\n const toggleControls = useCallback((isVisible) => {\n setIsFooterHidden?.(!isVisible);\n }, [setIsFooterHidden]);\n\n const localBlobUrl = (photo || video) ? (photo || video)!.blobUrl : undefined;\n let bestImageData = (!isVideo && (localBlobUrl || fullMediaBlobUrl)) || previewBlobUrl || pictogramBlobUrl;\n const thumbDataUri = useBlurSync(!bestImageData && message && getMessageMediaThumbDataUri(message));\n if (!bestImageData && origin !== MediaViewerOrigin.SearchResult) {\n bestImageData = thumbDataUri;\n }\n\n const videoSize = message ? getMessageFileSize(message) : undefined;\n\n let dimensions!: ApiDimensions;\n if (message) {\n if (isDocumentPhoto || isDocumentVideo) {\n dimensions = getMessageDocument(message)!.mediaSize!;\n } else if (photo || webPagePhoto) {\n dimensions = getPhotoFullDimensions((photo || webPagePhoto)!)!;\n } else if (video || webPageVideo) {\n dimensions = getVideoDimensions((video || webPageVideo)!)!;\n }\n } else {\n dimensions = AVATAR_FULL_DIMENSIONS;\n }\n\n if (isAvatar) {\n return (\n <div key={chatId} className=\"MediaViewerContent\">\n {renderPhoto(\n fullMediaBlobUrl || previewBlobUrl,\n calculateMediaViewerDimensions(AVATAR_FULL_DIMENSIONS, false),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n )}\n </div>\n );\n }\n\n if (!message) return undefined;\n const textParts = renderMessageText(message);\n const hasFooter = Boolean(textParts);\n\n return (\n <div\n className={`MediaViewerContent ${hasFooter ? 'has-footer' : ''}`}\n >\n {isProtected && <div onContextMenu={stopEvent} className=\"protector\" />}\n {isPhoto && renderPhoto(\n localBlobUrl || fullMediaBlobUrl || previewBlobUrl || pictogramBlobUrl,\n message && calculateMediaViewerDimensions(dimensions!, hasFooter),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n )}\n {isVideo && ((!isActive && IS_TOUCH_ENV) ? renderVideoPreview(\n bestImageData,\n message && calculateMediaViewerDimensions(dimensions!, hasFooter, true),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n ) : (\n <VideoPlayer\n key={messageId}\n url={localBlobUrl || fullMediaBlobUrl}\n isGif={isGif}\n posterData={bestImageData}\n posterSize={message && calculateMediaViewerDimensions(dimensions!, hasFooter, true)}\n loadProgress={loadProgress}\n fileSize={videoSize!}\n isMediaViewerOpen={isOpen && isActive}\n areControlsVisible={!isFooterHidden}\n toggleControls={toggleControls}\n noPlay={!isActive}\n onClose={onClose}\n isMuted={isMuted}\n volume={volume}\n playbackRate={playbackRate}\n />\n ))}\n {textParts && (\n <MediaViewerFooter\n text={textParts}\n onClick={onFooterClick}\n isHidden={isFooterHidden}\n isForVideo={isVideo && !isGif}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, ownProps): StateProps => {\n const {\n chatId,\n threadId,\n messageId,\n avatarOwnerId,\n profilePhotoIndex,\n origin,\n } = ownProps;\n\n const {\n volume,\n isMuted,\n playbackRate,\n } = global.mediaViewer;\n\n if (origin === MediaViewerOrigin.SearchResult) {\n if (!(chatId && messageId)) {\n return { volume, isMuted, playbackRate };\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n if (!message) {\n return { volume, isMuted, playbackRate };\n }\n\n return {\n chatId,\n messageId,\n senderId: message.senderId,\n origin,\n message,\n isProtected: selectIsMessageProtected(global, message),\n volume,\n isMuted,\n playbackRate,\n };\n }\n\n if (avatarOwnerId) {\n const sender = selectUser(global, avatarOwnerId) || selectChat(global, avatarOwnerId);\n\n return {\n messageId: -1,\n senderId: avatarOwnerId,\n avatarOwner: sender,\n profilePhotoIndex: profilePhotoIndex || 0,\n origin,\n volume,\n isMuted,\n playbackRate,\n };\n }\n\n if (!(chatId && threadId && messageId)) {\n return { volume, isMuted, playbackRate };\n }\n\n let message: ApiMessage | undefined;\n if (origin && [MediaViewerOrigin.ScheduledAlbum, MediaViewerOrigin.ScheduledInline].includes(origin)) {\n message = selectScheduledMessage(global, chatId, messageId);\n } else {\n message = selectChatMessage(global, chatId, messageId);\n }\n\n if (!message) {\n return { volume, isMuted, playbackRate };\n }\n\n return {\n chatId,\n threadId,\n messageId,\n senderId: message.senderId,\n origin,\n message,\n isProtected: selectIsMessageProtected(global, message),\n volume,\n isMuted,\n playbackRate,\n };\n },\n)(MediaViewerContent));\n\nfunction renderPhoto(blobUrl?: string, imageSize?: ApiDimensions, canDrag?: boolean) {\n return blobUrl\n ? (\n <img\n src={blobUrl}\n alt=\"\"\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n draggable={Boolean(canDrag)}\n />\n )\n : (\n <div\n className=\"spinner-wrapper\"\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n >\n <Spinner color=\"white\" />\n </div>\n );\n}\n\nfunction renderVideoPreview(blobUrl?: string, imageSize?: ApiDimensions, canDrag?: boolean) {\n const wrapperStyle = imageSize && `width: ${imageSize.width}px; height: ${imageSize.height}px`;\n const videoStyle = `background-image: url(${blobUrl})`;\n return blobUrl\n ? (\n <div\n className=\"VideoPlayer\"\n >\n <div\n style={wrapperStyle}\n >\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <video\n style={videoStyle}\n draggable={Boolean(canDrag)}\n />\n </div>\n </div>\n )\n : (\n <div\n className=\"spinner-wrapper\"\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n >\n <Spinner color=\"white\" />\n </div>\n );\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport type { MediaViewerOrigin } from '../../types';\nimport type { RealTouchEvent } from '../../util/captureEvents';\n\nimport { animateNumber, timingFunctions } from '../../util/animation';\nimport arePropsShallowEqual from '../../util/arePropsShallowEqual';\nimport buildClassName from '../../util/buildClassName';\nimport { captureEvents, IOS_SCREEN_EDGE_THRESHOLD } from '../../util/captureEvents';\nimport { IS_IOS, IS_TOUCH_ENV } from '../../util/environment';\nimport { clamp, isBetween, round } from '../../util/math';\nimport { debounce } from '../../util/schedulers';\n\nimport useDebouncedCallback from '../../hooks/useDebouncedCallback';\nimport useForceUpdate from '../../hooks/useForceUpdate';\nimport useLang from '../../hooks/useLang';\nimport usePrevious from '../../hooks/usePrevious';\nimport useTimeout from '../../hooks/useTimeout';\nimport useWindowSize from '../../hooks/useWindowSize';\n\nimport MediaViewerContent from './MediaViewerContent';\n\nimport './MediaViewerSlides.scss';\n\nconst { easeOutCubic, easeOutQuart } = timingFunctions;\n\ntype OwnProps = {\n messageId?: number;\n getMessageId: (fromId?: number, direction?: number) => number | undefined;\n isVideo?: boolean;\n isGif?: boolean;\n isPhoto?: boolean;\n isOpen?: boolean;\n selectMessage: (id?: number) => void;\n chatId?: string;\n threadId?: number;\n isActive?: boolean;\n avatarOwnerId?: string;\n profilePhotoIndex?: number;\n origin?: MediaViewerOrigin;\n animationLevel: 0 | 1 | 2;\n onClose: () => void;\n hasFooter?: boolean;\n onFooterClick: () => void;\n zoomLevelChange: number;\n};\n\nconst SWIPE_X_THRESHOLD = 50;\nconst SWIPE_Y_THRESHOLD = 50;\nconst SLIDES_GAP = IS_TOUCH_ENV ? 40 : 0;\nconst ANIMATION_DURATION = 350;\nconst DEBOUNCE_MESSAGE = 350;\nconst DEBOUNCE_SWIPE = 500;\nconst DEBOUNCE_ACTIVE = 800;\nconst DOUBLE_TAP_ZOOM = 3;\nconst CLICK_Y_THRESHOLD = 80;\nconst HEADER_HEIGHT = 60;\nconst MAX_ZOOM = 4;\nconst MIN_ZOOM = 1;\nlet cancelAnimation: Function | undefined;\nlet cancelZoomAnimation: Function | undefined;\n\ntype Transform = {\n x: number;\n y: number;\n scale: number;\n};\n\nenum SwipeDirection {\n Horizontal,\n Vertical,\n}\n\nconst MediaViewerSlides: FC<OwnProps> = ({\n messageId,\n getMessageId,\n selectMessage,\n isVideo,\n isGif,\n isPhoto,\n isOpen,\n isActive,\n hasFooter,\n zoomLevelChange,\n animationLevel,\n ...rest\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const activeSlideRef = useRef<HTMLDivElement>(null);\n const transformRef = useRef<Transform>({ x: 0, y: 0, scale: 1 });\n const lastTransformRef = useRef<Transform>({ x: 0, y: 0, scale: 1 });\n const swipeDirectionRef = useRef<SwipeDirection | undefined>(undefined);\n const isActiveRef = useRef(true);\n const [activeMessageId, setActiveMessageId] = useState<number | undefined>(messageId);\n const prevZoomLevelChange = usePrevious(zoomLevelChange);\n const hasZoomChanged = prevZoomLevelChange !== undefined && prevZoomLevelChange !== zoomLevelChange;\n const forceUpdate = useForceUpdate();\n const [isFooterHidden, setIsFooterHidden] = useState(true);\n const [isMouseDown, setIsMouseDown] = useState(false);\n const { height: windowHeight, width: windowWidth, isResizing } = useWindowSize();\n const { onClose } = rest;\n\n const lang = useLang();\n\n const setTransform = useCallback((value: Transform) => {\n transformRef.current = value;\n forceUpdate();\n }, [forceUpdate]);\n\n const selectMessageDebounced = useDebouncedCallback(selectMessage, [], DEBOUNCE_MESSAGE, true);\n const clearSwipeDirectionDebounced = useDebouncedCallback(() => {\n swipeDirectionRef.current = undefined;\n }, [], DEBOUNCE_SWIPE, true);\n const setIsActiveDebounced = useDebouncedCallback((value: boolean) => {\n isActiveRef.current = value;\n forceUpdate();\n }, [forceUpdate], DEBOUNCE_ACTIVE, true);\n\n const shouldCloseOnVideo = isGif && !IS_IOS;\n const clickXThreshold = IS_TOUCH_ENV ? 40 : windowWidth / 10;\n\n const handleToggleFooterVisibility = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (!IS_TOUCH_ENV) return;\n const isFooter = windowHeight - e.pageY < CLICK_Y_THRESHOLD;\n if (!isFooter && e.pageX < clickXThreshold) return;\n if (!isFooter && e.pageX > windowWidth - clickXThreshold) return;\n setIsFooterHidden(!isFooterHidden);\n }, [clickXThreshold, isFooterHidden, windowHeight, windowWidth]);\n\n useTimeout(() => setIsFooterHidden(false), ANIMATION_DURATION - 150);\n\n useEffect(() => {\n if (!containerRef.current || !activeMessageId) {\n return undefined;\n }\n let lastTransform = lastTransformRef.current;\n const lastDragOffset = {\n x: 0,\n y: 0,\n };\n const lastZoomCenter = {\n x: 0,\n y: 0,\n };\n const panDelta = {\n x: 0,\n y: 0,\n };\n let lastGestureTime = Date.now();\n let initialContentRect: DOMRect;\n let content: HTMLElement | null;\n const setLastGestureTime = debounce(() => {\n lastGestureTime = Date.now();\n }, 500, false, true);\n\n const changeSlide = (direction: number) => {\n const mId = getMessageId(activeMessageId, direction);\n if (mId) {\n const offset = (windowWidth + SLIDES_GAP) * direction;\n transformRef.current.x += offset;\n isActiveRef.current = false;\n setActiveMessageId(mId);\n selectMessageDebounced(mId);\n setIsActiveDebounced(true);\n lastTransform = { x: 0, y: 0, scale: 1 };\n if (animationLevel === 0) {\n setTransform(lastTransform);\n return true;\n }\n cancelAnimation = animateNumber({\n from: transformRef.current.x,\n to: 0,\n duration: ANIMATION_DURATION,\n timing: easeOutCubic,\n onUpdate: (value) => setTransform({\n y: 0,\n x: value,\n scale: 1,\n }),\n });\n return true;\n }\n return false;\n };\n\n const changeSlideOnClick = (e: MouseEvent): [boolean, boolean] => {\n if (transformRef.current.scale !== 1) return [false, false];\n let direction = 0;\n if (windowHeight - e.pageY < CLICK_Y_THRESHOLD) {\n return [false, false];\n }\n if (e.pageX < clickXThreshold) {\n direction = -1;\n } else if (e.pageX > windowWidth - clickXThreshold) {\n direction = 1;\n }\n const hasNextSlide = changeSlide(direction);\n const isInThreshold = direction !== 0;\n return [isInThreshold, hasNextSlide];\n };\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (transformRef.current.scale !== 1) return;\n switch (e.key) {\n case 'Left': // IE/Edge specific value\n case 'ArrowLeft':\n changeSlide(-1);\n break;\n\n case 'Right': // IE/Edge specific value\n case 'ArrowRight':\n changeSlide(1);\n break;\n }\n };\n\n const calculateOffsetBoundaries = (\n { x, y, scale }: Transform,\n offsetTop = 0,\n ):[Transform, boolean, boolean] => {\n if (!initialContentRect) return [{ x, y, scale }, true, true];\n // Get current content boundaries\n let inBoundsX = true;\n let inBoundsY = true;\n\n const centerX = (windowWidth - windowWidth * scale) / 2;\n const centerY = (windowHeight - windowHeight * scale) / 2;\n\n // If content is outside window we calculate offset boundaries\n // based on initial content rect and current scale\n const minOffsetX = Math.max(-initialContentRect.left * scale, centerX);\n const maxOffsetX = windowWidth - initialContentRect.right * scale;\n inBoundsX = isBetween(x, maxOffsetX, minOffsetX);\n x = clamp(x, maxOffsetX, minOffsetX);\n\n const minOffsetY = Math.max(-initialContentRect.top * scale + offsetTop, centerY);\n const maxOffsetY = windowHeight - initialContentRect.bottom * scale;\n inBoundsY = isBetween(y, maxOffsetY, minOffsetY);\n y = clamp(y, maxOffsetY, minOffsetY);\n\n return [{ x, y, scale }, inBoundsX, inBoundsY];\n };\n\n const cleanup = captureEvents(containerRef.current, {\n isNotPassive: true,\n withNativeDrag: true,\n excludedClosestSelector: '.MediaViewerFooter, .ZoomControls',\n minZoom: MIN_ZOOM,\n maxZoom: MAX_ZOOM,\n doubleTapZoom: DOUBLE_TAP_ZOOM,\n onCapture: (e) => {\n if (checkIfControlTarget(e)) return;\n if (e.type === 'mousedown') {\n setIsMouseDown(true);\n if (transformRef.current.scale !== 1) {\n e.preventDefault();\n return;\n }\n }\n lastGestureTime = Date.now();\n if (arePropsShallowEqual(transformRef.current, { x: 0, y: 0, scale: 1 })) {\n if (!activeSlideRef.current) return;\n content = activeSlideRef.current.querySelector('img, video');\n if (!content) return;\n // Store initial content rect, without transformations\n initialContentRect = content.getBoundingClientRect();\n }\n },\n onDrag: (event, captureEvent, {\n dragOffsetX,\n dragOffsetY,\n }, cancelDrag) => {\n if (checkIfControlTarget(event)) return;\n // Avoid conflicts with swipe-to-back gestures\n if (IS_IOS && captureEvent.type === 'touchstart') {\n const { pageX } = (captureEvent as RealTouchEvent).touches[0];\n if (pageX <= IOS_SCREEN_EDGE_THRESHOLD || pageX >= windowWidth - IOS_SCREEN_EDGE_THRESHOLD) {\n return;\n }\n }\n if (cancelAnimation) {\n cancelAnimation();\n cancelAnimation = undefined;\n }\n panDelta.x = lastDragOffset.x - dragOffsetX;\n panDelta.y = lastDragOffset.y - dragOffsetY;\n lastDragOffset.x = dragOffsetX;\n lastDragOffset.y = dragOffsetY;\n const absOffsetX = Math.abs(dragOffsetX);\n const absOffsetY = Math.abs(dragOffsetY);\n const {\n scale,\n x,\n y,\n } = transformRef.current;\n const h = 10;\n\n // If user is inactive but is still touching the screen\n // we reset last gesture time\n setLastGestureTime();\n\n // If image is scaled we just need to pan it\n if (scale !== 1) {\n const x1 = lastTransform.x + dragOffsetX;\n const y1 = lastTransform.y + dragOffsetY;\n if (['wheel', 'mousemove'].includes(event.type)) {\n const [transform, inBoundsX, inBoundsY] = calculateOffsetBoundaries({ x: x1, y: y1, scale }, HEADER_HEIGHT);\n if (cancelDrag) cancelDrag(!inBoundsX, !inBoundsY);\n setTransform(transform);\n return;\n }\n if ('touches' in event && event.touches.length === 1) {\n setTransform({\n x: x1,\n y: y1,\n scale,\n });\n }\n return;\n }\n if (['wheel', 'mousemove'].includes(event.type)) return;\n if (swipeDirectionRef.current !== SwipeDirection.Vertical) {\n // If user is swiping horizontally or horizontal shift is dominant\n // we change only horizontal position\n if (swipeDirectionRef.current === SwipeDirection.Horizontal\n || Math.abs(x) > h || (absOffsetX > h && absOffsetY < h)) {\n swipeDirectionRef.current = SwipeDirection.Horizontal;\n isActiveRef.current = false;\n const limit = windowWidth + SLIDES_GAP;\n setTransform({\n x: clamp(dragOffsetX, -limit, limit),\n y: 0,\n scale,\n });\n return;\n }\n }\n // If vertical shift is dominant we change only vertical position\n if (swipeDirectionRef.current === SwipeDirection.Vertical\n || Math.abs(y) > h || (absOffsetY > h && absOffsetX < h)) {\n swipeDirectionRef.current = SwipeDirection.Vertical;\n const limit = windowHeight;\n setTransform({\n x: 0,\n y: clamp(dragOffsetY, -limit, limit),\n scale,\n });\n }\n },\n onZoom: (e, {\n zoom,\n zoomFactor,\n initialCenterX,\n initialCenterY,\n dragOffsetX,\n dragOffsetY,\n currentCenterX,\n currentCenterY,\n }) => {\n if (cancelAnimation) cancelAnimation();\n initialCenterX = initialCenterX || windowWidth / 2;\n initialCenterY = initialCenterY || windowHeight / 2;\n currentCenterX = currentCenterX || windowWidth / 2;\n currentCenterY = currentCenterY || windowHeight / 2;\n\n // Calculate current scale based on zoom factor and limits, add zoom margin for bounce back effect\n const scale = zoom ?? clamp(lastTransform.scale * zoomFactor!, MIN_ZOOM * 0.5, MAX_ZOOM * 3);\n const scaleFactor = scale / lastTransform.scale;\n const offsetX = Math.abs(Math.min(lastTransform.x, 0));\n const offsetY = Math.abs(Math.min(lastTransform.y, 0));\n\n // Save last zoom center for bounce back effect\n lastZoomCenter.x = currentCenterX;\n lastZoomCenter.y = currentCenterY;\n\n // Calculate new center relative to the shifted image\n const scaledCenterX = offsetX + initialCenterX;\n const scaledCenterY = offsetY + initialCenterY;\n\n // Calculate how much we need to shift the image to keep the zoom center at the same position\n const scaleOffsetX = (scaledCenterX - scaleFactor * scaledCenterX);\n const scaleOffsetY = (scaledCenterY - scaleFactor * scaledCenterY);\n\n const [transform] = calculateOffsetBoundaries({\n x: lastTransform.x + scaleOffsetX + dragOffsetX,\n y: lastTransform.y + scaleOffsetY + dragOffsetY,\n scale,\n });\n\n setTransform(transform);\n },\n onClick(e) {\n const [isInThreshold, hasNextSlide] = changeSlideOnClick(e as MouseEvent);\n if (isInThreshold) {\n e.preventDefault();\n e.stopPropagation();\n if (IS_TOUCH_ENV) return;\n if (!hasNextSlide) onClose();\n return;\n }\n if (lastTransform.scale !== 1 || IS_TOUCH_ENV) return;\n if (shouldCloseOnVideo || !checkIfInsideSelector(e.target as HTMLElement, '.VideoPlayer')) {\n onClose();\n }\n },\n onDoubleClick(e, {\n centerX,\n centerY,\n }) {\n const [isInThreshold] = changeSlideOnClick(e as MouseEvent);\n if (isInThreshold) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n if (!IS_TOUCH_ENV && e.type !== 'wheel') return;\n // Calculate how much we need to shift the image to keep the zoom center at the same position\n const scaleOffsetX = (centerX - DOUBLE_TAP_ZOOM * centerX);\n const scaleOffsetY = (centerY - DOUBLE_TAP_ZOOM * centerY);\n const {\n scale,\n x,\n y,\n } = transformRef.current;\n if (scale === 1) {\n if (x !== 0 || y !== 0) return;\n lastTransform = calculateOffsetBoundaries({\n x: scaleOffsetX,\n y: scaleOffsetY,\n scale: DOUBLE_TAP_ZOOM,\n })[0];\n } else {\n lastTransform = {\n x: 0,\n y: 0,\n scale: 1,\n };\n }\n cancelAnimation = animateNumber({\n from: [x, y, scale],\n to: [lastTransform.x, lastTransform.y, lastTransform.scale],\n duration: ANIMATION_DURATION,\n timing: easeOutCubic,\n onUpdate: (value) => {\n const transform = {\n x: value[0],\n y: value[1],\n scale: value[2],\n };\n setTransform(transform);\n },\n });\n },\n onRelease: (e) => {\n if (e.type === 'mouseup') {\n setIsMouseDown(false);\n }\n const absX = Math.abs(transformRef.current.x);\n const absY = Math.abs(transformRef.current.y);\n const {\n scale,\n x,\n y,\n } = transformRef.current;\n\n clearSwipeDirectionDebounced();\n setIsActiveDebounced(true);\n\n // If scale is less than 1 we need to bounce back\n if (scale < 1) {\n lastTransform = { x: 0, y: 0, scale: 1 };\n cancelAnimation = animateNumber({\n from: [x, y, scale],\n to: [0, 0, 1],\n duration: ANIMATION_DURATION,\n timing: easeOutCubic,\n onUpdate: (value) => setTransform({\n x: value[0],\n y: value[1],\n scale: value[2],\n }),\n });\n return undefined;\n }\n if (scale > 1) {\n // Get current content boundaries\n const s1 = Math.min(scale, MAX_ZOOM);\n const scaleFactor = s1 / scale;\n\n // Calculate new position based on the last zoom center to keep the zoom center\n // at the same position when bouncing back from max zoom\n let x1 = x * scaleFactor + (lastZoomCenter.x - scaleFactor * lastZoomCenter.x);\n let y1 = y * scaleFactor + (lastZoomCenter.y - scaleFactor * lastZoomCenter.y);\n\n // Arbitrary pan velocity coefficient\n const k = 0.15;\n\n // If scale didn't change, we need to add inertia to pan gesture\n if (e.type !== 'wheel' && lastTransform.scale === scale) {\n // Calculate user gesture velocity\n const Vx = Math.abs(lastDragOffset.x) / (Date.now() - lastGestureTime);\n const Vy = Math.abs(lastDragOffset.y) / (Date.now() - lastGestureTime);\n\n // Add extra distance based on gesture velocity and last pan delta\n x1 -= Math.abs(lastDragOffset.x) * Vx * k * panDelta.x;\n y1 -= Math.abs(lastDragOffset.y) * Vy * k * panDelta.y;\n }\n\n [lastTransform] = calculateOffsetBoundaries({ x: x1, y: y1, scale: s1 }, HEADER_HEIGHT);\n cancelAnimation = animateNumber({\n from: [x, y, scale],\n to: [lastTransform.x, lastTransform.y, lastTransform.scale],\n duration: ANIMATION_DURATION,\n timing: easeOutCubic,\n onUpdate: (value) => setTransform({\n x: value[0],\n y: value[1],\n scale: value[2],\n }),\n });\n return undefined;\n }\n lastTransform = {\n x,\n y,\n scale,\n };\n if (e.type !== 'wheel' && absY >= SWIPE_Y_THRESHOLD) return onClose();\n // Bounce back if vertical swipe is below threshold\n if (absY > 0) {\n cancelAnimation = animateNumber({\n from: y,\n to: 0,\n duration: ANIMATION_DURATION,\n timing: easeOutCubic,\n onUpdate: (value) => setTransform({\n x: 0,\n y: value,\n scale,\n }),\n });\n return undefined;\n }\n // Get horizontal swipe direction\n const direction = x < 0 ? 1 : -1;\n const mId = getMessageId(activeMessageId, x < 0 ? 1 : -1);\n // Get the direction of the last pan gesture.\n // Could be different from the total horizontal swipe direction\n // if user starts a swipe in one direction and then changes the direction\n // we need to cancel slide transition\n const dirX = panDelta.x < 0 ? -1 : 1;\n if (mId && absX >= SWIPE_X_THRESHOLD && direction === dirX) {\n const offset = (windowWidth + SLIDES_GAP) * direction;\n // If image is shifted by more than SWIPE_X_THRESHOLD,\n // We shift everything by one screen width and then set new active message id\n transformRef.current.x += offset;\n setActiveMessageId(mId);\n selectMessageDebounced(mId);\n }\n // Then we always return to the original position\n cancelAnimation = animateNumber({\n from: transformRef.current.x,\n to: 0,\n duration: ANIMATION_DURATION,\n timing: easeOutCubic,\n onUpdate: (value) => setTransform({\n y: 0,\n x: value,\n scale: transformRef.current.scale,\n }),\n });\n return undefined;\n },\n });\n document.addEventListener('keydown', handleKeyDown, false);\n return () => {\n cleanup();\n document.removeEventListener('keydown', handleKeyDown, false);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n onClose,\n setTransform,\n getMessageId,\n activeMessageId,\n windowWidth,\n windowHeight,\n clickXThreshold,\n shouldCloseOnVideo,\n selectMessageDebounced,\n setIsActiveDebounced,\n clearSwipeDirectionDebounced,\n animationLevel,\n setIsMouseDown,\n ]);\n\n useEffect(() => {\n if (!containerRef.current || !hasZoomChanged) return;\n const { scale } = transformRef.current;\n const dir = zoomLevelChange > 0 ? -1 : +1;\n const minZoom = MIN_ZOOM * 0.5;\n const maxZoom = MAX_ZOOM * 3;\n const steps = 100;\n let prevValue = 0;\n if (scale <= minZoom && dir > 0) return;\n if (scale >= maxZoom && dir < 0) return;\n if (cancelZoomAnimation) cancelZoomAnimation();\n cancelZoomAnimation = animateNumber({\n from: dir,\n to: dir * steps,\n duration: ANIMATION_DURATION,\n timing: easeOutQuart,\n onUpdate: (value) => {\n if (!containerRef.current) return;\n const delta = round(value - prevValue, 2);\n prevValue = value;\n // To reuse existing logic we trigger wheel event for zoom buttons\n const wheelEvent = new WheelEvent('wheel', {\n deltaY: delta,\n ctrlKey: true,\n });\n containerRef.current.dispatchEvent(wheelEvent);\n },\n });\n }, [zoomLevelChange, hasZoomChanged]);\n\n if (!activeMessageId) return undefined;\n\n const nextMessageId = getMessageId(activeMessageId, 1);\n const previousMessageId = getMessageId(activeMessageId, -1);\n const offsetX = transformRef.current.x;\n const offsetY = transformRef.current.y;\n const { scale } = transformRef.current;\n\n return (\n <div className=\"MediaViewerSlides\" ref={containerRef}>\n {previousMessageId && scale === 1 && !isResizing && (\n <div className=\"MediaViewerSlide\" style={getAnimationStyle(-windowWidth + offsetX - SLIDES_GAP)}>\n <MediaViewerContent\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n animationLevel={animationLevel}\n isFooterHidden={isFooterHidden}\n messageId={previousMessageId}\n />\n </div>\n )}\n {activeMessageId && (\n <div\n className={buildClassName(\n 'MediaViewerSlide',\n isActive && 'MediaViewerSlide--active',\n isMouseDown && scale > 1 && 'MediaViewerSlide--moving',\n )}\n onClick={handleToggleFooterVisibility}\n ref={activeSlideRef}\n style={getAnimationStyle(offsetX, offsetY, scale)}\n >\n <MediaViewerContent\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n messageId={activeMessageId}\n animationLevel={animationLevel}\n isActive={isActive && isActiveRef.current}\n setIsFooterHidden={setIsFooterHidden}\n isFooterHidden={isFooterHidden || scale !== 1}\n />\n </div>\n )}\n {nextMessageId && scale === 1 && !isResizing && (\n <div className=\"MediaViewerSlide\" style={getAnimationStyle(windowWidth + offsetX + SLIDES_GAP)}>\n <MediaViewerContent\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n animationLevel={animationLevel}\n isFooterHidden={isFooterHidden}\n messageId={nextMessageId}\n />\n </div>\n )}\n {previousMessageId && scale === 1 && !IS_TOUCH_ENV && (\n <button\n type=\"button\"\n className={`navigation prev ${isVideo && !isGif && 'inline'}`}\n aria-label={lang('AccDescrPrevious')}\n dir={lang.isRtl ? 'rtl' : undefined}\n />\n )}\n {nextMessageId && scale === 1 && !IS_TOUCH_ENV && (\n <button\n type=\"button\"\n className={`navigation next ${isVideo && !isGif && 'inline'}`}\n aria-label={lang('Next')}\n dir={lang.isRtl ? 'rtl' : undefined}\n />\n )}\n </div>\n );\n};\n\nexport default memo(MediaViewerSlides);\n\nfunction getAnimationStyle(x = 0, y = 0, scale = 1) {\n return `transform: translate3d(${x.toFixed(3)}px, ${y.toFixed(3)}px, 0px) scale(${scale.toFixed(3)});`;\n}\n\nfunction checkIfInsideSelector(element: HTMLElement, selector: string) {\n if (!element) return false;\n if (element.matches(selector)) return true;\n return Boolean(element.closest(selector));\n}\n\nfunction checkIfControlTarget(e: TouchEvent | MouseEvent) {\n const target = e.target as HTMLElement;\n if (checkIfInsideSelector(target, '.VideoPlayerControls')) {\n if (checkIfInsideSelector(\n target,\n '.play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu',\n )) {\n return true;\n }\n e.preventDefault();\n return true;\n }\n return false;\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChat, ApiMessage, ApiUser } from '../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { getSenderTitle, isUserId } from '../../global/helpers';\nimport { formatMediaDateTime } from '../../util/dateFormat';\nimport renderText from '../common/helpers/renderText';\nimport {\n selectChat,\n selectChatMessage,\n selectSender,\n selectUser,\n} from '../../global/selectors';\nimport useLang from '../../hooks/useLang';\n\nimport Avatar from '../common/Avatar';\n\nimport './SenderInfo.scss';\n\ntype OwnProps = {\n chatId?: string;\n messageId?: number;\n isAvatar?: boolean;\n};\n\ntype StateProps = {\n sender?: ApiUser | ApiChat;\n message?: ApiMessage;\n};\n\nconst ANIMATION_DURATION = 350;\n\nconst SenderInfo: FC<OwnProps & StateProps> = ({\n chatId,\n messageId,\n sender,\n isAvatar,\n message,\n}) => {\n const {\n closeMediaViewer,\n focusMessage,\n toggleChatInfo,\n } = getActions();\n\n const handleFocusMessage = useCallback(() => {\n closeMediaViewer();\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n setTimeout(() => {\n toggleChatInfo(false, { forceSyncOnIOs: true });\n focusMessage({ chatId, messageId });\n }, ANIMATION_DURATION);\n } else {\n focusMessage({ chatId, messageId });\n }\n }, [chatId, focusMessage, toggleChatInfo, messageId, closeMediaViewer]);\n\n const lang = useLang();\n\n if (!sender || (!message && !isAvatar)) {\n return undefined;\n }\n\n const senderTitle = getSenderTitle(lang, sender);\n\n return (\n <div className=\"SenderInfo\" onClick={handleFocusMessage}>\n {isUserId(sender.id) ? (\n <Avatar key={sender.id} size=\"medium\" user={sender as ApiUser} />\n ) : (\n <Avatar key={sender.id} size=\"medium\" chat={sender as ApiChat} />\n )}\n <div className=\"meta\">\n <div className=\"title\" dir=\"auto\">\n {senderTitle && renderText(senderTitle)}\n </div>\n <div className=\"date\" dir=\"auto\">\n {isAvatar\n ? lang('lng_mediaview_profile_photo')\n : formatMediaDateTime(lang, message!.date * 1000, true)}\n </div>\n </div>\n </div>\n );\n};\n\nexport default withGlobal<OwnProps>(\n (global, { chatId, messageId, isAvatar }): StateProps => {\n if (isAvatar && chatId) {\n return {\n sender: isUserId(chatId) ? selectUser(global, chatId) : selectChat(global, chatId),\n };\n }\n\n if (!messageId || !chatId) {\n return {};\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n\n return {\n message,\n sender: message && selectSender(global, message),\n };\n },\n)(SenderInfo);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport type {\n ApiChat, ApiDimensions, ApiMessage, ApiUser,\n} from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { getActions, withGlobal } from '../../global';\nimport {\n getChatAvatarHash,\n getChatMediaMessageIds,\n getMessageDocument,\n getMessageFileName,\n getMessageMediaFormat,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessagePhoto,\n getMessageVideo,\n getMessageWebPagePhoto,\n getMessageWebPageVideo,\n getPhotoFullDimensions,\n getVideoDimensions,\n isMessageDocumentPhoto,\n isMessageDocumentVideo,\n} from '../../global/helpers';\nimport {\n selectChat,\n selectChatMessage,\n selectChatMessages,\n selectCurrentMediaSearch,\n selectIsChatWithSelf,\n selectListedIds,\n selectOutlyingIds,\n selectScheduledMessage,\n selectScheduledMessages,\n selectUser,\n} from '../../global/selectors';\nimport { stopCurrentAudio } from '../../util/audioPlayer';\nimport captureEscKeyListener from '../../util/captureEscKeyListener';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { ANIMATION_END_DELAY } from '../../config';\nimport { AVATAR_FULL_DIMENSIONS, MEDIA_VIEWER_MEDIA_QUERY } from '../common/helpers/mediaDimensions';\nimport windowSize from '../../util/windowSize';\nimport { animateClosing, animateOpening } from './helpers/ghostAnimation';\nimport { renderMessageText } from '../common/helpers/renderMessageText';\n\nimport useBlurSync from '../../hooks/useBlurSync';\nimport useFlag from '../../hooks/useFlag';\nimport useForceUpdate from '../../hooks/useForceUpdate';\nimport { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport useLang from '../../hooks/useLang';\nimport useMedia from '../../hooks/useMedia';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport ReportModal from '../common/ReportModal';\nimport Button from '../ui/Button';\nimport ShowTransition from '../ui/ShowTransition';\nimport Transition from '../ui/Transition';\nimport MediaViewerActions from './MediaViewerActions';\nimport MediaViewerSlides from './MediaViewerSlides';\nimport SenderInfo from './SenderInfo';\n\nimport './MediaViewer.scss';\n\ntype StateProps = {\n chatId?: string;\n threadId?: number;\n messageId?: number;\n senderId?: string;\n isChatWithSelf?: boolean;\n origin?: MediaViewerOrigin;\n avatarOwner?: ApiChat | ApiUser;\n profilePhotoIndex?: number;\n message?: ApiMessage;\n chatMessages?: Record<number, ApiMessage>;\n collectionIds?: number[];\n animationLevel: 0 | 1 | 2;\n};\n\nconst ANIMATION_DURATION = 350;\n\nconst MediaViewer: FC<StateProps> = ({\n chatId,\n threadId,\n messageId,\n senderId,\n isChatWithSelf,\n origin,\n avatarOwner,\n profilePhotoIndex,\n message,\n chatMessages,\n collectionIds,\n animationLevel,\n}) => {\n const {\n openMediaViewer,\n closeMediaViewer,\n openForwardMenu,\n focusMessage,\n toggleChatInfo,\n } = getActions();\n\n const isOpen = Boolean(avatarOwner || messageId);\n\n const isFromSharedMedia = origin === MediaViewerOrigin.SharedMedia;\n const isFromSearch = origin === MediaViewerOrigin.SearchResult;\n\n /* Content */\n const photo = message ? getMessagePhoto(message) : undefined;\n const video = message ? getMessageVideo(message) : undefined;\n const webPagePhoto = message ? getMessageWebPagePhoto(message) : undefined;\n const webPageVideo = message ? getMessageWebPageVideo(message) : undefined;\n const isDocumentPhoto = message ? isMessageDocumentPhoto(message) : false;\n const isDocumentVideo = message ? isMessageDocumentVideo(message) : false;\n const isVideo = Boolean(video || webPageVideo || isDocumentVideo);\n const { isGif } = video || webPageVideo || {};\n const isPhoto = Boolean(!isVideo && (photo || webPagePhoto || isDocumentPhoto));\n const isAvatar = Boolean(avatarOwner);\n\n /* Navigation */\n const singleMessageId = webPagePhoto || webPageVideo ? messageId : undefined;\n\n const messageIds = useMemo(() => {\n return singleMessageId\n ? [singleMessageId]\n : getChatMediaMessageIds(chatMessages || {}, collectionIds || [], isFromSharedMedia);\n }, [singleMessageId, chatMessages, collectionIds, isFromSharedMedia]);\n\n const selectedMediaMessageIndex = messageId ? messageIds.indexOf(messageId) : -1;\n\n /* Animation */\n const animationKey = useRef<number>();\n const prevSenderId = usePrevious<string | undefined>(senderId);\n if (isOpen && (!prevSenderId || prevSenderId !== senderId || !animationKey.current)) {\n animationKey.current = selectedMediaMessageIndex;\n }\n const headerAnimation = animationLevel === 2 ? 'slide-fade' : 'none';\n const isGhostAnimation = animationLevel === 2;\n\n /* Controls */\n const [isReportModalOpen, openReportModal, closeReportModal] = useFlag();\n const [zoomLevelChange, setZoomLevelChange] = useState<number>(1);\n\n /* Media data */\n function getMediaHash(isFull?: boolean) {\n if (isAvatar && profilePhotoIndex !== undefined) {\n const { photos } = avatarOwner!;\n return photos && photos[profilePhotoIndex]\n ? `photo${photos[profilePhotoIndex].id}?size=c`\n : getChatAvatarHash(avatarOwner!, isFull ? 'big' : 'normal');\n }\n\n return message && getMessageMediaHash(message, isFull ? 'viewerFull' : 'viewerPreview');\n }\n\n const pictogramBlobUrl = useMedia(\n message && (isFromSharedMedia || isFromSearch) && getMessageMediaHash(message, 'pictogram'),\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const previewMediaHash = getMediaHash();\n const previewBlobUrl = useMedia(\n previewMediaHash,\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const { mediaData: fullMediaBlobUrl } = useMediaWithLoadProgress(\n getMediaHash(true),\n undefined,\n message && getMessageMediaFormat(message, 'viewerFull'),\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const avatarPhoto = avatarOwner?.photos?.[profilePhotoIndex!];\n const canReport = !!avatarPhoto && profilePhotoIndex! > 0 && !isChatWithSelf;\n\n const localBlobUrl = (photo || video) ? (photo || video)!.blobUrl : undefined;\n let bestImageData = (!isVideo && (localBlobUrl || fullMediaBlobUrl)) || previewBlobUrl || pictogramBlobUrl;\n const thumbDataUri = useBlurSync(!bestImageData && message && getMessageMediaThumbDataUri(message));\n if (!bestImageData && origin !== MediaViewerOrigin.SearchResult) {\n bestImageData = thumbDataUri;\n }\n\n const fileName = message\n ? getMessageFileName(message)\n : isAvatar\n ? `avatar${avatarOwner!.id}-${profilePhotoIndex}.jpg`\n : undefined;\n\n let dimensions!: ApiDimensions;\n if (message) {\n if (isDocumentPhoto || isDocumentVideo) {\n dimensions = getMessageDocument(message)!.mediaSize!;\n } else if (photo || webPagePhoto) {\n dimensions = getPhotoFullDimensions((photo || webPagePhoto)!)!;\n } else if (video || webPageVideo) {\n dimensions = getVideoDimensions((video || webPageVideo)!)!;\n }\n } else {\n dimensions = AVATAR_FULL_DIMENSIONS;\n }\n\n useEffect(() => {\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n return;\n }\n\n document.body.classList.toggle('is-media-viewer-open', isOpen);\n }, [isOpen]);\n\n const forceUpdate = useForceUpdate();\n useEffect(() => {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n if (typeof mql.addEventListener === 'function') {\n mql.addEventListener('change', forceUpdate);\n } else if (typeof mql.addListener === 'function') {\n mql.addListener(forceUpdate);\n }\n\n return () => {\n if (typeof mql.removeEventListener === 'function') {\n mql.removeEventListener('change', forceUpdate);\n } else if (typeof mql.removeListener === 'function') {\n mql.removeListener(forceUpdate);\n }\n };\n }, [forceUpdate]);\n\n const prevMessage = usePrevious<ApiMessage | undefined>(message);\n const prevOrigin = usePrevious(origin);\n const prevAvatarOwner = usePrevious<ApiChat | ApiUser | undefined>(avatarOwner);\n const prevBestImageData = usePrevious(bestImageData);\n const textParts = message ? renderMessageText(message) : undefined;\n const hasFooter = Boolean(textParts);\n\n useEffect(() => {\n if (isGhostAnimation && isOpen && !prevMessage && !prevAvatarOwner) {\n dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);\n animateOpening(hasFooter, origin!, bestImageData!, dimensions, isVideo, message);\n }\n\n if (isGhostAnimation && !isOpen && (prevMessage || prevAvatarOwner)) {\n dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);\n animateClosing(prevOrigin!, prevBestImageData!, prevMessage || undefined);\n }\n }, [\n isGhostAnimation, isOpen, origin, prevOrigin, message, prevMessage, prevAvatarOwner,\n bestImageData, prevBestImageData, dimensions, isVideo, hasFooter,\n ]);\n\n const close = useCallback(() => {\n closeMediaViewer();\n }, [closeMediaViewer]);\n\n const handleFooterClick = useCallback(() => {\n close();\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n setTimeout(() => {\n toggleChatInfo(false, { forceSyncOnIOs: true });\n focusMessage({ chatId, threadId, messageId });\n }, ANIMATION_DURATION);\n } else {\n focusMessage({ chatId, threadId, messageId });\n }\n }, [close, chatId, threadId, focusMessage, toggleChatInfo, messageId]);\n\n const handleForward = useCallback(() => {\n openForwardMenu({\n fromChatId: chatId,\n messageIds: [messageId],\n });\n }, [openForwardMenu, chatId, messageId]);\n\n const selectMessage = useCallback((id?: number) => openMediaViewer({\n chatId,\n threadId,\n messageId: id,\n origin,\n }, {\n forceOnHeavyAnimation: true,\n }), [chatId, openMediaViewer, origin, threadId]);\n\n useEffect(() => (isOpen ? captureEscKeyListener(() => {\n close();\n }) : undefined), [close, isOpen]);\n\n useEffect(() => {\n if (isVideo && !isGif) {\n stopCurrentAudio();\n }\n }, [isGif, isVideo]);\n\n // Prevent refresh when rotating device to watch a video\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isOpen]);\n\n const getMessageId = useCallback((fromId?: number, direction?: number): number | undefined => {\n if (!fromId) return undefined;\n const index = messageIds.indexOf(fromId);\n if ((direction === -1 && index > 0) || (direction === 1 && index < messageIds.length - 1)) {\n return messageIds[index + direction];\n }\n return undefined;\n }, [messageIds]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive: isOpen,\n onBack: closeMediaViewer,\n });\n\n function renderSenderInfo() {\n return isAvatar ? (\n <SenderInfo\n key={avatarOwner!.id}\n chatId={avatarOwner!.id}\n isAvatar\n />\n ) : (\n <SenderInfo\n key={messageId}\n chatId={chatId}\n messageId={messageId}\n />\n );\n }\n\n return (\n <ShowTransition id=\"MediaViewer\" isOpen={isOpen}>\n <div className=\"media-viewer-head\" dir={lang.isRtl ? 'rtl' : undefined}>\n {IS_SINGLE_COLUMN_LAYOUT && (\n <Button\n className=\"media-viewer-close\"\n round\n size=\"smaller\"\n color=\"translucent-white\"\n ariaLabel={lang('Close')}\n onClick={close}\n >\n <i className=\"icon-close\" />\n </Button>\n )}\n <Transition activeKey={animationKey.current!} name={headerAnimation}>\n {renderSenderInfo()}\n </Transition>\n <MediaViewerActions\n mediaData={fullMediaBlobUrl || previewBlobUrl}\n isVideo={isVideo}\n message={message}\n fileName={fileName}\n canReport={canReport}\n onReport={openReportModal}\n onCloseMediaViewer={close}\n onForward={handleForward}\n zoomLevelChange={zoomLevelChange}\n setZoomLevelChange={setZoomLevelChange}\n isAvatar={isAvatar}\n />\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n subject=\"media\"\n photo={avatarPhoto}\n chatId={avatarOwner?.id}\n />\n </div>\n <MediaViewerSlides\n messageId={messageId}\n getMessageId={getMessageId}\n chatId={chatId}\n isPhoto={isPhoto}\n isGif={isGif}\n threadId={threadId}\n avatarOwnerId={avatarOwner && avatarOwner.id}\n profilePhotoIndex={profilePhotoIndex}\n origin={origin}\n isOpen={isOpen}\n hasFooter={hasFooter}\n zoomLevelChange={zoomLevelChange}\n isActive\n isVideo={isVideo}\n animationLevel={animationLevel}\n onClose={close}\n selectMessage={selectMessage}\n onFooterClick={handleFooterClick}\n />\n </ShowTransition>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n chatId,\n threadId,\n messageId,\n avatarOwnerId,\n profilePhotoIndex,\n origin,\n } = global.mediaViewer;\n const {\n animationLevel,\n } = global.settings.byKey;\n\n let isChatWithSelf = !!chatId && selectIsChatWithSelf(global, chatId);\n\n if (origin === MediaViewerOrigin.SearchResult) {\n if (!(chatId && messageId)) {\n return { animationLevel };\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n if (!message) {\n return { animationLevel };\n }\n\n return {\n chatId,\n messageId,\n senderId: message.senderId,\n isChatWithSelf,\n origin,\n message,\n animationLevel,\n };\n }\n\n if (avatarOwnerId) {\n const sender = selectUser(global, avatarOwnerId) || selectChat(global, avatarOwnerId);\n isChatWithSelf = selectIsChatWithSelf(global, avatarOwnerId);\n\n return {\n messageId: -1,\n senderId: avatarOwnerId,\n avatarOwner: sender,\n isChatWithSelf,\n profilePhotoIndex: profilePhotoIndex || 0,\n animationLevel,\n origin,\n };\n }\n\n if (!(chatId && threadId && messageId)) {\n return { animationLevel };\n }\n\n let message: ApiMessage | undefined;\n if (origin && [MediaViewerOrigin.ScheduledAlbum, MediaViewerOrigin.ScheduledInline].includes(origin)) {\n message = selectScheduledMessage(global, chatId, messageId);\n } else {\n message = selectChatMessage(global, chatId, messageId);\n }\n\n if (!message) {\n return { animationLevel };\n }\n\n let chatMessages: Record<number, ApiMessage> | undefined;\n\n if (origin && [MediaViewerOrigin.ScheduledAlbum, MediaViewerOrigin.ScheduledInline].includes(origin)) {\n chatMessages = selectScheduledMessages(global, chatId);\n } else {\n chatMessages = selectChatMessages(global, chatId);\n }\n let collectionIds: number[] | undefined;\n\n if (origin === MediaViewerOrigin.Inline || origin === MediaViewerOrigin.Album) {\n collectionIds = selectOutlyingIds(global, chatId, threadId) || selectListedIds(global, chatId, threadId);\n } else if (origin === MediaViewerOrigin.SharedMedia) {\n const currentSearch = selectCurrentMediaSearch(global);\n const { foundIds } = (currentSearch && currentSearch.resultsByType && currentSearch.resultsByType.media) || {};\n collectionIds = foundIds;\n }\n\n return {\n chatId,\n threadId,\n messageId,\n senderId: message.senderId,\n isChatWithSelf,\n origin,\n message,\n chatMessages,\n collectionIds,\n animationLevel,\n };\n },\n)(MediaViewer));\n","import type { RefObject } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { memo, useRef, useCallback } from '../../lib/teact/teact';\n\nimport { CHAT_HEIGHT_PX } from '../../config';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport useLang from '../../hooks/useLang';\nimport useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation';\nimport useInputFocusOnOpen from '../../hooks/useInputFocusOnOpen';\nimport { isUserId } from '../../global/helpers';\n\nimport Loading from '../ui/Loading';\nimport Modal from '../ui/Modal';\nimport InputText from '../ui/InputText';\nimport Button from '../ui/Button';\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport ListItem from '../ui/ListItem';\nimport GroupChatInfo from './GroupChatInfo';\nimport PrivateChatInfo from './PrivateChatInfo';\n\nimport './ChatOrUserPicker.scss';\n\nexport type OwnProps = {\n currentUserId?: string;\n chatOrUserIds: string[];\n isOpen: boolean;\n filterRef: RefObject<HTMLInputElement>;\n filterPlaceholder: string;\n filter: string;\n loadMore?: NoneToVoidFunction;\n onFilterChange: (filter: string) => void;\n onSelectChatOrUser: (chatOrUserId: string) => void;\n onClose: NoneToVoidFunction;\n onCloseAnimationEnd?: NoneToVoidFunction;\n};\n\nconst ChatOrUserPicker: FC<OwnProps> = ({\n isOpen,\n currentUserId,\n chatOrUserIds,\n filterRef,\n filter,\n filterPlaceholder,\n loadMore,\n onFilterChange,\n onSelectChatOrUser,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const lang = useLang();\n const [viewportIds, getMore] = useInfiniteScroll(loadMore, chatOrUserIds, Boolean(filter));\n\n const resetFilter = useCallback(() => {\n onFilterChange('');\n }, [onFilterChange]);\n useInputFocusOnOpen(filterRef, isOpen, resetFilter);\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n onFilterChange(e.currentTarget.value);\n }, [onFilterChange]);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isOpen, (index) => {\n if (viewportIds && viewportIds.length > 0) {\n onSelectChatOrUser(viewportIds[index === -1 ? 0 : index]);\n }\n }, '.ListItem-button', true);\n\n const modalHeader = (\n <div className=\"modal-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Close')}\n onClick={onClose}\n >\n <i className=\"icon-close\" />\n </Button>\n <InputText\n ref={filterRef}\n value={filter}\n onChange={handleFilterChange}\n onKeyDown={handleKeyDown}\n placeholder={filterPlaceholder}\n />\n </div>\n );\n\n const viewportOffset = chatOrUserIds!.indexOf(viewportIds![0]);\n\n return (\n <Modal\n isOpen={isOpen}\n className=\"ChatOrUserPicker\"\n header={modalHeader}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n >\n {viewportIds?.length ? (\n <InfiniteScroll\n ref={containerRef}\n className=\"picker-list custom-scroll\"\n items={viewportIds}\n onLoadMore={getMore}\n withAbsolutePositioning\n maxHeight={chatOrUserIds!.length * CHAT_HEIGHT_PX}\n onKeyDown={handleKeyDown}\n >\n {viewportIds.map((id, i) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable force-rounded-corners\"\n style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onSelectChatOrUser(id)}\n >\n {isUserId(id) ? (\n <PrivateChatInfo status={id === currentUserId ? lang('SavedMessagesInfo') : undefined} userId={id} />\n ) : (\n <GroupChatInfo chatId={id} />\n )}\n </ListItem>\n ))}\n </InfiniteScroll>\n ) : viewportIds && !viewportIds.length ? (\n <p className=\"no-results\">{lang('lng_blocked_list_not_found')}</p>\n ) : (\n <Loading />\n )}\n </Modal>\n );\n};\n\nexport default memo(ChatOrUserPicker);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useMemo, useState, memo, useRef, useCallback, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport type { ApiChat } from '../../api/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\nimport type { GlobalState } from '../../global/types';\n\nimport {\n filterChatsByName,\n filterUsersByName,\n getCanPostInChat,\n sortChatIds,\n} from '../../global/helpers';\nimport { unique } from '../../util/iteratees';\nimport useLang from '../../hooks/useLang';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\nimport useFlag from '../../hooks/useFlag';\n\nimport ChatOrUserPicker from '../common/ChatOrUserPicker';\n\nexport type OwnProps = {\n isOpen: boolean;\n};\n\ntype StateProps = {\n chatsById: Record<string, ApiChat>;\n activeListIds?: string[];\n archivedListIds?: string[];\n pinnedIds?: string[];\n contactIds?: string[];\n currentUserId?: string;\n switchBotInline?: GlobalState['switchBotInline'];\n};\n\nconst ForwardPicker: FC<OwnProps & StateProps> = ({\n chatsById,\n activeListIds,\n archivedListIds,\n pinnedIds,\n contactIds,\n currentUserId,\n isOpen,\n switchBotInline,\n}) => {\n const {\n setForwardChatId,\n exitForwardMode,\n openChatWithText,\n resetSwitchBotInline,\n } = getActions();\n\n const lang = useLang();\n const [filter, setFilter] = useState('');\n // eslint-disable-next-line no-null/no-null\n const filterRef = useRef<HTMLInputElement>(null);\n\n const [isShown, markIsShown, unmarkIsShown] = useFlag();\n useEffect(() => {\n if (isOpen) {\n markIsShown();\n }\n }, [isOpen, markIsShown]);\n\n const chatAndContactIds = useMemo(() => {\n if (!isOpen) {\n return undefined;\n }\n\n let priorityIds = pinnedIds || [];\n if (currentUserId) {\n priorityIds = unique([currentUserId, ...priorityIds]);\n }\n\n const chatIds = [\n ...(activeListIds || []),\n ...(archivedListIds || []),\n ].filter((id) => {\n const chat = chatsById[id];\n\n return chat && getCanPostInChat(chat, MAIN_THREAD_ID);\n });\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n return sortChatIds(unique([\n ...filterChatsByName(lang, chatIds, chatsById, filter, currentUserId),\n ...(contactIds ? filterUsersByName(contactIds, usersById, filter) : []),\n ]), chatsById, undefined, priorityIds);\n }, [activeListIds, archivedListIds, chatsById, contactIds, currentUserId, filter, isOpen, lang, pinnedIds]);\n\n const handleSelectUser = useCallback((userId: string) => {\n if (switchBotInline) {\n const text = `@${switchBotInline.botUsername} ${switchBotInline.query}`;\n openChatWithText({ chatId: userId, text });\n resetSwitchBotInline();\n } else {\n setForwardChatId({ id: userId });\n }\n }, [openChatWithText, resetSwitchBotInline, setForwardChatId, switchBotInline]);\n\n const handleClose = useCallback(() => {\n exitForwardMode();\n resetSwitchBotInline();\n }, [exitForwardMode, resetSwitchBotInline]);\n\n const renderingChatAndContactIds = useCurrentOrPrev(chatAndContactIds, true)!;\n\n if (!isOpen && !isShown) {\n return undefined;\n }\n\n return (\n <ChatOrUserPicker\n currentUserId={currentUserId}\n isOpen={isOpen}\n chatOrUserIds={renderingChatAndContactIds}\n filterRef={filterRef}\n filterPlaceholder={lang('ForwardTo')}\n filter={filter}\n onFilterChange={setFilter}\n onSelectChatOrUser={handleSelectUser}\n onClose={handleClose}\n onCloseAnimationEnd={unmarkIsShown}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n chats: {\n byId: chatsById,\n listIds,\n orderedPinnedIds,\n },\n currentUserId,\n switchBotInline,\n } = global;\n\n return {\n chatsById,\n activeListIds: listIds.active,\n archivedListIds: listIds.archived,\n pinnedIds: orderedPinnedIds.active,\n contactIds: global.contactList?.userIds,\n currentUserId,\n switchBotInline,\n };\n },\n)(ForwardPicker));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useEffect } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type {\n ApiContact, ApiError, ApiInviteInfo, ApiPhoto,\n} from '../../api/types';\n\nimport getReadableErrorText from '../../util/getReadableErrorText';\nimport { pick } from '../../util/iteratees';\nimport renderText from '../common/helpers/renderText';\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport Avatar from '../common/Avatar';\n\nimport './Dialogs.scss';\n\ntype StateProps = {\n dialogs: (ApiError | ApiInviteInfo)[];\n};\n\nconst Dialogs: FC<StateProps> = ({ dialogs }) => {\n const {\n dismissDialog,\n acceptInviteConfirmation,\n sendMessage,\n showNotification,\n } = getActions();\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n const lang = useLang();\n\n useEffect(() => {\n if (dialogs.length > 0) {\n openModal();\n }\n }, [dialogs, openModal]);\n\n if (!dialogs.length) {\n return undefined;\n }\n\n function renderInviteHeader(title: string, photo?: ApiPhoto) {\n return (\n <div className=\"modal-header\">\n {photo && <Avatar size=\"small\" photo={photo} />}\n <div className=\"modal-title\">\n {renderText(title)}\n </div>\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel={lang('Close')} onClick={closeModal}>\n <i className=\"icon-close\" />\n </Button>\n </div>\n );\n }\n\n const renderInvite = (invite: ApiInviteInfo) => {\n const {\n hash, title, about, participantsCount, isChannel, photo, isRequestNeeded,\n } = invite;\n\n const handleJoinClick = () => {\n acceptInviteConfirmation({\n hash,\n });\n showNotification({\n message: isChannel ? lang('RequestToJoinChannelSentDescription') : lang('RequestToJoinGroupSentDescription'),\n });\n closeModal();\n };\n\n const participantsText = isChannel\n ? lang('Subscribers', participantsCount, 'i')\n : lang('Members', participantsCount, 'i');\n\n const joinText = isChannel ? lang('ChannelJoin') : lang('JoinGroup');\n const requestToJoinText = isChannel\n ? lang('MemberRequests.RequestToJoinChannel') : lang('MemberRequests.RequestToJoinGroup');\n\n return (\n <Modal\n isOpen={isModalOpen}\n onClose={closeModal}\n className=\"error\"\n header={renderInviteHeader(title, photo)}\n onCloseAnimationEnd={dismissDialog}\n >\n {participantsCount !== undefined && <p className=\"modal-help\">{participantsText}</p>}\n {about && <p className=\"modal-about\">{renderText(about, ['br'])}</p>}\n {isRequestNeeded && (\n <p className=\"modal-help\">\n {isChannel\n ? lang('MemberRequests.RequestToJoinDescriptionChannel')\n : lang('MemberRequests.RequestToJoinDescriptionGroup')}\n </p>\n )}\n <Button\n isText\n className=\"confirm-dialog-button\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={handleJoinClick}\n >\n {isRequestNeeded ? requestToJoinText : joinText}\n </Button>\n <Button isText className=\"confirm-dialog-button\" onClick={closeModal}>{lang('Cancel')}</Button>\n </Modal>\n );\n };\n\n const renderContactRequest = (contactRequest: ApiContact) => {\n const handleConfirm = () => {\n sendMessage({\n contact: pick(contactRequest, ['firstName', 'lastName', 'phoneNumber']),\n });\n closeModal();\n };\n\n return (\n <Modal\n isOpen={isModalOpen}\n onClose={closeModal}\n className=\"confirm\"\n title={lang('ShareYouPhoneNumberTitle')}\n onCloseAnimationEnd={dismissDialog}\n >\n {lang('AreYouSureShareMyContactInfoBot')}\n <div>\n <Button\n className=\"confirm-dialog-button\"\n isText\n // eslint-disable-next-line react/jsx-no-bind\n onClick={handleConfirm}\n >\n {lang('OK')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={closeModal}>{lang('Cancel')}</Button>\n </div>\n </Modal>\n );\n };\n\n const renderError = (error: ApiError) => {\n return (\n <Modal\n isOpen={isModalOpen}\n onClose={closeModal}\n onCloseAnimationEnd={dismissDialog}\n className=\"error\"\n title={getErrorHeader(error)}\n >\n {error.hasErrorKey ? getReadableErrorText(error) : renderText(error.message!, ['emoji', 'br'])}\n <div>\n <Button isText onClick={closeModal}>{lang('OK')}</Button>\n </div>\n </Modal>\n );\n };\n\n const renderDialog = (dialog: ApiError | ApiInviteInfo | ApiContact) => {\n if ('hash' in dialog) {\n return renderInvite(dialog);\n }\n\n if ('phoneNumber' in dialog) {\n return renderContactRequest(dialog);\n }\n\n return renderError(dialog);\n };\n\n return (\n <div id=\"Dialogs\">\n {Boolean(dialogs.length) && renderDialog(dialogs[dialogs.length - 1])}\n </div>\n );\n};\n\nfunction getErrorHeader(error: ApiError) {\n if (error.isSlowMode) {\n return 'Slowmode enabled';\n }\n\n if (!error.hasErrorKey) {\n return 'Telegram';\n }\n\n return 'Something went wrong';\n}\n\nexport default memo(withGlobal(\n (global): StateProps => pick(global, ['dialogs']),\n)(Dialogs));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiNotification } from '../../api/types';\n\nimport { pick } from '../../util/iteratees';\nimport renderText from '../common/helpers/renderText';\n\nimport Notification from '../ui/Notification';\n\ntype StateProps = {\n notifications: ApiNotification[];\n};\n\nconst Notifications: FC<StateProps> = ({ notifications }) => {\n const { dismissNotification } = getActions();\n\n if (!notifications.length) {\n return undefined;\n }\n\n return (\n <div id=\"Notifications\">\n {notifications.map(({ message, localId }) => (\n <Notification\n message={renderText(message, ['emoji', 'br', 'links', 'simple_markdown'])}\n // eslint-disable-next-line react/jsx-no-bind\n onDismiss={() => dismissNotification({ localId })}\n />\n ))}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => pick(global, ['notifications']),\n)(Notifications));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport { ensureProtocol } from '../../util/ensureProtocol';\nimport renderText from '../common/helpers/renderText';\nimport useLang from '../../hooks/useLang';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nexport type OwnProps = {\n url?: string;\n};\n\nconst SafeLinkModal: FC<OwnProps> = ({ url }) => {\n const { toggleSafeLinkModal } = getActions();\n\n const lang = useLang();\n\n const handleOpen = useCallback(() => {\n window.open(ensureProtocol(url));\n toggleSafeLinkModal({ url: undefined });\n }, [toggleSafeLinkModal, url]);\n\n const handleDismiss = useCallback(() => {\n toggleSafeLinkModal({ url: undefined });\n }, [toggleSafeLinkModal]);\n\n const renderingUrl = useCurrentOrPrev(url);\n\n return (\n <ConfirmDialog\n isOpen={Boolean(url)}\n onClose={handleDismiss}\n title={lang('OpenUrlTitle')}\n textParts={renderText(lang('OpenUrlAlert2', renderingUrl), ['links'])}\n confirmLabel={lang('OpenUrlTitle')}\n confirmHandler={handleOpen}\n />\n );\n};\n\nexport default memo(SafeLinkModal);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useState, useEffect, useMemo, useCallback,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport { formatTime, formatDateToString, getDayStart } from '../../util/dateFormat';\nimport type { LangFn } from '../../hooks/useLang';\nimport useLang from '../../hooks/useLang';\nimport usePrevious from '../../hooks/usePrevious';\nimport useFlag from '../../hooks/useFlag';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nimport './CalendarModal.scss';\n\nconst MAX_SAFE_DATE = 2147483647 * 1000; // API has int for dates\nconst MIN_SAFE_DATE = 0;\n\nexport type OwnProps = {\n selectedAt?: number;\n minAt?: number;\n maxAt?: number;\n isFutureMode?: boolean;\n isPastMode?: boolean;\n isOpen: boolean;\n withTimePicker?: boolean;\n submitButtonLabel?: string;\n secondButtonLabel?: string;\n onClose: () => void;\n onSubmit: (date: Date) => void;\n onSecondButtonClick?: NoneToVoidFunction;\n};\n\nconst WEEKDAY_LETTERS = [\n 'lng_weekday1',\n 'lng_weekday2',\n 'lng_weekday3',\n 'lng_weekday4',\n 'lng_weekday5',\n 'lng_weekday6',\n 'lng_weekday7',\n];\n\nconst CalendarModal: FC<OwnProps> = ({\n selectedAt,\n minAt,\n maxAt,\n isFutureMode,\n isPastMode,\n isOpen,\n withTimePicker,\n submitButtonLabel,\n secondButtonLabel,\n onClose,\n onSubmit,\n onSecondButtonClick,\n}) => {\n const lang = useLang();\n const now = new Date();\n\n const minDate = useMemo(() => {\n if (isFutureMode && !minAt) return new Date();\n return new Date(Math.max(minAt || MIN_SAFE_DATE, MIN_SAFE_DATE));\n }, [isFutureMode, minAt]);\n const maxDate = useMemo(() => {\n if (isPastMode && !maxAt) return new Date();\n return new Date(Math.min(maxAt || MAX_SAFE_DATE, MAX_SAFE_DATE));\n }, [isPastMode, maxAt]);\n\n const passedSelectedDate = useMemo(() => (selectedAt ? new Date(selectedAt) : new Date()), [selectedAt]);\n const prevIsOpen = usePrevious(isOpen);\n const [isTimeInputFocused, markTimeInputAsFocused, unmarkTimeInputAsFocused] = useFlag(false);\n\n const [selectedDate, setSelectedDate] = useState<Date>(passedSelectedDate);\n const [currentMonthAndYear, setCurrentMonthAndYear] = useState<Date>(\n new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1),\n );\n const [selectedHours, setSelectedHours] = useState<string>(\n formatInputTime(passedSelectedDate.getHours()),\n );\n const [selectedMinutes, setSelectedMinutes] = useState<string>(\n formatInputTime(passedSelectedDate.getMinutes()),\n );\n\n const selectedDay = formatDay(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate());\n const currentYear = currentMonthAndYear.getFullYear();\n const currentMonth = currentMonthAndYear.getMonth();\n\n useEffect(() => {\n if (!prevIsOpen && isOpen) {\n setSelectedDate(passedSelectedDate);\n setCurrentMonthAndYear(new Date(passedSelectedDate.getFullYear(), passedSelectedDate.getMonth(), 1));\n if (withTimePicker) {\n setSelectedHours(formatInputTime(passedSelectedDate.getHours()));\n setSelectedMinutes(formatInputTime(passedSelectedDate.getMinutes()));\n }\n }\n }, [passedSelectedDate, isOpen, prevIsOpen, withTimePicker]);\n\n useEffect(() => {\n if (isFutureMode && !isTimeInputFocused && selectedDate.getTime() < minDate.getTime()) {\n setSelectedDate(minDate);\n setSelectedHours(formatInputTime(minDate.getHours()));\n setSelectedMinutes(formatInputTime(minDate.getMinutes()));\n }\n }, [isFutureMode, isTimeInputFocused, minDate, selectedDate]);\n\n useEffect(() => {\n if (isPastMode && !isTimeInputFocused && selectedDate.getTime() > maxDate.getTime()) {\n setSelectedDate(maxDate);\n setSelectedHours(formatInputTime(maxDate.getHours()));\n setSelectedMinutes(formatInputTime(maxDate.getMinutes()));\n }\n }, [isFutureMode, isPastMode, isTimeInputFocused, maxDate, minDate, selectedDate]);\n\n useEffect(() => {\n if (selectedAt) {\n const newSelectedDate = new Date(selectedAt);\n setSelectedDate(newSelectedDate);\n setSelectedHours(formatInputTime(newSelectedDate.getHours()));\n setSelectedMinutes(formatInputTime(newSelectedDate.getMinutes()));\n }\n }, [selectedAt]);\n\n const shouldDisableNextMonth = (isPastMode && currentYear >= now.getFullYear() && currentMonth >= now.getMonth())\n || (maxDate && currentYear >= maxDate.getFullYear() && currentMonth >= maxDate.getMonth());\n const shouldDisablePrevMonth = isFutureMode && currentYear <= now.getFullYear() && currentMonth <= now.getMonth();\n\n const { prevMonthGrid, currentMonthGrid, nextMonthGrid } = useMemo(() => (\n buildCalendarGrid(currentYear, currentMonth)\n ), [currentMonth, currentYear]);\n\n const submitLabel = useMemo(() => {\n return submitButtonLabel || formatSubmitLabel(lang, selectedDate);\n }, [lang, selectedDate, submitButtonLabel]);\n\n function handlePrevMonth() {\n setCurrentMonthAndYear((d) => {\n const dateCopy = new Date(d);\n dateCopy.setMonth(dateCopy.getMonth() - 1);\n\n return dateCopy;\n });\n }\n\n function handleNextMonth() {\n setCurrentMonthAndYear((d) => {\n const dateCopy = new Date(d);\n dateCopy.setMonth(dateCopy.getMonth() + 1);\n\n return dateCopy;\n });\n }\n\n function handleDateSelect(date: number) {\n setSelectedDate((d) => {\n const dateCopy = new Date(d);\n dateCopy.setDate(date);\n dateCopy.setMonth(currentMonth);\n dateCopy.setFullYear(currentYear);\n\n return dateCopy;\n });\n }\n\n const handleSubmit = useCallback(() => {\n onSubmit(selectedDate);\n }, [onSubmit, selectedDate]);\n\n const handleChangeHours = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value.replace(/[^\\d]+/g, '');\n if (!value.length) {\n setSelectedHours('');\n e.target.value = '';\n return;\n }\n\n const hours = Math.max(0, Math.min(Number(value), 23));\n\n const date = new Date(selectedDate.getTime());\n date.setHours(hours);\n setSelectedDate(date);\n\n const hoursStr = formatInputTime(hours);\n setSelectedHours(hoursStr);\n e.target.value = hoursStr;\n }, [selectedDate]);\n\n const handleChangeMinutes = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value.replace(/[^\\d]+/g, '');\n if (!value.length) {\n setSelectedMinutes('');\n e.target.value = '';\n return;\n }\n\n const minutes = Math.max(0, Math.min(Number(value), 59));\n\n const date = new Date(selectedDate.getTime());\n date.setMinutes(minutes);\n setSelectedDate(date);\n\n const minutesStr = formatInputTime(minutes);\n setSelectedMinutes(minutesStr);\n e.target.value = minutesStr;\n }, [selectedDate]);\n\n function renderTimePicker() {\n return (\n <div className=\"timepicker\">\n <input\n type=\"text\"\n className=\"form-control\"\n inputMode=\"decimal\"\n value={selectedHours}\n onChange={handleChangeHours}\n onFocus={markTimeInputAsFocused}\n onBlur={unmarkTimeInputAsFocused}\n />\n :\n <input\n type=\"text\"\n className=\"form-control\"\n inputMode=\"decimal\"\n value={selectedMinutes}\n onChange={handleChangeMinutes}\n onFocus={markTimeInputAsFocused}\n onBlur={unmarkTimeInputAsFocused}\n />\n </div>\n );\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n className=\"CalendarModal\"\n >\n <div className=\"container\">\n <div className=\"month-selector\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onClose}\n >\n <i className=\"icon-close\" />\n </Button>\n\n <h4>\n {lang(`lng_month${currentMonth + 1}`)}\n {' '}\n {currentYear}\n </h4>\n\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n disabled={shouldDisablePrevMonth}\n onClick={!shouldDisablePrevMonth ? handlePrevMonth : undefined}\n >\n <i className=\"icon-previous\" />\n </Button>\n\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n disabled={shouldDisableNextMonth}\n onClick={!shouldDisableNextMonth ? handleNextMonth : undefined}\n >\n <i className=\"icon-next\" />\n </Button>\n </div>\n </div>\n\n <div className=\"calendar-wrapper\">\n <div className=\"calendar-grid\">\n {WEEKDAY_LETTERS.map((day) => (\n <div className=\"day-button faded weekday\">\n <span>{lang(day)}</span>\n </div>\n ))}\n {prevMonthGrid.map((gridDate) => (\n <div className=\"day-button disabled\"><span>{gridDate}</span></div>\n ))}\n {currentMonthGrid.map((gridDate) => (\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => handleDateSelect(gridDate)}\n className={buildClassName(\n 'day-button',\n isDisabledDay(\n currentYear, currentMonth, gridDate, minDate, maxDate,\n )\n ? 'disabled'\n : `${gridDate ? 'clickable' : ''}`,\n selectedDay === formatDay(currentYear, currentMonth, gridDate) && 'selected',\n )}\n >\n {Boolean(gridDate) && (\n <span>{gridDate}</span>\n )}\n </div>\n ))}\n {nextMonthGrid.map((gridDate) => (\n <div className=\"day-button disabled\"><span>{gridDate}</span></div>\n ))}\n </div>\n </div>\n\n {withTimePicker && renderTimePicker()}\n\n <div className=\"footer\">\n <Button onClick={handleSubmit}>\n {submitLabel}\n </Button>\n {secondButtonLabel && (\n <Button onClick={onSecondButtonClick} isText>\n {secondButtonLabel}\n </Button>\n )}\n </div>\n </Modal>\n );\n};\n\nfunction buildCalendarGrid(year: number, month: number) {\n const prevMonthGrid: number[] = [];\n const currentMonthGrid: number[] = [];\n const nextMonthGrid: number[] = [];\n\n const date = new Date();\n date.setDate(1);\n date.setMonth(month);\n date.setFullYear(year);\n const firstDay = date.getDay() || 7;\n const totalDaysInPrevMonth = new Date(year, month, 0).getDate();\n\n for (let i = 1; i < firstDay; i++) {\n prevMonthGrid.push(totalDaysInPrevMonth - firstDay + i + 1);\n }\n\n while (date.getMonth() === month) {\n const gridDate = date.getDate();\n currentMonthGrid.push(gridDate);\n date.setDate(gridDate + 1);\n }\n\n const lastRowDaysCount = (currentMonthGrid.length + prevMonthGrid.length) % 7;\n if (lastRowDaysCount > 0) {\n for (let i = 1; i <= 7 - lastRowDaysCount; i++) {\n nextMonthGrid.push(i);\n }\n }\n\n return { prevMonthGrid, currentMonthGrid, nextMonthGrid };\n}\n\nfunction isDisabledDay(year: number, month: number, day: number, minDate?: Date, maxDate?: Date) {\n const selectedDay = new Date(year, month, day);\n const fixedMinDate = minDate && getDayStart(minDate);\n const fixedMaxDate = maxDate && getDayStart(maxDate);\n\n if (fixedMaxDate && selectedDay > fixedMaxDate) {\n return true;\n } else if (fixedMinDate && selectedDay < fixedMinDate) {\n return true;\n }\n\n return false;\n}\n\nfunction formatInputTime(value: string | number) {\n return String(value).padStart(2, '0');\n}\n\nfunction formatDay(year: number, month: number, day: number) {\n return `${year}-${month + 1}-${day}`;\n}\n\nfunction formatSubmitLabel(lang: LangFn, date: Date) {\n const day = formatDateToString(date, lang.code);\n const today = formatDateToString(new Date(), lang.code);\n\n if (day === today) {\n return lang('Conversation.ScheduleMessage.SendToday', formatTime(lang, date));\n }\n\n return lang('Conversation.ScheduleMessage.SendOn', [day, formatTime(lang, date)]);\n}\n\nexport default memo(CalendarModal);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport useLang from '../../hooks/useLang';\n\nimport CalendarModal from '../common/CalendarModal';\n\nexport type OwnProps = {\n isOpen: boolean;\n};\n\ntype StateProps = {\n selectedAt?: number;\n};\n\nconst HistoryCalendar: FC<OwnProps & StateProps> = ({\n isOpen, selectedAt,\n}) => {\n const { searchMessagesByDate, closeHistoryCalendar } = getActions();\n\n const handleJumpToDate = useCallback((date: Date) => {\n searchMessagesByDate({ timestamp: date.valueOf() / 1000 });\n closeHistoryCalendar();\n }, [closeHistoryCalendar, searchMessagesByDate]);\n\n const lang = useLang();\n\n return (\n <CalendarModal\n isOpen={isOpen}\n selectedAt={selectedAt}\n isPastMode\n submitButtonLabel={lang('JumpToDate')}\n onClose={closeHistoryCalendar}\n onSubmit={handleJumpToDate}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return { selectedAt: global.historyCalendarSelectedAt };\n },\n)(HistoryCalendar));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiCountryCode, ApiUser, ApiUserStatus } from '../../api/types';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport { getUserStatus } from '../../global/helpers';\nimport { selectUser, selectUserStatus } from '../../global/selectors';\nimport renderText from '../common/helpers/renderText';\nimport { formatPhoneNumberWithCode } from '../../util/phoneNumber';\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\n\nimport Modal from '../ui/Modal';\nimport Avatar from '../common/Avatar';\nimport InputText from '../ui/InputText';\nimport Checkbox from '../ui/Checkbox';\nimport Button from '../ui/Button';\n\nimport './NewContactModal.scss';\n\nconst ANIMATION_DURATION = 200;\n\nexport type OwnProps = {\n isOpen: boolean;\n userId?: string;\n isByPhoneNumber?: boolean;\n};\n\ntype StateProps = {\n user?: ApiUser;\n userStatus?: ApiUserStatus;\n phoneCodeList: ApiCountryCode[];\n serverTimeOffset?: number;\n};\n\nconst NewContactModal: FC<OwnProps & StateProps> = ({\n isOpen,\n userId,\n isByPhoneNumber,\n user,\n userStatus,\n phoneCodeList,\n serverTimeOffset,\n}) => {\n const { updateContact, importContact, closeNewContactDialog } = getActions();\n\n const lang = useLang();\n const renderingUser = useCurrentOrPrev(user);\n const renderingIsByPhoneNumber = useCurrentOrPrev(isByPhoneNumber);\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [isShown, markIsShown, unmarkIsShown] = useFlag();\n const [firstName, setFirstName] = useState<string>(renderingUser?.firstName ?? '');\n const [lastName, setLastName] = useState<string>(renderingUser?.lastName ?? '');\n const [phone, setPhone] = useState<string>(renderingUser?.phoneNumber ?? '');\n const [shouldSharePhoneNumber, setShouldSharePhoneNumber] = useState<boolean>(true);\n const canBeSubmitted = Boolean(firstName && (!isByPhoneNumber || phone));\n\n useEffect(() => {\n if (isOpen) {\n markIsShown();\n setFirstName(renderingUser?.firstName ?? '');\n setLastName(renderingUser?.lastName ?? '');\n setPhone(renderingUser?.phoneNumber ?? '');\n setShouldSharePhoneNumber(true);\n }\n }, [isOpen, markIsShown, renderingUser?.firstName, renderingUser?.lastName, renderingUser?.phoneNumber]);\n\n useEffect(() => {\n if (!IS_TOUCH_ENV && isShown) {\n setTimeout(() => { inputRef.current?.focus(); }, ANIMATION_DURATION);\n }\n }, [isShown]);\n\n const handleFirstNameChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n }, []);\n\n const handlePhoneChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setPhone(formatPhoneNumberWithCode(phoneCodeList, e.target.value));\n }, [phoneCodeList]);\n\n const handleLastNameChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n }, []);\n\n const handleClose = useCallback(() => {\n closeNewContactDialog();\n setFirstName('');\n setLastName('');\n setPhone('');\n }, [closeNewContactDialog]);\n\n const handleSubmit = useCallback(() => {\n if (isByPhoneNumber || !userId) {\n importContact({\n firstName,\n lastName,\n phoneNumber: phone,\n });\n } else {\n updateContact({\n userId,\n firstName,\n lastName,\n shouldSharePhoneNumber,\n });\n }\n }, [firstName, importContact, isByPhoneNumber, lastName, phone, shouldSharePhoneNumber, updateContact, userId]);\n\n if (!isOpen && !isShown) {\n return undefined;\n }\n\n function renderAddContact() {\n return (\n <>\n <div className=\"NewContactModal__profile\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Avatar size=\"jumbo\" user={renderingUser} text={`${firstName} ${lastName}`} />\n <div className=\"NewContactModal__profile-info\">\n <p className=\"NewContactModal__phone-number\">\n {renderingUser?.phoneNumber\n ? formatPhoneNumberWithCode(phoneCodeList, renderingUser.phoneNumber)\n : lang('MobileHidden')}\n </p>\n <span className=\"NewContactModal__user-status\" dir=\"auto\">\n {getUserStatus(lang, renderingUser!, userStatus, serverTimeOffset!)}\n </span>\n </div>\n </div>\n <InputText\n ref={inputRef}\n value={firstName}\n label={lang('FirstName')}\n tabIndex={0}\n onChange={handleFirstNameChange}\n />\n <InputText\n value={lastName}\n label={lang('LastName')}\n tabIndex={0}\n onChange={handleLastNameChange}\n />\n <p className=\"NewContactModal__help-text\">\n {renderText(\n lang('NewContact.Phone.Hidden.Text', renderingUser?.firstName || ''),\n ['emoji', 'simple_markdown'],\n )}\n </p>\n <Checkbox\n checked={shouldSharePhoneNumber}\n tabIndex={0}\n onCheck={setShouldSharePhoneNumber}\n label={lang('lng_new_contact_share')}\n />\n <p className=\"NewContactModal__help-text\">\n {renderText(lang('AddContact.SharedContactExceptionInfo', renderingUser?.firstName))}\n </p>\n </>\n );\n }\n\n function renderCreateContact() {\n return (\n <div className=\"NewContactModal__new-contact\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Avatar size=\"jumbo\" text={`${firstName} ${lastName}`} />\n <div className=\"NewContactModal__new-contact-fieldset\">\n <InputText\n ref={inputRef}\n value={phone}\n inputMode=\"tel\"\n label={lang('lng_contact_phone')}\n tabIndex={0}\n onChange={handlePhoneChange}\n />\n <InputText\n value={firstName}\n label={lang('FirstName')}\n tabIndex={0}\n onChange={handleFirstNameChange}\n />\n <InputText\n value={lastName}\n label={lang('LastName')}\n tabIndex={0}\n onChange={handleLastNameChange}\n />\n </div>\n </div>\n );\n }\n\n return (\n <Modal\n className=\"NewContactModal\"\n title={lang('NewContact')}\n isOpen={isOpen}\n onClose={handleClose}\n onCloseAnimationEnd={unmarkIsShown}\n >\n {renderingUser && renderAddContact()}\n {renderingIsByPhoneNumber && renderCreateContact()}\n <div className=\"dialog-buttons\">\n <Button\n isText\n className=\"confirm-dialog-button\"\n onClick={handleClose}\n >\n {lang('Cancel')}\n </Button>\n <Button\n isText\n className=\"confirm-dialog-button\"\n disabled={!canBeSubmitted}\n onClick={handleSubmit}\n >\n {lang('Done')}\n </Button>\n </div>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n return {\n user: userId ? selectUser(global, userId) : undefined,\n userStatus: userId ? selectUserStatus(global, userId) : undefined,\n serverTimeOffset: global.serverTimeOffset,\n phoneCodeList: global.countryList.phoneCodes,\n };\n },\n)(NewContactModal));\n","import useWindowSize from '../../../hooks/useWindowSize';\nimport { useCallback, useEffect, useRef } from '../../../lib/teact/teact';\nimport { extractCurrentThemeParams } from '../../../util/themeStyle';\n\nexport type WebAppInboundEvent = {\n eventType: 'web_app_data_send';\n eventData: {\n data: string;\n };\n} | {\n eventType: 'web_app_setup_main_button';\n eventData: {\n is_visible: boolean;\n is_active: boolean;\n text: string;\n color: string;\n text_color: string;\n is_progress_visible: boolean;\n };\n} | {\n eventType: 'web_app_open_tg_link';\n eventData: {\n path_full: string;\n };\n} | {\n eventType: 'web_app_request_viewport' | 'web_app_request_theme' | 'web_app_ready' | 'web_app_expand'\n | 'web_app_close' | 'iframe_ready';\n};\n\ntype WebAppOutboundEvent = {\n eventType: 'viewport_changed';\n eventData: {\n height: number;\n width?: number;\n is_expanded?: boolean;\n };\n} | {\n eventType: 'theme_changed';\n eventData: {\n theme_params: {\n bg_color: string;\n text_color: string;\n hint_color: string;\n link_color: string;\n button_color: string;\n button_text_color: string;\n };\n };\n} | {\n eventType: 'set_custom_style';\n eventData: string;\n} | {\n eventType: 'main_button_pressed';\n};\n\nconst SCROLLBAR_STYLE = `* {\n scrollbar-width: thin;\n scrollbar-color: %SCROLLBAR_COLOR% transparent;\n}\n\n*::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border-radius: 6px;\n background-color: %SCROLLBAR_COLOR%;\n}\n\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}`;\n\nconst useWebAppFrame = (isOpen: boolean, isSimpleView: boolean, onEvent: (event: WebAppInboundEvent) => void) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLIFrameElement>(null);\n const ignoreEventsRef = useRef<boolean>(false);\n const windowSize = useWindowSize();\n\n const reloadFrame = useCallback((url: string) => {\n if (!ref.current) return;\n const frame = ref.current;\n frame.src = 'about:blank';\n frame.addEventListener('load', () => {\n frame.src = url;\n }, { once: true });\n }, []);\n\n const sendEvent = useCallback((event: WebAppOutboundEvent) => {\n if (!ref.current?.contentWindow) return;\n ref.current.contentWindow.postMessage(JSON.stringify(event), '*');\n }, []);\n\n const sendViewport = useCallback(() => {\n if (!ref.current) {\n return;\n }\n const { width, height } = ref.current.getBoundingClientRect();\n sendEvent({\n eventType: 'viewport_changed',\n eventData: {\n width,\n height,\n is_expanded: true,\n },\n });\n }, [sendEvent]);\n\n const sendTheme = useCallback(() => {\n sendEvent({\n eventType: 'theme_changed',\n eventData: {\n theme_params: extractCurrentThemeParams(),\n },\n });\n }, [sendEvent]);\n\n const sendCustomStyle = useCallback((style: string) => {\n sendEvent({\n eventType: 'set_custom_style',\n eventData: style,\n });\n }, [sendEvent]);\n\n const handleMessage = useCallback((event: MessageEvent<string>) => {\n if (ignoreEventsRef.current) {\n return;\n }\n\n try {\n const data = JSON.parse(event.data) as WebAppInboundEvent;\n // Handle some app requests here to simplify hook usage\n if (data.eventType === 'web_app_request_viewport') {\n sendViewport();\n }\n\n if (data.eventType === 'web_app_request_theme') {\n sendTheme();\n }\n\n if (data.eventType === 'iframe_ready') {\n const scrollbarColor = getComputedStyle(document.body).getPropertyValue('--color-scrollbar');\n sendCustomStyle(SCROLLBAR_STYLE.replace(/%SCROLLBAR_COLOR%/g, scrollbarColor));\n }\n\n if (data.eventType === 'web_app_data_send') {\n if (!isSimpleView) return; // Allowed only in simple view\n ignoreEventsRef.current = true;\n }\n onEvent(data);\n } catch (err) {\n // Ignore other messages\n }\n }, [isSimpleView, onEvent, sendCustomStyle, sendTheme, sendViewport]);\n\n useEffect(() => {\n if (windowSize) {\n sendViewport();\n }\n }, [sendViewport, windowSize]);\n\n useEffect(() => {\n window.addEventListener('message', handleMessage);\n return () => window.removeEventListener('message', handleMessage);\n }, [handleMessage]);\n\n useEffect(() => {\n if (isOpen && ref.current?.contentWindow) {\n sendViewport();\n ignoreEventsRef.current = false;\n }\n }, [isOpen, sendViewport]);\n\n return {\n ref, sendEvent, reloadFrame, sendViewport, sendTheme,\n };\n};\n\nexport default useWebAppFrame;\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChat } from '../../api/types';\nimport type { GlobalState } from '../../global/types';\nimport type { ThemeKey } from '../../types';\n\nimport windowSize from '../../util/windowSize';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { selectCurrentChat, selectTheme } from '../../global/selectors';\nimport buildClassName from '../../util/buildClassName';\nimport { extractCurrentThemeParams, validateHexColor } from '../../util/themeStyle';\n\nimport useInterval from '../../hooks/useInterval';\nimport useLang from '../../hooks/useLang';\nimport useOnChange from '../../hooks/useOnChange';\nimport type { WebAppInboundEvent } from './hooks/useWebAppFrame';\nimport useWebAppFrame from './hooks/useWebAppFrame';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport DropdownMenu from '../ui/DropdownMenu';\nimport MenuItem from '../ui/MenuItem';\nimport Spinner from '../ui/Spinner';\n\nimport './WebAppModal.scss';\n\ntype WebAppButton = {\n isVisible: boolean;\n isActive: boolean;\n text: string;\n color: string;\n textColor: string;\n isProgressVisible: boolean;\n};\n\nexport type OwnProps = {\n webApp?: GlobalState['webApp'];\n};\n\ntype StateProps = {\n isInstalled?: boolean;\n chat?: ApiChat;\n theme?: ThemeKey;\n};\n\nconst MAIN_BUTTON_ANIMATION_TIME = 250;\nconst PROLONG_INTERVAL = 45000; // 45s\nconst ANIMATION_WAIT = 400;\nconst LINK_PREFIX = 'https://t.me/';\n\nconst WebAppModal: FC<OwnProps & StateProps> = ({\n webApp,\n chat,\n isInstalled,\n theme,\n}) => {\n const {\n closeWebApp, sendWebViewData, prolongWebView, toggleBotInAttachMenu, openTelegramLink, openChat,\n } = getActions();\n const [mainButton, setMainButton] = useState<WebAppButton | undefined>();\n const lang = useLang();\n const {\n url, bot, buttonText, queryId,\n } = webApp || {};\n const isOpen = Boolean(url);\n const isSimple = !queryId;\n\n const handleEvent = useCallback((event: WebAppInboundEvent) => {\n const { eventType } = event;\n if (eventType === 'web_app_close') {\n closeWebApp();\n }\n\n if (eventType === 'web_app_open_tg_link') {\n const linkUrl = LINK_PREFIX + event.eventData.path_full;\n openTelegramLink({ url: linkUrl });\n closeWebApp();\n }\n\n if (eventType === 'web_app_data_send') {\n const { eventData } = event;\n closeWebApp();\n sendWebViewData({\n bot: bot!,\n buttonText: buttonText!,\n data: eventData.data,\n });\n }\n\n if (eventType === 'web_app_setup_main_button') {\n const { eventData } = event;\n const themeParams = extractCurrentThemeParams();\n // Validate colors if they are present\n const color = !eventData.color || validateHexColor(eventData.color) ? eventData.color\n : themeParams.button_color;\n const textColor = !eventData.text_color || validateHexColor(eventData.text_color) ? eventData.text_color\n : themeParams.text_color;\n setMainButton({\n isVisible: eventData.is_visible && Boolean(eventData.text?.trim().length),\n isActive: eventData.is_active,\n text: eventData.text || '',\n color,\n textColor,\n isProgressVisible: eventData.is_progress_visible,\n });\n }\n }, [bot, buttonText, closeWebApp, openTelegramLink, sendWebViewData]);\n\n const {\n ref, reloadFrame, sendEvent, sendViewport, sendTheme,\n } = useWebAppFrame(isOpen, isSimple, handleEvent);\n\n const shouldShowMainButton = mainButton?.isVisible && mainButton.text.trim().length > 0;\n\n useInterval(() => {\n prolongWebView({\n bot: bot!,\n queryId: queryId!,\n peer: chat!,\n });\n }, queryId ? PROLONG_INTERVAL : undefined, true);\n\n const handleMainButtonClick = useCallback(() => {\n sendEvent({\n eventType: 'main_button_pressed',\n });\n }, [sendEvent]);\n\n const handleRefreshClick = useCallback(() => {\n reloadFrame(webApp!.url);\n }, [reloadFrame, webApp]);\n\n // Notify view that height changed\n useOnChange(() => {\n setTimeout(() => {\n sendViewport();\n }, ANIMATION_WAIT);\n }, [mainButton?.isVisible, sendViewport]);\n\n // Notify view that theme changed\n useOnChange(() => {\n setTimeout(() => {\n sendTheme();\n }, ANIMATION_WAIT);\n }, [theme, sendTheme]);\n\n // Prevent refresh when rotating device\n useEffect(() => {\n if (!isOpen) return undefined;\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isOpen]);\n\n const handleToggleClick = useCallback(() => {\n toggleBotInAttachMenu({\n botId: bot!.id,\n isEnabled: !isInstalled,\n });\n }, [bot, isInstalled, toggleBotInAttachMenu]);\n\n const openBotChat = useCallback(() => {\n openChat({\n id: bot!.id,\n });\n closeWebApp();\n }, [bot, closeWebApp, openChat]);\n\n const MoreMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen: isMenuOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isMenuOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"More actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n const header = useMemo(() => {\n return (\n <div className=\"modal-header\">\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Close')}\n onClick={closeWebApp}\n >\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{bot?.firstName}</div>\n <DropdownMenu\n className=\"web-app-more-menu\"\n trigger={MoreMenuButton}\n positionX=\"right\"\n >\n {chat && bot && chat.id !== bot.id && (\n <MenuItem icon=\"bots\" onClick={openBotChat}>{lang('BotWebViewOpenBot')}</MenuItem>\n )}\n <MenuItem icon=\"reload\" onClick={handleRefreshClick}>{lang('WebApp.ReloadPage')}</MenuItem>\n {bot?.isAttachMenuBot && (\n <MenuItem icon={isInstalled ? 'stop' : 'install'} onClick={handleToggleClick} destructive={isInstalled}>\n {lang(isInstalled ? 'WebApp.RemoveBot' : 'WebApp.AddToAttachmentAdd')}\n </MenuItem>\n )}\n </DropdownMenu>\n </div>\n );\n }, [lang, closeWebApp, bot, MoreMenuButton, handleRefreshClick, isInstalled, handleToggleClick, chat, openBotChat]);\n\n const prevMainButtonColor = usePrevious(mainButton?.color, true);\n const prevMainButtonTextColor = usePrevious(mainButton?.textColor, true);\n const prevMainButtonIsActive = usePrevious(mainButton && Boolean(mainButton.isActive), true);\n const prevMainButtonText = usePrevious(mainButton?.text, true);\n\n const mainButtonCurrentColor = mainButton?.color || prevMainButtonColor;\n const mainButtonCurrentTextColor = mainButton?.textColor || prevMainButtonTextColor;\n const mainButtonCurrentIsActive = mainButton?.isActive !== undefined ? mainButton.isActive : prevMainButtonIsActive;\n const mainButtonCurrentText = mainButton?.text || prevMainButtonText;\n\n useEffect(() => {\n if (!isOpen) setMainButton(undefined);\n }, [isOpen]);\n\n const [shouldDecreaseWebFrameSize, setShouldDecreaseWebFrameSize] = useState(false);\n const [shouldHideButton, setShouldHideButton] = useState(true);\n\n const buttonChangeTimeout = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n if (buttonChangeTimeout.current) clearTimeout(buttonChangeTimeout.current);\n if (!shouldShowMainButton) {\n setShouldDecreaseWebFrameSize(false);\n buttonChangeTimeout.current = setTimeout(() => {\n setShouldHideButton(true);\n }, MAIN_BUTTON_ANIMATION_TIME);\n } else {\n setShouldHideButton(false);\n buttonChangeTimeout.current = setTimeout(() => {\n setShouldDecreaseWebFrameSize(true);\n }, MAIN_BUTTON_ANIMATION_TIME);\n }\n }, [setShouldDecreaseWebFrameSize, shouldShowMainButton]);\n\n return (\n <Modal\n className=\"WebAppModal\"\n isOpen={isOpen}\n onClose={closeWebApp}\n header={header}\n hasCloseButton\n >\n {isOpen && (\n <>\n <iframe\n ref={ref}\n className={buildClassName('web-app-frame', shouldDecreaseWebFrameSize && 'with-button')}\n src={url}\n title={`${bot?.firstName} Web App`}\n sandbox=\"allow-scripts allow-same-origin allow-popups allow-forms\"\n allow=\"camera; microphone; geolocation;\"\n allowFullScreen\n />\n <Button\n className={buildClassName(\n 'web-app-button',\n shouldShowMainButton && 'visible',\n shouldHideButton && 'hidden',\n )}\n style={`background-color: ${mainButtonCurrentColor}; color: ${mainButtonCurrentTextColor}`}\n disabled={!mainButtonCurrentIsActive}\n onClick={handleMainButtonClick}\n >\n {mainButtonCurrentText}\n {mainButton?.isProgressVisible && <Spinner color=\"white\" />}\n </Button>\n </>\n )}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { webApp }): StateProps => {\n const { bot } = webApp || {};\n const isInstalled = Boolean(bot && global.attachMenu.bots[bot.id]);\n const chat = selectCurrentChat(global);\n const theme = selectTheme(global);\n\n return {\n isInstalled,\n chat,\n theme,\n };\n },\n)(WebAppModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { ApiUser } from '../../api/types';\n\nimport { getUserFullName } from '../../global/helpers';\nimport renderText from '../common/helpers/renderText';\n\nimport useLang from '../../hooks/useLang';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nexport type OwnProps = {\n bot?: ApiUser;\n type?: 'game' | 'webApp';\n};\n\nconst BotTrustModal: FC<OwnProps> = ({ bot, type }) => {\n const { cancelBotTrustRequest, markBotTrusted } = getActions();\n const lang = useLang();\n // Keep props a little bit longer, to show correct text on closing animation\n const previousBot = usePrevious(bot, false);\n const previousType = usePrevious(type, false);\n const currentBot = bot || previousBot;\n const currentType = type || previousType;\n\n const handleBotTrustAccept = useCallback(() => {\n markBotTrusted({ botId: bot!.id });\n }, [markBotTrusted, bot]);\n\n const title = currentType === 'game' ? lang('AppName') : lang('BotOpenPageTitle');\n const text = currentType === 'game' ? lang('BotPermissionGameAlert', getUserFullName(currentBot))\n : lang('BotOpenPageMessage', getUserFullName(currentBot));\n\n return (\n <ConfirmDialog\n isOpen={Boolean(bot)}\n onClose={cancelBotTrustRequest}\n confirmHandler={handleBotTrustAccept}\n title={title}\n textParts={renderText(text, ['br', 'simple_markdown'])}\n />\n );\n};\n\nexport default memo(BotTrustModal);\n","import type { FC } from '../../lib/teact/teact';\nimport React from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { ApiUser } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nexport type OwnProps = {\n bot?: ApiUser;\n};\n\nconst BotAttachModal: FC<OwnProps> = ({\n bot,\n}) => {\n const { closeBotAttachRequestModal, confirmBotAttachRequest } = getActions();\n\n const lang = useLang();\n\n const name = bot?.firstName;\n\n return (\n <ConfirmDialog\n isOpen={Boolean(bot)}\n onClose={closeBotAttachRequestModal}\n confirmHandler={confirmBotAttachRequest}\n title={name}\n textParts={lang('WebApp.AddToAttachmentText', name)}\n />\n );\n};\n\nexport default BotAttachModal;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiMessage } from '../../api/types';\nimport type { IAlbum } from '../../types';\n\nimport {\n selectAllowedMessageActions,\n selectChat,\n selectCurrentMessageList,\n selectUser,\n} from '../../global/selectors';\nimport {\n isUserId,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n} from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nexport type OwnProps = {\n isOpen: boolean;\n isSchedule: boolean;\n message: ApiMessage;\n album?: IAlbum;\n onClose: () => void;\n};\n\ntype StateProps = {\n canDeleteForAll?: boolean;\n contactName?: string;\n willDeleteForCurrentUserOnly?: boolean;\n willDeleteForAll?: boolean;\n};\n\nconst DeleteMessageModal: FC<OwnProps & StateProps> = ({\n isOpen,\n isSchedule,\n message,\n album,\n canDeleteForAll,\n contactName,\n willDeleteForCurrentUserOnly,\n willDeleteForAll,\n onClose,\n}) => {\n const {\n deleteMessages,\n deleteScheduledMessages,\n } = getActions();\n\n const handleDeleteMessageForAll = useCallback(() => {\n const messageIds = album?.messages\n ? album.messages.map(({ id }) => id)\n : [message.id];\n deleteMessages({ messageIds, shouldDeleteForAll: true });\n onClose();\n }, [deleteMessages, message.id, onClose, album]);\n\n const handleDeleteMessageForSelf = useCallback(() => {\n const messageIds = album?.messages\n ? album.messages.map(({ id }) => id)\n : [message.id];\n if (isSchedule) {\n deleteScheduledMessages({ messageIds });\n } else {\n deleteMessages({\n messageIds,\n shouldDeleteForAll: false,\n });\n }\n onClose();\n }, [album, message.id, isSchedule, onClose, deleteScheduledMessages, deleteMessages]);\n\n const lang = useLang();\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n onEnter={isOpen && !canDeleteForAll ? handleDeleteMessageForSelf : undefined}\n className=\"delete\"\n title={lang('DeleteSingleMessagesTitle')}\n >\n <p>{lang('AreYouSureDeleteSingleMessage')}</p>\n {willDeleteForCurrentUserOnly && (\n <p>{lang('lng_delete_for_me_chat_hint', 1, 'i')}</p>\n )}\n {willDeleteForAll && (\n <p>{lang('lng_delete_for_everyone_hint', 1, 'i')}</p>\n )}\n {canDeleteForAll && (\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteMessageForAll}>\n {contactName && renderText(lang('Conversation.DeleteMessagesFor', contactName))}\n {!contactName && lang('Conversation.DeleteMessagesForEveryone')}\n </Button>\n )}\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteMessageForSelf}>\n {lang(canDeleteForAll ? 'ChatList.DeleteForCurrentUser' : 'Delete')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Cancel')}</Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { message, isSchedule }): StateProps => {\n const { threadId } = selectCurrentMessageList(global) || {};\n const { canDeleteForAll } = (threadId && selectAllowedMessageActions(global, message, threadId)) || {};\n const chat = selectChat(global, message.chatId);\n const contactName = chat && isUserId(chat.id)\n ? getUserFirstOrLastName(selectUser(global, getPrivateChatUserId(chat)!))\n : undefined;\n\n const willDeleteForCurrentUserOnly = chat && isChatBasicGroup(chat) && !canDeleteForAll;\n const willDeleteForAll = chat && isChatSuperGroup(chat);\n\n return {\n canDeleteForAll: !isSchedule && canDeleteForAll,\n contactName,\n willDeleteForCurrentUserOnly,\n willDeleteForAll,\n };\n },\n)(DeleteMessageModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { selectChat, selectIsChatWithSelf, selectUser } from '../../global/selectors';\nimport {\n isUserId,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n isChatChannel,\n} from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport renderText from './helpers/renderText';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nexport type OwnProps = {\n isOpen: boolean;\n chatId: string;\n messageId: number;\n onClose: () => void;\n};\n\ntype StateProps = {\n isChannel: boolean;\n isPrivateChat: boolean;\n isChatWithSelf: boolean;\n isGroup: boolean;\n isSuperGroup: boolean;\n canPinForAll: boolean;\n contactName?: string;\n};\n\nconst PinMessageModal: FC<OwnProps & StateProps> = ({\n isOpen,\n messageId,\n chatId,\n isChannel,\n isGroup,\n isSuperGroup,\n canPinForAll,\n contactName,\n onClose,\n}) => {\n const { pinMessage } = getActions();\n\n const handlePinMessageForAll = useCallback(() => {\n pinMessage({\n chatId, messageId, isUnpin: false,\n });\n onClose();\n }, [pinMessage, chatId, messageId, onClose]);\n\n const handlePinMessage = useCallback(() => {\n pinMessage({\n chatId, messageId, isUnpin: false, isOneSide: true, isSilent: true,\n });\n onClose();\n }, [chatId, messageId, onClose, pinMessage]);\n\n const lang = useLang();\n\n function renderMessage() {\n if (isChannel) {\n return lang('PinMessageAlertChannel');\n }\n\n if (isGroup || isSuperGroup) {\n return lang('PinMessageAlert');\n }\n\n return lang('PinMessageAlertChat');\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n className=\"pin\"\n title={lang('PinMessageAlertTitle')}\n >\n <p>{renderMessage()}</p>\n <Button className=\"confirm-dialog-button\" isText onClick={handlePinMessage}>\n {lang('DialogPin')}\n </Button>\n {canPinForAll && (\n <Button className=\"confirm-dialog-button\" isText onClick={handlePinMessageForAll}>\n {contactName\n ? renderText(lang('Conversation.PinMessagesFor', contactName))\n : lang('Conversation.PinMessageAlert.PinAndNotifyMembers')}\n </Button>\n )}\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Cancel')}</Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const isPrivateChat = isUserId(chatId);\n const isChatWithSelf = selectIsChatWithSelf(global, chatId);\n const chat = selectChat(global, chatId);\n const isChannel = Boolean(chat) && isChatChannel(chat);\n const isGroup = Boolean(chat) && isChatBasicGroup(chat);\n const isSuperGroup = Boolean(chat) && isChatSuperGroup(chat);\n const canPinForAll = (isPrivateChat && !isChatWithSelf) || isSuperGroup || isGroup;\n const contactName = chat && isUserId(chat.id)\n ? getUserFirstOrLastName(selectUser(global, getPrivateChatUserId(chat)!))\n : undefined;\n\n return {\n isPrivateChat,\n isChatWithSelf,\n isChannel,\n isGroup,\n isSuperGroup,\n canPinForAll,\n contactName,\n };\n },\n)(PinMessageModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nexport type OwnProps = {\n isOpen: boolean;\n chatId?: string;\n pinnedMessagesCount?: number;\n onClose: () => void;\n onUnpin: () => void;\n};\n\nconst UnpinAllMessagesModal: FC<OwnProps> = ({\n isOpen,\n pinnedMessagesCount = 0,\n onClose,\n onUnpin,\n}) => {\n const lang = useLang();\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n className=\"unpin-all\"\n title={lang('Chat.PanelUnpinAllMessages')}\n >\n <p>{lang('Chat.UnpinAllMessagesConfirmation', pinnedMessagesCount, 'i')}</p>\n <Button className=\"confirm-dialog-button\" isText onClick={onUnpin}>\n {lang('DialogUnpin')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Cancel')}</Button>\n </Modal>\n );\n};\n\nexport default memo(UnpinAllMessagesModal);\n","import { useHotkeys } from '../../../hooks/useHotkeys';\n\nconst useCopySelectedMessages = (isActive: boolean, copySelectedMessages: NoneToVoidFunction) => {\n function handleCopy(e: KeyboardEvent) {\n if (!isActive) {\n return;\n }\n\n e.preventDefault();\n copySelectedMessages();\n }\n\n useHotkeys({ 'Meta+C': handleCopy });\n};\n\nexport default useCopySelectedMessages;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo, useEffect } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { selectCanDeleteSelectedMessages, selectCurrentChat, selectUser } from '../../global/selectors';\nimport {\n isUserId,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n} from '../../global/helpers';\nimport renderText from '../common/helpers/renderText';\nimport useLang from '../../hooks/useLang';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nexport type OwnProps = {\n isOpen: boolean;\n isSchedule: boolean;\n onClose: () => void;\n};\n\ntype StateProps = {\n selectedMessageIds?: number[];\n canDeleteForAll?: boolean;\n contactName?: string;\n willDeleteForCurrentUserOnly?: boolean;\n willDeleteForAll?: boolean;\n};\n\nconst DeleteSelectedMessageModal: FC<OwnProps & StateProps> = ({\n isOpen,\n isSchedule,\n selectedMessageIds,\n canDeleteForAll,\n contactName,\n willDeleteForCurrentUserOnly,\n willDeleteForAll,\n onClose,\n}) => {\n const {\n deleteMessages,\n deleteScheduledMessages,\n exitMessageSelectMode,\n } = getActions();\n\n const prevIsOpen = usePrevious(isOpen);\n\n const handleDeleteMessageForAll = useCallback(() => {\n onClose();\n deleteMessages({ messageIds: selectedMessageIds, shouldDeleteForAll: true });\n }, [deleteMessages, selectedMessageIds, onClose]);\n\n const handleDeleteMessageForSelf = useCallback(() => {\n if (isSchedule) {\n deleteScheduledMessages({ messageIds: selectedMessageIds });\n } else {\n deleteMessages({ messageIds: selectedMessageIds, shouldDeleteForAll: false });\n }\n\n onClose();\n }, [isSchedule, onClose, deleteScheduledMessages, selectedMessageIds, deleteMessages]);\n\n const lang = useLang();\n\n // Returning `undefined` from FC instead of `<Modal>` doesn't trigger useHistoryBack\n useEffect(() => {\n if (!isOpen && prevIsOpen) {\n exitMessageSelectMode();\n }\n }, [exitMessageSelectMode, isOpen, prevIsOpen]);\n\n if (!selectedMessageIds) {\n return undefined;\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n onEnter={canDeleteForAll ? undefined : handleDeleteMessageForSelf}\n className=\"delete\"\n title={lang('Conversation.DeleteManyMessages')}\n >\n <p>{lang('AreYouSureDeleteFewMessages')}</p>\n {willDeleteForCurrentUserOnly && (\n <p>This will delete them just for you, not for other participants in the chat.</p>\n )}\n {willDeleteForAll && (\n <p>This will delete them for everyone in this chat.</p>\n )}\n {canDeleteForAll && (\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteMessageForAll}>\n {contactName\n ? renderText(lang('ChatList.DeleteForEveryone', contactName))\n : lang('Conversation.DeleteMessagesForEveryone')}\n </Button>\n )}\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteMessageForSelf}>\n {lang(canDeleteForAll ? 'ChatList.DeleteForCurrentUser' : 'Delete')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Cancel')}</Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { isSchedule }): StateProps => {\n const { messageIds: selectedMessageIds } = global.selectedMessages || {};\n const { canDeleteForAll } = selectCanDeleteSelectedMessages(global);\n const chat = selectCurrentChat(global);\n const contactName = chat && isUserId(chat.id)\n ? getUserFirstOrLastName(selectUser(global, getPrivateChatUserId(chat)!))\n : undefined;\n\n const willDeleteForCurrentUserOnly = chat && isChatBasicGroup(chat) && !canDeleteForAll;\n const willDeleteForAll = chat && isChatSuperGroup(chat);\n\n return {\n selectedMessageIds,\n canDeleteForAll: !isSchedule && canDeleteForAll,\n contactName,\n willDeleteForCurrentUserOnly,\n willDeleteForAll,\n };\n },\n)(DeleteSelectedMessageModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { MessageListType } from '../../global/types';\n\nimport {\n selectCanDeleteSelectedMessages,\n selectCanDownloadSelectedMessages,\n selectCanReportSelectedMessages,\n selectCurrentMessageList,\n selectHasProtectedMessage,\n selectSelectedMessagesCount,\n} from '../../global/selectors';\nimport useFlag from '../../hooks/useFlag';\nimport captureKeyboardListeners from '../../util/captureKeyboardListeners';\nimport buildClassName from '../../util/buildClassName';\nimport usePrevious from '../../hooks/usePrevious';\nimport useLang from '../../hooks/useLang';\nimport useCopySelectedMessages from './hooks/useCopySelectedMessages';\n\nimport Button from '../ui/Button';\n\nimport DeleteSelectedMessageModal from './DeleteSelectedMessageModal';\nimport ReportModal from '../common/ReportModal';\n\nimport './MessageSelectToolbar.scss';\n\nexport type OwnProps = {\n isActive?: boolean;\n canPost?: boolean;\n messageListType?: MessageListType;\n};\n\ntype StateProps = {\n isSchedule: boolean;\n selectedMessagesCount?: number;\n canDeleteMessages?: boolean;\n canReportMessages?: boolean;\n canDownloadMessages?: boolean;\n hasProtectedMessage?: boolean;\n selectedMessageIds?: number[];\n};\n\nconst MessageSelectToolbar: FC<OwnProps & StateProps> = ({\n canPost,\n isActive,\n messageListType,\n isSchedule,\n selectedMessagesCount,\n canDeleteMessages,\n canReportMessages,\n canDownloadMessages,\n hasProtectedMessage,\n selectedMessageIds,\n}) => {\n const {\n exitMessageSelectMode,\n openForwardMenuForSelectedMessages,\n downloadSelectedMessages,\n copySelectedMessages,\n showNotification,\n } = getActions();\n const lang = useLang();\n\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isReportModalOpen, openReportModal, closeReportModal] = useFlag();\n\n useCopySelectedMessages(Boolean(isActive), copySelectedMessages);\n useEffect(() => {\n return isActive && !isDeleteModalOpen && !isReportModalOpen\n ? captureKeyboardListeners({\n onBackspace: openDeleteModal,\n onDelete: openDeleteModal,\n onEsc: exitMessageSelectMode,\n })\n : undefined;\n }, [isActive, isDeleteModalOpen, isReportModalOpen, openDeleteModal, exitMessageSelectMode]);\n\n const handleCopy = useCallback(() => {\n copySelectedMessages();\n showNotification({\n message: lang('Share.Link.Copied'),\n });\n exitMessageSelectMode();\n }, [copySelectedMessages, exitMessageSelectMode, lang, showNotification]);\n\n const handleDownload = useCallback(() => {\n downloadSelectedMessages();\n exitMessageSelectMode();\n }, [downloadSelectedMessages, exitMessageSelectMode]);\n\n const prevSelectedMessagesCount = usePrevious(selectedMessagesCount || undefined, true);\n const renderingSelectedMessagesCount = isActive ? selectedMessagesCount : prevSelectedMessagesCount;\n\n const formattedMessagesCount = lang('VoiceOver.Chat.MessagesSelected', renderingSelectedMessagesCount, 'i');\n\n const className = buildClassName(\n 'MessageSelectToolbar',\n canPost && 'with-composer',\n isActive && 'shown',\n );\n\n const renderButton = (\n icon: string, label: string, onClick: AnyToVoidFunction, disabled?: boolean, destructive?: boolean,\n ) => {\n return (\n <div\n role=\"button\"\n tabIndex={0}\n className={buildClassName(\n 'item',\n disabled && 'disabled',\n destructive && 'destructive',\n )}\n onClick={!disabled ? onClick : undefined}\n title={label}\n >\n <i className={`icon-${icon}`} />\n </div>\n );\n };\n\n return (\n <div className={className}>\n <div className=\"MessageSelectToolbar-inner\">\n <Button\n color=\"translucent\"\n round\n onClick={exitMessageSelectMode}\n ariaLabel=\"Exit select mode\"\n >\n <i className=\"icon-close\" />\n </Button>\n <span className=\"MessageSelectToolbar-count\" title={formattedMessagesCount}>\n {formattedMessagesCount}\n </span>\n\n {Boolean(selectedMessagesCount) && (\n <div className=\"MessageSelectToolbar-actions\">\n {messageListType !== 'scheduled' && (\n renderButton(\n 'forward', lang('Chat.ForwardActionHeader'), openForwardMenuForSelectedMessages, hasProtectedMessage,\n )\n )}\n {canReportMessages && (\n renderButton('flag', lang('Conversation.ReportMessages'), openReportModal)\n )}\n {canDownloadMessages && (\n renderButton('download', lang('lng_media_download'), handleDownload, hasProtectedMessage)\n )}\n {renderButton('copy', lang('lng_context_copy_selected_items'), handleCopy, hasProtectedMessage)}\n {renderButton('delete', lang('EditAdminGroupDeleteMessages'), openDeleteModal, !canDeleteMessages, true)}\n </div>\n )}\n </div>\n <DeleteSelectedMessageModal\n isOpen={isDeleteModalOpen}\n isSchedule={isSchedule}\n onClose={closeDeleteModal}\n />\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n messageIds={selectedMessageIds}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { type: messageListType, chatId } = selectCurrentMessageList(global) || {};\n const { canDelete } = selectCanDeleteSelectedMessages(global);\n const canReport = selectCanReportSelectedMessages(global);\n const canDownload = selectCanDownloadSelectedMessages(global);\n const { messageIds: selectedMessageIds } = global.selectedMessages || {};\n const hasProtectedMessage = chatId ? selectHasProtectedMessage(global, chatId, selectedMessageIds) : false;\n\n return {\n isSchedule: messageListType === 'scheduled',\n selectedMessagesCount: selectSelectedMessagesCount(global),\n canDeleteMessages: canDelete,\n canReportMessages: canReport,\n canDownloadMessages: canDownload,\n selectedMessageIds,\n hasProtectedMessage,\n };\n },\n)(MessageSelectToolbar));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport useLang from '../../hooks/useLang';\nimport { selectChatMessage } from '../../global/selectors';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport PrivateChatInfo from './PrivateChatInfo';\nimport ListItem from '../ui/ListItem';\n\nexport type OwnProps = {\n isOpen: boolean;\n};\n\nexport type StateProps = {\n memberIds?: string[];\n};\n\nconst CLOSE_ANIMATION_DURATION = 100;\n\nconst SeenByModal: FC<OwnProps & StateProps> = ({\n isOpen,\n memberIds,\n}) => {\n const {\n openChat,\n closeSeenByModal,\n } = getActions();\n\n const lang = useLang();\n\n const handleClick = useCallback((userId: string) => {\n closeSeenByModal();\n\n setTimeout(() => {\n openChat({ id: userId });\n }, CLOSE_ANIMATION_DURATION);\n }, [closeSeenByModal, openChat]);\n\n const renderingMemberIds = useCurrentOrPrev(memberIds, true);\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={closeSeenByModal}\n className=\"narrow\"\n title={`Seen by ${memberIds?.length} users`}\n >\n <div dir={lang.isRtl ? 'rtl' : undefined}>\n {renderingMemberIds && renderingMemberIds.map((userId) => (\n <ListItem\n key={userId}\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleClick(userId)}\n >\n <PrivateChatInfo userId={userId} noStatusOrTyping />\n </ListItem>\n ))}\n </div>\n <Button\n className=\"confirm-dialog-button\"\n isText\n onClick={closeSeenByModal}\n >\n {lang('Close')}\n </Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { chatId, messageId } = global.seenByModal || {};\n if (!chatId || !messageId) {\n return {};\n }\n\n return {\n memberIds: selectChatMessage(global, chatId, messageId)?.seenByUserIds,\n };\n },\n)(SeenByModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, memo, useMemo, useEffect, useState, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport type { ApiMessage } from '../../api/types';\nimport { LoadMoreDirection } from '../../types';\n\nimport useLang from '../../hooks/useLang';\nimport { selectChatMessage } from '../../global/selectors';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport { getUserFullName } from '../../global/helpers';\nimport renderText from '../common/helpers/renderText';\nimport useFlag from '../../hooks/useFlag';\nimport buildClassName from '../../util/buildClassName';\nimport { formatIntegerCompact } from '../../util/textFormat';\nimport { unique } from '../../util/iteratees';\n\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport Avatar from '../common/Avatar';\nimport ListItem from '../ui/ListItem';\nimport ReactionStaticEmoji from '../common/ReactionStaticEmoji';\nimport Loading from '../ui/Loading';\n\nimport './ReactorListModal.scss';\n\nconst MIN_REACTIONS_COUNT_FOR_FILTERS = 10;\n\nexport type OwnProps = {\n isOpen: boolean;\n};\n\nexport type StateProps = Pick<ApiMessage, 'reactors' | 'reactions' | 'seenByUserIds'> & {\n chatId?: string;\n messageId?: number;\n};\n\nconst ReactorListModal: FC<OwnProps & StateProps> = ({\n isOpen,\n reactors,\n reactions,\n chatId,\n messageId,\n seenByUserIds,\n}) => {\n const {\n loadReactors,\n closeReactorListModal,\n openChat,\n } = getActions();\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n const lang = useLang();\n const [isClosing, startClosing, stopClosing] = useFlag(false);\n const [chosenTab, setChosenTab] = useState<string | undefined>(undefined);\n const canShowFilters = reactors && reactions && reactors.count >= MIN_REACTIONS_COUNT_FOR_FILTERS\n && reactions.results.length > 1;\n const chatIdRef = useRef<string>();\n\n useEffect(() => {\n if (isClosing && !isOpen) {\n stopClosing();\n setChosenTab(undefined);\n }\n }, [isClosing, isOpen, stopClosing]);\n\n const handleCloseAnimationEnd = useCallback(() => {\n if (chatIdRef.current) {\n openChat({ id: chatIdRef.current });\n }\n closeReactorListModal();\n }, [closeReactorListModal, openChat]);\n\n const handleClose = useCallback(() => {\n startClosing();\n }, [startClosing]);\n\n const handleClick = useCallback((userId: string) => {\n chatIdRef.current = userId;\n handleClose();\n }, [handleClose]);\n\n const handleLoadMore = useCallback(() => {\n loadReactors({\n chatId,\n messageId,\n });\n }, [chatId, loadReactors, messageId]);\n\n const allReactions = useMemo(() => {\n return reactors?.reactions ? unique(reactors.reactions.map((l) => l.reaction)) : [];\n }, [reactors?.reactions]);\n\n const userIds = useMemo(() => {\n if (chosenTab) {\n return reactors?.reactions.filter((l) => l.reaction === chosenTab).map((l) => l.userId);\n }\n return unique(reactors?.reactions.map((l) => l.userId).concat(seenByUserIds || []) || []);\n }, [chosenTab, reactors?.reactions, seenByUserIds]);\n\n const [viewportIds, getMore] = useInfiniteScroll(\n handleLoadMore, userIds, reactors && reactors.nextOffset === undefined,\n );\n\n useEffect(() => {\n getMore?.({ direction: LoadMoreDirection.Backwards });\n }, [getMore]);\n\n return (\n <Modal\n isOpen={isOpen && !isClosing}\n onClose={handleClose}\n className=\"ReactorListModal narrow\"\n title={lang('Reactions')}\n onCloseAnimationEnd={handleCloseAnimationEnd}\n >\n {canShowFilters && (\n <div className=\"Reactions\">\n <Button\n className={buildClassName(!chosenTab && 'chosen')}\n size=\"tiny\"\n ripple\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setChosenTab(undefined)}\n >\n <i className=\"icon-heart\" />\n {reactors?.count && formatIntegerCompact(reactors.count)}\n </Button>\n {allReactions.map((reaction) => {\n const count = reactions?.results.find((l) => l.reaction === reaction)?.count;\n return (\n <Button\n className={buildClassName(chosenTab === reaction && 'chosen')}\n size=\"tiny\"\n ripple\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setChosenTab(reaction)}\n >\n <ReactionStaticEmoji reaction={reaction} className=\"reaction-filter-emoji\" />\n {count && formatIntegerCompact(count)}\n </Button>\n );\n })}\n </div>\n )}\n\n <div dir={lang.isRtl ? 'rtl' : undefined}>\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"reactor-list custom-scroll\"\n items={viewportIds}\n onLoadMore={getMore}\n >\n {viewportIds?.map(\n (userId) => {\n const user = usersById[userId];\n const fullName = getUserFullName(user);\n const reaction = reactors?.reactions.find((l) => l.userId === userId)?.reaction;\n return (\n <ListItem\n key={userId}\n className=\"chat-item-clickable reactors-list-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleClick(userId)}\n >\n <Avatar user={user} size=\"medium\" />\n <div className=\"title\">\n <h3 dir=\"auto\">{fullName && renderText(fullName)}</h3>\n </div>\n {reaction && <ReactionStaticEmoji className=\"reactors-list-emoji\" reaction={reaction} />}\n </ListItem>\n );\n },\n )}\n </InfiniteScroll>\n ) : <Loading />}\n </div>\n <Button\n className=\"confirm-dialog-button\"\n isText\n onClick={closeReactorListModal}\n >\n {lang('Close')}\n </Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { chatId, messageId } = global.reactorModal || {};\n const message = chatId && messageId ? selectChatMessage(global, chatId, messageId) : undefined;\n\n return {\n chatId,\n messageId,\n reactions: message?.reactions,\n reactors: message?.reactors,\n seenByUserIds: message?.seenByUserIds,\n };\n },\n)(ReactorListModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useLayoutEffect, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ActiveEmojiInteraction } from '../../global/types';\n\nimport { IS_ANDROID } from '../../util/environment';\nimport useFlag from '../../hooks/useFlag';\nimport useMedia from '../../hooks/useMedia';\nimport buildClassName from '../../util/buildClassName';\nimport {\n selectAnimatedEmojiEffect,\n} from '../../global/selectors';\nimport { LOCAL_TGS_URLS } from '../common/helpers/animatedAssets';\nimport { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\n\nimport AnimatedSticker from '../common/AnimatedSticker';\n\nimport './EmojiInteractionAnimation.scss';\n\nexport type OwnProps = {\n activeEmojiInteraction: ActiveEmojiInteraction;\n};\n\ntype StateProps = {\n effectAnimationId?: string;\n localEffectAnimation?: string;\n};\n\nconst HIDE_ANIMATION_DURATION = 250;\nconst PLAYING_DURATION = 3000;\nconst EFFECT_SIZE = 240;\n\nconst EmojiInteractionAnimation: FC<OwnProps & StateProps> = ({\n effectAnimationId,\n localEffectAnimation,\n activeEmojiInteraction,\n}) => {\n const { stopActiveEmojiInteraction } = getActions();\n\n const [isHiding, startHiding] = useFlag(false);\n const [isPlaying, startPlaying] = useFlag(false);\n const timeoutRef = useRef<NodeJS.Timeout>();\n\n const stop = useCallback(() => {\n startHiding();\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n setTimeout(() => {\n stopActiveEmojiInteraction({ id: activeEmojiInteraction.id });\n }, HIDE_ANIMATION_DURATION);\n }, [activeEmojiInteraction.id, startHiding, stopActiveEmojiInteraction]);\n\n const handleCancelAnimation = useCallback((e: UIEvent) => {\n if (!(e.target as HTMLElement)?.closest('.AnimatedEmoji')) {\n stop();\n }\n }, [stop]);\n\n useEffect(() => {\n document.addEventListener('touchstart', handleCancelAnimation);\n document.addEventListener('touchmove', handleCancelAnimation);\n document.addEventListener('mousedown', handleCancelAnimation);\n document.addEventListener('wheel', handleCancelAnimation);\n\n return () => {\n document.removeEventListener('touchstart', handleCancelAnimation);\n document.removeEventListener('touchmove', handleCancelAnimation);\n document.removeEventListener('mousedown', handleCancelAnimation);\n document.removeEventListener('wheel', handleCancelAnimation);\n };\n }, [handleCancelAnimation]);\n\n useLayoutEffect(() => {\n const dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();\n\n timeoutRef.current = setTimeout(() => {\n stop();\n dispatchHeavyAnimationStop();\n }, PLAYING_DURATION);\n }, [stop]);\n\n const effectTgsUrl = useMedia(`sticker${effectAnimationId}`, !effectAnimationId);\n\n if (!activeEmojiInteraction.startSize) {\n return undefined;\n }\n\n const scale = (activeEmojiInteraction.startSize || 0) / EFFECT_SIZE;\n const tgsUrl = localEffectAnimation && (localEffectAnimation in LOCAL_TGS_URLS)\n ? LOCAL_TGS_URLS[localEffectAnimation as keyof typeof LOCAL_TGS_URLS]\n : effectTgsUrl;\n\n return (\n <div\n className={buildClassName(\n 'EmojiInteractionAnimation',\n isHiding && 'hiding',\n isPlaying && 'playing',\n activeEmojiInteraction.isReversed && 'reversed',\n )}\n style={`--scale: ${scale}; --start-x: ${activeEmojiInteraction.x}px; --start-y: ${activeEmojiInteraction.y}px;`}\n >\n <AnimatedSticker\n key={`effect_${effectAnimationId}`}\n size={EFFECT_SIZE}\n tgsUrl={tgsUrl}\n play={isPlaying}\n quality={IS_ANDROID ? 0.5 : undefined}\n forceOnHeavyAnimation\n noLoop\n onLoad={startPlaying}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { activeEmojiInteraction }): StateProps => {\n const animatedEffect = activeEmojiInteraction.animatedEffect !== undefined\n && selectAnimatedEmojiEffect(global, activeEmojiInteraction.animatedEffect);\n return {\n effectAnimationId: animatedEffect ? animatedEffect.id : undefined,\n localEffectAnimation: !animatedEffect && activeEmojiInteraction.animatedEffect\n && Object.keys(LOCAL_TGS_URLS).includes(activeEmojiInteraction.animatedEffect)\n ? activeEmojiInteraction.animatedEffect : undefined,\n };\n },\n)(EmojiInteractionAnimation));\n","import { useCallback, useEffect, useRef } from '../lib/teact/teact';\n\nconst useSendWithEnter = (\n onSelect: NoneToVoidFunction,\n) => {\n // eslint-disable-next-line no-null/no-null\n const buttonRef = useRef<HTMLDivElement>(null);\n\n const handleKeyDown = useCallback((e: KeyboardEvent) => {\n if (e.key !== 'Enter') return;\n const isFocused = buttonRef.current === document.activeElement;\n\n if (isFocused) {\n onSelect();\n }\n }, [onSelect]);\n\n useEffect(() => {\n window.addEventListener('keydown', handleKeyDown, false);\n\n return () => window.removeEventListener('keydown', handleKeyDown, false);\n }, [handleKeyDown]);\n\n return buttonRef;\n};\n\nexport default useSendWithEnter;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiUser } from '../../../api/types';\n\nimport useChatContextActions from '../../../hooks/useChatContextActions';\nimport useFlag from '../../../hooks/useFlag';\nimport { isUserId, getPrivateChatUserId, selectIsChatMuted } from '../../../global/helpers';\nimport {\n selectChat, selectUser, selectIsChatPinned, selectNotifySettings, selectNotifyExceptions,\n} from '../../../global/selectors';\nimport useSelectWithEnter from '../../../hooks/useSelectWithEnter';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport GroupChatInfo from '../../common/GroupChatInfo';\nimport DeleteChatModal from '../../common/DeleteChatModal';\nimport ListItem from '../../ui/ListItem';\nimport ChatFolderModal from '../ChatFolderModal.async';\n\ntype OwnProps = {\n chatId: string;\n withUsername?: boolean;\n onClick: (id: string) => void;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n user?: ApiUser;\n isPinned?: boolean;\n isMuted?: boolean;\n canChangeFolder?: boolean;\n};\n\nconst LeftSearchResultChat: FC<OwnProps & StateProps> = ({\n chatId,\n withUsername,\n onClick,\n chat,\n user,\n isPinned,\n isMuted,\n canChangeFolder,\n}) => {\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isChatFolderModalOpen, openChatFolderModal, closeChatFolderModal] = useFlag();\n\n const contextActions = useChatContextActions({\n chat,\n user,\n isPinned,\n isMuted,\n canChangeFolder,\n handleDelete: openDeleteModal,\n handleChatFolderChange: openChatFolderModal,\n }, true);\n\n const handleClick = useCallback(() => {\n onClick(chatId);\n }, [chatId, onClick]);\n\n const buttonRef = useSelectWithEnter(handleClick);\n\n if (!chat) {\n return undefined;\n }\n\n return (\n <ListItem\n className=\"chat-item-clickable search-result\"\n onClick={handleClick}\n contextActions={contextActions}\n buttonRef={buttonRef}\n >\n {isUserId(chatId) ? (\n <PrivateChatInfo userId={chatId} withUsername={withUsername} avatarSize=\"large\" />\n ) : (\n <GroupChatInfo chatId={chatId} withUsername={withUsername} avatarSize=\"large\" />\n )}\n <DeleteChatModal\n isOpen={isDeleteModalOpen}\n onClose={closeDeleteModal}\n chat={chat}\n />\n <ChatFolderModal\n isOpen={isChatFolderModalOpen}\n onClose={closeChatFolderModal}\n chatId={chatId}\n />\n </ListItem>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const privateChatUserId = chat && getPrivateChatUserId(chat);\n const user = privateChatUserId ? selectUser(global, privateChatUserId) : undefined;\n const isPinned = selectIsChatPinned(global, chatId);\n const isMuted = chat\n ? selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global))\n : undefined;\n\n return {\n chat,\n user,\n isPinned,\n isMuted,\n canChangeFolder: Boolean(global.chatFolders.orderedIds?.length),\n };\n },\n)(LeftSearchResultChat));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useEffect, useCallback, useRef, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiUser } from '../../../api/types';\n\nimport { getUserFirstOrLastName } from '../../../global/helpers';\nimport renderText from '../../common/helpers/renderText';\nimport { throttle } from '../../../util/schedulers';\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useLang from '../../../hooks/useLang';\n\nimport Avatar from '../../common/Avatar';\nimport Button from '../../ui/Button';\nimport LeftSearchResultChat from './LeftSearchResultChat';\n\nimport './RecentContacts.scss';\n\ntype OwnProps = {\n onReset: () => void;\n};\n\ntype StateProps = {\n topUserIds?: string[];\n usersById: Record<string, ApiUser>;\n recentlyFoundChatIds?: string[];\n};\n\nconst SEARCH_CLOSE_TIMEOUT_MS = 250;\nconst NBSP = '\\u00A0';\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst RecentContacts: FC<OwnProps & StateProps> = ({\n topUserIds, usersById, recentlyFoundChatIds,\n onReset,\n}) => {\n const {\n loadTopUsers, openChat,\n addRecentlyFoundChatId, clearRecentlyFoundChats,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const topUsersRef = useRef<HTMLDivElement>(null);\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadTopUsers();\n });\n }, [loadTopUsers]);\n\n useHorizontalScroll(topUsersRef.current, !topUserIds);\n\n const handleClick = useCallback((id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n onReset();\n setTimeout(() => {\n addRecentlyFoundChatId({ id });\n }, SEARCH_CLOSE_TIMEOUT_MS);\n }, [openChat, addRecentlyFoundChatId, onReset]);\n\n const lang = useLang();\n\n return (\n <div className=\"RecentContacts custom-scroll\">\n {topUserIds && (\n <div className=\"top-peers-section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <div ref={topUsersRef} className=\"top-peers no-selection\">\n {topUserIds.map((userId) => (\n <div className=\"top-peer-item\" onClick={() => handleClick(userId)} dir={lang.isRtl ? 'rtl' : undefined}>\n <Avatar user={usersById[userId]} />\n <div className=\"top-peer-name\">{renderText(getUserFirstOrLastName(usersById[userId]) || NBSP)}</div>\n </div>\n ))}\n </div>\n </div>\n )}\n {recentlyFoundChatIds && (\n <div className=\"search-section pt-1\">\n <h3 className=\"section-heading mt-0 recent-chats-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('Recent')}\n\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n ariaLabel=\"Clear recent chats\"\n onClick={clearRecentlyFoundChats}\n isRtl={lang.isRtl}\n >\n <i className=\"icon-close\" />\n </Button>\n </h3>\n {recentlyFoundChatIds.map((id) => (\n <LeftSearchResultChat\n chatId={id}\n onClick={handleClick}\n />\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: topUserIds } = global.topPeers;\n const usersById = global.users.byId;\n const { recentlyFoundChatIds } = global.globalSearch;\n\n return {\n topUserIds,\n usersById,\n recentlyFoundChatIds,\n };\n },\n)(RecentContacts));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type {\n ApiChat, ApiUser, ApiMessage, ApiMessageOutgoingStatus,\n} from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport {\n getChatTitle,\n getPrivateChatUserId,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessageVideo,\n getMessageRoundVideo,\n} from '../../../global/helpers';\nimport { selectChat, selectUser } from '../../../global/selectors';\nimport buildClassName from '../../../util/buildClassName';\nimport renderText from '../../common/helpers/renderText';\nimport { formatPastTimeShort } from '../../../util/dateFormat';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport useMedia from '../../../hooks/useMedia';\nimport type { LangFn } from '../../../hooks/useLang';\nimport useLang from '../../../hooks/useLang';\nimport useSelectWithEnter from '../../../hooks/useSelectWithEnter';\n\nimport Avatar from '../../common/Avatar';\nimport VerifiedIcon from '../../common/VerifiedIcon';\nimport ListItem from '../../ui/ListItem';\nimport Link from '../../ui/Link';\nimport FakeIcon from '../../common/FakeIcon';\n\nimport './ChatMessage.scss';\n\ntype OwnProps = {\n searchQuery?: string;\n message: ApiMessage;\n chatId: string;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n privateChatUser?: ApiUser;\n lastMessageOutgoingStatus?: ApiMessageOutgoingStatus;\n lastSyncTime?: number;\n};\n\nconst ChatMessage: FC<OwnProps & StateProps> = ({\n message,\n searchQuery,\n chatId,\n chat,\n privateChatUser,\n lastSyncTime,\n}) => {\n const { focusMessage } = getActions();\n\n const mediaThumbnail = getMessageMediaThumbDataUri(message);\n const mediaBlobUrl = useMedia(getMessageMediaHash(message, 'micro'));\n const isRoundVideo = Boolean(getMessageRoundVideo(message));\n\n const handleClick = useCallback(() => {\n focusMessage({ chatId, messageId: message.id, shouldReplaceHistory: true });\n }, [chatId, focusMessage, message.id]);\n\n const lang = useLang();\n\n const buttonRef = useSelectWithEnter(handleClick);\n\n if (!chat) {\n return undefined;\n }\n\n return (\n <ListItem\n className=\"ChatMessage chat-item-clickable\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n onClick={handleClick}\n buttonRef={buttonRef}\n >\n <Avatar\n chat={chat}\n user={privateChatUser}\n isSavedMessages={privateChatUser?.isSelf}\n lastSyncTime={lastSyncTime}\n />\n <div className=\"info\">\n <div className=\"info-row\">\n <div className=\"title\">\n <h3 dir=\"auto\">{renderText(getChatTitle(lang, chat, privateChatUser))}</h3>\n {chat.isVerified && <VerifiedIcon />}\n {chat.fakeType && <FakeIcon fakeType={chat.fakeType} />}\n </div>\n <div className=\"message-date\">\n <Link className=\"date\">\n {formatPastTimeShort(lang, message.date * 1000)}\n </Link>\n </div>\n\n </div>\n <div className=\"subtitle\">\n <div className=\"message\" dir=\"auto\">\n {renderSummary(lang, message, mediaBlobUrl || mediaThumbnail, searchQuery, isRoundVideo)}\n </div>\n </div>\n </div>\n </ListItem>\n );\n};\n\nfunction renderSummary(\n lang: LangFn, message: ApiMessage, blobUrl?: string, searchQuery?: string, isRoundVideo?: boolean,\n) {\n if (!blobUrl) {\n return renderMessageSummary(lang, message, undefined, searchQuery);\n }\n\n return (\n <span className=\"media-preview\">\n <img src={blobUrl} alt=\"\" className={buildClassName('media-preview--image', isRoundVideo && 'round')} />\n {getMessageVideo(message) && <i className=\"icon-play\" />}\n {renderMessageSummary(lang, message, true, searchQuery)}\n </span>\n );\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n if (!chat) {\n return {};\n }\n\n const privateChatUserId = getPrivateChatUserId(chat);\n\n return {\n chat,\n lastSyncTime: global.lastSyncTime,\n ...(privateChatUserId && { privateChatUser: selectUser(global, privateChatUserId) }),\n };\n },\n)(ChatMessage));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useMemo } from '../../../lib/teact/teact';\nimport { formatDateToString } from '../../../util/dateFormat';\n\nimport './DateSuggest.scss';\n\nconst SUGGESTION_COUNT = 8;\n\nexport type OwnProps = {\n searchDate: string;\n onSelect: (value: Date) => void;\n};\n\nconst DateSuggest: FC<OwnProps> = ({\n searchDate, onSelect,\n}) => {\n const suggestions = useMemo(() => getSuggestionsFromDate(searchDate), [searchDate]);\n return (\n <section className=\"DateSuggest custom-scroll custom-scroll-x\">\n {suggestions.map(({ date, text }) => {\n return (\n <div\n onClick={() => onSelect(date)}\n className=\"date-item\"\n key={text}\n >\n <i className=\"icon-calendar\" />\n <span>{text}</span>\n </div>\n );\n })}\n </section>\n );\n};\n\nfunction getSuggestionsFromDate(searchDate: string) {\n const hasYear = searchDate.match(/^\\d{2,4}-\\d{2}-\\d{2}$/g);\n if (hasYear) {\n const date = new Date(searchDate);\n return [{ date, text: formatDateToString(date) }];\n }\n\n const suggestion = [];\n const currentDate = new Date();\n const currentYear = currentDate.getFullYear();\n const latestYear = currentDate.getTime() > (new Date(`${currentYear}-${searchDate}`)).getTime()\n ? currentYear\n : currentYear - 1;\n\n for (let i = 0; i < SUGGESTION_COUNT; i++) {\n const date = new Date(`${latestYear - i}-${searchDate}`);\n suggestion.push({ date, text: formatDateToString(date) });\n }\n\n return suggestion;\n}\n\nexport default memo(DateSuggest);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiMessage } from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { unique } from '../../../util/iteratees';\nimport {\n sortChatIds,\n filterUsersByName,\n} from '../../../global/helpers';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport { throttle } from '../../../util/schedulers';\nimport useLang from '../../../hooks/useLang';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport LeftSearchResultChat from './LeftSearchResultChat';\nimport RecentContacts from './RecentContacts';\nimport ChatMessage from './ChatMessage';\nimport DateSuggest from './DateSuggest';\nimport Link from '../../ui/Link';\nimport NothingFound from '../../common/NothingFound';\nimport PickerSelectedItem from '../../common/PickerSelectedItem';\n\nexport type OwnProps = {\n searchQuery?: string;\n dateSearchQuery?: string;\n searchDate?: number;\n onReset: () => void;\n onSearchDateSelect: (value: Date) => void;\n};\n\ntype StateProps = {\n currentUserId?: string;\n localContactIds?: string[];\n localChatIds?: string[];\n localUserIds?: string[];\n globalChatIds?: string[];\n globalUserIds?: string[];\n foundIds?: string[];\n globalMessagesByChatId?: Record<string, { byId: Record<number, ApiMessage> }>;\n chatsById: Record<string, ApiChat>;\n fetchingStatus?: { chats?: boolean; messages?: boolean };\n lastSyncTime?: number;\n};\n\nconst MIN_QUERY_LENGTH_FOR_GLOBAL_SEARCH = 4;\nconst LESS_LIST_ITEMS_AMOUNT = 5;\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst ChatResults: FC<OwnProps & StateProps> = ({\n searchQuery, searchDate, dateSearchQuery, currentUserId,\n localContactIds, localChatIds, localUserIds, globalChatIds, globalUserIds,\n foundIds, globalMessagesByChatId, chatsById, fetchingStatus, lastSyncTime,\n onReset, onSearchDateSelect,\n}) => {\n const {\n openChat, addRecentlyFoundChatId, searchMessagesGlobal, setGlobalSearchChatId,\n } = getActions();\n\n const lang = useLang();\n\n const [shouldShowMoreLocal, setShouldShowMoreLocal] = useState<boolean>(false);\n const [shouldShowMoreGlobal, setShouldShowMoreGlobal] = useState<boolean>(false);\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: 'text',\n query: searchQuery,\n });\n });\n }\n }, [lastSyncTime, searchMessagesGlobal, searchQuery]);\n\n const handleChatClick = useCallback(\n (id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n\n if (id !== currentUserId) {\n addRecentlyFoundChatId({ id });\n }\n\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n onReset();\n }\n },\n [currentUserId, openChat, addRecentlyFoundChatId, onReset],\n );\n\n const handlePickerItemClick = useCallback((id: string) => {\n setGlobalSearchChatId({ id });\n }, [setGlobalSearchChatId]);\n\n const localResults = useMemo(() => {\n if (!searchQuery || (searchQuery.startsWith('@') && searchQuery.length < 2)) {\n return MEMO_EMPTY_ARRAY;\n }\n\n const contactIdsWithMe = [\n ...(currentUserId ? [currentUserId] : []),\n ...(localContactIds || []),\n ];\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const foundContactIds = filterUsersByName(\n contactIdsWithMe, usersById, searchQuery, currentUserId, lang('SavedMessages'),\n );\n\n return [\n ...sortChatIds(unique([\n ...(foundContactIds || []),\n ...(localChatIds || []),\n ...(localUserIds || []),\n ]), chatsById, undefined, currentUserId ? [currentUserId] : undefined),\n ];\n }, [searchQuery, currentUserId, localContactIds, lang, localChatIds, localUserIds, chatsById]);\n\n const globalResults = useMemo(() => {\n if (!searchQuery || searchQuery.length < MIN_QUERY_LENGTH_FOR_GLOBAL_SEARCH || !globalChatIds || !globalUserIds) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return sortChatIds(\n unique([...globalChatIds, ...globalUserIds]),\n chatsById,\n true,\n );\n }, [chatsById, globalChatIds, globalUserIds, searchQuery]);\n\n const foundMessages = useMemo(() => {\n if ((!searchQuery && !searchDate) || !foundIds || foundIds.length === 0) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds\n .map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId?.[chatId]?.byId[Number(messageId)];\n })\n .filter<ApiMessage>(Boolean as any)\n .sort((a, b) => b.date - a.date);\n }, [foundIds, globalMessagesByChatId, searchQuery, searchDate]);\n\n const handleClickShowMoreLocal = useCallback(() => {\n setShouldShowMoreLocal(!shouldShowMoreLocal);\n }, [shouldShowMoreLocal]);\n\n const handleClickShowMoreGlobal = useCallback(() => {\n setShouldShowMoreGlobal(!shouldShowMoreGlobal);\n }, [shouldShowMoreGlobal]);\n\n function renderFoundMessage(message: ApiMessage) {\n const text = renderMessageSummary(lang, message);\n const chat = chatsById[message.chatId];\n\n if (!text || !chat) {\n return undefined;\n }\n\n return (\n <ChatMessage\n chatId={message.chatId}\n message={message}\n searchQuery={searchQuery}\n />\n );\n }\n\n const nothingFound = fetchingStatus && !fetchingStatus.chats && !fetchingStatus.messages\n && !localResults.length && !globalResults.length && !foundMessages.length;\n\n if (!searchQuery && !searchDate) {\n return <RecentContacts onReset={onReset} />;\n }\n\n return (\n <InfiniteScroll\n className=\"LeftSearch custom-scroll\"\n items={foundMessages}\n onLoadMore={handleLoadMore}\n // To prevent scroll jumps caused by delayed local results rendering\n noScrollRestoreOnTop\n noFastList\n >\n {dateSearchQuery && (\n <div className=\"chat-selection no-selection no-scrollbar\">\n <DateSuggest\n searchDate={dateSearchQuery}\n onSelect={onSearchDateSelect}\n />\n </div>\n )}\n {nothingFound && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {Boolean(localResults.length) && (\n <div className=\"chat-selection no-selection no-scrollbar\" dir={lang.isRtl ? 'rtl' : undefined}>\n {localResults.map((id) => (\n <PickerSelectedItem\n chatOrUserId={id}\n onClick={handlePickerItemClick}\n clickArg={id}\n />\n ))}\n </div>\n )}\n {Boolean(localResults.length) && (\n <div className=\"search-section\">\n <h3 className=\"section-heading\" dir={lang.isRtl ? 'auto' : undefined}>\n {localResults.length > LESS_LIST_ITEMS_AMOUNT && (\n <Link onClick={handleClickShowMoreLocal}>\n {lang(shouldShowMoreLocal ? 'ChatList.Search.ShowLess' : 'ChatList.Search.ShowMore')}\n </Link>\n )}\n {lang('DialogList.SearchSectionDialogs')}\n </h3>\n {localResults.map((id, index) => {\n if (!shouldShowMoreLocal && index >= LESS_LIST_ITEMS_AMOUNT) {\n return undefined;\n }\n\n return (\n <LeftSearchResultChat\n chatId={id}\n onClick={handleChatClick}\n />\n );\n })}\n </div>\n )}\n {Boolean(globalResults.length) && (\n <div className=\"search-section\">\n <h3 className=\"section-heading\" dir={lang.isRtl ? 'auto' : undefined}>\n {globalResults.length > LESS_LIST_ITEMS_AMOUNT && (\n <Link onClick={handleClickShowMoreGlobal}>\n {lang(shouldShowMoreGlobal ? 'ChatList.Search.ShowLess' : 'ChatList.Search.ShowMore')}\n </Link>\n )}\n {lang('DialogList.SearchSectionGlobal')}\n </h3>\n {globalResults.map((id, index) => {\n if (!shouldShowMoreGlobal && index >= LESS_LIST_ITEMS_AMOUNT) {\n return undefined;\n }\n\n return (\n <LeftSearchResultChat\n chatId={id}\n withUsername\n onClick={handleChatClick}\n />\n );\n })}\n </div>\n )}\n {Boolean(foundMessages.length) && (\n <div className=\"search-section\">\n <h3 className=\"section-heading\" dir={lang.isRtl ? 'auto' : undefined}>{lang('SearchMessages')}</h3>\n {foundMessages.map(renderFoundMessage)}\n </div>\n )}\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { byId: chatsById } = global.chats;\n\n const { userIds: localContactIds } = global.contactList || {};\n\n if (!localContactIds) {\n return {\n chatsById,\n };\n }\n\n const {\n currentUserId, messages, lastSyncTime,\n } = global;\n const {\n fetchingStatus, globalResults, localResults, resultsByType,\n } = global.globalSearch;\n const { chatIds: globalChatIds, userIds: globalUserIds } = globalResults || {};\n const { chatIds: localChatIds, userIds: localUserIds } = localResults || {};\n const { byChatId: globalMessagesByChatId } = messages;\n const foundIds = resultsByType?.text?.foundIds;\n\n return {\n currentUserId,\n localContactIds,\n localChatIds,\n localUserIds,\n globalChatIds,\n globalUserIds,\n foundIds,\n globalMessagesByChatId,\n chatsById,\n fetchingStatus,\n lastSyncTime,\n };\n },\n)(ChatResults));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiMessage } from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport { throttle } from '../../../util/schedulers';\nimport useLang from '../../../hooks/useLang';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport NothingFound from '../../common/NothingFound';\nimport ChatMessage from './ChatMessage';\nimport DateSuggest from './DateSuggest';\n\nexport type OwnProps = {\n searchQuery?: string;\n dateSearchQuery?: string;\n onReset: () => void;\n onSearchDateSelect: (value: Date) => void;\n};\n\ntype StateProps = {\n currentUserId?: string;\n foundIds?: string[];\n globalMessagesByChatId?: Record<string, { byId: Record<number, ApiMessage> }>;\n chatsById: Record<string, ApiChat>;\n fetchingStatus?: { chats?: boolean; messages?: boolean };\n lastSyncTime?: number;\n};\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst ChatMessageResults: FC<OwnProps & StateProps> = ({\n searchQuery,\n currentUserId,\n dateSearchQuery,\n foundIds,\n globalMessagesByChatId,\n chatsById,\n fetchingStatus,\n lastSyncTime,\n onSearchDateSelect,\n}) => {\n const { searchMessagesGlobal } = getActions();\n\n const lang = useLang();\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: 'text',\n query: searchQuery,\n chatId: currentUserId,\n });\n });\n }\n }, [currentUserId, lastSyncTime, searchMessagesGlobal, searchQuery]);\n\n const foundMessages = useMemo(() => {\n if (!foundIds || foundIds.length === 0) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds\n .map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId?.[chatId]?.byId[Number(messageId)];\n })\n .filter<ApiMessage>(Boolean as any)\n .sort((a, b) => b.date - a.date);\n }, [foundIds, globalMessagesByChatId]);\n\n function renderFoundMessage(message: ApiMessage) {\n const text = renderMessageSummary(lang, message);\n const chat = chatsById[message.chatId];\n\n if (!text || !chat) {\n return undefined;\n }\n\n return (\n <ChatMessage\n chatId={message.chatId}\n message={message}\n searchQuery={searchQuery}\n />\n );\n }\n\n const nothingFound = fetchingStatus && !fetchingStatus.chats && !fetchingStatus.messages && !foundMessages.length;\n\n return (\n <div className=\"LeftSearch\">\n <InfiniteScroll\n className=\"search-content custom-scroll chat-list\"\n items={foundMessages}\n onLoadMore={handleLoadMore}\n noFastList\n >\n {dateSearchQuery && (\n <div className=\"chat-selection no-selection no-scrollbar\">\n <DateSuggest\n searchDate={dateSearchQuery}\n onSelect={onSearchDateSelect}\n />\n </div>\n )}\n {nothingFound && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {foundMessages.map(renderFoundMessage)}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { byId: chatsById } = global.chats;\n const { currentUserId, messages: { byChatId: globalMessagesByChatId }, lastSyncTime } = global;\n const { fetchingStatus, resultsByType } = global.globalSearch;\n\n const { foundIds } = (resultsByType?.text) || {};\n\n return {\n currentUserId,\n foundIds,\n globalMessagesByChatId,\n chatsById,\n fetchingStatus,\n lastSyncTime,\n };\n },\n)(ChatMessageResults));\n","import type { GlobalState } from '../../../../global/types';\nimport type {\n ApiChat, ApiGlobalMessageSearchType, ApiMessage, ApiUser,\n} from '../../../../api/types';\nimport type { ISettings } from '../../../../types';\n\nimport { selectChat, selectTheme } from '../../../../global/selectors';\n\nexport type StateProps = {\n theme: ISettings['theme'];\n isLoading?: boolean;\n chatsById: Record<string, ApiChat>;\n usersById: Record<string, ApiUser>;\n globalMessagesByChatId?: Record<string, { byId: Record<number, ApiMessage> }>;\n foundIds?: string[];\n lastSyncTime?: number;\n searchChatId?: string;\n activeDownloads: Record<string, number[]>;\n isChatProtected?: boolean;\n};\n\nexport function createMapStateToProps(type: ApiGlobalMessageSearchType) {\n return (global: GlobalState, props: any) => {\n const { byId: chatsById } = global.chats;\n const { byId: usersById } = global.users;\n const {\n fetchingStatus, resultsByType, chatId,\n } = global.globalSearch;\n\n // One component is used for two different types of results.\n // The differences between them are only in the isVoice property.\n // The rest of the search results use their own personal components.\n const currentType = type !== 'audio' ? type : (props?.isVoice ? 'voice' : 'audio');\n\n const { byChatId: globalMessagesByChatId } = global.messages;\n const foundIds = resultsByType?.[currentType]?.foundIds;\n\n const activeDownloads = global.activeDownloads.byChatId;\n\n return {\n theme: selectTheme(global),\n isLoading: foundIds === undefined\n || (fetchingStatus ? Boolean(fetchingStatus.chats || fetchingStatus.messages) : false),\n chatsById,\n usersById,\n globalMessagesByChatId,\n foundIds,\n searchChatId: chatId,\n activeDownloads,\n isChatProtected: chatId ? selectChat(global, chatId)?.isProtected : undefined,\n lastSyncTime: global.lastSyncTime,\n };\n };\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { LoadMoreDirection, MediaViewerOrigin } from '../../../types';\n\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport { SLIDE_TRANSITION_DURATION } from '../../../config';\nimport type { StateProps } from './helpers/createMapStateToProps';\nimport { createMapStateToProps } from './helpers/createMapStateToProps';\nimport buildClassName from '../../../util/buildClassName';\nimport { throttle } from '../../../util/schedulers';\nimport useLang from '../../../hooks/useLang';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Media from '../../common/Media';\nimport ChatMessage from './ChatMessage';\nimport NothingFound from '../../common/NothingFound';\nimport Loading from '../../ui/Loading';\n\nexport type OwnProps = {\n searchQuery?: string;\n};\n\nconst CURRENT_TYPE = 'media';\nconst INTERSECTION_THROTTLE = 500;\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst MediaResults: FC<OwnProps & StateProps> = ({\n searchQuery,\n searchChatId,\n isLoading,\n globalMessagesByChatId,\n foundIds,\n lastSyncTime,\n isChatProtected,\n}) => {\n const {\n searchMessagesGlobal,\n openMediaViewer,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const { observe: observeIntersectionForMedia } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n });\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: CURRENT_TYPE,\n query: searchQuery,\n chatId: searchChatId,\n });\n });\n }\n }, [lastSyncTime, searchMessagesGlobal, searchQuery, searchChatId]);\n\n const foundMessages = useMemo(() => {\n if (!foundIds || !globalMessagesByChatId) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds.map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId[chatId]?.byId[Number(messageId)];\n }).filter(Boolean);\n }, [globalMessagesByChatId, foundIds]);\n\n const handleSelectMedia = useCallback((messageId: number, chatId: string) => {\n openMediaViewer({\n chatId,\n messageId,\n origin: MediaViewerOrigin.SearchResult,\n });\n }, [openMediaViewer]);\n\n function renderGallery() {\n return (\n <div className=\"media-list\" dir={lang.isRtl ? 'rtl' : undefined}>\n {foundMessages.map((message) => (\n <Media\n key={message.id}\n idPrefix=\"search-media\"\n message={message}\n isProtected={isChatProtected || message.isProtected}\n observeIntersection={observeIntersectionForMedia}\n onClick={handleSelectMedia}\n />\n ))}\n </div>\n );\n }\n\n function renderSearchResult() {\n return foundMessages.map((message) => (\n <ChatMessage\n key={message.id}\n chatId={message.chatId}\n message={message}\n />\n ));\n }\n\n const canRenderContents = useAsyncRendering([searchQuery], SLIDE_TRANSITION_DURATION) && !isLoading;\n const isMediaGrid = canRenderContents && foundIds && foundIds.length > 0 && !searchQuery;\n const isMessageList = canRenderContents && foundIds && foundIds.length > 0 && searchQuery;\n\n const classNames = buildClassName(\n 'search-content custom-scroll',\n isMessageList && 'chat-list',\n );\n\n return (\n <div ref={containerRef} className=\"LeftSearch\">\n <InfiniteScroll\n className={classNames}\n items={foundMessages}\n itemSelector={!searchQuery ? '.Media' : '.ListItem'}\n onLoadMore={handleLoadMore}\n noFastList\n >\n {!canRenderContents && <Loading />}\n {canRenderContents && (!foundIds || foundIds.length === 0) && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {isMediaGrid && renderGallery()}\n {isMessageList && renderSearchResult()}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n createMapStateToProps(CURRENT_TYPE),\n)(MediaResults));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { LoadMoreDirection } from '../../../types';\n\nimport { SLIDE_TRANSITION_DURATION } from '../../../config';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport type { StateProps } from './helpers/createMapStateToProps';\nimport { createMapStateToProps } from './helpers/createMapStateToProps';\nimport { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';\nimport { getSenderName } from './helpers/getSenderName';\nimport { throttle } from '../../../util/schedulers';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport useLang from '../../../hooks/useLang';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport WebLink from '../../common/WebLink';\nimport NothingFound from '../../common/NothingFound';\nimport Loading from '../../ui/Loading';\n\nexport type OwnProps = {\n searchQuery?: string;\n};\n\nconst CURRENT_TYPE = 'links';\nconst INTERSECTION_THROTTLE = 500;\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst LinkResults: FC<OwnProps & StateProps> = ({\n searchQuery,\n searchChatId,\n isLoading,\n chatsById,\n usersById,\n globalMessagesByChatId,\n foundIds,\n lastSyncTime,\n isChatProtected,\n}) => {\n const {\n searchMessagesGlobal,\n focusMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const { observe: observeIntersectionForMedia } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n });\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: CURRENT_TYPE,\n query: searchQuery,\n chatId: searchChatId,\n });\n });\n }\n }, [lastSyncTime, searchMessagesGlobal, searchQuery, searchChatId]);\n\n const foundMessages = useMemo(() => {\n if (!foundIds || !globalMessagesByChatId) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds.map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId[chatId]?.byId[Number(messageId)];\n }).filter(Boolean);\n }, [globalMessagesByChatId, foundIds]);\n\n const handleMessageFocus = useCallback((messageId: number, chatId: string) => {\n focusMessage({ chatId, messageId });\n }, [focusMessage]);\n\n function renderList() {\n return foundMessages.map((message, index) => {\n const shouldDrawDateDivider = index === 0\n || toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);\n return (\n <div\n className=\"ListItem small-icon\"\n dir={lang.isRtl ? 'rtl' : undefined}\n key={message.id}\n >\n {shouldDrawDateDivider && (\n <p className=\"section-heading\" dir={lang.isRtl ? 'rtl' : undefined}>\n {formatMonthAndYear(lang, new Date(message.date * 1000))}\n </p>\n )}\n <WebLink\n key={message.id}\n message={message}\n senderTitle={getSenderName(lang, message, chatsById, usersById)}\n isProtected={isChatProtected || message.isProtected}\n observeIntersection={observeIntersectionForMedia}\n onMessageClick={handleMessageFocus}\n />\n </div>\n );\n });\n }\n\n const canRenderContents = useAsyncRendering([searchQuery], SLIDE_TRANSITION_DURATION) && !isLoading;\n\n return (\n <div ref={containerRef} className=\"LeftSearch\">\n <InfiniteScroll\n className=\"search-content documents-list custom-scroll\"\n items={foundMessages}\n onLoadMore={handleLoadMore}\n noFastList\n >\n {!canRenderContents && <Loading />}\n {canRenderContents && (!foundIds || foundIds.length === 0) && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {canRenderContents && foundIds && foundIds.length > 0 && renderList()}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n createMapStateToProps(CURRENT_TYPE),\n)(LinkResults));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiMessage } from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport { SLIDE_TRANSITION_DURATION } from '../../../config';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport type { StateProps } from './helpers/createMapStateToProps';\nimport { createMapStateToProps } from './helpers/createMapStateToProps';\nimport { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';\nimport { getSenderName } from './helpers/getSenderName';\nimport { throttle } from '../../../util/schedulers';\nimport { getMessageDocument } from '../../../global/helpers';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport useLang from '../../../hooks/useLang';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\n\nimport Document from '../../common/Document';\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport NothingFound from '../../common/NothingFound';\nimport Loading from '../../ui/Loading';\n\nexport type OwnProps = {\n searchQuery?: string;\n};\n\nconst CURRENT_TYPE = 'documents';\nconst INTERSECTION_THROTTLE = 500;\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst FileResults: FC<OwnProps & StateProps> = ({\n searchQuery,\n searchChatId,\n isLoading,\n chatsById,\n usersById,\n globalMessagesByChatId,\n foundIds,\n activeDownloads,\n lastSyncTime,\n}) => {\n const {\n searchMessagesGlobal,\n focusMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const { observe: observeIntersectionForMedia } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n });\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: CURRENT_TYPE,\n query: searchQuery,\n chatId: searchChatId,\n });\n });\n }\n }, [lastSyncTime, searchMessagesGlobal, searchQuery, searchChatId]);\n\n const foundMessages = useMemo(() => {\n if (!foundIds || !globalMessagesByChatId) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds.map((id) => {\n const [chatId, messageId] = id.split('_');\n const message = globalMessagesByChatId[chatId]?.byId[Number(messageId)];\n\n return message && getMessageDocument(message) ? message : undefined;\n }).filter(Boolean) as ApiMessage[];\n }, [globalMessagesByChatId, foundIds]);\n\n const handleMessageFocus = useCallback((messageId: number, chatId: string) => {\n focusMessage({ chatId, messageId });\n }, [focusMessage]);\n\n function renderList() {\n return foundMessages.map((message, index) => {\n const shouldDrawDateDivider = index === 0\n || toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);\n return (\n <div\n className=\"ListItem small-icon\"\n key={message.id}\n >\n {shouldDrawDateDivider && (\n <p className=\"section-heading\">{formatMonthAndYear(lang, new Date(message.date * 1000))}</p>\n )}\n <Document\n message={message}\n withDate\n datetime={message.date}\n smaller\n sender={getSenderName(lang, message, chatsById, usersById)}\n className=\"scroll-item\"\n isDownloading={activeDownloads[message.chatId]?.includes(message.id)}\n observeIntersection={observeIntersectionForMedia}\n onDateClick={handleMessageFocus}\n />\n </div>\n );\n });\n }\n\n const canRenderContents = useAsyncRendering([searchQuery], SLIDE_TRANSITION_DURATION) && !isLoading;\n\n return (\n <div ref={containerRef} className=\"LeftSearch\">\n <InfiniteScroll\n className=\"search-content documents-list custom-scroll\"\n items={foundMessages}\n onLoadMore={handleLoadMore}\n noFastList\n >\n {!canRenderContents && <Loading />}\n {canRenderContents && (!foundIds || foundIds.length === 0) && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {canRenderContents && foundIds && foundIds.length > 0 && renderList()}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n createMapStateToProps(CURRENT_TYPE),\n)(FileResults));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { AudioOrigin, LoadMoreDirection } from '../../../types';\n\nimport { SLIDE_TRANSITION_DURATION } from '../../../config';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport type { StateProps } from './helpers/createMapStateToProps';\nimport { createMapStateToProps } from './helpers/createMapStateToProps';\nimport { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';\nimport { getSenderName } from './helpers/getSenderName';\nimport { throttle } from '../../../util/schedulers';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport useLang from '../../../hooks/useLang';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Audio from '../../common/Audio';\nimport NothingFound from '../../common/NothingFound';\nimport Loading from '../../ui/Loading';\n\nexport type OwnProps = {\n isVoice?: boolean;\n searchQuery?: string;\n};\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst AudioResults: FC<OwnProps & StateProps> = ({\n theme,\n isVoice,\n searchQuery,\n searchChatId,\n isLoading,\n chatsById,\n usersById,\n globalMessagesByChatId,\n foundIds,\n lastSyncTime,\n activeDownloads,\n}) => {\n const {\n searchMessagesGlobal,\n focusMessage,\n openAudioPlayer,\n } = getActions();\n\n const lang = useLang();\n const currentType = isVoice ? 'voice' : 'audio';\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: currentType,\n query: searchQuery,\n chatId: searchChatId,\n });\n });\n }\n }, [currentType, lastSyncTime, searchMessagesGlobal, searchQuery, searchChatId]);\n\n const foundMessages = useMemo(() => {\n if (!foundIds || !globalMessagesByChatId) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds.map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId[chatId]?.byId[Number(messageId)];\n }).filter(Boolean);\n }, [globalMessagesByChatId, foundIds]);\n\n const handleMessageFocus = useCallback((messageId: number, chatId: string) => {\n focusMessage({ chatId, messageId });\n }, [focusMessage]);\n\n const handlePlayAudio = useCallback((messageId: number, chatId: string) => {\n openAudioPlayer({ chatId, messageId });\n }, [openAudioPlayer]);\n\n function renderList() {\n return foundMessages.map((message, index) => {\n const shouldDrawDateDivider = index === 0\n || toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);\n return (\n <div\n className=\"ListItem small-icon\"\n key={message.id}\n >\n {shouldDrawDateDivider && (\n <p className=\"section-heading\" dir={lang.isRtl ? 'rtl' : undefined}>\n {formatMonthAndYear(lang, new Date(message.date * 1000))}\n </p>\n )}\n <Audio\n key={message.id}\n theme={theme}\n message={message}\n origin={AudioOrigin.Search}\n senderTitle={getSenderName(lang, message, chatsById, usersById)}\n date={message.date}\n lastSyncTime={lastSyncTime}\n className=\"scroll-item\"\n onPlay={handlePlayAudio}\n onDateClick={handleMessageFocus}\n isDownloading={activeDownloads[message.chatId]?.includes(message.id)}\n />\n </div>\n );\n });\n }\n\n const canRenderContents = useAsyncRendering([searchQuery], SLIDE_TRANSITION_DURATION) && !isLoading;\n\n return (\n <div className=\"LeftSearch\">\n <InfiniteScroll\n className=\"search-content documents-list custom-scroll\"\n items={foundMessages}\n onLoadMore={handleLoadMore}\n noFastList\n >\n {!canRenderContents && <Loading />}\n {canRenderContents && (!foundIds || foundIds.length === 0) && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {canRenderContents && foundIds && foundIds.length > 0 && renderList()}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n createMapStateToProps('audio'),\n)(AudioResults));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useState, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { GlobalSearchContent } from '../../../types';\n\nimport { parseDateString } from '../../../util/dateFormat';\nimport useKeyboardListNavigation from '../../../hooks/useKeyboardListNavigation';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport TabList from '../../ui/TabList';\nimport Transition from '../../ui/Transition';\nimport ChatResults from './ChatResults';\nimport UserChatResults from './ChatMessageResults';\nimport MediaResults from './MediaResults';\nimport LinkResults from './LinkResults';\nimport FileResults from './FileResults';\nimport AudioResults from './AudioResults';\n\nimport './LeftSearch.scss';\n\nexport type OwnProps = {\n searchQuery?: string;\n searchDate?: number;\n isActive: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n currentContent?: GlobalSearchContent;\n chatId?: string;\n};\n\nconst TABS = [\n { type: GlobalSearchContent.ChatList, title: 'SearchAllChatsShort' },\n { type: GlobalSearchContent.Media, title: 'SharedMediaTab2' },\n { type: GlobalSearchContent.Links, title: 'SharedLinksTab2' },\n { type: GlobalSearchContent.Files, title: 'SharedFilesTab2' },\n { type: GlobalSearchContent.Music, title: 'SharedMusicTab2' },\n { type: GlobalSearchContent.Voice, title: 'SharedVoiceTab2' },\n];\n\nconst CHAT_TABS = [\n { type: GlobalSearchContent.ChatList, title: 'All Messages' },\n ...TABS.slice(1),\n];\n\nconst TRANSITION_RENDER_COUNT = Object.keys(GlobalSearchContent).length / 2;\n\nconst LeftSearch: FC<OwnProps & StateProps> = ({\n searchQuery,\n searchDate,\n isActive,\n currentContent = GlobalSearchContent.ChatList,\n chatId,\n onReset,\n}) => {\n const {\n setGlobalSearchContent,\n setGlobalSearchDate,\n } = getActions();\n\n const lang = useLang();\n const [activeTab, setActiveTab] = useState(currentContent);\n const dateSearchQuery = useMemo(() => parseDateString(searchQuery), [searchQuery]);\n\n const handleSwitchTab = useCallback((index: number) => {\n const tab = TABS[index];\n setGlobalSearchContent({ content: tab.type });\n setActiveTab(index);\n }, [setGlobalSearchContent]);\n\n const handleSearchDateSelect = useCallback((value: Date) => {\n setGlobalSearchDate({ date: value.getTime() / 1000 });\n }, [setGlobalSearchDate]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isActive, undefined, '.ListItem-button', true);\n\n return (\n <div className=\"LeftSearch\" ref={containerRef} onKeyDown={handleKeyDown}>\n <TabList activeTab={activeTab} tabs={chatId ? CHAT_TABS : TABS} onSwitchTab={handleSwitchTab} />\n <Transition\n name={lang.isRtl ? 'slide-optimized-rtl' : 'slide-optimized'}\n renderCount={TRANSITION_RENDER_COUNT}\n activeKey={currentContent}\n >\n {(() => {\n switch (currentContent) {\n case GlobalSearchContent.ChatList:\n if (chatId) {\n return (\n <UserChatResults\n searchQuery={searchQuery}\n dateSearchQuery={dateSearchQuery}\n onReset={onReset}\n onSearchDateSelect={handleSearchDateSelect}\n />\n );\n }\n return (\n <ChatResults\n searchQuery={searchQuery}\n searchDate={searchDate}\n dateSearchQuery={dateSearchQuery}\n onReset={onReset}\n onSearchDateSelect={handleSearchDateSelect}\n />\n );\n case GlobalSearchContent.Media:\n return <MediaResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Links:\n return <LinkResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Files:\n return <FileResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Music:\n return (\n <AudioResults\n key=\"audio\"\n searchQuery={searchQuery}\n />\n );\n case GlobalSearchContent.Voice:\n return (\n <AudioResults\n key=\"voice\"\n isVoice\n searchQuery={searchQuery}\n />\n );\n default:\n return undefined;\n }\n })()}\n </Transition>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentContent, chatId } = global.globalSearch;\n\n return { currentContent, chatId };\n },\n)(LeftSearch));\n","import type { StateReducer, Dispatch } from '../useReducer';\nimport useReducer from '../useReducer';\n\nexport type TwoFaActions = (\n 'setCurrentPassword' | 'setPassword' | 'setHint' | 'setEmail' | 'reset'\n);\nexport type TwoFaDispatch = Dispatch<TwoFaActions>;\n\nexport type TwoFaState = {\n currentPassword: string;\n password: string;\n hint: string;\n email: string;\n};\n\nconst INITIAL_STATE: TwoFaState = {\n currentPassword: '',\n password: '',\n hint: '',\n email: '',\n};\n\nconst twoFaReducer: StateReducer<TwoFaState, TwoFaActions> = (\n state,\n action,\n) => {\n switch (action.type) {\n case 'setCurrentPassword':\n return {\n ...state,\n currentPassword: action.payload,\n };\n\n case 'setPassword':\n return {\n ...state,\n password: action.payload,\n };\n\n case 'setHint':\n return {\n ...state,\n hint: action.payload,\n };\n\n case 'setEmail':\n return {\n ...state,\n email: action.payload,\n };\n\n case 'reset':\n return INITIAL_STATE;\n\n default:\n return state;\n }\n};\n\nconst useTwoFaReducer = () => {\n return useReducer(twoFaReducer, INITIAL_STATE);\n};\n\nexport default useTwoFaReducer;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport { SettingsScreens } from '../../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport useLang from '../../../hooks/useLang';\n\nimport DropdownMenu from '../../ui/DropdownMenu';\nimport MenuItem from '../../ui/MenuItem';\nimport Button from '../../ui/Button';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\ntype OwnProps = {\n currentScreen: SettingsScreens;\n editedFolderId?: number;\n onReset: () => void;\n onSaveFilter: () => void;\n onScreenSelect: (screen: SettingsScreens) => void;\n};\n\nconst SettingsHeader: FC<OwnProps> = ({\n currentScreen,\n editedFolderId,\n onReset,\n onSaveFilter,\n onScreenSelect,\n}) => {\n const {\n signOut,\n deleteChatFolder,\n } = getActions();\n\n const [isSignOutDialogOpen, setIsSignOutDialogOpen] = useState(false);\n const [isDeleteFolderDialogOpen, setIsDeleteFolderDialogOpen] = useState(false);\n\n const openSignOutConfirmation = useCallback(() => {\n setIsSignOutDialogOpen(true);\n }, []);\n\n const closeSignOutConfirmation = useCallback(() => {\n setIsSignOutDialogOpen(false);\n }, []);\n\n const openDeleteFolderConfirmation = useCallback(() => {\n setIsDeleteFolderDialogOpen(true);\n }, []);\n\n const closeDeleteFolderConfirmation = useCallback(() => {\n setIsDeleteFolderDialogOpen(false);\n }, []);\n\n const handleSignOutMessage = useCallback(() => {\n closeSignOutConfirmation();\n signOut();\n }, [closeSignOutConfirmation, signOut]);\n\n const handleDeleteFolderMessage = useCallback(() => {\n closeDeleteFolderConfirmation();\n deleteChatFolder({ id: editedFolderId });\n onReset();\n }, [editedFolderId, closeDeleteFolderConfirmation, deleteChatFolder, onReset]);\n\n const SettingsMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"More actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n const lang = useLang();\n\n function renderHeaderContent() {\n switch (currentScreen) {\n case SettingsScreens.EditProfile:\n return <h3>{lang('lng_settings_information')}</h3>;\n case SettingsScreens.General:\n return <h3>{lang('General')}</h3>;\n case SettingsScreens.QuickReaction:\n return <h3>{lang('DoubleTapSetting')}</h3>;\n case SettingsScreens.Notifications:\n return <h3>{lang('Notifications')}</h3>;\n case SettingsScreens.DataStorage:\n return <h3>{lang('DataSettings')}</h3>;\n case SettingsScreens.Privacy:\n return <h3>{lang('PrivacySettings')}</h3>;\n case SettingsScreens.Language:\n return <h3>{lang('Language')}</h3>;\n\n case SettingsScreens.GeneralChatBackground:\n return <h3>{lang('ChatBackground')}</h3>;\n case SettingsScreens.GeneralChatBackgroundColor:\n return <h3>{lang('SetColor')}</h3>;\n\n case SettingsScreens.PrivacyPhoneNumber:\n return <h3>{lang('PrivacyPhone')}</h3>;\n case SettingsScreens.PrivacyLastSeen:\n return <h3>{lang('PrivacyLastSeen')}</h3>;\n case SettingsScreens.PrivacyProfilePhoto:\n return <h3>{lang('Privacy.ProfilePhoto')}</h3>;\n case SettingsScreens.PrivacyForwarding:\n return <h3>{lang('PrivacyForwards')}</h3>;\n case SettingsScreens.PrivacyGroupChats:\n return <h3>{lang('AutodownloadGroupChats')}</h3>;\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return <h3>{lang('AlwaysShareWith')}</h3>;\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return <h3>{lang('NeverShareWith')}</h3>;\n\n case SettingsScreens.ActiveSessions:\n return <h3>{lang('SessionsTitle')}</h3>;\n case SettingsScreens.PrivacyBlockedUsers:\n return <h3>{lang('BlockedUsers')}</h3>;\n\n case SettingsScreens.TwoFaDisabled:\n case SettingsScreens.TwoFaEnabled:\n return <h3>{lang('TwoStepVerification')}</h3>;\n case SettingsScreens.TwoFaNewPassword:\n case SettingsScreens.TwoFaChangePasswordNew:\n case SettingsScreens.TwoFaChangePasswordConfirm:\n return <h3>{lang('PleaseEnterCurrentPassword')}</h3>;\n case SettingsScreens.TwoFaNewPasswordConfirm:\n return <h3>{lang('PleaseReEnterPassword')}</h3>;\n case SettingsScreens.TwoFaNewPasswordHint:\n case SettingsScreens.TwoFaChangePasswordHint:\n return <h3>{lang('PasswordHint')}</h3>;\n case SettingsScreens.TwoFaNewPasswordEmail:\n case SettingsScreens.TwoFaRecoveryEmail:\n return <h3>{lang('RecoveryEmailTitle')}</h3>;\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return <h3>Recovery Email Code</h3>;\n case SettingsScreens.TwoFaCongratulations:\n return <h3>{lang('TwoStepVerificationPasswordSet')}</h3>;\n case SettingsScreens.TwoFaChangePasswordCurrent:\n case SettingsScreens.TwoFaTurnOff:\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n return <h3>{lang('PleaseEnterCurrentPassword')}</h3>;\n\n case SettingsScreens.PasscodeDisabled:\n case SettingsScreens.PasscodeEnabled:\n case SettingsScreens.PasscodeNewPasscode:\n case SettingsScreens.PasscodeNewPasscodeConfirm:\n case SettingsScreens.PasscodeCongratulations:\n return <h3>{lang('Passcode')}</h3>;\n\n case SettingsScreens.PasscodeTurnOff:\n return <h3>{lang('PasscodeController.Disable.Title')}</h3>;\n\n case SettingsScreens.PasscodeChangePasscodeCurrent:\n case SettingsScreens.PasscodeChangePasscodeNew:\n return <h3>{lang('PasscodeController.Change.Title')}</h3>;\n\n case SettingsScreens.PasscodeChangePasscodeConfirm:\n return <h3>{lang('PasscodeController.ReEnterPasscode.Placeholder')}</h3>;\n\n case SettingsScreens.Folders:\n return <h3>{lang('Filters')}</h3>;\n case SettingsScreens.FoldersCreateFolder:\n return <h3>{lang('FilterNew')}</h3>;\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n return (\n <div className=\"settings-main-header\">\n <h3>{lang('FilterEdit')}</h3>\n\n {editedFolderId && (\n <DropdownMenu\n className=\"settings-more-menu\"\n trigger={SettingsMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"delete\" destructive onClick={openDeleteFolderConfirmation}>\n {lang('Delete')}\n </MenuItem>\n </DropdownMenu>\n )}\n </div>\n );\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <div className=\"settings-main-header\">\n {(currentScreen === SettingsScreens.FoldersIncludedChats\n || currentScreen === SettingsScreens.FoldersIncludedChatsFromChatList) ? (\n <h3>{lang('FilterInclude')}</h3>\n ) : (\n <h3>{lang('FilterExclude')}</h3>\n )}\n\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n className=\"color-primary\"\n onClick={onSaveFilter}\n ariaLabel={lang('AutoDeleteConfirm')}\n >\n <i className=\"icon-check\" />\n </Button>\n </div>\n );\n\n default:\n return (\n <div className=\"settings-main-header\">\n <h3>{lang('SETTINGS')}</h3>\n\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.EditProfile)}\n ariaLabel={lang('lng_settings_information')}\n >\n <i className=\"icon-edit\" />\n </Button>\n <DropdownMenu\n className=\"settings-more-menu\"\n trigger={SettingsMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"logout\" onClick={openSignOutConfirmation}>{lang('LogOutTitle')}</MenuItem>\n </DropdownMenu>\n </div>\n );\n }\n }\n\n return (\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel={lang('AccDescrGoBack')}\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n {renderHeaderContent()}\n <ConfirmDialog\n isOpen={isSignOutDialogOpen}\n onClose={closeSignOutConfirmation}\n text={lang('lng_sure_logout')}\n confirmLabel={lang('AccountSettings.Logout')}\n confirmHandler={handleSignOutMessage}\n confirmIsDestructive\n />\n <ConfirmDialog\n isOpen={isDeleteFolderDialogOpen}\n onClose={closeDeleteFolderConfirmation}\n text={lang('FilterDeleteAlert')}\n confirmLabel={lang('Delete')}\n confirmHandler={handleDeleteFolderMessage}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(SettingsHeader);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens } from '../../../types';\nimport type { ApiUser } from '../../../api/types';\n\nimport { selectUser } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport ProfileInfo from '../../common/ProfileInfo';\nimport ChatExtra from '../../common/ChatExtra';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n sessionCount: number;\n currentUser?: ApiUser;\n lastSyncTime?: number;\n};\n\nconst SettingsMain: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n currentUser,\n sessionCount,\n lastSyncTime,\n}) => {\n const { loadProfilePhotos, loadAuthorizations } = getActions();\n\n const lang = useLang();\n const profileId = currentUser?.id;\n\n useEffect(() => {\n if (profileId && lastSyncTime) {\n loadProfilePhotos({ profileId });\n }\n }, [lastSyncTime, profileId, loadProfilePhotos]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n useEffect(() => {\n if (lastSyncTime) {\n loadAuthorizations();\n }\n }, [lastSyncTime, loadAuthorizations]);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-main-menu\">\n {currentUser && (\n <ProfileInfo\n userId={currentUser.id}\n forceShowSelf\n />\n )}\n {currentUser && (\n <ChatExtra\n chatOrUserId={currentUser.id}\n forceShowSelf\n />\n )}\n <ListItem\n icon=\"settings\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.General)}\n >\n {lang('Telegram.GeneralSettingsViewController')}\n </ListItem>\n <ListItem\n icon=\"unmute\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Notifications)}\n >\n {lang('Notifications')}\n </ListItem>\n <ListItem\n icon=\"data\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.DataStorage)}\n >\n {lang('DataSettings')}\n </ListItem>\n <ListItem\n icon=\"lock\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Privacy)}\n >\n {lang('PrivacySettings')}\n </ListItem>\n <ListItem\n icon=\"folder\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Folders)}\n >\n {lang('Filters')}\n </ListItem>\n <ListItem\n icon=\"active-sessions\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.ActiveSessions)}\n >\n {lang('SessionsTitle')}\n {sessionCount > 0 && (<span className=\"settings-item__current-value\">{sessionCount}</span>)}\n </ListItem>\n <ListItem\n icon=\"language\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Language)}\n >\n {lang('Language')}\n <span className=\"settings-item__current-value\">{lang.langName}</span>\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId, lastSyncTime } = global;\n\n return {\n sessionCount: global.activeSessions.orderedHashes.length,\n currentUser: currentUserId ? selectUser(global, currentUserId) : undefined,\n lastSyncTime,\n };\n },\n)(SettingsMain));\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, {\n useState, useCallback, memo, useEffect, useMemo,\n} from '../../lib/teact/teact';\n\nimport { debounce } from '../../util/schedulers';\nimport useLang from '../../hooks/useLang';\n\nimport InputText from '../ui/InputText';\n\ntype OwnProps = {\n currentUsername?: string;\n asLink?: boolean;\n isLoading?: boolean;\n isUsernameAvailable?: boolean;\n checkUsername: AnyToVoidFunction;\n onChange: (value: string | false) => void;\n};\n\nconst MIN_USERNAME_LENGTH = 5;\nconst MAX_USERNAME_LENGTH = 32;\nconst LINK_PREFIX = 'https://t.me/';\nconst LINK_PREFIX_REGEX = /https:\\/\\/t\\.me\\/?/i;\nconst USERNAME_REGEX = /^([a-zA-Z0-9_]+)$/;\n\nconst runDebouncedForCheckUsername = debounce((cb) => cb(), 250, false);\n\nfunction isUsernameValid(username: string) {\n return username.length >= MIN_USERNAME_LENGTH\n && username.length <= MAX_USERNAME_LENGTH\n && USERNAME_REGEX.test(username);\n}\n\nconst SettingsEditProfile: FC<OwnProps> = ({\n currentUsername,\n asLink,\n isLoading,\n isUsernameAvailable,\n checkUsername,\n onChange,\n}) => {\n const [username, setUsername] = useState(currentUsername || '');\n\n const lang = useLang();\n const langPrefix = asLink ? 'SetUrl' : 'Username';\n const label = asLink ? lang('SetUrlPlaceholder') : lang('Username');\n\n const [usernameSuccess, usernameError] = useMemo(() => {\n if (!username.length) {\n return [];\n }\n\n if (username.length < MIN_USERNAME_LENGTH) {\n return [undefined, `${label} is too short`];\n }\n if (username.length > MAX_USERNAME_LENGTH) {\n return [undefined, `${label} is too long`];\n }\n if (!USERNAME_REGEX.test(username)) {\n return [undefined, `${label} contains invalid characters`];\n }\n\n if (isUsernameAvailable === undefined) {\n return [];\n }\n\n // Variable `isUsernameAvailable` is initialized with `undefined`, so a strict false check is required\n return [\n isUsernameAvailable ? lang(`${langPrefix}Available`, 'Username') : undefined,\n isUsernameAvailable === false ? lang(`${langPrefix}InUse`) : undefined,\n ];\n }, [username, isUsernameAvailable, lang, langPrefix, label]);\n\n useEffect(() => {\n setUsername(currentUsername || '');\n }, [asLink, currentUsername]);\n\n const handleUsernameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const newUsername = e.target.value.trim().replace(LINK_PREFIX_REGEX, '');\n setUsername(newUsername);\n e.target.value = `${asLink ? LINK_PREFIX : ''}${newUsername}`;\n\n const isValid = isUsernameValid(newUsername);\n\n if (isValid) {\n runDebouncedForCheckUsername(() => {\n checkUsername({ username: newUsername });\n });\n }\n\n if (onChange) {\n onChange(isValid ? newUsername : false);\n }\n }, [asLink, checkUsername, onChange]);\n\n return (\n <InputText\n value={`${asLink ? LINK_PREFIX : ''}${username}`}\n onChange={handleUsernameChange}\n label={label}\n error={usernameError}\n success={usernameSuccess}\n readOnly={isLoading}\n />\n );\n};\n\nexport default memo(SettingsEditProfile);\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n useState, useCallback, memo, useEffect, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiMediaFormat } from '../../../api/types';\nimport { ProfileEditProgress } from '../../../types';\n\nimport { throttle } from '../../../util/schedulers';\nimport { selectUser } from '../../../global/selectors';\nimport { getChatAvatarHash } from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport InputText from '../../ui/InputText';\nimport renderText from '../../common/helpers/renderText';\nimport UsernameInput from '../../common/UsernameInput';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\ntype OwnProps = {\n isActive: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n currentAvatarHash?: string;\n currentFirstName?: string;\n currentLastName?: string;\n currentBio?: string;\n currentUsername?: string;\n progress?: ProfileEditProgress;\n isUsernameAvailable?: boolean;\n};\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst MAX_BIO_LENGTH = 70;\n\nconst ERROR_FIRST_NAME_MISSING = 'Please provide your first name';\nconst ERROR_BIO_TOO_LONG = 'Bio can\\' be longer than 70 characters';\n\nconst SettingsEditProfile: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n currentAvatarHash,\n currentFirstName,\n currentLastName,\n currentBio,\n currentUsername,\n progress,\n isUsernameAvailable,\n}) => {\n const {\n loadCurrentUser,\n updateProfile,\n checkUsername,\n } = getActions();\n\n const lang = useLang();\n\n const [isUsernameTouched, setIsUsernameTouched] = useState(false);\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [error, setError] = useState<string | undefined>();\n\n const [photo, setPhoto] = useState<File | undefined>();\n const [firstName, setFirstName] = useState(currentFirstName || '');\n const [lastName, setLastName] = useState(currentLastName || '');\n const [bio, setBio] = useState(currentBio || '');\n const [username, setUsername] = useState<string | false>(currentUsername || '');\n\n const currentAvatarBlobUrl = useMedia(currentAvatarHash, false, ApiMediaFormat.BlobUrl);\n\n const isLoading = progress === ProfileEditProgress.InProgress;\n const isUsernameError = username === false;\n\n const isSaveButtonShown = useMemo(() => {\n if (isUsernameError) {\n return false;\n }\n\n return Boolean(photo) || isProfileFieldsTouched || isUsernameAvailable === true;\n }, [photo, isProfileFieldsTouched, isUsernameError, isUsernameAvailable]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadCurrentUser();\n });\n }, [loadCurrentUser]);\n\n useEffect(() => {\n setPhoto(undefined);\n }, [currentAvatarBlobUrl]);\n\n useEffect(() => {\n setFirstName(currentFirstName || '');\n setLastName(currentLastName || '');\n setBio(currentBio || '');\n }, [currentFirstName, currentLastName, currentBio]);\n\n useEffect(() => {\n setUsername(currentUsername || '');\n }, [currentUsername]);\n\n useEffect(() => {\n if (progress === ProfileEditProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setIsUsernameTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handlePhotoChange = useCallback((newPhoto: File) => {\n setPhoto(newPhoto);\n }, []);\n\n const handleFirstNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleLastNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleBioChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setBio(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUsernameChange = useCallback((value: string | false) => {\n setUsername(value);\n setIsUsernameTouched(true);\n }, []);\n\n const handleProfileSave = useCallback(() => {\n const trimmedFirstName = firstName.trim();\n const trimmedLastName = lastName.trim();\n const trimmedBio = bio.trim();\n\n if (!trimmedFirstName.length) {\n setError(ERROR_FIRST_NAME_MISSING);\n return;\n }\n\n if (trimmedBio.length > MAX_BIO_LENGTH) {\n setError(ERROR_BIO_TOO_LONG);\n return;\n }\n\n updateProfile({\n photo,\n ...(isProfileFieldsTouched && {\n firstName: trimmedFirstName,\n lastName: trimmedLastName,\n bio: trimmedBio,\n }),\n ...(isUsernameTouched && {\n username,\n }),\n });\n }, [\n photo,\n firstName, lastName, bio, isProfileFieldsTouched,\n username, isUsernameTouched,\n updateProfile,\n ]);\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-edit-profile settings-item\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handlePhotoChange}\n title=\"Edit your profile photo\"\n disabled={isLoading}\n />\n <InputText\n value={firstName}\n onChange={handleFirstNameChange}\n label={lang('FirstName')}\n disabled={isLoading}\n error={error === ERROR_FIRST_NAME_MISSING ? error : undefined}\n />\n <InputText\n value={lastName}\n onChange={handleLastNameChange}\n label={lang('LastName')}\n disabled={isLoading}\n />\n <InputText\n value={bio}\n onChange={handleBioChange}\n label={lang('UserBio')}\n disabled={isLoading}\n error={error === ERROR_BIO_TOO_LONG ? error : undefined}\n />\n\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderText(lang('lng_settings_about_bio'), ['br', 'simple_markdown'])}\n </p>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('Username')}</h4>\n\n <UsernameInput\n currentUsername={username || ''}\n isLoading={isLoading}\n isUsernameAvailable={isUsernameAvailable}\n checkUsername={checkUsername}\n onChange={handleUsernameChange}\n />\n\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderText(lang('UsernameHelp'), ['br', 'simple_markdown'])}\n </p>\n {username && (\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('lng_username_link')}<br />\n <span className=\"username-link\">https://t.me/{username}</span>\n </p>\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isSaveButtonShown}\n onClick={handleProfileSave}\n disabled={isLoading}\n ariaLabel=\"Save changes\"\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId } = global;\n const { progress, isUsernameAvailable } = global.profileEdit || {};\n const currentUser = currentUserId ? selectUser(global, currentUserId) : undefined;\n\n if (!currentUser) {\n return {\n progress,\n isUsernameAvailable,\n };\n }\n\n const {\n firstName: currentFirstName,\n lastName: currentLastName,\n username: currentUsername,\n fullInfo,\n } = currentUser;\n const { bio: currentBio } = fullInfo || {};\n const currentAvatarHash = getChatAvatarHash(currentUser);\n\n return {\n currentAvatarHash,\n currentFirstName,\n currentLastName,\n currentBio,\n currentUsername,\n progress,\n isUsernameAvailable,\n };\n },\n)(SettingsEditProfile));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ISettings } from '../../../types';\n\nimport { AUTODOWNLOAD_FILESIZE_MB_LIMITS } from '../../../config';\nimport { pick } from '../../../util/iteratees';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport Checkbox from '../../ui/Checkbox';\nimport RangeSlider from '../../ui/RangeSlider';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = Pick<ISettings, (\n 'canAutoLoadPhotoFromContacts' |\n 'canAutoLoadPhotoInPrivateChats' |\n 'canAutoLoadPhotoInGroups' |\n 'canAutoLoadPhotoInChannels' |\n 'canAutoLoadVideoFromContacts' |\n 'canAutoLoadVideoInPrivateChats' |\n 'canAutoLoadVideoInGroups' |\n 'canAutoLoadVideoInChannels' |\n 'canAutoLoadFileFromContacts' |\n 'canAutoLoadFileInPrivateChats' |\n 'canAutoLoadFileInGroups' |\n 'canAutoLoadFileInChannels' |\n 'canAutoPlayGifs' |\n 'canAutoPlayVideos' |\n 'autoLoadFileMaxSizeMb'\n)>;\n\nconst SettingsDataStorage: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n canAutoLoadPhotoFromContacts,\n canAutoLoadPhotoInPrivateChats,\n canAutoLoadPhotoInGroups,\n canAutoLoadPhotoInChannels,\n canAutoLoadVideoFromContacts,\n canAutoLoadVideoInPrivateChats,\n canAutoLoadVideoInGroups,\n canAutoLoadVideoInChannels,\n canAutoLoadFileFromContacts,\n canAutoLoadFileInPrivateChats,\n canAutoLoadFileInGroups,\n canAutoLoadFileInChannels,\n canAutoPlayGifs,\n canAutoPlayVideos,\n autoLoadFileMaxSizeMb,\n}) => {\n const { setSettingOption } = getActions();\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const renderFileSizeCallback = useCallback((value: number) => {\n return lang('AutodownloadSizeLimitUpTo', lang('FileSize.MB', String(AUTODOWNLOAD_FILESIZE_MB_LIMITS[value]), 'i'));\n }, [lang]);\n\n const handleFileSizeChange = useCallback((value: number) => {\n setSettingOption({ autoLoadFileMaxSizeMb: AUTODOWNLOAD_FILESIZE_MB_LIMITS[value] });\n }, [setSettingOption]);\n\n const handleCanAutoPlayGifsChange = useCallback((value: boolean) => {\n setSettingOption({ canAutoPlayGifs: value });\n }, [setSettingOption]);\n\n const handleCanAutoPlayVideosChange = useCallback((value: boolean) => {\n setSettingOption({ canAutoPlayVideos: value });\n }, [setSettingOption]);\n\n function renderContentSizeSlider() {\n const value = AUTODOWNLOAD_FILESIZE_MB_LIMITS.indexOf(autoLoadFileMaxSizeMb);\n\n return (\n <div className=\"pt-5\">\n <RangeSlider\n label={lang('AutoDownloadMaxFileSize')}\n min={0}\n max={5}\n value={value !== -1 ? value : 2}\n renderValue={renderFileSizeCallback}\n onChange={handleFileSizeChange}\n />\n </div>\n );\n }\n\n function renderAutoDownloadBlock(\n title: string,\n key: 'Photo' | 'Video' | 'File',\n canAutoLoadFromContacts: boolean,\n canAutoLoadInPrivateChats: boolean,\n canAutoLoadInGroups: boolean,\n canAutoLoadInChannels: boolean,\n ) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{title}</h4>\n\n <Checkbox\n label={lang('AutoDownloadSettings.Contacts')}\n checked={canAutoLoadFromContacts}\n // TODO rewrite to support `useCallback`\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}FromContacts`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.PrivateChats')}\n checked={canAutoLoadInPrivateChats}\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InPrivateChats`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.GroupChats')}\n checked={canAutoLoadInGroups}\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InGroups`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.Channels')}\n checked={canAutoLoadInChannels}\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InChannels`]: isChecked })}\n />\n\n {key === 'File' && renderContentSizeSlider()}\n </div>\n );\n }\n\n return (\n <div className=\"settings-content custom-scroll\">\n {renderAutoDownloadBlock(\n lang('AutoDownloadPhotosTitle'),\n 'Photo',\n canAutoLoadPhotoFromContacts,\n canAutoLoadPhotoInPrivateChats,\n canAutoLoadPhotoInGroups,\n canAutoLoadPhotoInChannels,\n )}\n {renderAutoDownloadBlock(\n lang('AutoDownloadVideosTitle'),\n 'Video',\n canAutoLoadVideoFromContacts,\n canAutoLoadVideoInPrivateChats,\n canAutoLoadVideoInGroups,\n canAutoLoadVideoInChannels,\n )}\n {renderAutoDownloadBlock(\n 'Auto-download files', // Proper translation is not available yet\n 'File',\n canAutoLoadFileFromContacts,\n canAutoLoadFileInPrivateChats,\n canAutoLoadFileInGroups,\n canAutoLoadFileInChannels,\n )}\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('AutoplayMedia')}</h4>\n\n <Checkbox\n label={lang('GifsTab2')}\n checked={canAutoPlayGifs}\n onCheck={handleCanAutoPlayGifsChange}\n />\n <Checkbox\n label={lang('DataAndStorage.Autoplay.Videos')}\n checked={canAutoPlayVideos}\n onCheck={handleCanAutoPlayVideosChange}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return pick(global.settings.byKey, [\n 'canAutoLoadPhotoFromContacts',\n 'canAutoLoadPhotoInPrivateChats',\n 'canAutoLoadPhotoInGroups',\n 'canAutoLoadPhotoInChannels',\n 'canAutoLoadVideoFromContacts',\n 'canAutoLoadVideoInPrivateChats',\n 'canAutoLoadVideoInGroups',\n 'canAutoLoadVideoInChannels',\n 'canAutoLoadFileFromContacts',\n 'canAutoLoadFileInPrivateChats',\n 'canAutoLoadFileInGroups',\n 'canAutoLoadFileInChannels',\n 'canAutoPlayGifs',\n 'canAutoPlayVideos',\n 'autoLoadFileMaxSizeMb',\n ]);\n },\n)(SettingsDataStorage));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n memo, useMemo, useCallback, useEffect,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport type { ApiChatFolder } from '../../../../api/types';\n\nimport { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport { throttle } from '../../../../util/schedulers';\nimport { getFolderDescriptionText } from '../../../../global/helpers';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\nimport { useFolderManagerForChatsCount } from '../../../../hooks/useFolderManager';\n\nimport ListItem from '../../../ui/ListItem';\nimport Button from '../../../ui/Button';\nimport Loading from '../../../ui/Loading';\nimport AnimatedIcon from '../../../common/AnimatedIcon';\n\ntype OwnProps = {\n isActive?: boolean;\n onCreateFolder: () => void;\n onEditFolder: (folder: ApiChatFolder) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n orderedFolderIds?: number[];\n foldersById: Record<number, ApiChatFolder>;\n recommendedChatFolders?: ApiChatFolder[];\n};\n\nconst runThrottledForLoadRecommended = throttle((cb) => cb(), 60000, true);\n\nconst MAX_ALLOWED_FOLDERS = 10;\n\nconst SettingsFoldersMain: FC<OwnProps & StateProps> = ({\n isActive,\n onCreateFolder,\n onEditFolder,\n onReset,\n orderedFolderIds,\n foldersById,\n recommendedChatFolders,\n}) => {\n const {\n loadRecommendedChatFolders,\n addChatFolder,\n showDialog,\n } = getActions();\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottledForLoadRecommended(() => {\n loadRecommendedChatFolders();\n });\n }, [loadRecommendedChatFolders]);\n\n const handleCreateFolder = useCallback(() => {\n if (Object.keys(foldersById).length >= MAX_ALLOWED_FOLDERS) {\n showDialog({\n data: {\n message: 'DIALOG_FILTERS_TOO_MUCH',\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n onCreateFolder();\n }, [foldersById, showDialog, onCreateFolder]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const chatsCountByFolderId = useFolderManagerForChatsCount();\n const userFolders = useMemo(() => {\n if (!orderedFolderIds) {\n return undefined;\n }\n\n return orderedFolderIds.map((id) => {\n const folder = foldersById[id];\n\n return {\n id: folder.id,\n title: folder.title,\n subtitle: getFolderDescriptionText(lang, folder, chatsCountByFolderId[folder.id]),\n };\n });\n }, [orderedFolderIds, foldersById, lang, chatsCountByFolderId]);\n\n const handleCreateFolderFromRecommended = useCallback((folder: ApiChatFolder) => {\n if (Object.keys(foldersById).length >= MAX_ALLOWED_FOLDERS) {\n showDialog({\n data: {\n message: 'DIALOG_FILTERS_TOO_MUCH',\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n addChatFolder({ folder });\n }, [foldersById, addChatFolder, showDialog]);\n\n return (\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-content-header\">\n <AnimatedIcon\n size={STICKER_SIZE_FOLDER_SETTINGS}\n tgsUrl={LOCAL_TGS_URLS.FoldersAll}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {lang('CreateNewFilterInfo')}\n </p>\n\n <Button\n // TODO: Refactor button component to handle icon placemenet with props\n className=\"with-icon mb-2\"\n color=\"primary\"\n size=\"smaller\"\n pill\n fluid\n onClick={handleCreateFolder}\n isRtl={lang.isRtl}\n >\n <i className=\"icon-add\" />\n {lang('CreateNewFilter')}\n </Button>\n </div>\n\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('Filters')}</h4>\n\n {userFolders?.length ? userFolders.map((folder) => (\n <ListItem\n className=\"mb-2 no-icon\"\n narrow\n multiline\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onEditFolder(foldersById[folder.id])}\n >\n <span className=\"title\">{folder.title}</span>\n <span className=\"subtitle\">{folder.subtitle}</span>\n </ListItem>\n )) : userFolders && !userFolders.length ? (\n <p className=\"settings-item-description my-4\" dir=\"auto\">\n You have no folders yet.\n </p>\n ) : <Loading />}\n </div>\n\n {(recommendedChatFolders && Boolean(recommendedChatFolders.length)) && (\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterRecommended')}\n </h4>\n\n {recommendedChatFolders.map((folder) => (\n <ListItem\n className=\"mb-2\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleCreateFolderFromRecommended(folder)}\n >\n <div className=\"settings-folders-recommended-item\">\n <div className=\"multiline-item\">\n <span className=\"title\">{folder.title}</span>\n <span className=\"subtitle\">{folder.description}</span>\n </div>\n\n <Button\n className=\"px-3\"\n color=\"primary\"\n size=\"tiny\"\n pill\n fluid\n isRtl={lang.isRtl}\n >\n {lang('Add')}\n </Button>\n </div>\n </ListItem>\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n orderedIds: orderedFolderIds,\n byId: foldersById,\n recommended: recommendedChatFolders,\n } = global.chatFolders;\n\n return {\n orderedFolderIds,\n foldersById,\n recommendedChatFolders,\n };\n },\n)(SettingsFoldersMain));\n","import type { FC } from '../../lib/teact/teact';\nimport React from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\n\nimport Button from './Button';\n\nimport './ShowMoreButton.scss';\n\ntype OwnProps = {\n count: number;\n itemName: string;\n itemPluralName?: string;\n isLoading?: boolean;\n onClick: () => void;\n};\n\nconst ShowMoreButton: FC<OwnProps> = ({\n count,\n itemName,\n itemPluralName,\n isLoading,\n onClick,\n}) => {\n const lang = useLang();\n\n return (\n <Button\n className=\"ShowMoreButton\"\n color=\"translucent\"\n size=\"smaller\"\n isText\n isLoading={isLoading}\n isRtl={lang.isRtl}\n onClick={onClick}\n >\n <i className=\"icon-down\" />\n Show {count} more {count > 1 ? itemPluralName || `${itemName}s` : itemName}\n </Button>\n );\n};\n\nexport default ShowMoreButton;\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport { findIntersectionWithSet } from '../../../../util/iteratees';\nimport { isUserId } from '../../../../global/helpers';\nimport type {\n FolderEditDispatch,\n FoldersState,\n} from '../../../../hooks/reducers/useFoldersReducer';\nimport {\n EXCLUDED_CHAT_TYPES,\n INCLUDED_CHAT_TYPES,\n selectChatFilters,\n} from '../../../../hooks/reducers/useFoldersReducer';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport ListItem from '../../../ui/ListItem';\nimport InputText from '../../../ui/InputText';\nimport PrivateChatInfo from '../../../common/PrivateChatInfo';\nimport GroupChatInfo from '../../../common/GroupChatInfo';\nimport FloatingActionButton from '../../../ui/FloatingActionButton';\nimport Spinner from '../../../ui/Spinner';\nimport ShowMoreButton from '../../../ui/ShowMoreButton';\nimport AnimatedIcon from '../../../common/AnimatedIcon';\n\ntype OwnProps = {\n state: FoldersState;\n dispatch: FolderEditDispatch;\n onAddIncludedChats: () => void;\n onAddExcludedChats: () => void;\n isActive?: boolean;\n onReset: () => void;\n onBack: () => void;\n};\n\ntype StateProps = {\n loadedActiveChatIds?: string[];\n loadedArchivedChatIds?: string[];\n};\n\nconst SUBMIT_TIMEOUT = 500;\n\nconst INITIAL_CHATS_LIMIT = 5;\n\nconst ERROR_NO_TITLE = 'Please provide a title for this folder.';\nconst ERROR_NO_CHATS = 'ChatList.Filter.Error.Empty';\n\nconst SettingsFoldersEdit: FC<OwnProps & StateProps> = ({\n state,\n dispatch,\n onAddIncludedChats,\n onAddExcludedChats,\n isActive,\n onReset,\n onBack,\n loadedActiveChatIds,\n loadedArchivedChatIds,\n}) => {\n const {\n editChatFolder,\n addChatFolder,\n } = getActions();\n\n const [isIncludedChatsListExpanded, setIsIncludedChatsListExpanded] = useState(false);\n const [isExcludedChatsListExpanded, setIsExcludedChatsListExpanded] = useState(false);\n\n const {\n selectedChatIds: includedChatIds,\n selectedChatTypes: includedChatTypes,\n } = selectChatFilters(state, 'included');\n const {\n selectedChatIds: excludedChatIds,\n selectedChatTypes: excludedChatTypes,\n } = selectChatFilters(state, 'excluded');\n\n useEffect(() => {\n setIsIncludedChatsListExpanded(false);\n setIsExcludedChatsListExpanded(false);\n }, [state.folderId]);\n\n const [visibleIncludedChatIds, visibleExcludedChatIds] = useMemo(() => {\n const allLoadedChatsSet = new Set([\n ...(loadedActiveChatIds || []),\n ...(loadedArchivedChatIds || []),\n ]);\n\n const loadedIncludedChatIds = findIntersectionWithSet(includedChatIds, allLoadedChatsSet);\n const loadedExcludedChatIds = findIntersectionWithSet(excludedChatIds, allLoadedChatsSet);\n\n return [\n isIncludedChatsListExpanded\n ? loadedIncludedChatIds\n : loadedIncludedChatIds.slice(0, INITIAL_CHATS_LIMIT - includedChatTypes.length),\n isExcludedChatsListExpanded\n ? loadedExcludedChatIds\n : loadedExcludedChatIds.slice(0, INITIAL_CHATS_LIMIT - excludedChatTypes.length),\n ];\n }, [\n excludedChatIds, includedChatIds, includedChatTypes, excludedChatTypes,\n isExcludedChatsListExpanded, isIncludedChatsListExpanded,\n loadedActiveChatIds, loadedArchivedChatIds,\n ]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack,\n });\n\n const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n const { currentTarget } = event;\n dispatch({ type: 'setTitle', payload: currentTarget.value.trim() });\n }, [dispatch]);\n\n const handleSubmit = useCallback(() => {\n const { title } = state.folder;\n\n if (!title) {\n dispatch({ type: 'setError', payload: ERROR_NO_TITLE });\n return;\n }\n\n if (!includedChatIds.length && !Object.keys(includedChatTypes).length) {\n dispatch({ type: 'setError', payload: ERROR_NO_CHATS });\n return;\n }\n\n dispatch({ type: 'setIsLoading', payload: true });\n if (state.mode === 'edit') {\n editChatFolder({ id: state.folderId, folderUpdate: state.folder });\n } else {\n addChatFolder({ folder: state.folder });\n }\n\n setTimeout(() => {\n onReset();\n }, SUBMIT_TIMEOUT);\n }, [addChatFolder, dispatch, editChatFolder, includedChatIds.length, includedChatTypes, onReset, state]);\n\n function renderChatType(key: string, mode: 'included' | 'excluded') {\n const chatType = mode === 'included'\n ? INCLUDED_CHAT_TYPES.find(({ key: typeKey }) => typeKey === key)\n : EXCLUDED_CHAT_TYPES.find(({ key: typeKey }) => typeKey === key);\n\n if (!chatType) {\n return undefined;\n }\n\n return (\n <ListItem\n key={chatType.key}\n className=\"settings-folders-list-item mb-1\"\n icon={chatType.icon}\n narrow\n inactive\n >\n {lang(chatType.title)}\n </ListItem>\n );\n }\n\n function renderChats(mode: 'included' | 'excluded') {\n const selectedChatTypes = mode === 'included' ? includedChatTypes : excludedChatTypes;\n const visibleChatIds = mode === 'included' ? visibleIncludedChatIds : visibleExcludedChatIds;\n\n const isExpanded = mode === 'included' ? isIncludedChatsListExpanded : isExcludedChatsListExpanded;\n const allChatIds = mode === 'included' ? includedChatIds : excludedChatIds;\n const leftChatsCount = allChatIds.length - selectedChatTypes.length - visibleChatIds.length;\n const clickHandler = mode === 'included'\n ? () => setIsIncludedChatsListExpanded(true)\n : () => setIsExcludedChatsListExpanded(true);\n\n return (\n <>\n {selectedChatTypes.map((key) => renderChatType(key, mode))}\n {visibleChatIds.map((id) => (\n <ListItem\n className=\"settings-folders-list-item mb-1\"\n narrow\n inactive\n >\n {isUserId(id) ? (\n <PrivateChatInfo avatarSize=\"small\" userId={id} />\n ) : (\n <GroupChatInfo avatarSize=\"small\" chatId={id} />\n )}\n </ListItem>\n ))}\n {(!isExpanded && leftChatsCount > 0) && (\n <ShowMoreButton\n count={leftChatsCount}\n itemName=\"chat\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={clickHandler}\n />\n )}\n </>\n );\n }\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-content-header\">\n <AnimatedIcon\n size={STICKER_SIZE_FOLDER_SETTINGS}\n tgsUrl={LOCAL_TGS_URLS.FoldersNew}\n play={String(state.folderId)}\n className=\"settings-content-icon\"\n />\n\n {state.mode === 'create' && (\n <p className=\"settings-item-description mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterIncludeInfo')}\n </p>\n )}\n\n <InputText\n className=\"mb-0\"\n label={lang('FilterNameHint')}\n value={state.folder.title}\n onChange={handleChange}\n error={state.error && state.error === ERROR_NO_TITLE ? ERROR_NO_TITLE : undefined}\n />\n </div>\n\n <div className=\"settings-item no-border pt-3\">\n {state.error && state.error === ERROR_NO_CHATS && (\n <p className=\"settings-item-description color-danger mb-2\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang(state.error)}\n </p>\n )}\n\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterInclude')}</h4>\n\n <ListItem\n className=\"settings-folders-list-item color-primary mb-0\"\n icon=\"add\"\n onClick={onAddIncludedChats}\n >\n {lang('FilterAddChats')}\n </ListItem>\n\n {renderChats('included')}\n </div>\n\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterExclude')}</h4>\n\n <ListItem\n className=\"settings-folders-list-item color-primary mb-0\"\n icon=\"add\"\n onClick={onAddExcludedChats}\n >\n {lang('FilterAddChats')}\n </ListItem>\n\n {renderChats('excluded')}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={Boolean(state.isTouched)}\n disabled={state.isLoading}\n onClick={handleSubmit}\n ariaLabel={state.mode === 'edit' ? 'Save changes' : 'Create folder'}\n >\n {state.isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { listIds } = global.chats;\n\n return {\n loadedActiveChatIds: listIds.active,\n loadedArchivedChatIds: listIds.archived,\n };\n },\n)(SettingsFoldersEdit));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n useCallback, useRef, useEffect, memo,\n} from '../../../../lib/teact/teact';\n\nimport { isUserId } from '../../../../global/helpers';\nimport type { FolderChatType } from '../../../../hooks/reducers/useFoldersReducer';\nimport {\n INCLUDED_CHAT_TYPES,\n EXCLUDED_CHAT_TYPES,\n} from '../../../../hooks/reducers/useFoldersReducer';\nimport useInfiniteScroll from '../../../../hooks/useInfiniteScroll';\nimport useLang from '../../../../hooks/useLang';\n\nimport Checkbox from '../../../ui/Checkbox';\nimport InputText from '../../../ui/InputText';\nimport ListItem from '../../../ui/ListItem';\nimport PrivateChatInfo from '../../../common/PrivateChatInfo';\nimport GroupChatInfo from '../../../common/GroupChatInfo';\nimport PickerSelectedItem from '../../../common/PickerSelectedItem';\nimport InfiniteScroll from '../../../ui/InfiniteScroll';\nimport Loading from '../../../ui/Loading';\n\nimport '../../../common/Picker.scss';\nimport './SettingsFoldersChatsPicker.scss';\n\ntype OwnProps = {\n mode: 'included' | 'excluded';\n chatIds: string[];\n selectedIds: string[];\n selectedChatTypes: string[];\n filterValue?: string;\n onSelectedIdsChange: (ids: string[]) => void;\n onSelectedChatTypesChange: (types: string[]) => void;\n onFilterChange: (value: string) => void;\n};\n\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 500;\n\nconst MAX_CHATS = 100;\nconst MAX_FULL_ITEMS = 10;\nconst ALWAYS_FULL_ITEMS_COUNT = 5;\n\nconst SettingsFoldersChatsPicker: FC<OwnProps> = ({\n mode,\n chatIds,\n selectedIds,\n selectedChatTypes,\n filterValue,\n onSelectedIdsChange,\n onSelectedChatTypesChange,\n onFilterChange,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n const chatTypes = mode === 'included' ? INCLUDED_CHAT_TYPES : EXCLUDED_CHAT_TYPES;\n const shouldMinimize = selectedIds.length + selectedChatTypes.length > MAX_FULL_ITEMS;\n const hasMaxChats = selectedIds.length >= MAX_CHATS;\n\n useEffect(() => {\n setTimeout(() => {\n requestAnimationFrame(() => {\n inputRef.current!.focus();\n });\n }, FOCUS_DELAY_MS);\n }, []);\n\n const handleItemClick = useCallback((id: string) => {\n const newSelectedIds = [...selectedIds];\n if (newSelectedIds.includes(id)) {\n newSelectedIds.splice(newSelectedIds.indexOf(id), 1);\n } else {\n newSelectedIds.push(id);\n }\n onSelectedIdsChange(newSelectedIds);\n }, [selectedIds, onSelectedIdsChange]);\n\n const handleChatTypeClick = useCallback((key: FolderChatType['key']) => {\n const newSelectedChatTypes = [...selectedChatTypes];\n if (newSelectedChatTypes.includes(key)) {\n newSelectedChatTypes.splice(newSelectedChatTypes.indexOf(key), 1);\n } else {\n newSelectedChatTypes.push(key);\n }\n onSelectedChatTypesChange(newSelectedChatTypes);\n }, [selectedChatTypes, onSelectedChatTypesChange]);\n\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { value } = e.currentTarget;\n onFilterChange(value);\n }, [onFilterChange]);\n\n const lang = useLang();\n\n function renderSelectedChatType(key: string) {\n const selectedType = chatTypes.find(({ key: typeKey }) => key === typeKey);\n if (!selectedType) {\n return undefined;\n }\n\n return (\n <PickerSelectedItem\n icon={selectedType.icon}\n title={lang(selectedType.title)}\n isMinimized={shouldMinimize}\n canClose\n onClick={handleChatTypeClick}\n clickArg={selectedType.key}\n />\n );\n }\n\n function renderChatType(type: FolderChatType) {\n return (\n <ListItem\n key={type.key}\n className=\"chat-item-clickable picker-list-item chat-type-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleChatTypeClick(type.key)}\n ripple\n >\n <i className={`icon-${type.icon}`} />\n <h3 className=\"chat-type\" dir=\"auto\">{lang(type.title)}</h3>\n <Checkbox\n label=\"\"\n checked={selectedChatTypes.includes(type.key)}\n round\n />\n </ListItem>\n );\n }\n\n function renderItem(id: string) {\n const isSelected = selectedIds.includes(id);\n\n return (\n <ListItem\n key={id}\n className=\"chat-item-clickable picker-list-item chat-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleItemClick(id)}\n ripple\n disabled={!isSelected && hasMaxChats}\n >\n {isUserId(id) ? (\n <PrivateChatInfo userId={id} />\n ) : (\n <GroupChatInfo chatId={id} withChatType />\n )}\n <Checkbox\n label=\"\"\n checked={isSelected}\n round\n />\n </ListItem>\n );\n }\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, chatIds, Boolean(filterValue));\n\n return (\n <div className=\"Picker SettingsFoldersChatsPicker\">\n <div className=\"picker-header custom-scroll\">\n {selectedChatTypes.map(renderSelectedChatType)}\n {selectedIds.map((id, i) => (\n <PickerSelectedItem\n chatOrUserId={id}\n isMinimized={shouldMinimize && i < selectedIds.length - ALWAYS_FULL_ITEMS_COUNT}\n canClose\n onClick={handleItemClick}\n clickArg={id}\n />\n ))}\n {!hasMaxChats ? (\n <InputText\n ref={inputRef}\n value={filterValue}\n onChange={handleFilterChange}\n placeholder={lang('Search')}\n />\n ) : (\n <p className=\"max-items-reached\" dir=\"auto\">\n {`Sorry, you can't add more than ${MAX_CHATS} chats.`}\n </p>\n )}\n </div>\n <InfiniteScroll\n className=\"picker-list custom-scroll\"\n itemSelector=\".chat-item\"\n items={viewportIds}\n onLoadMore={getMore}\n >\n {(!viewportIds || !viewportIds.length || viewportIds.includes(chatIds[0])) && (\n <>\n <h4 key=\"header1\" className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterChatTypes')}\n </h4>\n {chatTypes.map(renderChatType)}\n <div key=\"divider\" className=\"picker-list-divider\" />\n <h4 key=\"header2\" className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterChats')}\n </h4>\n </>\n )}\n\n {viewportIds?.length ? (\n viewportIds.map(renderItem)\n ) : viewportIds && !viewportIds.length ? (\n <p className=\"no-results\" key=\"no-results\">Sorry, nothing found.</p>\n ) : (\n <Loading key=\"loading\" />\n )}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(SettingsFoldersChatsPicker);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useMemo, useCallback } from '../../../../lib/teact/teact';\nimport { getGlobal } from '../../../../global';\n\nimport { unique } from '../../../../util/iteratees';\n\nimport { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID } from '../../../../config';\nimport { filterChatsByName } from '../../../../global/helpers';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\nimport { useFolderManagerForOrderedIds } from '../../../../hooks/useFolderManager';\nimport type {\n FoldersState,\n FolderEditDispatch,\n} from '../../../../hooks/reducers/useFoldersReducer';\nimport {\n selectChatFilters,\n} from '../../../../hooks/reducers/useFoldersReducer';\n\nimport SettingsFoldersChatsPicker from './SettingsFoldersChatsPicker';\nimport Loading from '../../../ui/Loading';\n\ntype OwnProps = {\n mode: 'included' | 'excluded';\n state: FoldersState;\n dispatch: FolderEditDispatch;\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst SettingsFoldersChatFilters: FC<OwnProps> = ({\n mode,\n state,\n dispatch,\n isActive,\n onReset,\n}) => {\n const { chatFilter } = state;\n const { selectedChatIds, selectedChatTypes } = selectChatFilters(state, mode, true);\n\n const lang = useLang();\n\n const folderAllOrderedIds = useFolderManagerForOrderedIds(ALL_FOLDER_ID);\n const folderArchivedOrderedIds = useFolderManagerForOrderedIds(ARCHIVED_FOLDER_ID);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on chats, so we avoid them\n const chatsById = getGlobal().chats.byId;\n\n const chatIds = [...folderAllOrderedIds || [], ...folderArchivedOrderedIds || []];\n return unique([\n ...selectedChatIds,\n ...filterChatsByName(lang, chatIds, chatsById, chatFilter),\n ]);\n }, [folderAllOrderedIds, folderArchivedOrderedIds, selectedChatIds, lang, chatFilter]);\n\n const handleFilterChange = useCallback((newFilter: string) => {\n dispatch({\n type: 'setChatFilter',\n payload: newFilter,\n });\n }, [dispatch]);\n\n const handleSelectedIdsChange = useCallback((ids: string[]) => {\n if (mode === 'included') {\n dispatch({\n type: 'setIncludeFilters',\n payload: { ...state.includeFilters, includedChatIds: ids },\n });\n } else {\n dispatch({\n type: 'setExcludeFilters',\n payload: { ...state.excludeFilters, excludedChatIds: ids },\n });\n }\n }, [mode, state, dispatch]);\n\n const handleSelectedChatTypesChange = useCallback((keys: string[]) => {\n const newFilters: Record<string, boolean> = {};\n keys.forEach((key) => {\n newFilters[key] = true;\n });\n\n if (mode === 'included') {\n dispatch({\n type: 'setIncludeFilters',\n payload: {\n includedChatIds: selectedChatIds,\n ...newFilters,\n },\n });\n } else {\n dispatch({\n type: 'setExcludeFilters',\n payload: {\n excludedChatIds: selectedChatIds,\n ...newFilters,\n },\n });\n }\n }, [mode, selectedChatIds, dispatch]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n if (!displayedIds) {\n return <Loading />;\n }\n\n return (\n <SettingsFoldersChatsPicker\n mode={mode}\n chatIds={displayedIds}\n selectedIds={selectedChatIds}\n selectedChatTypes={selectedChatTypes}\n filterValue={chatFilter}\n onSelectedIdsChange={handleSelectedIdsChange}\n onSelectedChatTypesChange={handleSelectedChatTypesChange}\n onFilterChange={handleFilterChange}\n />\n );\n};\n\nexport default memo(SettingsFoldersChatFilters);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport type { ApiChatFolder } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport type { FolderEditDispatch, FoldersState } from '../../../../hooks/reducers/useFoldersReducer';\n\nimport SettingsFoldersMain from './SettingsFoldersMain';\nimport SettingsFoldersEdit from './SettingsFoldersEdit';\nimport SettingsFoldersChatFilters from './SettingsFoldersChatFilters';\n\nimport './SettingsFolders.scss';\n\nconst TRANSITION_DURATION = 200;\n\nexport type OwnProps = {\n currentScreen: SettingsScreens;\n shownScreen: SettingsScreens;\n state: FoldersState;\n dispatch: FolderEditDispatch;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsFolders: FC<OwnProps> = ({\n currentScreen,\n shownScreen,\n state,\n dispatch,\n isActive,\n onScreenSelect,\n onReset,\n}) => {\n const handleReset = useCallback(() => {\n if (\n currentScreen === SettingsScreens.FoldersCreateFolder\n || currentScreen === SettingsScreens.FoldersEditFolder\n || currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ) {\n setTimeout(() => {\n dispatch({ type: 'reset' });\n }, TRANSITION_DURATION);\n }\n\n if (\n currentScreen === SettingsScreens.FoldersIncludedChats\n || currentScreen === SettingsScreens.FoldersExcludedChats\n ) {\n if (state.mode === 'create') {\n onScreenSelect(SettingsScreens.FoldersCreateFolder);\n } else {\n onScreenSelect(SettingsScreens.FoldersEditFolder);\n }\n return;\n }\n\n onReset();\n }, [\n state.mode, dispatch,\n currentScreen, onReset, onScreenSelect,\n ]);\n\n const handleCreateFolder = useCallback(() => {\n dispatch({ type: 'reset' });\n onScreenSelect(SettingsScreens.FoldersCreateFolder);\n }, [onScreenSelect, dispatch]);\n\n const handleEditFolder = useCallback((folder: ApiChatFolder) => {\n dispatch({ type: 'editFolder', payload: folder });\n onScreenSelect(SettingsScreens.FoldersEditFolder);\n }, [dispatch, onScreenSelect]);\n\n const handleAddIncludedChats = useCallback(() => {\n dispatch({ type: 'editIncludeFilters' });\n onScreenSelect(currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ? SettingsScreens.FoldersIncludedChatsFromChatList\n : SettingsScreens.FoldersIncludedChats);\n }, [currentScreen, dispatch, onScreenSelect]);\n\n const handleAddExcludedChats = useCallback(() => {\n dispatch({ type: 'editExcludeFilters' });\n onScreenSelect(currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ? SettingsScreens.FoldersExcludedChatsFromChatList\n : SettingsScreens.FoldersExcludedChats);\n }, [currentScreen, dispatch, onScreenSelect]);\n\n switch (currentScreen) {\n case SettingsScreens.Folders:\n return (\n <SettingsFoldersMain\n onCreateFolder={handleCreateFolder}\n onEditFolder={handleEditFolder}\n isActive={isActive || [\n SettingsScreens.FoldersCreateFolder,\n SettingsScreens.FoldersEditFolder,\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersExcludedChats,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n return (\n <SettingsFoldersEdit\n state={state}\n dispatch={dispatch}\n onAddIncludedChats={handleAddIncludedChats}\n onAddExcludedChats={handleAddExcludedChats}\n onReset={handleReset}\n isActive={isActive || [\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersExcludedChats,\n ].includes(shownScreen)}\n onBack={onReset}\n />\n );\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n return (\n <SettingsFoldersChatFilters\n mode=\"included\"\n state={state}\n dispatch={dispatch}\n onReset={handleReset}\n isActive={isActive}\n />\n );\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <SettingsFoldersChatFilters\n mode=\"excluded\"\n state={state}\n dispatch={dispatch}\n onReset={handleReset}\n isActive={isActive}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(SettingsFolders);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useMemo, useRef } from '../../../lib/teact/teact';\n\nimport type { ApiStickerSet } from '../../../api/types';\n\nimport { STICKER_SIZE_PICKER_HEADER } from '../../../config';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport { getFirstLetters } from '../../../util/textFormat';\n\nimport AnimatedSticker from '../../common/AnimatedSticker';\n\ntype OwnProps = {\n size?: number;\n stickerSet: ApiStickerSet;\n observeIntersection: ObserveFn;\n};\n\nconst StickerSetCoverAnimated: FC<OwnProps> = ({\n size = STICKER_SIZE_PICKER_HEADER,\n stickerSet,\n observeIntersection,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const mediaHash = `stickerSet${stickerSet.id}`;\n const lottieData = useMedia(mediaHash, !isIntersecting);\n const transitionClassNames = useMediaTransition(lottieData);\n\n const firstLetters = useMemo(() => {\n if (lottieData) return undefined;\n\n return getFirstLetters(stickerSet.title, 2);\n }, [lottieData, stickerSet.title]);\n\n return (\n <div ref={ref} className=\"sticker-set-cover\">\n {firstLetters}\n {lottieData && (\n <AnimatedSticker\n size={size}\n tgsUrl={lottieData}\n className={transitionClassNames}\n />\n )}\n </div>\n );\n};\n\nexport default memo(StickerSetCoverAnimated);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useMemo, useRef } from '../../../lib/teact/teact';\n\nimport type { ApiStickerSet } from '../../../api/types';\n\nimport { IS_WEBM_SUPPORTED } from '../../../util/environment';\nimport { getFirstLetters } from '../../../util/textFormat';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\n\ntype OwnProps = {\n stickerSet: ApiStickerSet;\n observeIntersection: ObserveFn;\n};\n\nconst StickerSetCover: FC<OwnProps> = ({ stickerSet, observeIntersection }) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const mediaData = useMedia(stickerSet.hasThumbnail && `stickerSet${stickerSet.id}`, !isIntersecting);\n const transitionClassNames = useMediaTransition(mediaData);\n const isVideo = stickerSet.isVideos;\n\n const firstLetters = useMemo(() => {\n if ((isVideo && !IS_WEBM_SUPPORTED) || !mediaData) return getFirstLetters(stickerSet.title, 2);\n return undefined;\n }, [isVideo, mediaData, stickerSet.title]);\n\n return (\n <div ref={ref} className=\"sticker-set-cover\">\n {firstLetters}\n {isVideo ? (\n <video src={mediaData} className={transitionClassNames} loop autoPlay />\n ) : (\n <img src={mediaData} className={transitionClassNames} alt=\"\" />\n )}\n </div>\n );\n};\n\nexport default memo(StickerSetCover);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { ApiSticker, ApiStickerSet } from '../../../api/types';\n\nimport { STICKER_SIZE_GENERAL_SETTINGS } from '../../../config';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport useLang from '../../../hooks/useLang';\n\nimport ListItem from '../../ui/ListItem';\nimport Button from '../../ui/Button';\nimport StickerSetCoverAnimated from '../../middle/composer/StickerSetCoverAnimated';\nimport StickerSetCover from '../../middle/composer/StickerSetCover';\nimport StickerButton from '../../common/StickerButton';\n\nimport './SettingsStickerSet.scss';\n\ntype OwnProps = {\n stickerSet?: ApiStickerSet;\n observeIntersection: ObserveFn;\n onClick: (value: ApiSticker) => void;\n};\n\nconst SettingsStickerSet: FC<OwnProps> = ({\n stickerSet,\n observeIntersection,\n onClick,\n}) => {\n const lang = useLang();\n\n if (!stickerSet || !stickerSet.stickers) {\n return undefined;\n }\n\n const firstSticker = stickerSet.stickers?.[0];\n\n if (stickerSet.hasThumbnail || !firstSticker) {\n return (\n <ListItem\n narrow\n className=\"SettingsStickerSet\"\n inactive={!firstSticker}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => firstSticker && onClick(firstSticker)}\n >\n <Button\n ariaLabel={stickerSet.title}\n color=\"translucent\"\n isRtl={lang.isRtl}\n >\n {stickerSet.isLottie ? (\n <StickerSetCoverAnimated\n size={STICKER_SIZE_GENERAL_SETTINGS}\n stickerSet={stickerSet}\n observeIntersection={observeIntersection}\n />\n ) : (\n <StickerSetCover\n stickerSet={stickerSet}\n observeIntersection={observeIntersection}\n />\n )}\n </Button>\n <div className=\"multiline-menu-item\">\n <div className=\"title\">{stickerSet.title}</div>\n <div className=\"subtitle\">{lang('StickerPack.StickerCount', stickerSet.count, 'i')}</div>\n </div>\n </ListItem>\n );\n } else {\n return (\n <ListItem\n narrow\n className=\"SettingsStickerSet\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onClick(firstSticker)}\n >\n <StickerButton\n sticker={firstSticker}\n size={STICKER_SIZE_GENERAL_SETTINGS}\n title={stickerSet.title}\n observeIntersection={observeIntersection}\n clickArg={undefined}\n noContextMenu\n />\n <div className=\"multiline-menu-item\">\n <div className=\"title\">{stickerSet.title}</div>\n <div className=\"subtitle\">{lang('StickerPack.StickerCount', stickerSet.count, 'i')}</div>\n </div>\n </ListItem>\n );\n }\n};\n\nexport default memo(SettingsStickerSet);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useCallback, memo, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ISettings, TimeFormat } from '../../../types';\nimport { SettingsScreens } from '../../../types';\nimport type { ApiSticker, ApiStickerSet } from '../../../api/types';\n\nimport {\n getSystemTheme, IS_IOS, IS_MAC_OS, IS_TOUCH_ENV,\n} from '../../../util/environment';\nimport { pick } from '../../../util/iteratees';\nimport { setTimeFormat } from '../../../util/langProvider';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport RangeSlider from '../../ui/RangeSlider';\nimport Checkbox from '../../ui/Checkbox';\nimport type { IRadioOption } from '../../ui/RadioGroup';\nimport RadioGroup from '../../ui/RadioGroup';\nimport SettingsStickerSet from './SettingsStickerSet';\nimport StickerSetModal from '../../common/StickerSetModal.async';\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport switchTheme from '../../../util/switchTheme';\nimport { ANIMATION_LEVEL_MAX } from '../../../config';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps =\n Pick<ISettings, (\n 'messageTextSize' |\n 'animationLevel' |\n 'messageSendKeyCombo' |\n 'shouldSuggestStickers' |\n 'shouldLoopStickers' |\n 'timeFormat'\n )> & {\n stickerSetIds?: string[];\n stickerSetsById?: Record<string, ApiStickerSet>;\n defaultReaction?: string;\n theme: ISettings['theme'];\n shouldUseSystemTheme: boolean;\n };\n\nconst ANIMATION_LEVEL_OPTIONS = [\n 'Solid and Steady',\n 'Nice and Fast',\n 'Lots of Stuff',\n];\n\nconst TIME_FORMAT_OPTIONS: IRadioOption[] = [{\n label: '12-hour',\n value: '12h',\n}, {\n label: '24-hour',\n value: '24h',\n}];\n\nconst SettingsGeneral: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n stickerSetIds,\n stickerSetsById,\n defaultReaction,\n messageTextSize,\n animationLevel,\n messageSendKeyCombo,\n shouldSuggestStickers,\n shouldLoopStickers,\n timeFormat,\n theme,\n shouldUseSystemTheme,\n}) => {\n const {\n setSettingOption,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const stickerSettingsRef = useRef<HTMLDivElement>(null);\n const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: stickerSettingsRef });\n const [isModalOpen, openModal, closeModal] = useFlag();\n const [sticker, setSticker] = useState<ApiSticker>();\n\n const lang = useLang();\n\n const APPEARANCE_THEME_OPTIONS: IRadioOption[] = [{\n label: lang('EmptyChat.Appearance.Light'),\n value: 'light',\n }, {\n label: lang('EmptyChat.Appearance.Dark'),\n value: 'dark',\n }, {\n label: lang('EmptyChat.Appearance.System'),\n value: 'auto',\n }];\n\n const KEYBOARD_SEND_OPTIONS = !IS_TOUCH_ENV ? [\n { value: 'enter', label: lang('lng_settings_send_enter'), subLabel: 'New line by Shift + Enter' },\n {\n value: 'ctrl-enter',\n label: lang(IS_MAC_OS ? 'lng_settings_send_cmdenter' : 'lng_settings_send_ctrlenter'),\n subLabel: 'New line by Enter',\n },\n ] : undefined;\n\n const handleAnimationLevelChange = useCallback((newLevel: number) => {\n ANIMATION_LEVEL_OPTIONS.forEach((_, i) => {\n document.body.classList.toggle(`animation-level-${i}`, newLevel === i);\n });\n\n setSettingOption({ animationLevel: newLevel });\n }, [setSettingOption]);\n\n const handleMessageTextSizeChange = useCallback((newSize: number) => {\n document.documentElement.style.setProperty(\n '--composer-text-size', `${Math.max(newSize, IS_IOS ? 16 : 15)}px`,\n );\n document.documentElement.style.setProperty('--message-meta-height', `${Math.floor(newSize * 1.3125)}px`);\n document.documentElement.style.setProperty('--message-text-size', `${newSize}px`);\n document.documentElement.setAttribute('data-message-text-size', newSize.toString());\n\n setSettingOption({ messageTextSize: newSize });\n }, [setSettingOption]);\n\n const handleAppearanceThemeChange = useCallback((value: string) => {\n const newTheme = value === 'auto' ? getSystemTheme() : value as ISettings['theme'];\n\n setSettingOption({ theme: newTheme });\n setSettingOption({ shouldUseSystemTheme: value === 'auto' });\n if (newTheme !== theme) {\n switchTheme(newTheme, animationLevel === ANIMATION_LEVEL_MAX);\n }\n }, [animationLevel, setSettingOption, theme]);\n\n const handleTimeFormatChange = useCallback((newTimeFormat: string) => {\n setSettingOption({ timeFormat: newTimeFormat });\n setSettingOption({ wasTimeFormatSetManually: true });\n\n setTimeFormat(newTimeFormat as TimeFormat);\n }, [setSettingOption]);\n\n const handleStickerSetClick = useCallback((value: ApiSticker) => {\n setSticker(value);\n openModal();\n }, [openModal]);\n\n const handleMessageSendComboChange = useCallback((newCombo: string) => {\n setSettingOption({ messageSendKeyCombo: newCombo });\n }, [setSettingOption]);\n\n const handleSuggestStickersChange = useCallback((newValue: boolean) => {\n setSettingOption({ shouldSuggestStickers: newValue });\n }, [setSettingOption]);\n\n const handleShouldLoopStickersChange = useCallback((newValue: boolean) => {\n setSettingOption({ shouldLoopStickers: newValue });\n }, [setSettingOption]);\n\n const stickerSets = stickerSetIds && stickerSetIds.map((id: string) => {\n return stickerSetsById?.[id]?.installedDate ? stickerSetsById[id] : false;\n }).filter<ApiStickerSet>(Boolean as any);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('SETTINGS')}</h4>\n\n <RangeSlider\n label={lang('TextSize')}\n min={12}\n max={20}\n value={messageTextSize}\n onChange={handleMessageTextSizeChange}\n />\n\n <ListItem\n icon=\"photo\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.GeneralChatBackground)}\n >\n {lang('ChatBackground')}\n </ListItem>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('Theme')}\n </h4>\n <RadioGroup\n name=\"theme\"\n options={APPEARANCE_THEME_OPTIONS}\n selected={shouldUseSystemTheme ? 'auto' : theme}\n onChange={handleAppearanceThemeChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Time Format\n </h4>\n <RadioGroup\n name=\"timeformat\"\n options={TIME_FORMAT_OPTIONS}\n selected={timeFormat}\n onChange={handleTimeFormatChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Animation Level\n </h4>\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n Choose the desired animations amount.\n </p>\n\n <RangeSlider\n options={ANIMATION_LEVEL_OPTIONS}\n value={animationLevel}\n onChange={handleAnimationLevelChange}\n />\n </div>\n\n {KEYBOARD_SEND_OPTIONS && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('VoiceOver.Keyboard')}</h4>\n\n <RadioGroup\n name=\"keyboard-send-settings\"\n options={KEYBOARD_SEND_OPTIONS}\n onChange={handleMessageSendComboChange}\n selected={messageSendKeyCombo}\n />\n </div>\n )}\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('AccDescrStickers')}</h4>\n\n {defaultReaction && (\n <ListItem\n className=\"SettingsDefaultReaction\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.QuickReaction)}\n >\n <ReactionStaticEmoji reaction={defaultReaction} />\n <div className=\"title\">{lang('DoubleTapSetting')}</div>\n </ListItem>\n )}\n\n <Checkbox\n label={lang('SuggestStickers')}\n checked={shouldSuggestStickers}\n onCheck={handleSuggestStickersChange}\n />\n <Checkbox\n label={lang('LoopAnimatedStickers')}\n checked={shouldLoopStickers}\n onCheck={handleShouldLoopStickersChange}\n />\n\n <div className=\"mt-4\" ref={stickerSettingsRef}>\n {stickerSets && stickerSets.map((stickerSet: ApiStickerSet) => (\n <SettingsStickerSet\n key={stickerSet.id}\n stickerSet={stickerSet}\n observeIntersection={observeIntersectionForCovers}\n onClick={handleStickerSetClick}\n />\n ))}\n </div>\n {sticker && (\n <StickerSetModal\n isOpen={isModalOpen}\n fromSticker={sticker}\n onClose={closeModal}\n />\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { theme, shouldUseSystemTheme } = global.settings.byKey;\n\n return {\n ...pick(global.settings.byKey, [\n 'messageTextSize',\n 'animationLevel',\n 'messageSendKeyCombo',\n 'shouldSuggestStickers',\n 'shouldLoopStickers',\n 'isSensitiveEnabled',\n 'canChangeSensitive',\n 'timeFormat',\n ]),\n stickerSetIds: global.stickers.added.setIds,\n stickerSetsById: global.stickers.setsById,\n defaultReaction: global.appConfig?.defaultReaction,\n theme,\n shouldUseSystemTheme,\n };\n },\n)(SettingsGeneral));\n","/* eslint-disable eqeqeq */\n/* eslint-disable prefer-template */\n/* eslint-disable prefer-const */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable one-var */\n/* eslint-disable one-var-declaration-per-line */\n\nimport { preloadImage } from './files';\n\n/**\n * HEX > RGB\n * input: 'xxxxxx' (ex. 'ed15fa') case-insensitive\n * output: [r, g, b] ([0-255, 0-255, 0-255])\n */\nexport function hex2rgb(param: string): [number, number, number] {\n return [\n parseInt(param.substring(0, 2), 16),\n parseInt(param.substring(2, 4), 16),\n parseInt(param.substring(4, 6), 16),\n ];\n}\n\n/**\n * RGB > HEX\n * input: [r, g, b] ([0-255, 0-255, 0-255])\n * output: 'xxxxxx' (ex. 'ff0000')\n */\nexport function rgb2hex(param: [number, number, number]) {\n const p0 = param[0].toString(16);\n const p1 = param[1].toString(16);\n const p2 = param[2].toString(16);\n return (p0.length == 1 ? '0' + p0 : p0) + (p1.length == 1 ? '0' + p1 : p1) + (p2.length == 1 ? '0' + p2 : p2);\n}\n\n/**\n * Converts an RGB color value to HSV. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes r, g, and b are contained in the set [0, 255] and\n * returns h, s, and v in the set [0, 1].\n *\n * @param Number r The red color value\n * @param Number g The green color value\n * @param Number b The blue color value\n * @return Array The HSV representation\n */\nexport function rgb2hsb([r, g, b]: [number, number, number]): [number, number, number] {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h!: number, s: number, v: number = max;\n\n let d = max - min;\n s = max == 0 ? 0 : d / max;\n\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n\n h /= 6;\n }\n\n return [h, s, v];\n}\n\n/**\n * Converts an HSV color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes h, s, and v are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number v The value\n * @return Array The RGB representation\n */\nexport function hsb2rgb([h, s, v]: [number, number, number]): [number, number, number] {\n let r!: number, g!: number, b!: number;\n\n let i = Math.floor(h * 6);\n let f = h * 6 - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n }\n\n return [\n Math.round(r * 255),\n Math.round(g * 255),\n Math.round(b * 255),\n ];\n}\n\nexport async function getAverageColor(url: string): Promise<[number, number, number]> {\n // Only visit every 5 pixels\n const blockSize = 5;\n const defaultRGB: [number, number, number] = [0, 0, 0];\n let data;\n let width;\n let height;\n let i = -4;\n let length;\n let rgb: [number, number, number] = [0, 0, 0];\n let count = 0;\n\n const canvas = document.createElement('canvas');\n const context = canvas.getContext && canvas.getContext('2d');\n if (!context) {\n return defaultRGB;\n }\n\n const image = await preloadImage(url);\n height = image.naturalHeight || image.offsetHeight || image.height;\n width = image.naturalWidth || image.offsetWidth || image.width;\n canvas.height = height;\n canvas.width = width;\n\n context.drawImage(image, 0, 0);\n\n try {\n data = context.getImageData(0, 0, width, height);\n } catch (e) {\n return defaultRGB;\n }\n\n length = data.data.length;\n\n // eslint-disable-next-line no-cond-assign\n while ((i += blockSize * 4) < length) {\n ++count;\n rgb[0] += data.data[i];\n rgb[1] += data.data[i + 1];\n rgb[2] += data.data[i + 2];\n }\n\n rgb[0] = Math.floor(rgb[0] / count);\n rgb[1] = Math.floor(rgb[1] / count);\n rgb[2] = Math.floor(rgb[2] / count);\n\n return rgb;\n}\n\n// eslint-disable-next-line max-len\n// Function was adapted from https://github.com/telegramdesktop/tdesktop/blob/35ff621b5b52f7e3553fb0f990ea13ade7101b8e/Telegram/SourceFiles/data/data_wall_paper.cpp#L518\nexport function getPatternColor(rgbColor: [number, number, number]) {\n let [hue, saturation, value] = rgb2hsb(rgbColor);\n\n saturation = Math.min(1, saturation + 0.05 + 0.1 * (1 - saturation));\n value = value > 0.5\n ? Math.max(0, value * 0.65)\n : Math.max(0, Math.min(1, 1 - value * 0.65));\n\n return `hsla(${hue * 360}, ${saturation * 100}%, ${value * 100}%, .4)`;\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState, useRef,\n} from '../../../lib/teact/teact';\nimport type { ApiWallpaper } from '../../../api/types';\nimport type { ThemeKey } from '../../../types';\nimport { UPLOADING_WALLPAPER_SLUG } from '../../../types';\n\nimport { CUSTOM_BG_CACHE_NAME } from '../../../config';\nimport * as cacheApi from '../../../util/cacheApi';\nimport { fetchBlob } from '../../../util/files';\nimport buildClassName from '../../../util/buildClassName';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useCanvasBlur from '../../../hooks/useCanvasBlur';\n\nimport ProgressSpinner from '../../ui/ProgressSpinner';\n\nimport './WallpaperTile.scss';\n\ntype OwnProps = {\n wallpaper: ApiWallpaper;\n theme: ThemeKey;\n isSelected: boolean;\n onClick: (slug: string) => void;\n};\n\nconst WallpaperTile: FC<OwnProps> = ({\n wallpaper,\n theme,\n isSelected,\n onClick,\n}) => {\n const { slug, document } = wallpaper;\n const localMediaHash = `wallpaper${document.id!}`;\n const localBlobUrl = document.previewBlobUrl;\n const previewBlobUrl = useMedia(`${localMediaHash}?size=m`);\n const thumbRef = useCanvasBlur(document.thumbnail?.dataUri, Boolean(previewBlobUrl), true);\n const { transitionClassNames } = useShowTransition(\n Boolean(previewBlobUrl || localBlobUrl),\n undefined,\n undefined,\n 'slow',\n );\n const [isLoadAllowed, setIsLoadAllowed] = useState(false);\n const {\n mediaData: fullMedia, loadProgress,\n } = useMediaWithLoadProgress(localMediaHash, !isLoadAllowed);\n const wasLoadDisabled = usePrevious(isLoadAllowed) === false;\n const { shouldRender: shouldRenderSpinner, transitionClassNames: spinnerClassNames } = useShowTransition(\n (isLoadAllowed && !fullMedia) || slug === UPLOADING_WALLPAPER_SLUG,\n undefined,\n wasLoadDisabled,\n 'slow',\n );\n // To prevent triggering of the effect for useCallback\n const cacheKeyRef = useRef<string>();\n cacheKeyRef.current = theme;\n\n const handleSelect = useCallback(() => {\n (async () => {\n const blob = await fetchBlob(fullMedia!);\n await cacheApi.save(CUSTOM_BG_CACHE_NAME, cacheKeyRef.current!, blob);\n onClick(slug);\n })();\n }, [fullMedia, onClick, slug]);\n\n useEffect(() => {\n if (fullMedia) {\n handleSelect();\n }\n }, [fullMedia, handleSelect]);\n\n const handleClick = useCallback(() => {\n if (fullMedia) {\n handleSelect();\n } else {\n setIsLoadAllowed((isAllowed) => !isAllowed);\n }\n }, [fullMedia, handleSelect]);\n\n const className = buildClassName(\n 'WallpaperTile',\n isSelected && 'selected',\n );\n\n return (\n <div className={className} onClick={handleClick}>\n <div className=\"media-inner\">\n <canvas\n ref={thumbRef}\n className=\"thumbnail\"\n />\n <img\n src={previewBlobUrl || localBlobUrl}\n className={buildClassName('full-media', transitionClassNames)}\n alt=\"\"\n />\n {shouldRenderSpinner && (\n <div className={buildClassName('spinner-container', spinnerClassNames)}>\n <ProgressSpinner progress={loadProgress} onClick={handleClick} />\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(WallpaperTile);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useEffect, useCallback, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ThemeKey } from '../../../types';\nimport { SettingsScreens, UPLOADING_WALLPAPER_SLUG } from '../../../types';\nimport type { ApiWallpaper } from '../../../api/types';\n\nimport { DARK_THEME_PATTERN_COLOR, DEFAULT_PATTERN_COLOR } from '../../../config';\nimport { throttle } from '../../../util/schedulers';\nimport { openSystemFilesDialog } from '../../../util/systemFilesDialog';\nimport { getAverageColor, getPatternColor, rgb2hex } from '../../../util/colors';\nimport { selectTheme } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport Loading from '../../ui/Loading';\nimport WallpaperTile from './WallpaperTile';\n\nimport './SettingsGeneralBackground.scss';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n background?: string;\n isBlurred?: boolean;\n loadedWallpapers?: ApiWallpaper[];\n theme: ThemeKey;\n};\n\nconst SUPPORTED_TYPES = 'image/jpeg';\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst SettingsGeneralBackground: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n background,\n isBlurred,\n loadedWallpapers,\n theme,\n}) => {\n const {\n loadWallpapers,\n uploadWallpaper,\n setThemeSettings,\n } = getActions();\n\n const themeRef = useRef<string>();\n themeRef.current = theme;\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadWallpapers();\n });\n }, [loadWallpapers]);\n\n const handleFileSelect = useCallback((e: Event) => {\n const { files } = e.target as HTMLInputElement;\n\n if (files && files.length > 0) {\n uploadWallpaper(files[0]);\n }\n }, [uploadWallpaper]);\n\n const handleUploadWallpaper = useCallback(() => {\n openSystemFilesDialog(SUPPORTED_TYPES, handleFileSelect, true);\n }, [handleFileSelect]);\n\n const handleSetColor = useCallback(() => {\n onScreenSelect(SettingsScreens.GeneralChatBackgroundColor);\n }, [onScreenSelect]);\n\n const handleResetToDefault = useCallback(() => {\n setThemeSettings({\n theme,\n background: undefined,\n backgroundColor: undefined,\n isBlurred: true,\n patternColor: theme === 'dark' ? DARK_THEME_PATTERN_COLOR : DEFAULT_PATTERN_COLOR,\n });\n }, [setThemeSettings, theme]);\n\n const handleWallPaperSelect = useCallback((slug: string) => {\n setThemeSettings({ theme: themeRef.current, background: slug });\n const currentWallpaper = loadedWallpapers && loadedWallpapers.find((wallpaper) => wallpaper.slug === slug);\n if (currentWallpaper?.document.thumbnail) {\n getAverageColor(currentWallpaper.document.thumbnail.dataUri)\n .then((color) => {\n const patternColor = getPatternColor(color);\n const rgbColor = `#${rgb2hex(color)}`;\n setThemeSettings({ theme: themeRef.current, backgroundColor: rgbColor, patternColor });\n });\n }\n }, [loadedWallpapers, setThemeSettings]);\n\n const handleWallPaperBlurChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setThemeSettings({ theme: themeRef.current, isBlurred: e.target.checked });\n }, [setThemeSettings]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const isUploading = loadedWallpapers?.[0] && loadedWallpapers[0].slug === UPLOADING_WALLPAPER_SLUG;\n\n return (\n <div className=\"SettingsGeneralBackground settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <ListItem\n icon=\"camera-add\"\n className=\"mb-0\"\n disabled={isUploading}\n onClick={handleUploadWallpaper}\n >\n {lang('UploadImage')}\n </ListItem>\n\n <ListItem\n icon=\"colorize\"\n className=\"mb-0\"\n onClick={handleSetColor}\n >\n {lang('SetColor')}\n </ListItem>\n\n <ListItem icon=\"favorite\" onClick={handleResetToDefault}>\n {lang('ThemeResetToDefaults')}\n </ListItem>\n\n <Checkbox\n label={lang('BackgroundBlurred')}\n checked={Boolean(isBlurred)}\n onChange={handleWallPaperBlurChange}\n />\n </div>\n\n {loadedWallpapers ? (\n <div className=\"settings-wallpapers\">\n {loadedWallpapers.map((wallpaper) => (\n <WallpaperTile\n wallpaper={wallpaper}\n theme={theme}\n isSelected={background === wallpaper.slug}\n onClick={handleWallPaperSelect}\n />\n ))}\n </div>\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const theme = selectTheme(global);\n const { background, isBlurred } = global.settings.themes[theme] || {};\n const { loadedWallpapers } = global.settings;\n\n return {\n background,\n isBlurred,\n loadedWallpapers,\n theme,\n };\n },\n)(SettingsGeneralBackground));\n","import type { ChangeEvent, MutableRefObject, RefObject } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ThemeKey } from '../../../types';\n\nimport { pick } from '../../../util/iteratees';\nimport {\n getPatternColor, hex2rgb, hsb2rgb, rgb2hex, rgb2hsb,\n} from '../../../util/colors';\nimport type { RealTouchEvent } from '../../../util/captureEvents';\nimport { captureEvents } from '../../../util/captureEvents';\nimport { selectTheme } from '../../../global/selectors';\nimport useFlag from '../../../hooks/useFlag';\nimport buildClassName from '../../../util/buildClassName';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport InputText from '../../ui/InputText';\n\nimport './SettingsGeneralBackgroundColor.scss';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n backgroundColor?: string;\n theme: ThemeKey;\n};\n\ninterface CanvasRects {\n colorRect: {\n offsetLeft: number;\n top: number;\n width: number;\n height: number;\n };\n hueRect: {\n offsetLeft: number;\n width: number;\n };\n}\n\nconst DEFAULT_HSB = rgb2hsb(hex2rgb('e6ebee'));\nconst PREDEFINED_COLORS = [\n '#e6ebee', '#b2cee1', '#008dd0', '#c6e7cb', '#c4e1a6', '#60b16e',\n '#ccd0af', '#a6a997', '#7a7072', '#fdd7af', '#fdb76e', '#dd8851',\n];\n\nconst SettingsGeneralBackground: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n theme,\n backgroundColor,\n}) => {\n const { setThemeSettings } = getActions();\n\n const themeRef = useRef<string>();\n themeRef.current = theme;\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const colorPickerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const huePickerRef = useRef<HTMLDivElement>(null);\n const isFirstRunRef = useRef(true);\n\n const [hsb, setHsb] = useState(getInitialHsb(backgroundColor));\n // Cache for drag handlers\n const hsbRef = useRef(hsb);\n useEffect(() => {\n hsbRef.current = hsb;\n }, [hsb]);\n\n const [isDragging, markIsDragging, unmarkIsDragging] = useFlag();\n const [rgbInput, setRgbInput] = useState('');\n const [hexInput, setHexInput] = useState('');\n\n const rectsRef = useRef<CanvasRects>();\n const colorCtxRef = useRef<CanvasRenderingContext2D>();\n\n // Setup: cache rects, subscribe for drag events\n useEffect(() => {\n // We use `offsetLeft` instead of `left` to support screen transition\n const colorRect = {\n offsetLeft: colorPickerRef.current!.offsetLeft,\n ...pick(colorPickerRef.current!.getBoundingClientRect(), ['top', 'width', 'height']),\n };\n const hueRect = {\n offsetLeft: huePickerRef.current!.offsetLeft,\n ...pick(huePickerRef.current!.getBoundingClientRect(), ['width']),\n };\n\n rectsRef.current = { colorRect, hueRect };\n\n function handleColorDrag(e: MouseEvent | RealTouchEvent) {\n const colorPosition = [\n Math.min(Math.max(0, e.pageX! - colorRect.offsetLeft), colorRect.width - 1),\n Math.min(Math.max(0, e.pageY! - colorRect.top + containerRef.current!.scrollTop), colorRect.height - 1),\n ];\n\n const { huePosition } = hsb2positions(hsbRef.current, rectsRef.current!);\n\n setHsb(positions2hsb({ colorPosition, huePosition }, rectsRef.current!));\n markIsDragging();\n\n return true;\n }\n\n captureEvents(colorPickerRef.current!, {\n onCapture: handleColorDrag,\n onDrag: handleColorDrag,\n onRelease: unmarkIsDragging,\n onClick: unmarkIsDragging,\n selectorToPreventScroll: '.SettingsGeneralBackgroundColor',\n withCursor: true,\n });\n\n function handleHueDrag(e: MouseEvent | RealTouchEvent) {\n const { colorPosition } = hsb2positions(hsbRef.current, rectsRef.current!);\n const huePosition = Math.min(Math.max(0, e.pageX! - hueRect.offsetLeft), hueRect.width - 1);\n\n setHsb(positions2hsb({ colorPosition, huePosition }, rectsRef.current!));\n markIsDragging();\n\n return true;\n }\n\n captureEvents(huePickerRef.current!, {\n onCapture: handleHueDrag,\n onDrag: handleHueDrag,\n onRelease: unmarkIsDragging,\n onClick: unmarkIsDragging,\n selectorToPreventScroll: '.SettingsGeneralBackgroundColor',\n withCursor: true,\n });\n }, [markIsDragging, unmarkIsDragging]);\n\n const { colorPosition = [0, 0], huePosition = 0 } = rectsRef.current ? hsb2positions(hsb, rectsRef.current) : {};\n const hex = rgb2hex(hsb2rgb(hsb));\n const hue = hsb[0];\n const hueHex = rgb2hex(hsb2rgb([hue, 1, 1]));\n\n // Save value and update inputs when HSL changes\n useEffect(() => {\n const rgb = hsb2rgb(hsb);\n const color = `#${rgb2hex(rgb)}`;\n\n setRgbInput(rgb.join(', '));\n setHexInput(color);\n\n if (!isFirstRunRef.current) {\n const patternColor = getPatternColor(rgb);\n setThemeSettings({\n theme: themeRef.current,\n background: undefined,\n backgroundColor: color,\n patternColor,\n });\n }\n isFirstRunRef.current = false;\n }, [hsb, setThemeSettings]);\n\n // Redraw color picker when hue changes\n useEffect(() => {\n drawColor(colorPickerRef.current!.firstChild as HTMLCanvasElement, hue, colorCtxRef, rectsRef);\n }, [hue]);\n\n // Initially draw hue picker\n useEffect(() => {\n drawHue(huePickerRef.current!.firstChild as HTMLCanvasElement);\n }, []);\n\n const handleRgbChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const rgbValue = e.currentTarget.value.replace(/[^\\d, ]/g, '').slice(0, 13);\n\n if (rgbValue.match(/^\\d{1,3},\\s?\\d{1,3},\\s?\\d{1,3}$/)) {\n const rgb = rgbValue.split(',').map((channel) => Number(channel.trim())) as [number, number, number];\n setHsb(rgb2hsb(rgb));\n }\n\n e.currentTarget.value = rgbValue;\n }, []);\n\n const handleHexChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const hexValue = e.currentTarget.value.replace(/[^0-9a-fA-F]/g, '').slice(0, 6);\n\n if (hexValue.match(/^#?[0-9a-fA-F]{6}$/)) {\n setHsb(rgb2hsb(hex2rgb(hexValue.replace('#', ''))));\n }\n\n e.currentTarget.value = hexValue;\n }, []);\n\n const handlePredefinedColorClick = useCallback((e: React.MouseEvent<HTMLInputElement>) => {\n setHsb(rgb2hsb(hex2rgb(e.currentTarget.dataset.color!.replace('#', ''))));\n }, []);\n\n const className = buildClassName(\n 'SettingsGeneralBackgroundColor settings-content custom-scroll',\n isDragging && 'is-dragging',\n );\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div ref={containerRef} className={className}>\n <div className=\"settings-item pt-3\">\n <div ref={colorPickerRef} className=\"color-picker\">\n <canvas />\n <div\n className=\"handle\"\n style={`transform: translate(${colorPosition[0]}px, ${colorPosition[1]}px); background-color: #${hex};`}\n />\n </div>\n <div ref={huePickerRef} className=\"hue-picker\">\n <canvas />\n <div\n className=\"handle\"\n style={`transform: translateX(${huePosition}px); background-color: #${hueHex};`}\n />\n </div>\n <div className=\"tools\">\n <InputText value={hexInput} label=\"HEX\" onChange={handleHexChange} />\n <InputText value={rgbInput} label=\"RGB\" onChange={handleRgbChange} />\n </div>\n </div>\n <div className=\"predefined-colors\">\n {PREDEFINED_COLORS.map((color) => (\n <div\n className={color === `#${hex}` ? 'active' : undefined}\n data-color={color}\n style={`background-color: ${color};`}\n onClick={handlePredefinedColorClick}\n />\n ))}\n </div>\n </div>\n );\n};\n\nfunction getInitialHsb(backgroundColor?: string) {\n return backgroundColor && backgroundColor.startsWith('#')\n ? rgb2hsb(hex2rgb(backgroundColor.replace('#', '')))\n : DEFAULT_HSB;\n}\n\nfunction hsb2positions(hsb: [number, number, number], rects: CanvasRects) {\n return {\n colorPosition: [\n Math.round((hsb[1]) * (rects.colorRect.width - 1)),\n Math.round((1 - hsb[2]) * (rects.colorRect.height - 1)),\n ],\n huePosition: Math.round(hsb[0] * (rects.hueRect.width - 1)),\n };\n}\n\nfunction positions2hsb(\n { colorPosition, huePosition }: { colorPosition: number[]; huePosition: number },\n rects: CanvasRects,\n): [number, number, number] {\n return [\n huePosition / (rects.hueRect.width - 1),\n colorPosition[0] / (rects.colorRect.width - 1),\n 1 - colorPosition[1] / (rects.colorRect.height - 1),\n ];\n}\n\nfunction drawColor(\n canvas: HTMLCanvasElement,\n hue: number,\n colorCtxRef: MutableRefObject<CanvasRenderingContext2D | undefined>,\n rectsRef: RefObject<CanvasRects | undefined>,\n) {\n let w: number;\n let h: number;\n let ctx: CanvasRenderingContext2D;\n\n if (!colorCtxRef.current || !rectsRef.current) {\n // First run\n w = canvas.offsetWidth;\n h = canvas.offsetHeight;\n ctx = canvas.getContext('2d')!;\n\n canvas.width = w;\n canvas.height = h;\n\n colorCtxRef.current = ctx;\n } else {\n w = rectsRef.current.colorRect.width;\n h = rectsRef.current.colorRect.height;\n ctx = colorCtxRef.current;\n }\n\n const imgData = ctx!.createImageData(w, h);\n const pixels = imgData.data;\n const col = hsb2rgb([hue, 1, 1]);\n\n let index = 0;\n\n for (let y = 0; y < h; y++) {\n const perY = 1 - y / (h - 1);\n const st = [255 * perY, 255 * perY, 255 * perY];\n const ed = [col[0] * perY, col[1] * perY, col[2] * perY];\n for (let x = 0; x < w; x++) {\n const perX = x / (w - 1);\n pixels[index++] = st[0] + (ed[0] - st[0]) * perX;\n pixels[index++] = st[1] + (ed[1] - st[1]) * perX;\n pixels[index++] = st[2] + (ed[2] - st[2]) * perX;\n pixels[index++] = 255;\n }\n }\n\n ctx!.putImageData(imgData, 0, 0);\n}\n\nfunction drawHue(canvas: HTMLCanvasElement) {\n const w = canvas.offsetWidth;\n const h = 1;\n canvas.width = w;\n canvas.height = h;\n const ctx = canvas.getContext('2d')!;\n\n const imgData = ctx.createImageData(w, h);\n const pixels = imgData.data;\n\n let index = 0;\n\n for (let x = 0; x < w; x++) {\n const hue = x / (w - 1);\n const rgb = hsb2rgb([hue, 1, 1]);\n /* eslint-disable prefer-destructuring */\n pixels[index++] = rgb[0];\n pixels[index++] = rgb[1];\n pixels[index++] = rgb[2];\n /* eslint-enable prefer-destructuring */\n pixels[index++] = 255;\n }\n\n ctx.putImageData(imgData, 0, 0);\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const theme = selectTheme(global);\n const { backgroundColor } = global.settings.themes[theme] || {};\n return {\n backgroundColor,\n theme,\n };\n },\n)(SettingsGeneralBackground));\n","import type { ChangeEvent } from 'react';\nimport useRunDebounced from '../../../hooks/useRunDebounced';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { playNotifySound } from '../../../util/notifications';\n\nimport Checkbox from '../../ui/Checkbox';\nimport RangeSlider from '../../ui/RangeSlider';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n hasPrivateChatsNotifications: boolean;\n hasPrivateChatsMessagePreview: boolean;\n hasGroupNotifications: boolean;\n hasGroupMessagePreview: boolean;\n hasBroadcastNotifications: boolean;\n hasBroadcastMessagePreview: boolean;\n hasContactJoinedNotifications: boolean;\n hasWebNotifications: boolean;\n hasPushNotifications: boolean;\n notificationSoundVolume: number;\n};\n\nconst SettingsNotifications: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n hasPrivateChatsNotifications,\n hasPrivateChatsMessagePreview,\n hasGroupNotifications,\n hasGroupMessagePreview,\n hasBroadcastNotifications,\n hasBroadcastMessagePreview,\n hasContactJoinedNotifications,\n hasPushNotifications,\n hasWebNotifications,\n notificationSoundVolume,\n}) => {\n const {\n loadNotificationSettings,\n updateContactSignUpNotification,\n updateNotificationSettings,\n updateWebNotificationSettings,\n } = getActions();\n\n useEffect(() => {\n loadNotificationSettings();\n }, [loadNotificationSettings]);\n\n const runDebounced = useRunDebounced(500, true);\n\n const handleSettingsChange = useCallback((\n e: ChangeEvent<HTMLInputElement>,\n peerType: 'contact' | 'group' | 'broadcast',\n setting: 'silent' | 'showPreviews',\n ) => {\n const currentIsSilent = peerType === 'contact'\n ? !hasPrivateChatsNotifications\n : !(peerType === 'group' ? hasGroupNotifications : hasBroadcastNotifications);\n const currentShouldShowPreviews = peerType === 'contact'\n ? hasPrivateChatsMessagePreview\n : (peerType === 'group' ? hasGroupMessagePreview : hasBroadcastMessagePreview);\n\n updateNotificationSettings({\n peerType,\n ...(setting === 'silent' && { isSilent: !e.target.checked, shouldShowPreviews: currentShouldShowPreviews }),\n ...(setting === 'showPreviews' && { shouldShowPreviews: e.target.checked, isSilent: currentIsSilent }),\n });\n }, [\n hasBroadcastMessagePreview, hasBroadcastNotifications,\n hasGroupMessagePreview, hasGroupNotifications,\n hasPrivateChatsMessagePreview, hasPrivateChatsNotifications,\n updateNotificationSettings,\n ]);\n\n const handleWebNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n updateWebNotificationSettings({\n hasWebNotifications: e.target.checked,\n });\n }, [updateWebNotificationSettings]);\n\n const handlePushNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n updateWebNotificationSettings({\n hasPushNotifications: e.target.checked,\n });\n }, [updateWebNotificationSettings]);\n\n const handlePrivateChatsNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'contact', 'silent');\n }, [handleSettingsChange]);\n\n const handlePrivateChatsPreviewChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'contact', 'showPreviews');\n }, [handleSettingsChange]);\n\n const handleGroupsNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'group', 'silent');\n }, [handleSettingsChange]);\n\n const handleGroupsPreviewChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'group', 'showPreviews');\n }, [handleSettingsChange]);\n\n const handleChannelsNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'broadcast', 'silent');\n }, [handleSettingsChange]);\n\n const handleChannelsPreviewChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'broadcast', 'showPreviews');\n }, [handleSettingsChange]);\n\n const handleContactNotificationChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n updateContactSignUpNotification({\n isSilent: !e.target.checked,\n });\n }, [updateContactSignUpNotification]);\n\n const handleVolumeChange = useCallback((volume: number) => {\n updateWebNotificationSettings({\n notificationSoundVolume: volume,\n });\n runDebounced(() => playNotifySound(undefined, volume));\n }, [runDebounced, updateWebNotificationSettings]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Web notifications\n </h4>\n <Checkbox\n label=\"Web notifications\"\n // eslint-disable-next-line max-len\n subLabel={lang(hasWebNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasWebNotifications}\n onChange={handleWebNotificationsChange}\n />\n <Checkbox\n label=\"Offline notifications\"\n disabled={!hasWebNotifications}\n // eslint-disable-next-line max-len\n subLabel={lang(hasPushNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasPushNotifications}\n onChange={handlePushNotificationsChange}\n />\n <div className=\"settings-item-slider\">\n <RangeSlider\n label=\"Sound\"\n min={0}\n max={10}\n value={notificationSoundVolume}\n onChange={handleVolumeChange}\n />\n </div>\n </div>\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('AutodownloadPrivateChats')}\n </h4>\n\n <Checkbox\n label={lang('NotificationsForPrivateChats')}\n // eslint-disable-next-line max-len\n subLabel={lang(hasPrivateChatsNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasPrivateChatsNotifications}\n onChange={handlePrivateChatsNotificationsChange}\n />\n <Checkbox\n label={lang('MessagePreview')}\n disabled={!hasPrivateChatsNotifications}\n // eslint-disable-next-line max-len\n subLabel={lang(hasPrivateChatsMessagePreview ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasPrivateChatsMessagePreview}\n onChange={handlePrivateChatsPreviewChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterGroups')}</h4>\n\n <Checkbox\n label={lang('NotificationsForGroups')}\n subLabel={lang(hasGroupNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasGroupNotifications}\n onChange={handleGroupsNotificationsChange}\n />\n <Checkbox\n label={lang('MessagePreview')}\n disabled={!hasGroupNotifications}\n subLabel={lang(hasGroupMessagePreview ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasGroupMessagePreview}\n onChange={handleGroupsPreviewChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterChannels')}</h4>\n\n <Checkbox\n label={lang('NotificationsForChannels')}\n // eslint-disable-next-line max-len\n subLabel={lang(hasBroadcastNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasBroadcastNotifications}\n onChange={handleChannelsNotificationsChange}\n />\n <Checkbox\n label={lang('MessagePreview')}\n disabled={!hasBroadcastNotifications}\n // eslint-disable-next-line max-len\n subLabel={lang(hasBroadcastMessagePreview ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasBroadcastMessagePreview}\n onChange={handleChannelsPreviewChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('PhoneOther')}</h4>\n\n <Checkbox\n label={lang('ContactJoined')}\n checked={hasContactJoinedNotifications}\n onChange={handleContactNotificationChange}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n hasPrivateChatsNotifications: Boolean(global.settings.byKey.hasPrivateChatsNotifications),\n hasPrivateChatsMessagePreview: Boolean(global.settings.byKey.hasPrivateChatsMessagePreview),\n hasGroupNotifications: Boolean(global.settings.byKey.hasGroupNotifications),\n hasGroupMessagePreview: Boolean(global.settings.byKey.hasGroupMessagePreview),\n hasBroadcastNotifications: Boolean(global.settings.byKey.hasBroadcastNotifications),\n hasBroadcastMessagePreview: Boolean(global.settings.byKey.hasBroadcastMessagePreview),\n hasContactJoinedNotifications: Boolean(global.settings.byKey.hasContactJoinedNotifications),\n hasWebNotifications: global.settings.byKey.hasWebNotifications,\n hasPushNotifications: global.settings.byKey.hasPushNotifications,\n notificationSoundVolume: global.settings.byKey.notificationSoundVolume,\n };\n },\n)(SettingsNotifications));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiPrivacySettings } from '../../../types';\nimport { SettingsScreens } from '../../../types';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n hasPassword?: boolean;\n hasPasscode?: boolean;\n blockedCount: number;\n isSensitiveEnabled?: boolean;\n canChangeSensitive?: boolean;\n privacyPhoneNumber?: ApiPrivacySettings;\n privacyLastSeen?: ApiPrivacySettings;\n privacyProfilePhoto?: ApiPrivacySettings;\n privacyForwarding?: ApiPrivacySettings;\n privacyGroupChats?: ApiPrivacySettings;\n privacyPhoneCall?: ApiPrivacySettings;\n privacyPhoneP2P?: ApiPrivacySettings;\n};\n\nconst SettingsPrivacy: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n hasPassword,\n hasPasscode,\n blockedCount,\n isSensitiveEnabled,\n canChangeSensitive,\n privacyPhoneNumber,\n privacyLastSeen,\n privacyProfilePhoto,\n privacyForwarding,\n privacyGroupChats,\n privacyPhoneCall,\n privacyPhoneP2P,\n\n}) => {\n const {\n loadPrivacySettings,\n loadBlockedContacts,\n loadAuthorizations,\n loadContentSettings,\n updateContentSettings,\n } = getActions();\n\n useEffect(() => {\n loadBlockedContacts();\n loadAuthorizations();\n loadPrivacySettings();\n loadContentSettings();\n }, [loadBlockedContacts, loadAuthorizations, loadPrivacySettings, loadContentSettings]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function getVisibilityValue(setting?: ApiPrivacySettings) {\n const { visibility } = setting || {};\n const blockCount = setting ? setting.blockChatIds.length + setting.blockUserIds.length : 0;\n const allowCount = setting ? setting.allowChatIds.length + setting.allowUserIds.length : 0;\n const total = [];\n if (blockCount) total.push(`-${blockCount}`);\n if (allowCount) total.push(`+${allowCount}`);\n\n const exceptionString = total.length ? `(${total.join(',')})` : '';\n\n switch (visibility) {\n case 'everybody':\n return `${lang('P2PEverybody')} ${exceptionString}`;\n\n case 'contacts':\n return `${lang('P2PContacts')} ${exceptionString}`;\n\n case 'nobody':\n return `${lang('P2PNobody')} ${exceptionString}`;\n }\n\n return undefined;\n }\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <ListItem\n icon=\"delete-user\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyBlockedUsers)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('BlockedUsers')}</span>\n {blockedCount > 0 && (\n <span className=\"subtitle\" dir=\"auto\">\n {lang('Users', blockedCount)}\n </span>\n )}\n </div>\n </ListItem>\n <ListItem\n icon=\"key\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(\n hasPasscode ? SettingsScreens.PasscodeEnabled : SettingsScreens.PasscodeDisabled,\n )}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('Passcode')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {lang(hasPasscode ? 'PasswordOn' : 'PasswordOff')}\n </span>\n </div>\n </ListItem>\n <ListItem\n icon=\"lock\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(\n hasPassword ? SettingsScreens.TwoFaEnabled : SettingsScreens.TwoFaDisabled,\n )}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('TwoStepVerification')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {lang(hasPassword ? 'PasswordOn' : 'PasswordOff')}\n </span>\n </div>\n </ListItem>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('PrivacyTitle')}</h4>\n\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneNumber)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyPhoneTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyPhoneNumber)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyLastSeen)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('LastSeenTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyLastSeen)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyProfilePhoto)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyProfilePhotoTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyProfilePhoto)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneCall)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('WhoCanCallMe')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyPhoneCall)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneP2P)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyP2P')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyPhoneP2P)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyForwarding)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyForwardsTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyForwarding)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyGroupChats)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('WhoCanAddMe')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyGroupChats)}\n </span>\n </div>\n </ListItem>\n </div>\n\n {canChangeSensitive && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('lng_settings_sensitive_title')}\n </h4>\n <Checkbox\n label={lang('lng_settings_sensitive_disable_filtering')}\n subLabel={lang('lng_settings_sensitive_about')}\n checked={Boolean(isSensitiveEnabled)}\n disabled={!canChangeSensitive}\n onCheck={updateContentSettings}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n settings: {\n byKey: {\n hasPassword, isSensitiveEnabled, canChangeSensitive,\n },\n privacy,\n },\n blocked,\n passcode: {\n hasPasscode,\n },\n } = global;\n\n return {\n hasPassword,\n hasPasscode: Boolean(hasPasscode),\n blockedCount: blocked.totalCount,\n isSensitiveEnabled,\n canChangeSensitive,\n privacyPhoneNumber: privacy.phoneNumber,\n privacyLastSeen: privacy.lastSeen,\n privacyProfilePhoto: privacy.profilePhoto,\n privacyForwarding: privacy.forwards,\n privacyGroupChats: privacy.chatInvite,\n privacyPhoneCall: privacy.phoneCall,\n privacyPhoneP2P: privacy.phoneP2P,\n };\n },\n)(SettingsPrivacy));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ISettings, LangCode } from '../../../types';\nimport type { ApiLanguage } from '../../../api/types';\n\nimport { setLanguage } from '../../../util/langProvider';\n\nimport RadioGroup from '../../ui/RadioGroup';\nimport Loading from '../../ui/Loading';\nimport useFlag from '../../../hooks/useFlag';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = Pick<ISettings, 'languages' | 'language'>;\n\nconst SettingsLanguage: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n languages,\n language,\n}) => {\n const {\n loadLanguages,\n setSettingOption,\n } = getActions();\n\n const [selectedLanguage, setSelectedLanguage] = useState<string>(language);\n const [isLoading, markIsLoading, unmarkIsLoading] = useFlag();\n\n // TODO Throttle\n useEffect(() => {\n loadLanguages();\n }, [loadLanguages]);\n\n const handleChange = useCallback((langCode: string) => {\n setSelectedLanguage(langCode);\n markIsLoading();\n\n void setLanguage(langCode as LangCode, () => {\n unmarkIsLoading();\n\n setSettingOption({ language: langCode });\n });\n }, [markIsLoading, unmarkIsLoading, setSettingOption]);\n\n const options = useMemo(() => {\n return languages ? buildOptions(languages) : undefined;\n }, [languages]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content settings-item settings-language custom-scroll settings-item--first\">\n {options ? (\n <RadioGroup\n name=\"keyboard-send-settings\"\n options={options}\n selected={selectedLanguage}\n loadingOption={isLoading ? selectedLanguage : undefined}\n onChange={handleChange}\n />\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nfunction buildOptions(languages: ApiLanguage[]) {\n const currentLangCode = (window.navigator.language || 'en').toLowerCase();\n const shortLangCode = currentLangCode.substr(0, 2);\n\n return languages.map(({ langCode, nativeName, name }) => ({\n value: langCode,\n label: nativeName,\n subLabel: name,\n })).sort((a) => {\n return currentLangCode && (a.value === currentLangCode || a.value === shortLangCode) ? -1 : 0;\n });\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n languages: global.settings.byKey.languages,\n language: global.settings.byKey.language,\n };\n },\n)(SettingsLanguage));\n","import type { ApiPrivacyKey } from '../../../../types';\nimport { SettingsScreens } from '../../../../types';\n\nexport function getPrivacyKey(screen: SettingsScreens): ApiPrivacyKey | undefined {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n return 'phoneNumber';\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n return 'lastSeen';\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n return 'profilePhoto';\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return 'forwards';\n case SettingsScreens.PrivacyGroupChats:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return 'chatInvite';\n case SettingsScreens.PrivacyPhoneCall:\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n return 'phoneCall';\n case SettingsScreens.PrivacyPhoneP2P:\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n return 'phoneP2P';\n }\n\n return undefined;\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiUser } from '../../../api/types';\nimport type { ApiPrivacySettings } from '../../../types';\nimport { SettingsScreens } from '../../../types';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport RadioGroup from '../../ui/RadioGroup';\nimport { getPrivacyKey } from './helpers/privacy';\n\ntype OwnProps = {\n screen: SettingsScreens;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps =\n Partial<ApiPrivacySettings> & {\n chatsById?: Record<string, ApiChat>;\n usersById?: Record<string, ApiUser>;\n };\n\nconst SettingsPrivacyVisibility: FC<OwnProps & StateProps> = ({\n screen,\n isActive,\n onScreenSelect,\n onReset,\n visibility,\n allowUserIds,\n allowChatIds,\n blockUserIds,\n blockChatIds,\n chatsById,\n}) => {\n const { setPrivacyVisibility } = getActions();\n\n const lang = useLang();\n\n const visibilityOptions = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyGroupChats:\n return [\n { value: 'everybody', label: lang('P2PEverybody') },\n { value: 'contacts', label: lang('P2PContacts') },\n ];\n\n default:\n return [\n { value: 'everybody', label: lang('P2PEverybody') },\n { value: 'contacts', label: lang('P2PContacts') },\n { value: 'nobody', label: lang('P2PNobody') },\n ];\n }\n }, [lang, screen]);\n\n const exceptionLists = {\n shouldShowDenied: visibility !== 'nobody',\n shouldShowAllowed: visibility !== 'everybody',\n };\n\n const privacyKey = getPrivacyKey(screen);\n\n const headerText = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return lang('PrivacyPhoneTitle');\n case SettingsScreens.PrivacyLastSeen:\n return lang('LastSeenTitle');\n case SettingsScreens.PrivacyProfilePhoto:\n return lang('PrivacyProfilePhotoTitle');\n case SettingsScreens.PrivacyForwarding:\n return lang('PrivacyForwardsTitle');\n case SettingsScreens.PrivacyGroupChats:\n return lang('WhoCanAddMe');\n case SettingsScreens.PrivacyPhoneCall:\n return lang('WhoCanCallMe');\n case SettingsScreens.PrivacyPhoneP2P:\n return lang('PrivacyP2P');\n default:\n return undefined;\n }\n }, [lang, screen]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const descriptionText = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyLastSeen:\n return lang('CustomHelp');\n default:\n return undefined;\n }\n }, [lang, screen]);\n\n const allowedContactsScreen = (() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return SettingsScreens.PrivacyPhoneNumberAllowedContacts;\n case SettingsScreens.PrivacyLastSeen:\n return SettingsScreens.PrivacyLastSeenAllowedContacts;\n case SettingsScreens.PrivacyProfilePhoto:\n return SettingsScreens.PrivacyProfilePhotoAllowedContacts;\n case SettingsScreens.PrivacyForwarding:\n return SettingsScreens.PrivacyForwardingAllowedContacts;\n case SettingsScreens.PrivacyPhoneCall:\n return SettingsScreens.PrivacyPhoneCallAllowedContacts;\n case SettingsScreens.PrivacyPhoneP2P:\n return SettingsScreens.PrivacyPhoneP2PAllowedContacts;\n default:\n return SettingsScreens.PrivacyGroupChatsAllowedContacts;\n }\n })();\n\n const deniedContactsScreen = (() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return SettingsScreens.PrivacyPhoneNumberDeniedContacts;\n case SettingsScreens.PrivacyLastSeen:\n return SettingsScreens.PrivacyLastSeenDeniedContacts;\n case SettingsScreens.PrivacyProfilePhoto:\n return SettingsScreens.PrivacyProfilePhotoDeniedContacts;\n case SettingsScreens.PrivacyForwarding:\n return SettingsScreens.PrivacyForwardingDeniedContacts;\n case SettingsScreens.PrivacyPhoneCall:\n return SettingsScreens.PrivacyPhoneCallDeniedContacts;\n case SettingsScreens.PrivacyPhoneP2P:\n return SettingsScreens.PrivacyPhoneP2PDeniedContacts;\n default:\n return SettingsScreens.PrivacyGroupChatsDeniedContacts;\n }\n })();\n\n const allowedCount = useMemo(() => {\n if (!allowUserIds || !allowChatIds || !chatsById) {\n return 0;\n }\n\n return allowChatIds.reduce((result, chatId) => {\n return result + (chatsById[chatId] ? chatsById[chatId].membersCount! : 0);\n }, allowUserIds.length);\n }, [allowChatIds, allowUserIds, chatsById]);\n\n const blockCount = useMemo(() => {\n if (!blockUserIds || !blockChatIds || !chatsById) {\n return 0;\n }\n\n return blockChatIds.reduce((result, chatId) => {\n return result + (chatsById[chatId] ? chatsById[chatId].membersCount! : 0);\n }, blockUserIds.length);\n }, [blockChatIds, blockUserIds, chatsById]);\n\n const handleVisibilityChange = useCallback((value) => {\n setPrivacyVisibility({\n privacyKey,\n visibility: value,\n });\n }, [privacyKey, setPrivacyVisibility]);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{headerText}</h4>\n\n <RadioGroup\n name={`visibility-${privacyKey}`}\n options={visibilityOptions}\n onChange={handleVisibilityChange}\n selected={visibility}\n />\n\n {descriptionText && (\n <p className=\"settings-item-description-larger\" dir={lang.isRtl ? 'rtl' : undefined}>{descriptionText}</p>\n )}\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('PrivacyExceptions')}</h4>\n\n {exceptionLists.shouldShowAllowed && (\n <ListItem\n narrow\n icon=\"add-user\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => {\n onScreenSelect(allowedContactsScreen);\n }}\n >\n <div className=\"multiline-menu-item full-size\">\n {allowedCount > 0 && <span className=\"date\" dir=\"auto\">+{allowedCount}</span>}\n <span className=\"title\">{lang('AlwaysAllow')}</span>\n <span className=\"subtitle\">{lang('EditAdminAddUsers')}</span>\n </div>\n </ListItem>\n )}\n {exceptionLists.shouldShowDenied && (\n <ListItem\n narrow\n icon=\"delete-user\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => {\n onScreenSelect(deniedContactsScreen);\n }}\n >\n <div className=\"multiline-menu-item full-size\">\n {blockCount > 0 && <span className=\"date\" dir=\"auto\">−{blockCount}</span>}\n <span className=\"title\">{lang('NeverAllow')}</span>\n <span className=\"subtitle\">{lang('EditAdminAddUsers')}</span>\n </div>\n </ListItem>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { screen }): StateProps => {\n let privacySettings: ApiPrivacySettings | undefined;\n\n const {\n chats: { byId: chatsById },\n settings: { privacy },\n } = global;\n\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n privacySettings = privacy.phoneNumber;\n break;\n\n case SettingsScreens.PrivacyLastSeen:\n privacySettings = privacy.lastSeen;\n break;\n\n case SettingsScreens.PrivacyProfilePhoto:\n privacySettings = privacy.profilePhoto;\n break;\n\n case SettingsScreens.PrivacyPhoneCall:\n privacySettings = privacy.phoneCall;\n break;\n\n case SettingsScreens.PrivacyPhoneP2P:\n privacySettings = privacy.phoneP2P;\n break;\n\n case SettingsScreens.PrivacyForwarding:\n privacySettings = privacy.forwards;\n break;\n\n case SettingsScreens.PrivacyGroupChats:\n privacySettings = privacy.chatInvite;\n break;\n }\n\n if (!privacySettings) {\n return {};\n }\n\n return {\n ...privacySettings,\n chatsById,\n };\n },\n)(SettingsPrivacyVisibility));\n","import type { ApiSession } from '../../../../api/types';\n\nexport default function getSessionIcon(session: ApiSession): string {\n const platform = session.platform.toLowerCase();\n const device = session.deviceModel.toLowerCase();\n const systemVersion = session.systemVersion.toLowerCase();\n\n if (device.includes('xbox')) {\n return 'xbox';\n }\n\n if (device.includes('chrome') && !device.includes('chromebook')) {\n return 'chrome';\n }\n if (device.includes('brave')) {\n return 'brave';\n }\n if (device.includes('vivaldi')) {\n return 'vivaldi';\n }\n if (device.includes('safari')) {\n return 'safari';\n }\n if (device.includes('firefox')) {\n return 'firefox';\n }\n if (device.includes('opera')) {\n return 'opera';\n }\n if (device.includes('samsungbrowser')) {\n return 'samsung';\n }\n if (platform.includes('android')) {\n return 'android';\n }\n if (\n device.includes('iphone')\n || device.includes('ipad')\n || platform.includes('ios')\n || platform.includes('macos')\n || systemVersion.includes('macos')\n ) {\n return 'apple';\n }\n if (platform.includes('ubuntu') || systemVersion.includes('ubuntu')) {\n return 'ubuntu';\n }\n if (platform.includes('linux') || systemVersion.includes('linux')) {\n return 'linux';\n }\n if (platform.includes('windows') || systemVersion.includes('windows')) {\n return 'windows';\n }\n\n return 'unknown';\n}\n","// extracted by mini-css-extract-plugin\nexport default {\"SettingsActiveSession\":\"src-components-left-settings-SettingsActiveSession-module__SettingsActiveSession\",\"settingsActiveSession\":\"src-components-left-settings-SettingsActiveSession-module__SettingsActiveSession\",\"iconDevice\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice\",\"iconDevice__android\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__android\",\"iconDeviceAndroid\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__android\",\"iconDevice__apple\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__apple\",\"iconDeviceApple\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__apple\",\"iconDevice__brave\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__brave\",\"iconDeviceBrave\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__brave\",\"iconDevice__chrome\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__chrome\",\"iconDeviceChrome\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__chrome\",\"iconDevice__edge\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__edge\",\"iconDeviceEdge\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__edge\",\"iconDevice__firefox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__firefox\",\"iconDeviceFirefox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__firefox\",\"iconDevice__linux\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__linux\",\"iconDeviceLinux\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__linux\",\"iconDevice__opera\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__opera\",\"iconDeviceOpera\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__opera\",\"iconDevice__safari\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__safari\",\"iconDeviceSafari\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__safari\",\"iconDevice__samsung\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__samsung\",\"iconDeviceSamsung\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__samsung\",\"iconDevice__ubuntu\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__ubuntu\",\"iconDeviceUbuntu\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__ubuntu\",\"iconDevice__unknown\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__unknown\",\"iconDeviceUnknown\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__unknown\",\"iconDevice__vivaldi\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__vivaldi\",\"iconDeviceVivaldi\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__vivaldi\",\"iconDevice__windows\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__windows\",\"iconDeviceWindows\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__windows\",\"iconDevice__xbox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__xbox\",\"iconDeviceXbox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__xbox\",\"title\":\"src-components-left-settings-SettingsActiveSession-module__title\",\"note\":\"src-components-left-settings-SettingsActiveSession-module__note\",\"date\":\"src-components-left-settings-SettingsActiveSession-module__date\",\"box\":\"src-components-left-settings-SettingsActiveSession-module__box\",\"actionHeader\":\"src-components-left-settings-SettingsActiveSession-module__actionHeader\",\"actionName\":\"src-components-left-settings-SettingsActiveSession-module__actionName\",\"headerButton\":\"src-components-left-settings-SettingsActiveSession-module__headerButton\"};","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiSession } from '../../../api/types';\n\nimport { formatDateTimeToString } from '../../../util/dateFormat';\nimport useLang from '../../../hooks/useLang';\nimport useCurrentOrPrev from '../../../hooks/useCurrentOrPrev';\nimport getSessionIcon from './helpers/getSessionIcon';\nimport buildClassName from '../../../util/buildClassName';\n\nimport ListItem from '../../ui/ListItem';\nimport Modal from '../../ui/Modal';\nimport Switcher from '../../ui/Switcher';\nimport Button from '../../ui/Button';\n\nimport styles from './SettingsActiveSession.module.scss';\n\ntype OwnProps = {\n isOpen: boolean;\n hash?: string;\n onClose: () => void;\n};\n\ntype StateProps = {\n session?: ApiSession;\n};\n\nconst SettingsActiveSession: FC<OwnProps & StateProps> = ({\n isOpen, session, onClose,\n}) => {\n const { changeSessionSettings, terminateAuthorization } = getActions();\n const lang = useLang();\n\n const renderingSession = useCurrentOrPrev(session, true);\n\n const handleSecretChatsStateChange = useCallback(() => {\n changeSessionSettings({\n hash: session!.hash,\n areSecretChatsEnabled: !session!.areSecretChatsEnabled,\n });\n }, [changeSessionSettings, session]);\n\n const handleCallsStateChange = useCallback(() => {\n changeSessionSettings({\n hash: session!.hash,\n areCallsEnabled: !session!.areCallsEnabled,\n });\n }, [changeSessionSettings, session]);\n\n const handleTerminateSessionClick = useCallback(() => {\n terminateAuthorization({ hash: session!.hash });\n onClose();\n }, [onClose, session, terminateAuthorization]);\n\n if (!renderingSession) {\n return undefined;\n }\n\n function renderHeader() {\n return (\n <div className=\"modal-header-condensed\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel={lang('Close')} onClick={onClose}>\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{lang('SessionPreview.Title')}</div>\n <Button\n color=\"danger\"\n onClick={handleTerminateSessionClick}\n className={buildClassName('modal-action-button', styles.headerButton)}\n >\n {lang('SessionPreview.TerminateSession')}\n </Button>\n </div>\n );\n }\n return (\n <Modal\n header={renderHeader()}\n isOpen={isOpen}\n hasCloseButton\n onClose={onClose}\n className={styles.SettingsActiveSession}\n >\n <div className={buildClassName(\n styles.iconDevice,\n renderingSession && styles[`iconDevice__${getSessionIcon(renderingSession)}`],\n )}\n />\n <h3 className={styles.title} dir=\"auto\">{renderingSession?.deviceModel}</h3>\n <div className={styles.date} aria-label={lang('PrivacySettings.LastSeen')}>\n {formatDateTimeToString(renderingSession.dateActive * 1000, lang.code)}\n </div>\n\n <dl className={styles.box}>\n <dt>{lang('SessionPreview.App')}</dt>\n <dd>\n {renderingSession?.appName} {renderingSession?.appVersion},{' '}\n {renderingSession?.platform} {renderingSession?.systemVersion}\n </dd>\n\n <dt>{lang('SessionPreview.Ip')}</dt>\n <dd>{renderingSession?.ip}</dd>\n\n <dt>{lang('SessionPreview.Location')}</dt>\n <dd>{renderingSession && getLocation(renderingSession)}</dd>\n </dl>\n\n <p className={styles.note}>{lang('SessionPreview.IpDesc')}</p>\n\n <h4 className={styles.actionHeader}>{lang('AuthSessions.View.AcceptTitle')}</h4>\n\n <ListItem onClick={handleSecretChatsStateChange}>\n <span className={styles.actionName}>{lang('SessionPreview.Accept.Secret')}</span>\n <Switcher\n id=\"accept_secrets\"\n label=\"On\"\n checked={renderingSession.areSecretChatsEnabled}\n />\n </ListItem>\n <ListItem onClick={handleCallsStateChange}>\n <span className={styles.actionName}>{lang('SessionPreview.Accept.Calls')}</span>\n <Switcher\n id=\"accept_calls\"\n label=\"On\"\n checked={renderingSession.areCallsEnabled}\n />\n </ListItem>\n </Modal>\n );\n};\n\nfunction getLocation(session: ApiSession) {\n return [session.region, session.country].filter(Boolean).join(', ');\n}\n\nexport default memo(withGlobal<OwnProps>((global, { hash }) => {\n return {\n session: hash ? global.activeSessions.byHash[hash] : undefined,\n };\n})(SettingsActiveSession));\n","/* eslint-disable react/jsx-no-bind */\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiSession } from '../../../api/types';\n\nimport { formatPastTimeShort } from '../../../util/dateFormat';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport getSessionIcon from './helpers/getSessionIcon';\n\nimport ListItem from '../../ui/ListItem';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport SettingsActiveSession from './SettingsActiveSession';\n\nimport './SettingsActiveSessions.scss';\nimport RadioGroup from '../../ui/RadioGroup';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n byHash: Record<string, ApiSession>;\n orderedHashes: string[];\n ttlDays?: number;\n};\n\nconst SettingsActiveSessions: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n byHash,\n orderedHashes,\n ttlDays,\n}) => {\n const {\n terminateAuthorization,\n terminateAllAuthorizations,\n changeSessionTtl,\n } = getActions();\n\n const lang = useLang();\n const [isConfirmTerminateAllDialogOpen, openConfirmTerminateAllDialog, closeConfirmTerminateAllDialog] = useFlag();\n const [openedSessionHash, setOpenedSessionHash] = useState<string | undefined>();\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n const autoTerminateValue = useMemo(() => {\n if (ttlDays === undefined) {\n return undefined;\n }\n if (ttlDays <= 7) {\n return '7';\n }\n if (ttlDays <= 30) {\n return '30';\n }\n if (ttlDays <= 90) {\n return '90';\n }\n if (ttlDays <= 180) {\n return '180';\n }\n\n return undefined;\n }, [ttlDays]);\n\n const AUTO_TERMINATE_OPTIONS = useMemo(() => [{\n label: lang('Weeks', 1, 'i'),\n value: '7',\n }, {\n label: lang('Months', 1, 'i'),\n value: '30',\n }, {\n label: lang('Months', 3, 'i'),\n value: '90',\n }, {\n label: lang('Months', 6, 'i'),\n value: '180',\n }], [lang]);\n\n const handleTerminateSessionClick = useCallback((hash: string) => {\n terminateAuthorization({ hash });\n }, [terminateAuthorization]);\n\n const handleTerminateAllSessions = useCallback(() => {\n closeConfirmTerminateAllDialog();\n terminateAllAuthorizations();\n }, [closeConfirmTerminateAllDialog, terminateAllAuthorizations]);\n\n const handleOpenSessionModal = useCallback((hash: string) => {\n setOpenedSessionHash(hash);\n openModal();\n }, [openModal]);\n\n const handleCloseSessionModal = useCallback(() => {\n setOpenedSessionHash(undefined);\n closeModal();\n }, [closeModal]);\n\n const handleChangeSessionTtl = useCallback((value: string) => {\n changeSessionTtl({ days: Number(value) });\n }, [changeSessionTtl]);\n\n const currentSession = useMemo(() => {\n const currentSessionHash = orderedHashes.find((hash) => byHash[hash].isCurrent);\n\n return currentSessionHash ? byHash[currentSessionHash] : undefined;\n }, [byHash, orderedHashes]);\n\n const otherSessionHashes = useMemo(() => {\n return orderedHashes.filter((hash) => !byHash[hash].isCurrent);\n }, [byHash, orderedHashes]);\n const hasOtherSessions = Boolean(otherSessionHashes.length);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function renderCurrentSession(session: ApiSession) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('AuthSessions.CurrentSession')}\n </h4>\n\n <ListItem narrow inactive icon={`device-${getSessionIcon(session)} icon-device`}>\n <div className=\"multiline-menu-item\" dir=\"auto\">\n <span className=\"title\" dir=\"auto\">{session.deviceModel}</span>\n <span className=\"subtitle black tight\">\n {session.appName} {session.appVersion}, {session.platform} {session.systemVersion}\n </span>\n <span className=\"subtitle\">{session.ip} - {getLocation(session)}</span>\n </div>\n </ListItem>\n\n {hasOtherSessions && (\n <ListItem\n className=\"destructive mb-0 no-icon\"\n icon=\"stop\"\n ripple\n narrow\n onClick={openConfirmTerminateAllDialog}\n >\n {lang('TerminateAllSessions')}\n </ListItem>\n )}\n </div>\n );\n }\n\n function renderOtherSessions(sessionHashes: string[]) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('OtherSessions')}\n </h4>\n\n {sessionHashes.map(renderSession)}\n </div>\n );\n }\n\n function renderAutoTerminate() {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('TerminateOldSessionHeader')}\n </h4>\n\n <p>{lang('IfInactiveFor')}</p>\n <RadioGroup\n name=\"session_ttl\"\n options={AUTO_TERMINATE_OPTIONS}\n selected={autoTerminateValue}\n onChange={handleChangeSessionTtl}\n />\n </div>\n );\n }\n\n function renderSession(sessionHash: string) {\n const session = byHash[sessionHash];\n\n return (\n <ListItem\n key={session.hash}\n ripple\n narrow\n contextActions={[{\n title: 'Terminate',\n icon: 'stop',\n handler: () => {\n handleTerminateSessionClick(session.hash);\n },\n }]}\n icon={`device-${getSessionIcon(session)} icon-device`}\n onClick={() => { handleOpenSessionModal(session.hash); }}\n >\n <div className=\"multiline-menu-item full-size\" dir=\"auto\">\n <span className=\"date\">{formatPastTimeShort(lang, session.dateActive * 1000)}</span>\n <span className=\"title\">{session.deviceModel}</span>\n <span className=\"subtitle black tight\">\n {session.appName} {session.appVersion}, {session.platform} {session.systemVersion}\n </span>\n <span className=\"subtitle\">{session.ip} {getLocation(session)}</span>\n </div>\n </ListItem>\n );\n }\n\n return (\n <div className=\"settings-content custom-scroll SettingsActiveSessions\">\n {currentSession && renderCurrentSession(currentSession)}\n {hasOtherSessions && renderOtherSessions(otherSessionHashes)}\n {renderAutoTerminate()}\n {hasOtherSessions && (\n <ConfirmDialog\n isOpen={isConfirmTerminateAllDialogOpen}\n onClose={closeConfirmTerminateAllDialog}\n text={lang('AreYouSureSessions')}\n confirmLabel={lang('TerminateAllSessions')}\n confirmHandler={handleTerminateAllSessions}\n confirmIsDestructive\n />\n )}\n <SettingsActiveSession isOpen={isModalOpen} hash={openedSessionHash} onClose={handleCloseSessionModal} />\n </div>\n );\n};\n\nfunction getLocation(session: ApiSession) {\n return [session.region, session.country].filter(Boolean).join(', ');\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => global.activeSessions,\n)(SettingsActiveSessions));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useMemo, useState, memo, useRef, useCallback, useEffect,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiUser } from '../../../api/types';\n\nimport { filterUsersByName, getUserFullName } from '../../../global/helpers';\nimport { unique } from '../../../util/iteratees';\nimport useLang from '../../../hooks/useLang';\n\nimport ChatOrUserPicker from '../../common/ChatOrUserPicker';\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: NoneToVoidFunction;\n};\n\ntype StateProps = {\n usersById: Record<string, ApiUser>;\n blockedIds: string[];\n contactIds?: string[];\n localContactIds?: string[];\n currentUserId?: string;\n};\n\nconst BlockUserModal: FC<OwnProps & StateProps> = ({\n usersById,\n blockedIds,\n contactIds,\n localContactIds,\n currentUserId,\n isOpen,\n onClose,\n}) => {\n const {\n setUserSearchQuery,\n blockContact,\n } = getActions();\n\n const lang = useLang();\n const [filter, setFilter] = useState('');\n // eslint-disable-next-line no-null/no-null\n const filterRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n setUserSearchQuery({ query: filter });\n }, [filter, setUserSearchQuery]);\n\n const filteredContactIds = useMemo(() => {\n const availableContactIds = unique([\n ...(contactIds || []),\n ...(localContactIds || []),\n ].filter((contactId) => {\n return contactId !== currentUserId && !blockedIds.includes(contactId);\n }));\n\n return filterUsersByName(availableContactIds, usersById, filter)\n .sort((firstId, secondId) => {\n const firstName = getUserFullName(usersById[firstId]) || '';\n const secondName = getUserFullName(usersById[secondId]) || '';\n\n return firstName.localeCompare(secondName);\n });\n }, [blockedIds, contactIds, currentUserId, filter, localContactIds, usersById]);\n\n const handleRemoveUser = useCallback((userId: string) => {\n const { id: contactId, accessHash } = usersById[userId] || {};\n if (!contactId || !accessHash) {\n return;\n }\n blockContact({ contactId, accessHash });\n onClose();\n }, [blockContact, onClose, usersById]);\n\n return (\n <ChatOrUserPicker\n isOpen={isOpen}\n chatOrUserIds={filteredContactIds}\n filterRef={filterRef}\n filterPlaceholder={lang('BlockedUsers.BlockUser')}\n filter={filter}\n onFilterChange={setFilter}\n onSelectChatOrUser={handleRemoveUser}\n onClose={onClose}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n users: {\n byId: usersById,\n },\n blocked: {\n ids: blockedIds,\n },\n contactList,\n currentUserId,\n } = global;\n\n return {\n usersById,\n blockedIds,\n contactIds: contactList?.userIds,\n localContactIds: global.userSearch.localUserIds,\n currentUserId,\n };\n },\n)(BlockUserModal));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiCountryCode, ApiUser } from '../../../api/types';\n\nimport { CHAT_HEIGHT_PX } from '../../../config';\nimport { formatPhoneNumberWithCode } from '../../../util/phoneNumber';\nimport {\n getChatTitle, getUserFullName, isUserId,\n} from '../../../global/helpers';\nimport renderText from '../../common/helpers/renderText';\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useFlag from '../../../hooks/useFlag';\n\nimport ListItem from '../../ui/ListItem';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Avatar from '../../common/Avatar';\nimport Loading from '../../ui/Loading';\nimport BlockUserModal from './BlockUserModal';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n chatsByIds: Record<string, ApiChat>;\n usersByIds: Record<string, ApiUser>;\n blockedIds: string[];\n phoneCodeList: ApiCountryCode[];\n};\n\nconst SettingsPrivacyBlockedUsers: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n chatsByIds,\n usersByIds,\n blockedIds,\n phoneCodeList,\n}) => {\n const { unblockContact } = getActions();\n\n const lang = useLang();\n const [isBlockUserModalOpen, openBlockUserModal, closeBlockUserModal] = useFlag();\n const handleUnblockClick = useCallback((contactId: string) => {\n unblockContact({ contactId });\n }, [unblockContact]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function renderContact(contactId: string, i: number, viewportOffset: number) {\n const isPrivate = isUserId(contactId);\n const user = isPrivate ? usersByIds[contactId] : undefined;\n const chat = !isPrivate ? chatsByIds[contactId] : undefined;\n\n const className = buildClassName(\n 'Chat chat-item-clickable blocked-list-item small-icon',\n isPrivate ? 'private' : 'group',\n );\n\n return (\n <ListItem\n key={contactId}\n className={className}\n ripple\n narrow\n contextActions={[{\n title: 'Unblock',\n icon: 'unlock',\n handler: () => {\n handleUnblockClick(contactId);\n },\n }]}\n style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}\n >\n <Avatar size=\"medium\" user={user} chat={chat} />\n <div className=\"contact-info\" dir=\"auto\">\n <h3 dir=\"auto\">{renderText((isPrivate ? getUserFullName(user) : getChatTitle(lang, chat!)) || '')}</h3>\n {user?.phoneNumber && (\n <div className=\"contact-phone\" dir=\"auto\">{formatPhoneNumberWithCode(phoneCodeList, user.phoneNumber)}</div>\n )}\n {user && !user.phoneNumber && user.username && (\n <div className=\"contact-username\" dir=\"auto\">@{user.username}</div>\n )}\n </div>\n </ListItem>\n );\n }\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content infinite-scroll\">\n <div className=\"settings-item no-border\">\n <p className=\"settings-item-description-larger mt-0 mb-2\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('BlockedUsersInfo')}\n </p>\n </div>\n\n <div className=\"chat-list custom-scroll\">\n {blockedIds?.length ? (\n <div className=\"scroll-container\">\n {blockedIds!.map((contactId, i) => renderContact(contactId, i, 0))}\n </div>\n ) : blockedIds && !blockedIds.length ? (\n <div className=\"no-results\" dir=\"auto\">{lang('NoBlocked')}</div>\n ) : (\n <Loading key=\"loading\" />\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown\n onClick={openBlockUserModal}\n ariaLabel={lang('BlockContact')}\n >\n <i className=\"icon-add\" />\n </FloatingActionButton>\n <BlockUserModal\n isOpen={isBlockUserModalOpen}\n onClose={closeBlockUserModal}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n chats: {\n byId: chatsByIds,\n },\n users: {\n byId: usersByIds,\n },\n blocked: {\n ids,\n },\n countryList: {\n phoneCodes: phoneCodeList,\n },\n } = global;\n\n return {\n chatsByIds,\n usersByIds,\n blockedIds: ids,\n phoneCodeList,\n };\n },\n)(SettingsPrivacyBlockedUsers));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport ListItem from '../../../ui/ListItem';\nimport renderText from '../../../common/helpers/renderText';\nimport AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview';\n\nimport lockPreviewUrl from '../../../../assets/lock.png';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsTwoFaEnabled: FC<OwnProps> = ({\n isActive, onReset, onScreenSelect,\n}) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={160}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {renderText(lang('EnabledPasswordText'), ['br'])}\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <ListItem\n icon=\"edit\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.TwoFaChangePasswordCurrent)}\n >\n {lang('ChangePassword')}\n </ListItem>\n <ListItem\n icon=\"password-off\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.TwoFaTurnOff)}\n >\n {lang('TurnPasswordOff')}\n </ListItem>\n <ListItem\n icon=\"email\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCurrentPassword)}\n >\n {lang('SetRecoveryEmail')}\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsTwoFaEnabled);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useState } from '../../../lib/teact/teact';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport PasswordMonkey from '../../common/PasswordMonkey';\nimport PasswordForm from '../../common/PasswordForm';\n\ntype OwnProps = {\n error?: string;\n isLoading?: boolean;\n shouldDisablePasswordManager?: boolean;\n expectedPassword?: string;\n placeholder?: string;\n hint?: string;\n submitLabel?: string;\n clearError?: NoneToVoidFunction;\n onSubmit: (password: string) => void;\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst EQUAL_PASSWORD_ERROR = 'Passwords Should Be Equal';\n\nconst SettingsPasswordForm: FC<OwnProps> = ({\n isActive,\n onReset,\n error,\n isLoading,\n shouldDisablePasswordManager,\n expectedPassword,\n placeholder = 'Current Password',\n hint,\n submitLabel,\n clearError,\n onSubmit,\n}) => {\n const [validationError, setValidationError] = useState<string>('');\n const [shouldShowPassword, setShouldShowPassword] = useState(false);\n\n const handleSubmit = useCallback((newPassword) => {\n if (expectedPassword && newPassword !== expectedPassword) {\n setValidationError(EQUAL_PASSWORD_ERROR);\n } else {\n onSubmit(newPassword);\n }\n }, [onSubmit, expectedPassword]);\n\n const handleClearError = useCallback(() => {\n if (clearError) {\n clearError();\n }\n setValidationError('');\n }, [clearError]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content password-form custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <PasswordMonkey isBig isPasswordVisible={shouldShowPassword} />\n </div>\n\n <div className=\"settings-item pt-0\">\n <PasswordForm\n error={validationError || error}\n hint={hint}\n placeholder={placeholder}\n shouldDisablePasswordManager={shouldDisablePasswordManager}\n submitLabel={submitLabel || lang('Next')}\n clearError={handleClearError}\n isLoading={isLoading}\n isPasswordVisible={shouldShowPassword}\n shouldResetValue={isActive}\n onChangePasswordVisibility={setShouldShowPassword}\n onSubmit={handleSubmit}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasswordForm);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview';\n\nimport lockPreviewUrl from '../../../../assets/lock.png';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\n\ntype OwnProps = {\n onStart: NoneToVoidFunction;\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst SettingsTwoFaStart: FC<OwnProps> = ({\n isActive, onReset, onStart,\n}) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={160}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {lang('SetAdditionalPasswordInfo')}\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={onStart}>{lang('EditAdminTransferSetPassword')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsTwoFaStart);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport type { ApiSticker } from '../../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../../util/environment';\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\nimport renderText from '../../../common/helpers/renderText';\nimport useFlag from '../../../../hooks/useFlag';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport Modal from '../../../ui/Modal';\nimport InputText from '../../../ui/InputText';\nimport AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker';\n\ntype OwnProps = {\n icon: 'hint' | 'email';\n type?: 'text' | 'email';\n isLoading?: boolean;\n error?: string;\n placeholder: string;\n shouldConfirm?: boolean;\n clearError?: NoneToVoidFunction;\n onSubmit: (value?: string) => void;\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\nconst ICON_SIZE = 160;\n\nconst SettingsTwoFaSkippableForm: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n type = 'text',\n isLoading,\n error,\n placeholder,\n shouldConfirm,\n clearError,\n onSubmit,\n isActive,\n onReset,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n const [isConfirmShown, markIsConfirmShown, unmarkIsConfirmShown] = useFlag(false);\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (error && clearError) {\n clearError();\n }\n\n setValue(e.target.value);\n }, [clearError, error]);\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n\n if (!inputRef.current) {\n return;\n }\n\n onSubmit(value);\n };\n\n const handleSkip = useCallback(() => {\n onSubmit();\n }, [onSubmit]);\n\n const handleSkipConfirm = useCallback(() => {\n unmarkIsConfirmShown();\n onSubmit();\n }, [onSubmit, unmarkIsConfirmShown]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconFromSticker sticker={animatedEmoji} size={ICON_SIZE} className=\"settings-content-icon\" />\n </div>\n\n <div className=\"settings-item pt-0\">\n <form action=\"\" onSubmit={handleSubmit}>\n <InputText\n ref={inputRef}\n value={value}\n inputMode={type}\n label={placeholder}\n error={error}\n onChange={handleInputChange}\n />\n\n {value ? (\n <Button type=\"submit\" isLoading={isLoading} ripple>{lang('Continue')}</Button>\n ) : (\n <Button\n isText\n isLoading={isLoading}\n ripple\n onClick={shouldConfirm ? markIsConfirmShown : handleSkip}\n >\n {lang('YourEmailSkip')}\n </Button>\n )}\n </form>\n {shouldConfirm && (\n <Modal\n className=\"narrow\"\n isOpen={isConfirmShown}\n title={lang('YourEmailSkipWarning')}\n onClose={unmarkIsConfirmShown}\n >\n {renderText(lang('YourEmailSkipWarningText'), ['br', 'simple_markdown'])}\n <div className=\"dialog-buttons\">\n <Button\n color=\"danger\"\n ripple\n isText\n className=\"confirm-dialog-button\"\n onClick={handleSkipConfirm}\n >\n {lang('YourEmailSkip')}\n </Button>\n <Button\n color=\"primary\"\n ripple\n isText\n className=\"confirm-dialog-button\"\n onClick={unmarkIsConfirmShown}\n >\n {lang('Cancel')}\n </Button>\n </div>\n </Modal>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global, { icon }) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, icon === 'email' ? '💌' : '💡'),\n };\n})(SettingsTwoFaSkippableForm));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport { STICKER_SIZE_TWO_FA } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedIcon from '../../../common/AnimatedIcon';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsTwoFaCongratulations: FC<OwnProps> = ({\n isActive, onReset, onScreenSelect,\n}) => {\n const lang = useLang();\n\n const handleClick = useCallback(() => {\n onScreenSelect(SettingsScreens.Privacy);\n }, [onScreenSelect]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIcon\n size={STICKER_SIZE_TWO_FA}\n tgsUrl={LOCAL_TGS_URLS.Congratulations}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {lang('TwoStepVerificationPasswordSetInfo')}\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={handleClick}>{lang('TwoStepVerificationPasswordReturnSettings')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsTwoFaCongratulations);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport type { ApiSticker } from '../../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../../util/environment';\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport InputText from '../../../ui/InputText';\nimport Loading from '../../../ui/Loading';\nimport AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker';\n\ntype OwnProps = {\n isLoading?: boolean;\n error?: string;\n clearError: NoneToVoidFunction;\n onSubmit: (hint: string) => void;\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n codeLength: number;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\nconst ICON_SIZE = 160;\n\nconst SettingsTwoFaEmailCode: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n codeLength,\n isLoading,\n error,\n clearError,\n onSubmit,\n isActive,\n onReset,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (error && clearError) {\n clearError();\n }\n\n const newValue = e.target.value.slice(0, codeLength);\n\n if (newValue.length === codeLength) {\n onSubmit(newValue);\n }\n\n setValue(newValue);\n e.target.value = newValue;\n }, [clearError, codeLength, error, onSubmit]);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconFromSticker sticker={animatedEmoji} size={ICON_SIZE} className=\"settings-content-icon\" />\n </div>\n\n <div className=\"settings-item pt-0\">\n <InputText\n value={value}\n ref={inputRef}\n inputMode=\"decimal\"\n label={lang('YourEmailCode')}\n error={error}\n onChange={handleInputChange}\n />\n {isLoading && <Loading />}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, '💌'),\n codeLength: global.twoFaSettings.waitingEmailCodeLength,\n };\n})(SettingsTwoFaEmailCode));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport type { GlobalState } from '../../../../global/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport type { TwoFaDispatch, TwoFaState } from '../../../../hooks/reducers/useTwoFaReducer';\nimport useLang from '../../../../hooks/useLang';\n\nimport SettingsTwoFaEnabled from './SettingsTwoFaEnabled';\nimport SettingsTwoFaPassword from '../SettingsPasswordForm';\nimport SettingsTwoFaStart from './SettingsTwoFaStart';\nimport SettingsTwoFaSkippableForm from './SettingsTwoFaSkippableForm';\nimport SettingsTwoFaCongratulations from './SettingsTwoFaCongratulations';\nimport SettingsTwoFaEmailCode from './SettingsTwoFaEmailCode';\n\nexport type OwnProps = {\n state: TwoFaState;\n currentScreen: SettingsScreens;\n shownScreen: SettingsScreens;\n dispatch: TwoFaDispatch;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = GlobalState['twoFaSettings'];\n\nconst SettingsTwoFa: FC<OwnProps & StateProps> = ({\n currentScreen,\n shownScreen,\n state,\n hint,\n isLoading,\n error,\n waitingEmailCodeLength,\n dispatch,\n isActive,\n onScreenSelect,\n onReset,\n}) => {\n const {\n updatePassword,\n checkPassword,\n clearTwoFaError,\n updateRecoveryEmail,\n provideTwoFaEmailCode,\n clearPassword,\n } = getActions();\n\n useEffect(() => {\n if (waitingEmailCodeLength) {\n if (currentScreen === SettingsScreens.TwoFaNewPasswordEmail) {\n onScreenSelect(SettingsScreens.TwoFaNewPasswordEmailCode);\n } else if (currentScreen === SettingsScreens.TwoFaRecoveryEmail) {\n onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCode);\n }\n }\n }, [currentScreen, onScreenSelect, waitingEmailCodeLength]);\n\n const handleStartWizard = useCallback(() => {\n dispatch({ type: 'reset' });\n onScreenSelect(SettingsScreens.TwoFaNewPassword);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPassword = useCallback((value: string) => {\n dispatch({ type: 'setPassword', payload: value });\n onScreenSelect(SettingsScreens.TwoFaNewPasswordConfirm);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPasswordConfirm = useCallback(() => {\n onScreenSelect(SettingsScreens.TwoFaNewPasswordHint);\n }, [onScreenSelect]);\n\n const handleNewPasswordHint = useCallback((value?: string) => {\n dispatch({ type: 'setHint', payload: value });\n onScreenSelect(SettingsScreens.TwoFaNewPasswordEmail);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPasswordEmail = useCallback((value?: string) => {\n dispatch({ type: 'setEmail', payload: value });\n updatePassword({\n ...state,\n email: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updatePassword]);\n\n const handleChangePasswordCurrent = useCallback((value: string) => {\n dispatch({ type: 'setCurrentPassword', payload: value });\n checkPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaChangePasswordNew);\n },\n });\n }, [checkPassword, dispatch, onScreenSelect]);\n\n const handleChangePasswordNew = useCallback((value: string) => {\n dispatch({ type: 'setPassword', payload: value });\n onScreenSelect(SettingsScreens.TwoFaChangePasswordConfirm);\n }, [dispatch, onScreenSelect]);\n\n const handleChangePasswordConfirm = useCallback(() => {\n onScreenSelect(SettingsScreens.TwoFaChangePasswordHint);\n }, [onScreenSelect]);\n\n const handleChangePasswordHint = useCallback((value?: string) => {\n dispatch({ type: 'setHint', payload: value });\n updatePassword({\n ...state,\n hint: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updatePassword]);\n\n const handleTurnOff = useCallback((value: string) => {\n clearPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.Privacy);\n },\n });\n }, [clearPassword, onScreenSelect]);\n\n const handleRecoveryEmailCurrentPassword = useCallback((value: string) => {\n dispatch({ type: 'setCurrentPassword', payload: value });\n checkPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaRecoveryEmail);\n },\n });\n }, [checkPassword, dispatch, onScreenSelect]);\n\n const handleRecoveryEmail = useCallback((value?: string) => {\n dispatch({ type: 'setEmail', payload: value });\n updateRecoveryEmail({\n ...state,\n email: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updateRecoveryEmail]);\n\n const handleEmailCode = useCallback((code: string) => {\n provideTwoFaEmailCode({ code });\n }, [provideTwoFaEmailCode]);\n\n const lang = useLang();\n\n switch (currentScreen) {\n case SettingsScreens.TwoFaDisabled:\n return (\n <SettingsTwoFaStart\n onStart={handleStartWizard}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPassword,\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPassword:\n return (\n <SettingsTwoFaPassword\n placeholder={lang('PleaseEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPassword}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordConfirm:\n return (\n <SettingsTwoFaPassword\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPasswordConfirm}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleNewPasswordHint}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmail:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"email\"\n type=\"email\"\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n placeholder={lang('RecoveryEmailTitle')}\n shouldConfirm\n onSubmit={handleNewPasswordEmail}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n return (\n <SettingsTwoFaEmailCode\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaCongratulations:\n return (\n <SettingsTwoFaCongratulations\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaEnabled:\n return (\n <SettingsTwoFaEnabled\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordCurrent,\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaTurnOff,\n SettingsScreens.TwoFaRecoveryEmailCurrentPassword,\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordCurrent:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleChangePasswordCurrent}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordNew:\n return (\n <SettingsTwoFaPassword\n placeholder={lang('PleaseEnterNewFirstPassword')}\n onSubmit={handleChangePasswordNew}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordConfirm:\n return (\n <SettingsTwoFaPassword\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n onSubmit={handleChangePasswordConfirm}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleChangePasswordHint}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaTurnOff:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleTurnOff}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleRecoveryEmailCurrentPassword}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmail:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"email\"\n type=\"email\"\n placeholder={lang('RecoveryEmailTitle')}\n onSubmit={handleRecoveryEmail}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFaEmailCode\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => ({ ...global.twoFaSettings }),\n)(SettingsTwoFa));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { GlobalState } from '../../../global/types';\nimport type { ApiPrivacySettings } from '../../../types';\nimport { SettingsScreens } from '../../../types';\n\nimport { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID } from '../../../config';\nimport { unique } from '../../../util/iteratees';\nimport { filterChatsByName, isUserId } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager';\nimport { getPrivacyKey } from './helpers/privacy';\n\nimport Picker from '../../common/Picker';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\n\nexport type OwnProps = {\n isAllowList?: boolean;\n screen: SettingsScreens;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n currentUserId?: string;\n settings?: ApiPrivacySettings;\n};\n\nconst SettingsPrivacyVisibilityExceptionList: FC<OwnProps & StateProps> = ({\n isAllowList,\n screen,\n isActive,\n onScreenSelect,\n onReset,\n currentUserId,\n settings,\n}) => {\n const { setPrivacySettings } = getActions();\n\n const lang = useLang();\n\n const selectedContactIds = useMemo(() => {\n if (!settings) {\n return [];\n }\n\n if (isAllowList) {\n return [...settings.allowUserIds, ...settings.allowChatIds];\n } else {\n return [...settings.blockUserIds, ...settings.blockChatIds];\n }\n }, [isAllowList, settings]);\n const [searchQuery, setSearchQuery] = useState<string>('');\n const [isSubmitShown, setIsSubmitShown] = useState<boolean>(false);\n const [newSelectedContactIds, setNewSelectedContactIds] = useState<string[]>(selectedContactIds);\n\n const folderAllOrderedIds = useFolderManagerForOrderedIds(ALL_FOLDER_ID);\n const folderArchivedOrderedIds = useFolderManagerForOrderedIds(ARCHIVED_FOLDER_ID);\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on chats, so we avoid them\n const chatsById = getGlobal().chats.byId;\n\n const chatIds = unique([...folderAllOrderedIds || [], ...folderArchivedOrderedIds || []])\n .filter((chatId) => {\n const chat = chatsById[chatId];\n\n return chat && isUserId(chat.id) && chat.id !== currentUserId;\n });\n\n return unique([\n ...selectedContactIds,\n ...filterChatsByName(lang, chatIds, chatsById, searchQuery),\n ]);\n }, [folderAllOrderedIds, folderArchivedOrderedIds, selectedContactIds, lang, searchQuery, currentUserId]);\n\n const handleSelectedContactIdsChange = useCallback((value: string[]) => {\n setNewSelectedContactIds(value);\n setIsSubmitShown(true);\n }, []);\n\n const handleSubmit = useCallback(() => {\n setPrivacySettings({\n privacyKey: getPrivacyKey(screen),\n isAllowList: Boolean(isAllowList),\n contactsIds: newSelectedContactIds,\n });\n\n onScreenSelect(SettingsScreens.Privacy);\n }, [isAllowList, newSelectedContactIds, onScreenSelect, screen, setPrivacySettings]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"NewChat-inner step-1\">\n <Picker\n itemIds={displayedIds || []}\n selectedIds={newSelectedContactIds}\n filterValue={searchQuery}\n filterPlaceholder={isAllowList ? lang('AlwaysAllowPlaceholder') : lang('NeverAllowPlaceholder')}\n searchInputId=\"new-group-picker-search\"\n onSelectedIdsChange={handleSelectedContactIdsChange}\n onFilterChange={setSearchQuery}\n />\n\n <FloatingActionButton\n isShown={isSubmitShown}\n onClick={handleSubmit}\n ariaLabel={isAllowList ? lang('AlwaysAllow') : lang('NeverAllow')}\n >\n <i className=\"icon-arrow-right\" />\n </FloatingActionButton>\n </div>\n );\n};\n\nfunction getCurrentPrivacySettings(global: GlobalState, screen: SettingsScreens) {\n const { privacy } = global.settings;\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n return privacy.phoneNumber;\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n return privacy.lastSeen;\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n return privacy.profilePhoto;\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n return privacy.phoneCall;\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n return privacy.phoneP2P;\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return privacy.forwards;\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return privacy.chatInvite;\n }\n\n return undefined;\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { screen }): StateProps => {\n return {\n currentUserId: global.currentUserId,\n settings: getCurrentPrivacySettings(global, screen),\n };\n },\n)(SettingsPrivacyVisibilityExceptionList));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiAvailableReaction } from '../../../api/types';\n\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport RadioGroup from '../../ui/RadioGroup';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n availableReactions?: ApiAvailableReaction[];\n selectedReaction?: string;\n};\n\nconst SettingsQuickReaction: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n availableReactions,\n selectedReaction,\n}) => {\n const { setDefaultReaction } = getActions();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const options = availableReactions?.filter((l) => !l.isInactive).map((l) => {\n return {\n label: <><ReactionStaticEmoji reaction={l.reaction} />{l.title}</>,\n value: l.reaction,\n };\n }) || [];\n\n const handleChange = useCallback((reaction: string) => {\n setDefaultReaction({ reaction });\n }, [setDefaultReaction]);\n\n return (\n <div className=\"settings-content settings-item custom-scroll settings-quick-reaction\">\n <RadioGroup\n name=\"quick-reaction-settings\"\n options={options}\n selected={selectedReaction}\n onChange={handleChange}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global) => {\n const { availableReactions, appConfig } = global;\n\n return {\n availableReactions,\n selectedReaction: appConfig?.defaultReaction,\n };\n },\n)(SettingsQuickReaction));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport { STICKER_SIZE_PASSCODE } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview';\n\nimport lockPreviewUrl from '../../../../assets/lock.png';\n\ntype OwnProps = {\n onStart: NoneToVoidFunction;\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst SettingsPasscodeStart: FC<OwnProps> = ({\n isActive, onReset, onStart,\n}) => {\n const lang = useLang();\n\n useHistoryBack({ isActive, onBack: onReset });\n\n return (\n <div className=\"settings-content local-passcode custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={STICKER_SIZE_PASSCODE}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description\" dir=\"auto\">\n When you set up an additional passcode, a lock icon will appear on the chats page.\n Tap it to lock and unlock your Telegram WebZ.\n </p>\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n Note: if you forget your local passcode, you'll need to log out of Telegram WebZ and log in again.\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={onStart}>{lang('EnablePasscode')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasscodeStart);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport ListItem from '../../../ui/ListItem';\nimport AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview';\n\nimport lockPreviewUrl from '../../../../assets/lock.png';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsPasscodeEnabled: FC<OwnProps> = ({\n isActive, onReset, onScreenSelect,\n}) => {\n const lang = useLang();\n\n useHistoryBack({ isActive, onBack: onReset });\n\n return (\n <div className=\"settings-content local-passcode custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={160}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n Local passcode is enabled.\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <ListItem\n icon=\"edit\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PasscodeChangePasscodeCurrent)}\n >\n {lang('Passcode.Change')}\n </ListItem>\n <ListItem\n icon=\"password-off\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PasscodeTurnOff)}\n >\n {lang('Passcode.TurnOff')}\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasscodeEnabled);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport { STICKER_SIZE_PASSCODE } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedIcon from '../../../common/AnimatedIcon';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: (forceReturnToChatList?: boolean) => void;\n};\n\nconst SettingsPasscodeCongratulations: FC<OwnProps> = ({\n isActive, onReset,\n}) => {\n const lang = useLang();\n\n const fullReset = useCallback(() => {\n onReset(true);\n }, [onReset]);\n\n useHistoryBack({ isActive, onBack: onReset });\n\n return (\n <div className=\"settings-content local-passcode custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIcon\n size={STICKER_SIZE_PASSCODE}\n tgsUrl={LOCAL_TGS_URLS.Congratulations}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n Congratulations!\n </p>\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n Now you can lock the app with a passcode so that others can't open it.\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={fullReset}>{lang('Back')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasscodeCongratulations);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport type { GlobalState } from '../../../../global/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport useLang from '../../../../hooks/useLang';\nimport { decryptSession } from '../../../../util/passcode';\n\nimport SettingsPasscodeStart from './SettingsPasscodeStart';\nimport SettingsPasscodeForm from '../SettingsPasswordForm';\nimport SettingsPasscodeEnabled from './SettingsPasscodeEnabled';\nimport SettingsPasscodeCongratulations from './SettingsPasscodeCongratulations';\n\nexport type OwnProps = {\n passcode: string;\n currentScreen: SettingsScreens;\n shownScreen: SettingsScreens;\n isActive?: boolean;\n onSetPasscode: (passcode: string) => void;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = GlobalState['passcode'];\n\nconst SettingsPasscode: FC<OwnProps & StateProps> = ({\n passcode,\n currentScreen,\n shownScreen,\n error,\n isActive,\n isLoading,\n onScreenSelect,\n onSetPasscode,\n onReset,\n}) => {\n const {\n setPasscode,\n clearPasscode,\n setPasscodeError,\n clearPasscodeError,\n } = getActions();\n\n const lang = useLang();\n\n const handleStartWizard = useCallback(() => {\n onSetPasscode('');\n onScreenSelect(SettingsScreens.PasscodeNewPasscode);\n }, [onScreenSelect, onSetPasscode]);\n\n const handleNewPassword = useCallback((value: string) => {\n onSetPasscode(value);\n onScreenSelect(SettingsScreens.PasscodeNewPasscodeConfirm);\n }, [onScreenSelect, onSetPasscode]);\n\n const handleNewPasswordConfirm = useCallback(() => {\n setPasscode({ passcode });\n onSetPasscode('');\n onScreenSelect(SettingsScreens.PasscodeCongratulations);\n }, [onScreenSelect, onSetPasscode, passcode, setPasscode]);\n\n const handleChangePasswordCurrent = useCallback((currentPasscode: string) => {\n onSetPasscode('');\n decryptSession(currentPasscode).then(() => {\n onScreenSelect(SettingsScreens.PasscodeChangePasscodeNew);\n }, () => {\n setPasscodeError({\n error: lang('PasscodeController.Error.Current'),\n });\n });\n }, [lang, onScreenSelect, onSetPasscode, setPasscodeError]);\n\n const handleChangePasswordNew = useCallback((value: string) => {\n onSetPasscode(value);\n onScreenSelect(SettingsScreens.PasscodeChangePasscodeConfirm);\n }, [onScreenSelect, onSetPasscode]);\n\n const handleTurnOff = useCallback((currentPasscode: string) => {\n decryptSession(currentPasscode).then(() => {\n clearPasscode();\n onScreenSelect(SettingsScreens.Privacy);\n }, () => {\n setPasscodeError({\n error: lang('PasscodeController.Error.Current'),\n });\n });\n }, [clearPasscode, lang, onScreenSelect, setPasscodeError]);\n\n switch (currentScreen) {\n case SettingsScreens.PasscodeDisabled:\n return (\n <SettingsPasscodeStart\n onStart={handleStartWizard}\n isActive={isActive || [\n SettingsScreens.PasscodeNewPasscode,\n SettingsScreens.PasscodeNewPasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeNewPasscode:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n placeholder={lang('EnterNewPasscode')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPassword}\n isActive={isActive || [\n SettingsScreens.PasscodeNewPasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeNewPasscodeConfirm:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n expectedPassword={passcode}\n placeholder={lang('ReEnterYourPasscode')}\n submitLabel={lang('Continue')}\n isLoading={isLoading}\n onSubmit={handleNewPasswordConfirm}\n isActive={isActive || [\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeCongratulations:\n return (\n <SettingsPasscodeCongratulations\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeEnabled:\n return (\n <SettingsPasscodeEnabled\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.PasscodeChangePasscodeCurrent,\n SettingsScreens.PasscodeChangePasscodeNew,\n SettingsScreens.PasscodeChangePasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n SettingsScreens.PasscodeTurnOff,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeChangePasscodeCurrent:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n error={error}\n clearError={clearPasscodeError}\n placeholder={lang('PasscodeController.Current.Placeholder')}\n onSubmit={handleChangePasswordCurrent}\n isActive={isActive || [\n SettingsScreens.PasscodeChangePasscodeNew,\n SettingsScreens.PasscodeChangePasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeChangePasscodeNew:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n placeholder={lang('PleaseEnterNewFirstPassword')}\n onSubmit={handleChangePasswordNew}\n isActive={isActive || [\n SettingsScreens.PasscodeChangePasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeChangePasscodeConfirm:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n expectedPassword={passcode}\n placeholder={lang('PasscodeController.ReEnterPasscode.Placeholder')}\n isLoading={isLoading}\n onSubmit={handleNewPasswordConfirm}\n isActive={isActive || [\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeTurnOff:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n error={error ? lang(error) : undefined}\n clearError={clearPasscodeError}\n placeholder={lang('PasscodeController.Current.Placeholder')}\n onSubmit={handleTurnOff}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => ({ ...global.passcode }),\n)(SettingsPasscode));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useState } from '../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../types';\nimport type { FolderEditDispatch, FoldersState } from '../../../hooks/reducers/useFoldersReducer';\n\nimport { LAYERS_ANIMATION_NAME } from '../../../util/environment';\nimport useTwoFaReducer from '../../../hooks/reducers/useTwoFaReducer';\n\nimport Transition from '../../ui/Transition';\nimport SettingsHeader from './SettingsHeader';\nimport SettingsMain from './SettingsMain';\nimport SettingsEditProfile from './SettingsEditProfile';\nimport SettingsDataStorage from './SettingsDataStorage';\nimport SettingsFolders from './folders/SettingsFolders';\nimport SettingsGeneral from './SettingsGeneral';\nimport SettingsGeneralBackground from './SettingsGeneralBackground';\nimport SettingsGeneralBackgroundColor from './SettingsGeneralBackgroundColor';\nimport SettingsNotifications from './SettingsNotifications';\nimport SettingsPrivacy from './SettingsPrivacy';\nimport SettingsLanguage from './SettingsLanguage';\nimport SettingsPrivacyVisibility from './SettingsPrivacyVisibility';\nimport SettingsActiveSessions from './SettingsActiveSessions';\nimport SettingsPrivacyBlockedUsers from './SettingsPrivacyBlockedUsers';\nimport SettingsTwoFa from './twoFa/SettingsTwoFa';\nimport SettingsPrivacyVisibilityExceptionList from './SettingsPrivacyVisibilityExceptionList';\nimport SettingsQuickReaction from './SettingsQuickReaction';\nimport SettingsPasscode from './passcode/SettingsPasscode';\n\nimport './Settings.scss';\n\nconst TRANSITION_RENDER_COUNT = Object.keys(SettingsScreens).length / 2;\nconst TRANSITION_DURATION = 200;\n\nconst TWO_FA_SCREENS = [\n SettingsScreens.TwoFaDisabled,\n SettingsScreens.TwoFaNewPassword,\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n SettingsScreens.TwoFaEnabled,\n SettingsScreens.TwoFaChangePasswordCurrent,\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaTurnOff,\n SettingsScreens.TwoFaRecoveryEmailCurrentPassword,\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n];\n\nconst PASSCODE_SCREENS = [\n SettingsScreens.PasscodeDisabled,\n SettingsScreens.PasscodeEnabled,\n];\n\nconst FOLDERS_SCREENS = [\n SettingsScreens.Folders,\n SettingsScreens.FoldersCreateFolder,\n SettingsScreens.FoldersEditFolder,\n SettingsScreens.FoldersEditFolderFromChatList,\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersIncludedChatsFromChatList,\n SettingsScreens.FoldersExcludedChats,\n SettingsScreens.FoldersExcludedChatsFromChatList,\n];\n\nconst PRIVACY_SCREENS = [\n SettingsScreens.PrivacyBlockedUsers,\n SettingsScreens.ActiveSessions,\n];\n\nconst PRIVACY_PHONE_NUMBER_SCREENS = [\n SettingsScreens.PrivacyPhoneNumberAllowedContacts,\n SettingsScreens.PrivacyPhoneNumberDeniedContacts,\n];\n\nconst PRIVACY_LAST_SEEN_PHONE_SCREENS = [\n SettingsScreens.PrivacyLastSeenAllowedContacts,\n SettingsScreens.PrivacyLastSeenDeniedContacts,\n];\n\nconst PRIVACY_PROFILE_PHOTO_SCREENS = [\n SettingsScreens.PrivacyProfilePhotoAllowedContacts,\n SettingsScreens.PrivacyProfilePhotoDeniedContacts,\n];\n\nconst PRIVACY_PHONE_CALL_SCREENS = [\n SettingsScreens.PrivacyPhoneCallAllowedContacts,\n SettingsScreens.PrivacyPhoneCallDeniedContacts,\n];\n\nconst PRIVACY_PHONE_P2P_SCREENS = [\n SettingsScreens.PrivacyPhoneP2PAllowedContacts,\n SettingsScreens.PrivacyPhoneP2PDeniedContacts,\n];\n\nconst PRIVACY_FORWARDING_SCREENS = [\n SettingsScreens.PrivacyForwardingAllowedContacts,\n SettingsScreens.PrivacyForwardingDeniedContacts,\n];\n\nconst PRIVACY_GROUP_CHATS_SCREENS = [\n SettingsScreens.PrivacyGroupChatsAllowedContacts,\n SettingsScreens.PrivacyGroupChatsDeniedContacts,\n];\n\nexport type OwnProps = {\n isActive: boolean;\n currentScreen: SettingsScreens;\n foldersState: FoldersState;\n foldersDispatch: FolderEditDispatch;\n onScreenSelect: (screen: SettingsScreens) => void;\n shouldSkipTransition?: boolean;\n onReset: (forceReturnToChatList?: true | Event) => void;\n};\n\nconst Settings: FC<OwnProps> = ({\n isActive,\n currentScreen,\n foldersState,\n foldersDispatch,\n onScreenSelect,\n onReset,\n shouldSkipTransition,\n}) => {\n const [twoFaState, twoFaDispatch] = useTwoFaReducer();\n const [privacyPasscode, setPrivacyPasscode] = useState<string>('');\n\n const handleReset = useCallback((forceReturnToChatList?: true | Event) => {\n if (forceReturnToChatList === true) {\n onReset(true);\n return;\n }\n\n if (\n currentScreen === SettingsScreens.FoldersCreateFolder\n || currentScreen === SettingsScreens.FoldersEditFolder\n || currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ) {\n setTimeout(() => {\n foldersDispatch({ type: 'reset' });\n }, TRANSITION_DURATION);\n }\n\n if (\n currentScreen === SettingsScreens.FoldersIncludedChats\n || currentScreen === SettingsScreens.FoldersExcludedChats\n ) {\n if (foldersState.mode === 'create') {\n onScreenSelect(SettingsScreens.FoldersCreateFolder);\n } else {\n onScreenSelect(SettingsScreens.FoldersEditFolder);\n }\n return;\n }\n\n onReset();\n }, [\n foldersState.mode, foldersDispatch,\n currentScreen, onReset, onScreenSelect,\n ]);\n\n const handleSaveFilter = useCallback(() => {\n foldersDispatch({ type: 'saveFilters' });\n handleReset();\n }, [foldersDispatch, handleReset]);\n\n function renderCurrentSectionContent(isScreenActive: boolean, screen: SettingsScreens) {\n const privacyAllowScreens: Record<number, boolean> = {\n [SettingsScreens.PrivacyPhoneNumber]: PRIVACY_PHONE_NUMBER_SCREENS.includes(screen),\n [SettingsScreens.PrivacyLastSeen]: PRIVACY_LAST_SEEN_PHONE_SCREENS.includes(screen),\n [SettingsScreens.PrivacyProfilePhoto]: PRIVACY_PROFILE_PHOTO_SCREENS.includes(screen),\n [SettingsScreens.PrivacyPhoneCall]: PRIVACY_PHONE_CALL_SCREENS.includes(screen),\n [SettingsScreens.PrivacyPhoneP2P]: PRIVACY_PHONE_P2P_SCREENS.includes(screen),\n [SettingsScreens.PrivacyForwarding]: PRIVACY_FORWARDING_SCREENS.includes(screen),\n [SettingsScreens.PrivacyGroupChats]: PRIVACY_GROUP_CHATS_SCREENS.includes(screen),\n };\n\n const isTwoFaScreen = TWO_FA_SCREENS.includes(screen);\n const isPasscodeScreen = PASSCODE_SCREENS.includes(screen);\n const isFoldersScreen = FOLDERS_SCREENS.includes(screen);\n const isPrivacyScreen = PRIVACY_SCREENS.includes(screen)\n || isTwoFaScreen\n || isPasscodeScreen\n || Object.keys(privacyAllowScreens).includes(screen.toString())\n || Object.values(privacyAllowScreens).find((key) => key === true);\n\n switch (currentScreen) {\n case SettingsScreens.Main:\n return (\n <SettingsMain onScreenSelect={onScreenSelect} isActive={isActive} onReset={handleReset} />\n );\n case SettingsScreens.EditProfile:\n return (\n <SettingsEditProfile\n isActive={isActive && isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.General:\n return (\n <SettingsGeneral\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive\n || screen === SettingsScreens.GeneralChatBackgroundColor\n || screen === SettingsScreens.GeneralChatBackground\n || screen === SettingsScreens.QuickReaction\n || isPrivacyScreen || isFoldersScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.QuickReaction:\n return (\n <SettingsQuickReaction isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Notifications:\n return (\n <SettingsNotifications isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.DataStorage:\n return (\n <SettingsDataStorage isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Privacy:\n return (\n <SettingsPrivacy\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || isPrivacyScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.Language:\n return (\n <SettingsLanguage isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.GeneralChatBackground:\n return (\n <SettingsGeneralBackground\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || screen === SettingsScreens.GeneralChatBackgroundColor}\n onReset={handleReset}\n />\n );\n case SettingsScreens.GeneralChatBackgroundColor:\n return (\n <SettingsGeneralBackgroundColor\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.ActiveSessions:\n return (\n <SettingsActiveSessions\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyBlockedUsers:\n return (\n <SettingsPrivacyBlockedUsers\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyPhoneCall:\n case SettingsScreens.PrivacyPhoneP2P:\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyGroupChats:\n return (\n <SettingsPrivacyVisibility\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n isAllowList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.Folders:\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <SettingsFolders\n currentScreen={currentScreen}\n shownScreen={screen}\n state={foldersState}\n dispatch={foldersDispatch}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.TwoFaDisabled:\n case SettingsScreens.TwoFaNewPassword:\n case SettingsScreens.TwoFaNewPasswordConfirm:\n case SettingsScreens.TwoFaNewPasswordHint:\n case SettingsScreens.TwoFaNewPasswordEmail:\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n case SettingsScreens.TwoFaCongratulations:\n case SettingsScreens.TwoFaEnabled:\n case SettingsScreens.TwoFaChangePasswordCurrent:\n case SettingsScreens.TwoFaChangePasswordNew:\n case SettingsScreens.TwoFaChangePasswordConfirm:\n case SettingsScreens.TwoFaChangePasswordHint:\n case SettingsScreens.TwoFaTurnOff:\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n case SettingsScreens.TwoFaRecoveryEmail:\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFa\n currentScreen={currentScreen}\n state={twoFaState}\n dispatch={twoFaDispatch}\n shownScreen={screen}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PasscodeDisabled:\n case SettingsScreens.PasscodeNewPasscode:\n case SettingsScreens.PasscodeNewPasscodeConfirm:\n case SettingsScreens.PasscodeChangePasscodeCurrent:\n case SettingsScreens.PasscodeChangePasscodeNew:\n case SettingsScreens.PasscodeChangePasscodeConfirm:\n case SettingsScreens.PasscodeCongratulations:\n case SettingsScreens.PasscodeEnabled:\n case SettingsScreens.PasscodeTurnOff:\n return (\n <SettingsPasscode\n currentScreen={currentScreen}\n passcode={privacyPasscode}\n onSetPasscode={setPrivacyPasscode}\n shownScreen={screen}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n default:\n return undefined;\n }\n }\n\n function renderCurrentSection(isScreenActive: boolean, isFrom: boolean, currentKey: SettingsScreens) {\n return (\n <>\n <SettingsHeader\n currentScreen={currentScreen}\n onReset={handleReset}\n onSaveFilter={handleSaveFilter}\n onScreenSelect={onScreenSelect}\n editedFolderId={foldersState.folderId}\n />\n {renderCurrentSectionContent(isScreenActive, currentKey)}\n </>\n );\n }\n\n return (\n <Transition\n id=\"Settings\"\n name={shouldSkipTransition ? 'none' : LAYERS_ANIMATION_NAME}\n activeKey={currentScreen}\n renderCount={TRANSITION_RENDER_COUNT}\n >\n {renderCurrentSection}\n </Transition>\n );\n};\n\nexport default memo(Settings);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { useCallback, useMemo, memo } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiUser, ApiUserStatus } from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { filterUsersByName, sortUserIds } from '../../../global/helpers';\nimport useInfiniteScroll from '../../../hooks/useInfiniteScroll';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useLang from '../../../hooks/useLang';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport ListItem from '../../ui/ListItem';\nimport Loading from '../../ui/Loading';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\n\nexport type OwnProps = {\n filter: string;\n isActive: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n usersById: Record<string, ApiUser>;\n userStatusesById: Record<string, ApiUserStatus>;\n contactIds?: string[];\n serverTimeOffset: number;\n};\n\nconst ContactList: FC<OwnProps & StateProps> = ({\n isActive,\n filter,\n usersById,\n userStatusesById,\n contactIds,\n serverTimeOffset,\n onReset,\n}) => {\n const {\n openChat,\n openNewContactDialog,\n } = getActions();\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const handleClick = useCallback((id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n }, [openChat]);\n\n const listIds = useMemo(() => {\n if (!contactIds) {\n return undefined;\n }\n\n const filteredIds = filterUsersByName(contactIds, usersById, filter);\n\n return sortUserIds(filteredIds, usersById, userStatusesById, undefined, serverTimeOffset);\n }, [contactIds, filter, usersById, userStatusesById, serverTimeOffset]);\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, listIds, Boolean(filter));\n\n return (\n <InfiniteScroll items={viewportIds} onLoadMore={getMore} className=\"chat-list custom-scroll\">\n {viewportIds?.length ? (\n viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleClick(id)}\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n >\n <PrivateChatInfo userId={id} forceShowSelf avatarSize=\"large\" />\n </ListItem>\n ))\n ) : viewportIds && !viewportIds.length ? (\n <p className=\"no-results\" key=\"no-results\" dir=\"auto\">\n {filter.length ? 'No contacts matched your search.' : 'Contact list is empty.'}\n </p>\n ) : (\n <Loading key=\"loading\" />\n )}\n <FloatingActionButton\n isShown\n onClick={openNewContactDialog}\n ariaLabel={lang('CreateNewContact')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: contactIds } = global.contactList || {};\n const { byId: usersById, statusesById: userStatusesById } = global.users;\n\n return {\n usersById,\n userStatusesById,\n contactIds,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ContactList));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { useCallback, useMemo, memo } from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { ApiChat } from '../../../api/types';\n\nimport { unique } from '../../../util/iteratees';\nimport { filterUsersByName, isUserBot, sortChatIds } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport Picker from '../../common/Picker';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Button from '../../ui/Button';\n\nexport type OwnProps = {\n isChannel?: boolean;\n isActive: boolean;\n selectedMemberIds: string[];\n onSelectedMemberIdsChange: (ids: string[]) => void;\n onNextStep: () => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n chatsById: Record<string, ApiChat>;\n localContactIds?: string[];\n searchQuery?: string;\n isSearching?: boolean;\n localUserIds?: string[];\n globalUserIds?: string[];\n};\n\nconst NewChatStep1: FC<OwnProps & StateProps> = ({\n isChannel,\n isActive,\n selectedMemberIds,\n onSelectedMemberIdsChange,\n onNextStep,\n onReset,\n chatsById,\n localContactIds,\n searchQuery,\n isSearching,\n localUserIds,\n globalUserIds,\n}) => {\n const {\n setGlobalSearchQuery,\n } = getActions();\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const handleFilterChange = useCallback((query: string) => {\n setGlobalSearchQuery({ query });\n }, [setGlobalSearchQuery]);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const foundContactIds = localContactIds ? filterUsersByName(localContactIds, usersById, searchQuery) : [];\n\n return sortChatIds(\n unique([\n ...foundContactIds,\n ...(localUserIds || []),\n ...(globalUserIds || []),\n ]).filter((contactId) => {\n const user = usersById[contactId];\n if (!user) {\n return true;\n }\n\n return !user.isSelf && (user.canBeInvitedToGroup || !isUserBot(user));\n }),\n chatsById,\n false,\n selectedMemberIds,\n );\n }, [localContactIds, chatsById, searchQuery, localUserIds, globalUserIds, selectedMemberIds]);\n\n const handleNextStep = useCallback(() => {\n if (selectedMemberIds.length || isChannel) {\n setGlobalSearchQuery({ query: '' });\n onNextStep();\n }\n }, [selectedMemberIds.length, isChannel, setGlobalSearchQuery, onNextStep]);\n\n return (\n <div className=\"NewChat step-1\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel=\"Return to Chat List\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang('GroupAddMembers')}</h3>\n </div>\n <div className=\"NewChat-inner step-1\">\n <Picker\n itemIds={displayedIds}\n selectedIds={selectedMemberIds}\n filterValue={searchQuery}\n filterPlaceholder={lang('SendMessageTo')}\n searchInputId=\"new-group-picker-search\"\n isLoading={isSearching}\n onSelectedIdsChange={onSelectedMemberIdsChange}\n onFilterChange={handleFilterChange}\n />\n\n <FloatingActionButton\n isShown={Boolean(selectedMemberIds.length || isChannel)}\n onClick={handleNextStep}\n ariaLabel={isChannel ? 'Continue To Channel Info' : 'Continue To Group Info'}\n >\n <i className=\"icon-arrow-right\" />\n </FloatingActionButton>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: localContactIds } = global.contactList || {};\n const { byId: chatsById } = global.chats;\n\n const {\n query: searchQuery,\n fetchingStatus,\n globalResults,\n localResults,\n } = global.globalSearch;\n const { userIds: globalUserIds } = globalResults || {};\n const { userIds: localUserIds } = localResults || {};\n\n return {\n chatsById,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus?.chats,\n globalUserIds,\n localUserIds,\n };\n },\n)(NewChatStep1));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useState, useCallback, useEffect, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ChatCreationProgress } from '../../../types';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport InputText from '../../ui/InputText';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport Button from '../../ui/Button';\nimport ListItem from '../../ui/ListItem';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\n\nexport type OwnProps = {\n isChannel?: boolean;\n isActive: boolean;\n memberIds: string[];\n onReset: (forceReturnToChatList?: boolean) => void;\n};\n\ntype StateProps = {\n creationProgress?: ChatCreationProgress;\n creationError?: string;\n};\n\n// TODO @implement\nconst MAX_USERS_FOR_LEGACY_CHAT = 199; // Accounting for current user\n\nconst NewChatStep2: FC<OwnProps & StateProps > = ({\n isChannel,\n isActive,\n memberIds,\n onReset,\n creationProgress,\n creationError,\n}) => {\n const {\n createGroupChat,\n createChannel,\n } = getActions();\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const [title, setTitle] = useState('');\n const [about, setAbout] = useState('');\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n\n const chatTitleEmptyError = 'Chat title can\\'t be empty';\n const channelTitleEmptyError = 'Channel title can\\'t be empty';\n const chatTooManyUsersError = 'Sorry, creating supergroups is not yet supported';\n\n const isLoading = creationProgress === ChatCreationProgress.InProgress;\n\n const handleTitleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { value } = e.currentTarget;\n const newValue = value.replace(/^\\s+/, '');\n\n setTitle(newValue);\n\n if (newValue !== value) {\n e.currentTarget.value = newValue;\n }\n }, []);\n\n const handleDescriptionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setAbout(e.currentTarget.value);\n }, []);\n\n const handleCreateGroup = useCallback(() => {\n if (!title.length) {\n setError(chatTitleEmptyError);\n return;\n }\n\n if (memberIds.length > MAX_USERS_FOR_LEGACY_CHAT) {\n setError(chatTooManyUsersError);\n return;\n }\n\n createGroupChat({\n title,\n photo,\n memberIds,\n });\n }, [title, memberIds, createGroupChat, photo, chatTitleEmptyError, chatTooManyUsersError]);\n\n const handleCreateChannel = useCallback(() => {\n if (!title.length) {\n setError(channelTitleEmptyError);\n return;\n }\n\n createChannel({\n title,\n about,\n photo,\n memberIds,\n });\n }, [title, createChannel, about, photo, memberIds, channelTitleEmptyError]);\n\n useEffect(() => {\n if (creationProgress === ChatCreationProgress.Complete) {\n onReset(true);\n }\n }, [creationProgress, onReset]);\n\n const renderedError = (creationError && lang(creationError)) || (\n error !== chatTitleEmptyError && error !== channelTitleEmptyError\n ? error\n : undefined\n );\n\n return (\n <div className=\"NewChat\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onReset()}\n ariaLabel=\"Return to member selection\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang(isChannel ? 'NewChannel' : 'NewGroup')}</h3>\n </div>\n <div className=\"NewChat-inner step-2\">\n <AvatarEditable\n onChange={setPhoto}\n title={lang('AddPhoto')}\n />\n <InputText\n value={title}\n onChange={handleTitleChange}\n label={lang(isChannel ? 'EnterChannelName' : 'GroupName')}\n error={error === chatTitleEmptyError || error === channelTitleEmptyError ? error : undefined}\n />\n {isChannel && (\n <>\n <InputText\n value={about}\n onChange={handleDescriptionChange}\n label={lang('DescriptionOptionalPlaceholder')}\n />\n <p className=\"note\">{lang('DescriptionInfo')}</p>\n </>\n )}\n\n {renderedError && (\n <p className=\"error\">{renderedError}</p>\n )}\n\n {memberIds.length > 0 && (\n <>\n <h3 className=\"chat-members-heading\">{lang('GroupInfo.ParticipantCount', memberIds.length, 'i')}</h3>\n\n <div className=\"chat-members-list custom-scroll\">\n {memberIds.map((id) => (\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo userId={id} />\n </ListItem>\n ))}\n </div>\n </>\n )}\n </div>\n\n <FloatingActionButton\n isShown={title.length !== 0}\n onClick={isChannel ? handleCreateChannel : handleCreateGroup}\n disabled={isLoading}\n ariaLabel={isChannel ? lang('ChannelIntro.CreateChannel') : 'Create Group'}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-arrow-right\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n progress: creationProgress,\n error: creationError,\n } = global.chatCreation || {};\n\n return {\n creationProgress,\n creationError,\n };\n },\n)(NewChatStep2));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useState } from '../../../lib/teact/teact';\n\nimport { LeftColumnContent } from '../../../types';\n\nimport { LAYERS_ANIMATION_NAME } from '../../../util/environment';\n\nimport Transition from '../../ui/Transition';\nimport NewChatStep1 from './NewChatStep1';\nimport NewChatStep2 from './NewChatStep2';\n\nimport './NewChat.scss';\n\nexport type OwnProps = {\n isActive: boolean;\n isChannel?: boolean;\n content: LeftColumnContent;\n onContentChange: (content: LeftColumnContent) => void;\n onReset: () => void;\n};\n\nconst RENDER_COUNT = Object.keys(LeftColumnContent).length / 2;\n\nconst NewChat: FC<OwnProps> = ({\n isActive,\n isChannel = false,\n content,\n onContentChange,\n onReset,\n}) => {\n const [newChatMemberIds, setNewChatMemberIds] = useState<string[]>([]);\n\n const handleNextStep = useCallback(() => {\n onContentChange(isChannel ? LeftColumnContent.NewChannelStep2 : LeftColumnContent.NewGroupStep2);\n }, [isChannel, onContentChange]);\n\n return (\n <Transition\n id=\"NewChat\"\n name={LAYERS_ANIMATION_NAME}\n renderCount={RENDER_COUNT}\n activeKey={content}\n >\n {(isStepActive) => {\n switch (content) {\n case LeftColumnContent.NewChannelStep1:\n case LeftColumnContent.NewGroupStep1:\n return (\n <NewChatStep1\n isChannel={isChannel}\n isActive={isActive}\n selectedMemberIds={newChatMemberIds}\n onSelectedMemberIdsChange={setNewChatMemberIds}\n onNextStep={handleNextStep}\n onReset={onReset}\n />\n );\n case LeftColumnContent.NewChannelStep2:\n case LeftColumnContent.NewGroupStep2:\n return (\n <NewChatStep2\n isChannel={isChannel}\n isActive={isStepActive && isActive}\n memberIds={newChatMemberIds}\n onReset={onReset}\n />\n );\n default:\n return undefined;\n }\n }}\n </Transition>\n );\n};\n\nexport default memo(NewChat);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\n\nimport Button from '../ui/Button';\nimport ChatList from './main/ChatList';\nimport type { LeftColumnContent } from '../../types';\n\nimport './ArchivedChats.scss';\n\nexport type OwnProps = {\n isActive: boolean;\n onReset: () => void;\n onContentChange: (content: LeftColumnContent) => void;\n};\n\nconst ArchivedChats: FC<OwnProps> = ({ isActive, onReset }) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"ArchivedChats\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel=\"Return to chat list\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang('ArchivedChats')}</h3>\n </div>\n <ChatList folderType=\"archived\" isActive={isActive} />\n </div>\n );\n};\n\nexport default memo(ArchivedChats);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, memo, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChatFolder } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport CheckboxGroup from '../ui/CheckboxGroup';\n\nexport type OwnProps = {\n isOpen: boolean;\n chatId: string;\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n};\n\ntype StateProps = {\n foldersById?: Record<number, ApiChatFolder>;\n folderOrderedIds?: number[];\n};\n\nconst ChatFolderModal: FC<OwnProps & StateProps> = ({\n isOpen,\n chatId,\n foldersById,\n folderOrderedIds,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const { editChatFolders } = getActions();\n\n const lang = useLang();\n\n const initialSelectedFolderIds = useMemo(() => {\n if (!foldersById) {\n return [];\n }\n\n return Object.keys(foldersById).reduce((result, folderId) => {\n const { includedChatIds, pinnedChatIds } = foldersById[Number(folderId)];\n if (includedChatIds.includes(chatId) || pinnedChatIds?.includes(chatId)) {\n result.push(folderId);\n }\n\n return result;\n }, [] as string[]);\n }, [chatId, foldersById]);\n\n const [selectedFolderIds, setSelectedFolderIds] = useState<string[]>(initialSelectedFolderIds);\n\n const folders = useMemo(() => {\n return folderOrderedIds?.map((folderId) => ({\n label: foldersById ? foldersById[folderId].title : '',\n value: String(folderId),\n })) || [];\n }, [folderOrderedIds, foldersById]);\n\n const handleSubmit = useCallback(() => {\n const idsToRemove = initialSelectedFolderIds.filter((id) => !selectedFolderIds.includes(id)).map(Number);\n const idsToAdd = selectedFolderIds.filter((id) => !initialSelectedFolderIds.includes(id)).map(Number);\n\n editChatFolders({ chatId, idsToRemove, idsToAdd });\n onClose();\n }, [chatId, editChatFolders, initialSelectedFolderIds, onClose, selectedFolderIds]);\n\n if (!foldersById || !folderOrderedIds) {\n return undefined;\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n onEnter={handleSubmit}\n className=\"delete\"\n title={lang('FilterAddTo')}\n >\n <CheckboxGroup\n options={folders}\n selected={selectedFolderIds}\n onChange={setSelectedFolderIds}\n round\n />\n <Button color=\"primary\" className=\"confirm-dialog-button\" isText onClick={handleSubmit}>\n {lang('FilterAddTo')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Cancel')}</Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { byId: foldersById, orderedIds: folderOrderedIds } = global.chatFolders;\n\n return {\n foldersById,\n folderOrderedIds,\n };\n },\n)(ChatFolderModal));\n","import type { ApiMessage } from '../../../../api/types';\nimport { ApiMediaFormat } from '../../../../api/types';\n\nimport * as mediaLoader from '../../../../util/mediaLoader';\nimport {\n getMessageContact,\n getMessageMediaHash,\n getMessagePhoto,\n getMessageText,\n getMessageTextWithSpoilers,\n getMessageWebPagePhoto,\n getMessageWebPageVideo,\n hasMessageLocalBlobUrl,\n} from '../../../../global/helpers';\nimport { CLIPBOARD_ITEM_SUPPORTED, copyImageToClipboard, copyTextToClipboard } from '../../../../util/clipboard';\nimport getMessageIdsForSelectedText from '../../../../util/getMessageIdsForSelectedText';\n\ntype ICopyOptions = {\n label: string;\n icon: string;\n handler: () => void;\n}[];\n\nexport function getMessageCopyOptions(\n message: ApiMessage,\n afterEffect?: () => void,\n onCopyLink?: () => void,\n onCopyMessages?: (messageIds: number[]) => void,\n onCopyNumber?: () => void,\n): ICopyOptions {\n const options: ICopyOptions = [];\n const text = getMessageText(message);\n const photo = getMessagePhoto(message)\n || (!getMessageWebPageVideo(message) ? getMessageWebPagePhoto(message) : undefined);\n const contact = getMessageContact(message);\n const mediaHash = getMessageMediaHash(message, 'inline');\n const canImageBeCopied = photo && (mediaHash || hasMessageLocalBlobUrl(message)) && CLIPBOARD_ITEM_SUPPORTED;\n const selection = window.getSelection();\n\n if (canImageBeCopied) {\n options.push({\n label: 'lng_context_copy_image',\n icon: 'copy-media',\n handler: () => {\n Promise.resolve(mediaHash ? mediaLoader.fetch(mediaHash, ApiMediaFormat.BlobUrl) : photo!.blobUrl)\n .then(copyImageToClipboard);\n\n afterEffect?.();\n },\n });\n }\n\n if (text) {\n // Detect if the user has selection in the current message\n const hasSelection = Boolean((\n selection?.anchorNode?.parentNode\n && (selection.anchorNode.parentNode as HTMLElement).closest('.Message .content-inner')\n && selection.toString().replace(/(?:\\r\\n|\\r|\\n)/g, '') !== ''\n ));\n\n options.push({\n label: getCopyLabel(hasSelection),\n icon: 'copy',\n handler: () => {\n const messageIds = getMessageIdsForSelectedText();\n if (messageIds?.length && onCopyMessages) {\n onCopyMessages(messageIds);\n } else {\n const clipboardText = hasSelection && selection ? selection.toString() : getMessageTextWithSpoilers(message)!;\n copyTextToClipboard(clipboardText);\n }\n\n afterEffect?.();\n },\n });\n }\n\n if (onCopyLink) {\n options.push({\n label: 'lng_context_copy_message_link',\n icon: 'link',\n handler: () => {\n onCopyLink();\n\n afterEffect?.();\n },\n });\n }\n\n if (contact && onCopyNumber) {\n options.push({\n label: 'lng_profile_copy_phone',\n icon: 'copy',\n handler: () => {\n onCopyNumber();\n\n afterEffect?.();\n },\n });\n }\n\n return options;\n}\n\nfunction getCopyLabel(hasSelection: boolean): string {\n if (hasSelection) {\n return 'lng_context_copy_selected';\n }\n return 'lng_context_copy_text';\n}\n","let scrollLockEl: HTMLElement | null | undefined;\nlet excludedClosestSelector: string | undefined;\n\nconst IGNORED_KEYS: Record<string, boolean> = {\n Down: true,\n ArrowDown: true,\n Up: true,\n ArrowUp: true,\n Left: true,\n ArrowLeft: true,\n Right: true,\n ArrowRight: true,\n ' ': true,\n PageUp: true,\n PageDown: true,\n End: true,\n Home: true,\n Tab: true,\n};\n\nfunction isTextBox(target: EventTarget | null) {\n if (!target || !(target instanceof HTMLElement)) return false;\n const element = target;\n const tagName = element.tagName.toLowerCase();\n if (tagName === 'textarea') return true;\n if (tagName !== 'input') return false;\n const type = element.getAttribute('type');\n if (!type) return false;\n const inputTypes = [\n 'text', 'password', 'number', 'email', 'tel', 'url',\n 'search', 'date', 'datetime', 'datetime-local', 'time', 'month', 'week',\n ];\n return inputTypes.indexOf(type.toLowerCase()) > -1;\n}\n\nexport const getTouchY = (e: WheelEvent | TouchEvent | React.WheelEvent | React.TouchEvent) => {\n return ('changedTouches' in e ? e.changedTouches[0].clientY : 0);\n};\n\nconst preventDefault = (e: WheelEvent | TouchEvent) => {\n const deltaY = 'deltaY' in e ? e.deltaY : getTouchY(e);\n\n if (\n !scrollLockEl\n // Allow overlay scrolling\n || !scrollLockEl.contains(e.target as HTMLElement)\n // Prevent top overscroll\n || (scrollLockEl.scrollTop <= 0 && deltaY <= 0)\n // Prevent bottom overscroll\n || (scrollLockEl.scrollTop >= (scrollLockEl.scrollHeight - scrollLockEl.offsetHeight) && deltaY >= 0)\n ) {\n if (excludedClosestSelector && (e.target as HTMLElement).closest(excludedClosestSelector)) return;\n e.preventDefault();\n }\n};\n\nfunction preventDefaultForScrollKeys(e: KeyboardEvent) {\n if (IGNORED_KEYS[e.key] && !isTextBox(e.target)) {\n e.preventDefault();\n }\n}\n\nexport function disableScrolling(el?: HTMLElement | null, _excludedClosestSelector?: string) {\n scrollLockEl = el;\n excludedClosestSelector = _excludedClosestSelector;\n // Disable scrolling in Chrome\n document.addEventListener('wheel', preventDefault, { passive: false });\n document.addEventListener('touchmove', preventDefault, { passive: false });\n document.onkeydown = preventDefaultForScrollKeys;\n}\n\nexport function enableScrolling() {\n scrollLockEl = undefined;\n excludedClosestSelector = undefined;\n document.removeEventListener('wheel', preventDefault); // Enable scrolling in Chrome\n document.removeEventListener('touchmove', preventDefault);\n // eslint-disable-next-line no-null/no-null\n document.onkeydown = null;\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useRef } from '../../../lib/teact/teact';\n\nimport type { ApiAvailableReaction } from '../../../api/types';\n\nimport useMedia from '../../../hooks/useMedia';\nimport useFlag from '../../../hooks/useFlag';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport { createClassNameBuilder } from '../../../util/buildClassName';\nimport { IS_COMPACT_MENU } from '../../../util/environment';\n\nimport AnimatedSticker from '../../common/AnimatedSticker';\n\nimport './ReactionSelectorReaction.scss';\n\nconst REACTION_SIZE = IS_COMPACT_MENU ? 24 : 32;\n\ntype OwnProps = {\n reaction: ApiAvailableReaction;\n previewIndex: number;\n isReady?: boolean;\n onSendReaction: (reaction: string, x: number, y: number) => void;\n};\n\nconst cn = createClassNameBuilder('ReactionSelectorReaction');\n\nconst ReactionSelectorReaction: FC<OwnProps> = ({\n reaction, previewIndex, onSendReaction, isReady,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const mediaData = useMedia(`document${reaction.selectAnimation?.id}`, !isReady);\n\n const [isActivated, activate, deactivate] = useFlag();\n const [isAnimationLoaded, markAnimationLoaded] = useFlag();\n\n const shouldRenderAnimated = Boolean(isReady && mediaData);\n const { transitionClassNames: animatedClassNames } = useShowTransition(shouldRenderAnimated);\n const { shouldRender: shouldRenderStatic, transitionClassNames: staticClassNames } = useShowTransition(\n !isReady || !isAnimationLoaded, undefined, true,\n );\n\n function handleClick() {\n if (!containerRef.current) return;\n const { x, y } = containerRef.current.getBoundingClientRect();\n\n onSendReaction(reaction.reaction, x, y);\n }\n\n return (\n <div\n className={cn('&', IS_COMPACT_MENU && 'compact')}\n onClick={handleClick}\n ref={containerRef}\n onMouseEnter={isReady ? activate : undefined}\n >\n {shouldRenderStatic && (\n <div\n className={cn(\n 'static',\n isReady ? [staticClassNames] : undefined,\n )}\n style={`background-position-x: ${previewIndex * -REACTION_SIZE}px;`}\n />\n )}\n {shouldRenderAnimated && (\n <AnimatedSticker\n className={cn('animated', [animatedClassNames])}\n tgsUrl={mediaData}\n play={isActivated}\n noLoop\n size={REACTION_SIZE}\n onLoad={markAnimationLoaded}\n onEnded={deactivate}\n />\n )}\n </div>\n );\n};\n\nexport default memo(ReactionSelectorReaction);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useLayoutEffect, useRef } from '../../../lib/teact/teact';\n\nimport type { ApiAvailableReaction } from '../../../api/types';\n\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useFlag from '../../../hooks/useFlag';\nimport { getTouchY } from '../../../util/scrollLock';\nimport { createClassNameBuilder } from '../../../util/buildClassName';\nimport { IS_COMPACT_MENU } from '../../../util/environment';\n\nimport ReactionSelectorReaction from './ReactionSelectorReaction';\n\nimport './ReactionSelector.scss';\n\ntype OwnProps = {\n enabledReactions?: string[];\n onSendReaction: (reaction: string, x: number, y: number) => void;\n isPrivate?: boolean;\n availableReactions?: ApiAvailableReaction[];\n isReady?: boolean;\n};\n\nconst cn = createClassNameBuilder('ReactionSelector');\n\nconst ReactionSelector: FC<OwnProps> = ({\n availableReactions,\n enabledReactions,\n onSendReaction,\n isPrivate,\n isReady,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const itemsScrollRef = useRef<HTMLDivElement>(null);\n const [isHorizontalScrollEnabled, enableHorizontalScroll] = useFlag(false);\n useHorizontalScroll(itemsScrollRef.current, !isHorizontalScrollEnabled);\n\n useLayoutEffect(() => {\n enableHorizontalScroll();\n }, [enableHorizontalScroll]);\n\n const handleWheel = (e: React.WheelEvent | React.TouchEvent) => {\n if (!itemsScrollRef) return;\n const deltaY = 'deltaY' in e ? e.deltaY : getTouchY(e);\n\n if (deltaY) {\n e.preventDefault();\n }\n };\n\n if ((!isPrivate && !enabledReactions?.length) || !availableReactions) return undefined;\n\n return (\n <div className={cn('&', IS_COMPACT_MENU && 'compact')} onWheelCapture={handleWheel} onTouchMove={handleWheel}>\n <div className={cn('bubble-big')} />\n <div className={cn('bubble-small')} />\n <div className={cn('items-wrapper')}>\n <div className={cn('items', ['no-scrollbar'])} ref={itemsScrollRef}>\n {availableReactions?.map((reaction, i) => {\n if (reaction.isInactive\n || (!isPrivate && (!enabledReactions || !enabledReactions.includes(reaction.reaction)))) return undefined;\n return (\n <ReactionSelectorReaction\n key={reaction.reaction}\n previewIndex={i}\n isReady={isReady}\n onSendReaction={onSendReaction}\n reaction={reaction}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(ReactionSelector);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { ApiAvailableReaction, ApiMessage, ApiUser } from '../../../api/types';\nimport type { IAnchorPosition } from '../../../types';\n\nimport { getMessageCopyOptions } from './helpers/copyOptions';\nimport { disableScrolling, enableScrolling } from '../../../util/scrollLock';\nimport { getUserFullName } from '../../../global/helpers';\nimport buildClassName from '../../../util/buildClassName';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\n\nimport useFlag from '../../../hooks/useFlag';\nimport useContextMenuPosition from '../../../hooks/useContextMenuPosition';\nimport useLang from '../../../hooks/useLang';\n\nimport Menu from '../../ui/Menu';\nimport MenuItem from '../../ui/MenuItem';\nimport Avatar from '../../common/Avatar';\nimport ReactionSelector from './ReactionSelector';\n\nimport './MessageContextMenu.scss';\n\ntype OwnProps = {\n availableReactions?: ApiAvailableReaction[];\n isOpen: boolean;\n anchor: IAnchorPosition;\n message: ApiMessage;\n canSendNow?: boolean;\n enabledReactions?: string[];\n canReschedule?: boolean;\n canReply?: boolean;\n canPin?: boolean;\n canUnpin?: boolean;\n canDelete?: boolean;\n canReport?: boolean;\n canShowReactionsCount?: boolean;\n canShowReactionList?: boolean;\n canRemoveReaction?: boolean;\n canEdit?: boolean;\n canForward?: boolean;\n canFaveSticker?: boolean;\n canUnfaveSticker?: boolean;\n canCopy?: boolean;\n canCopyLink?: boolean;\n canSelect?: boolean;\n isPrivate?: boolean;\n canDownload?: boolean;\n canSaveGif?: boolean;\n isDownloading?: boolean;\n canShowSeenBy?: boolean;\n seenByRecentUsers?: ApiUser[];\n onReply: () => void;\n onEdit: () => void;\n onPin: () => void;\n onUnpin: () => void;\n onForward: () => void;\n onDelete: () => void;\n onReport: () => void;\n onFaveSticker: () => void;\n onUnfaveSticker: () => void;\n onSelect: () => void;\n onSend: () => void;\n onReschedule: () => void;\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n onCopyLink?: () => void;\n onCopyMessages?: (messageIds: number[]) => void;\n onCopyNumber?: () => void;\n onDownload?: () => void;\n onSaveGif?: () => void;\n onShowSeenBy?: () => void;\n onShowReactors?: () => void;\n onSendReaction: (reaction: string | undefined, x: number, y: number) => void;\n};\n\nconst SCROLLBAR_WIDTH = 10;\nconst REACTION_BUBBLE_EXTRA_WIDTH = 32;\nconst ANIMATION_DURATION = 200;\n\nconst MessageContextMenu: FC<OwnProps> = ({\n availableReactions,\n isOpen,\n message,\n isPrivate,\n enabledReactions,\n anchor,\n canSendNow,\n canReschedule,\n canReply,\n canEdit,\n canPin,\n canUnpin,\n canDelete,\n canReport,\n canForward,\n canFaveSticker,\n canUnfaveSticker,\n canCopy,\n canCopyLink,\n canSelect,\n canDownload,\n canSaveGif,\n isDownloading,\n canShowSeenBy,\n canShowReactionsCount,\n canRemoveReaction,\n canShowReactionList,\n seenByRecentUsers,\n onReply,\n onEdit,\n onPin,\n onUnpin,\n onForward,\n onDelete,\n onReport,\n onFaveSticker,\n onUnfaveSticker,\n onSelect,\n onSend,\n onReschedule,\n onClose,\n onCloseAnimationEnd,\n onCopyLink,\n onCopyNumber,\n onDownload,\n onSaveGif,\n onShowSeenBy,\n onShowReactors,\n onSendReaction,\n onCopyMessages,\n}) => {\n const { showNotification } = getActions();\n // eslint-disable-next-line no-null/no-null\n const menuRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const scrollableRef = useRef<HTMLDivElement>(null);\n const lang = useLang();\n const noReactions = !isPrivate && !enabledReactions?.length;\n const withReactions = canShowReactionList && !noReactions;\n\n const [isReady, markIsReady, unmarkIsReady] = useFlag();\n\n const handleAfterCopy = useCallback(() => {\n showNotification({\n message: lang('Share.Link.Copied'),\n });\n onClose();\n }, [lang, onClose, showNotification]);\n\n const copyOptions = getMessageCopyOptions(\n message, handleAfterCopy, canCopyLink ? onCopyLink : undefined, onCopyMessages, onCopyNumber,\n );\n\n const getTriggerElement = useCallback(() => {\n return document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id=\"${message.id}\"]`);\n }, [message.id]);\n\n const getRootElement = useCallback(\n () => document.querySelector('.Transition__slide--active > .MessageList'),\n [],\n );\n\n const getMenuElement = useCallback(\n () => document.querySelector('.MessageContextMenu .bubble'),\n [],\n );\n\n const getLayout = useCallback(() => {\n const extraHeightAudioPlayer = (IS_SINGLE_COLUMN_LAYOUT\n && (document.querySelector<HTMLElement>('.AudioPlayer-content'))?.offsetHeight) || 0;\n const pinnedElement = document.querySelector<HTMLElement>('.HeaderPinnedMessage-wrapper');\n const extraHeightPinned = (((IS_SINGLE_COLUMN_LAYOUT && !extraHeightAudioPlayer)\n || (!IS_SINGLE_COLUMN_LAYOUT && pinnedElement?.classList.contains('full-width')))\n && pinnedElement?.offsetHeight) || 0;\n\n return {\n extraPaddingX: SCROLLBAR_WIDTH,\n extraTopPadding: (document.querySelector<HTMLElement>('.MiddleHeader')!).offsetHeight,\n marginSides: withReactions ? REACTION_BUBBLE_EXTRA_WIDTH : undefined,\n extraMarginTop: extraHeightPinned + extraHeightAudioPlayer,\n };\n }, [withReactions]);\n\n const handleRemoveReaction = useCallback(() => {\n onSendReaction(undefined, 0, 0);\n }, [onSendReaction]);\n\n useEffect(() => {\n if (!isOpen) {\n unmarkIsReady();\n return;\n }\n\n setTimeout(() => {\n markIsReady();\n }, ANIMATION_DURATION);\n }, [isOpen, markIsReady, unmarkIsReady]);\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style, menuStyle, withScroll,\n } = useContextMenuPosition(anchor, getTriggerElement, getRootElement, getMenuElement, getLayout);\n\n useEffect(() => {\n disableScrolling(withScroll ? scrollableRef.current : undefined, '.ReactionSelector');\n\n return enableScrolling;\n }, [withScroll]);\n\n return (\n <Menu\n ref={menuRef}\n isOpen={isOpen}\n transformOriginX={transformOriginX}\n transformOriginY={transformOriginY}\n positionX={positionX}\n positionY={positionY}\n style={style}\n bubbleStyle={menuStyle}\n className={buildClassName(\n 'MessageContextMenu', 'fluid', withReactions && 'with-reactions',\n )}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n >\n {canShowReactionList && (\n <ReactionSelector\n enabledReactions={enabledReactions}\n onSendReaction={onSendReaction}\n isPrivate={isPrivate}\n availableReactions={availableReactions}\n isReady={isReady}\n />\n )}\n\n <div\n className=\"scrollable-content custom-scroll\"\n style={menuStyle}\n ref={scrollableRef}\n >\n {canRemoveReaction && <MenuItem icon=\"heart-outline\" onClick={handleRemoveReaction}>Remove Reaction</MenuItem>}\n {canSendNow && <MenuItem icon=\"send-outline\" onClick={onSend}>{lang('MessageScheduleSend')}</MenuItem>}\n {canReschedule && (\n <MenuItem icon=\"schedule\" onClick={onReschedule}>{lang('MessageScheduleEditTime')}</MenuItem>\n )}\n {canReply && <MenuItem icon=\"reply\" onClick={onReply}>{lang('Reply')}</MenuItem>}\n {canEdit && <MenuItem icon=\"edit\" onClick={onEdit}>{lang('Edit')}</MenuItem>}\n {canFaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onFaveSticker}>{lang('AddToFavorites')}</MenuItem>\n )}\n {canUnfaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onUnfaveSticker}>{lang('Stickers.RemoveFromFavorites')}</MenuItem>\n )}\n {canCopy && copyOptions.map((option) => (\n <MenuItem key={option.label} icon={option.icon} onClick={option.handler}>{lang(option.label)}</MenuItem>\n ))}\n {canPin && <MenuItem icon=\"pin\" onClick={onPin}>{lang('DialogPin')}</MenuItem>}\n {canUnpin && <MenuItem icon=\"unpin\" onClick={onUnpin}>{lang('DialogUnpin')}</MenuItem>}\n {canSaveGif && <MenuItem icon=\"gifs\" onClick={onSaveGif}>{lang('lng_context_save_gif')}</MenuItem>}\n {canDownload && (\n <MenuItem icon=\"download\" onClick={onDownload}>\n {isDownloading ? lang('lng_context_cancel_download') : lang('lng_media_download')}\n </MenuItem>\n )}\n {canForward && <MenuItem icon=\"forward\" onClick={onForward}>{lang('Forward')}</MenuItem>}\n {canSelect && <MenuItem icon=\"select\" onClick={onSelect}>{lang('Common.Select')}</MenuItem>}\n {canReport && <MenuItem icon=\"flag\" onClick={onReport}>{lang('lng_context_report_msg')}</MenuItem>}\n {(canShowSeenBy || canShowReactionsCount) && (\n <MenuItem\n className=\"MessageContextMenu--seen-by\"\n icon={canShowReactionsCount ? 'heart-outline' : 'group'}\n onClick={canShowReactionsCount ? onShowReactors : onShowSeenBy}\n disabled={!canShowReactionsCount && !message.seenByUserIds?.length}\n >\n <span className=\"MessageContextMenu--seen-by-label\">\n {canShowReactionsCount && message.reactors?.count ? (\n canShowSeenBy && message.seenByUserIds?.length\n ? lang(\n 'Chat.OutgoingContextMixedReactionCount',\n [message.reactors.count, message.seenByUserIds.length],\n )\n : lang('Chat.ContextReactionCount', message.reactors.count, 'i')\n ) : (\n message.seenByUserIds?.length === 1 && seenByRecentUsers\n ? getUserFullName(seenByRecentUsers[0])\n : (message.seenByUserIds?.length\n ? lang('Conversation.ContextMenuSeen', message.seenByUserIds.length, 'i')\n : lang('Conversation.ContextMenuNoViews')\n )\n )}\n </span>\n <div className=\"avatars\">\n {seenByRecentUsers?.map((user) => (\n <Avatar\n size=\"micro\"\n user={user}\n />\n ))}\n </div>\n </MenuItem>\n )}\n {canDelete && <MenuItem destructive icon=\"delete\" onClick={onDelete}>{lang('Delete')}</MenuItem>}\n </div>\n </Menu>\n );\n};\n\nexport default memo(MessageContextMenu);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { MessageListType } from '../../../global/types';\nimport type { ApiAvailableReaction, ApiMessage } from '../../../api/types';\nimport type { IAlbum, IAnchorPosition } from '../../../types';\n\nimport {\n selectActiveDownloadIds,\n selectAllowedMessageActions,\n selectChat,\n selectCurrentMessageList,\n selectIsMessageProtected,\n} from '../../../global/selectors';\nimport {\n isActionMessage, isChatChannel,\n isChatGroup, isOwnMessage, areReactionsEmpty, isUserId, isMessageLocal, getMessageVideo,\n} from '../../../global/helpers';\nimport { SERVICE_NOTIFICATIONS_USER_ID } from '../../../config';\nimport { getDayStartAt } from '../../../util/dateFormat';\nimport buildClassName from '../../../util/buildClassName';\nimport { REM } from '../../common/helpers/mediaDimensions';\n\nimport { copyTextToClipboard } from '../../../util/clipboard';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useFlag from '../../../hooks/useFlag';\n\nimport DeleteMessageModal from '../../common/DeleteMessageModal';\nimport ReportModal from '../../common/ReportModal';\nimport PinMessageModal from '../../common/PinMessageModal';\nimport MessageContextMenu from './MessageContextMenu';\nimport CalendarModal from '../../common/CalendarModal';\n\nconst START_SIZE = 2 * REM;\n\nexport type OwnProps = {\n isOpen: boolean;\n chatUsername?: string;\n message: ApiMessage;\n album?: IAlbum;\n anchor: IAnchorPosition;\n messageListType: MessageListType;\n onClose: () => void;\n onCloseAnimationEnd: () => void;\n};\n\ntype StateProps = {\n availableReactions?: ApiAvailableReaction[];\n noOptions?: boolean;\n canSendNow?: boolean;\n canReschedule?: boolean;\n canReply?: boolean;\n canPin?: boolean;\n canShowReactionsCount?: boolean;\n canShowReactionList?: boolean;\n canRemoveReaction?: boolean;\n canUnpin?: boolean;\n canDelete?: boolean;\n canReport?: boolean;\n canEdit?: boolean;\n canForward?: boolean;\n canFaveSticker?: boolean;\n canUnfaveSticker?: boolean;\n canCopy?: boolean;\n isPrivate?: boolean;\n hasFullInfo?: boolean;\n canCopyLink?: boolean;\n canSelect?: boolean;\n canDownload?: boolean;\n canSaveGif?: boolean;\n activeDownloads: number[];\n canShowSeenBy?: boolean;\n enabledReactions?: string[];\n};\n\nconst ContextMenuContainer: FC<OwnProps & StateProps> = ({\n availableReactions,\n isOpen,\n messageListType,\n chatUsername,\n message,\n album,\n anchor,\n onClose,\n onCloseAnimationEnd,\n noOptions,\n canSendNow,\n hasFullInfo,\n canReschedule,\n canReply,\n canPin,\n canUnpin,\n canDelete,\n canReport,\n canShowReactionsCount,\n canShowReactionList,\n canRemoveReaction,\n canEdit,\n enabledReactions,\n isPrivate,\n canForward,\n canFaveSticker,\n canUnfaveSticker,\n canCopy,\n canCopyLink,\n canSelect,\n canDownload,\n canSaveGif,\n activeDownloads,\n canShowSeenBy,\n}) => {\n const {\n setReplyingToId,\n setEditingId,\n pinMessage,\n openForwardMenu,\n faveSticker,\n unfaveSticker,\n toggleMessageSelection,\n sendScheduledMessages,\n rescheduleMessage,\n downloadMessageMedia,\n cancelMessageMediaDownload,\n loadSeenBy,\n openSeenByModal,\n sendReaction,\n openReactorListModal,\n loadFullChat,\n loadReactors,\n copyMessagesByIds,\n saveGif,\n } = getActions();\n\n const { transitionClassNames } = useShowTransition(isOpen, onCloseAnimationEnd, undefined, false);\n const [isMenuOpen, setIsMenuOpen] = useState(true);\n const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);\n const [isReportModalOpen, setIsReportModalOpen] = useState(false);\n const [isPinModalOpen, setIsPinModalOpen] = useState(false);\n const [isCalendarOpen, openCalendar, closeCalendar] = useFlag();\n\n useEffect(() => {\n if (canShowSeenBy && isOpen) {\n loadSeenBy({ chatId: message.chatId, messageId: message.id });\n }\n }, [loadSeenBy, isOpen, message.chatId, message.id, canShowSeenBy]);\n\n useEffect(() => {\n if (canShowReactionsCount && isOpen) {\n loadReactors({ chatId: message.chatId, messageId: message.id });\n }\n }, [canShowReactionsCount, isOpen, loadReactors, message.chatId, message.id]);\n\n useEffect(() => {\n if (!hasFullInfo && !isPrivate && isOpen) {\n loadFullChat({ chatId: message.chatId });\n }\n }, [hasFullInfo, isOpen, isPrivate, loadFullChat, message.chatId]);\n\n const seenByRecentUsers = useMemo(() => {\n if (message.reactions?.recentReactions?.length) {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n return message.reactions?.recentReactions?.slice(0, 3).map(({ userId }) => usersById[userId]).filter(Boolean);\n }\n\n if (!message.seenByUserIds) {\n return undefined;\n }\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n return message.seenByUserIds?.slice(0, 3).map((id) => usersById[id]).filter(Boolean);\n }, [message.reactions?.recentReactions, message.seenByUserIds]);\n\n const isDownloading = album ? album.messages.some((msg) => activeDownloads.includes(msg.id))\n : activeDownloads.includes(message.id);\n\n const handleDelete = useCallback(() => {\n setIsMenuOpen(false);\n setIsDeleteModalOpen(true);\n }, []);\n\n const handleReport = useCallback(() => {\n setIsMenuOpen(false);\n setIsReportModalOpen(true);\n }, []);\n\n const closeMenu = useCallback(() => {\n setIsMenuOpen(false);\n onClose();\n }, [onClose]);\n\n const closeDeleteModal = useCallback(() => {\n setIsDeleteModalOpen(false);\n onClose();\n }, [onClose]);\n\n const closeReportModal = useCallback(() => {\n setIsReportModalOpen(false);\n onClose();\n }, [onClose]);\n\n const closePinModal = useCallback(() => {\n setIsPinModalOpen(false);\n onClose();\n }, [onClose]);\n\n const handleCloseCalendar = useCallback(() => {\n closeCalendar();\n onClose();\n }, [closeCalendar, onClose]);\n\n const handleReply = useCallback(() => {\n setReplyingToId({ messageId: message.id });\n closeMenu();\n }, [setReplyingToId, message.id, closeMenu]);\n\n const handleEdit = useCallback(() => {\n setEditingId({ messageId: message.id });\n closeMenu();\n }, [setEditingId, message.id, closeMenu]);\n\n const handlePin = useCallback(() => {\n setIsMenuOpen(false);\n setIsPinModalOpen(true);\n }, []);\n\n const handleUnpin = useCallback(() => {\n pinMessage({ messageId: message.id, isUnpin: true });\n closeMenu();\n }, [pinMessage, message.id, closeMenu]);\n\n const handleForward = useCallback(() => {\n closeMenu();\n if (album?.messages) {\n const messageIds = album.messages.map(({ id }) => id);\n openForwardMenu({ fromChatId: message.chatId, messageIds });\n } else {\n openForwardMenu({ fromChatId: message.chatId, messageIds: [message.id] });\n }\n }, [openForwardMenu, message, closeMenu, album]);\n\n const handleFaveSticker = useCallback(() => {\n closeMenu();\n faveSticker({ sticker: message.content.sticker });\n }, [closeMenu, message.content.sticker, faveSticker]);\n\n const handleUnfaveSticker = useCallback(() => {\n closeMenu();\n unfaveSticker({ sticker: message.content.sticker });\n }, [closeMenu, message.content.sticker, unfaveSticker]);\n\n const handleSelectMessage = useCallback(() => {\n const params = album?.messages\n ? {\n messageId: message.id,\n childMessageIds: album.messages.map(({ id }) => id),\n withShift: false,\n }\n : { messageId: message.id, withShift: false };\n\n toggleMessageSelection(params);\n closeMenu();\n }, [closeMenu, message.id, toggleMessageSelection, album]);\n\n const handleScheduledMessageSend = useCallback(() => {\n sendScheduledMessages({ chatId: message.chatId, id: message.id });\n closeMenu();\n }, [closeMenu, message.chatId, message.id, sendScheduledMessages]);\n\n const handleOpenCalendar = useCallback(() => {\n setIsMenuOpen(false);\n openCalendar();\n }, [openCalendar]);\n\n const handleOpenSeenByModal = useCallback(() => {\n closeMenu();\n openSeenByModal({ chatId: message.chatId, messageId: message.id });\n }, [closeMenu, message.chatId, message.id, openSeenByModal]);\n\n const handleOpenReactorListModal = useCallback(() => {\n closeMenu();\n openReactorListModal({ chatId: message.chatId, messageId: message.id });\n }, [closeMenu, openReactorListModal, message.chatId, message.id]);\n\n const handleRescheduleMessage = useCallback((date: Date) => {\n rescheduleMessage({\n chatId: message.chatId,\n messageId: message.id,\n scheduledAt: Math.round(date.getTime() / 1000),\n });\n }, [message.chatId, message.id, rescheduleMessage]);\n\n const handleCopyMessages = useCallback((messageIds: number[]) => {\n copyMessagesByIds({ messageIds });\n closeMenu();\n }, [closeMenu, copyMessagesByIds]);\n\n const handleCopyLink = useCallback(() => {\n copyTextToClipboard(`https://t.me/${chatUsername || `c/${message.chatId.replace('-', '')}`}/${message.id}`);\n closeMenu();\n }, [chatUsername, closeMenu, message]);\n\n const handleCopyNumber = useCallback(() => {\n copyTextToClipboard(message.content.contact!.phoneNumber);\n closeMenu();\n }, [closeMenu, message]);\n\n const handleDownloadClick = useCallback(() => {\n (album?.messages || [message]).forEach((msg) => {\n if (isDownloading) {\n cancelMessageMediaDownload({ message: msg });\n } else {\n downloadMessageMedia({ message: msg });\n }\n });\n closeMenu();\n }, [album, message, closeMenu, isDownloading, cancelMessageMediaDownload, downloadMessageMedia]);\n\n const handleSaveGif = useCallback(() => {\n const video = getMessageVideo(message);\n saveGif({ gif: video });\n closeMenu();\n }, [closeMenu, message, saveGif]);\n\n const handleSendReaction = useCallback((reaction: string | undefined, x: number, y: number) => {\n sendReaction({\n chatId: message.chatId, messageId: message.id, reaction, x, y, startSize: START_SIZE,\n });\n closeMenu();\n }, [closeMenu, message.chatId, message.id, sendReaction]);\n\n const reportMessageIds = useMemo(() => (album ? album.messages : [message]).map(({ id }) => id), [album, message]);\n\n if (noOptions) {\n closeMenu();\n\n return undefined;\n }\n\n const scheduledMaxDate = new Date();\n scheduledMaxDate.setFullYear(scheduledMaxDate.getFullYear() + 1);\n\n return (\n <div className={buildClassName('ContextMenuContainer', transitionClassNames)}>\n <MessageContextMenu\n availableReactions={availableReactions}\n message={message}\n isPrivate={isPrivate}\n isOpen={isMenuOpen}\n enabledReactions={enabledReactions}\n anchor={anchor}\n canShowReactionsCount={canShowReactionsCount}\n canShowReactionList={canShowReactionList}\n canRemoveReaction={canRemoveReaction}\n canSendNow={canSendNow}\n canReschedule={canReschedule}\n canReply={canReply}\n canDelete={canDelete}\n canReport={canReport}\n canPin={canPin}\n canUnpin={canUnpin}\n canEdit={canEdit}\n canForward={canForward}\n canFaveSticker={canFaveSticker}\n canUnfaveSticker={canUnfaveSticker}\n canCopy={canCopy}\n canCopyLink={canCopyLink}\n canSelect={canSelect}\n canDownload={canDownload}\n canSaveGif={canSaveGif}\n canShowSeenBy={canShowSeenBy}\n isDownloading={isDownloading}\n seenByRecentUsers={seenByRecentUsers}\n onReply={handleReply}\n onEdit={handleEdit}\n onPin={handlePin}\n onUnpin={handleUnpin}\n onForward={handleForward}\n onDelete={handleDelete}\n onReport={handleReport}\n onFaveSticker={handleFaveSticker}\n onUnfaveSticker={handleUnfaveSticker}\n onSelect={handleSelectMessage}\n onSend={handleScheduledMessageSend}\n onReschedule={handleOpenCalendar}\n onClose={closeMenu}\n onCopyLink={handleCopyLink}\n onCopyMessages={handleCopyMessages}\n onCopyNumber={handleCopyNumber}\n onDownload={handleDownloadClick}\n onSaveGif={handleSaveGif}\n onShowSeenBy={handleOpenSeenByModal}\n onSendReaction={handleSendReaction}\n onShowReactors={handleOpenReactorListModal}\n />\n <DeleteMessageModal\n isOpen={isDeleteModalOpen}\n isSchedule={messageListType === 'scheduled'}\n onClose={closeDeleteModal}\n album={album}\n message={message}\n />\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n messageIds={reportMessageIds}\n />\n <PinMessageModal\n isOpen={isPinModalOpen}\n messageId={message.id}\n chatId={message.chatId}\n onClose={closePinModal}\n />\n {canReschedule && (\n <CalendarModal\n isOpen={isCalendarOpen}\n withTimePicker\n selectedAt={message.date * 1000}\n maxAt={getDayStartAt(scheduledMaxDate)}\n isFutureMode\n onClose={handleCloseCalendar}\n onSubmit={handleRescheduleMessage}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { message, messageListType }): StateProps => {\n const { threadId } = selectCurrentMessageList(global) || {};\n const activeDownloads = selectActiveDownloadIds(global, message.chatId);\n const chat = selectChat(global, message.chatId);\n const { seenByExpiresAt, seenByMaxChatMembers } = global.appConfig || {};\n const {\n noOptions,\n canReply,\n canPin,\n canUnpin,\n canDelete,\n canReport,\n canEdit,\n canForward,\n canFaveSticker,\n canUnfaveSticker,\n canCopy,\n canCopyLink,\n canSelect,\n canDownload,\n canSaveGif,\n } = (threadId && selectAllowedMessageActions(global, message, threadId)) || {};\n const isPinned = messageListType === 'pinned';\n const isScheduled = messageListType === 'scheduled';\n const isChannel = chat && isChatChannel(chat);\n const isLocal = isMessageLocal(message);\n const canShowSeenBy = Boolean(chat\n && seenByMaxChatMembers\n && seenByExpiresAt\n && isChatGroup(chat)\n && isOwnMessage(message)\n && !isScheduled\n && chat.membersCount\n && chat.membersCount <= seenByMaxChatMembers\n && message.date > Date.now() / 1000 - seenByExpiresAt);\n const isPrivate = chat && isUserId(chat.id);\n const isAction = isActionMessage(message);\n const canShowReactionsCount = !isLocal && !isChannel && !isScheduled && !isAction && !isPrivate && message.reactions\n && !areReactionsEmpty(message.reactions) && message.reactions.canSeeList;\n const canRemoveReaction = isPrivate && message.reactions?.results?.some((l) => l.isChosen);\n const isProtected = selectIsMessageProtected(global, message);\n const canCopyNumber = Boolean(message.content.contact);\n\n return {\n availableReactions: global.availableReactions,\n noOptions,\n canSendNow: isScheduled,\n canReschedule: isScheduled,\n canReply: !isPinned && !isScheduled && canReply,\n canPin: !isScheduled && canPin,\n canUnpin: !isScheduled && canUnpin,\n canDelete,\n canReport,\n canEdit: !isPinned && canEdit,\n canForward: !isProtected && !isScheduled && canForward,\n canFaveSticker: !isScheduled && canFaveSticker,\n canUnfaveSticker: !isScheduled && canUnfaveSticker,\n canCopy: canCopyNumber || (!isProtected && canCopy),\n canCopyLink: !isProtected && !isScheduled && canCopyLink,\n canSelect,\n canDownload: !isProtected && canDownload,\n canSaveGif: !isProtected && canSaveGif,\n activeDownloads,\n canShowSeenBy,\n enabledReactions: chat?.isForbidden ? undefined : chat?.fullInfo?.enabledReactions,\n isPrivate,\n hasFullInfo: Boolean(chat?.fullInfo),\n canShowReactionsCount,\n canShowReactionList: !isLocal && !isAction && !isScheduled && chat?.id !== SERVICE_NOTIFICATIONS_USER_ID,\n canRemoveReaction,\n };\n },\n)(ContextMenuContainer));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiSticker, ApiStickerSet } from '../../api/types';\n\nimport { STICKER_SIZE_MODAL } from '../../config';\nimport {\n selectCanScheduleUntilOnline,\n selectChat,\n selectCurrentMessageList,\n selectIsChatWithSelf,\n selectShouldSchedule,\n selectStickerSet,\n selectStickerSetByShortName,\n} from '../../global/selectors';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport renderText from './helpers/renderText';\nimport { getAllowedAttachmentOptions, getCanPostInChat } from '../../global/helpers';\nimport useSchedule from '../../hooks/useSchedule';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport Loading from '../ui/Loading';\nimport StickerButton from './StickerButton';\n\nimport './StickerSetModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n fromSticker?: ApiSticker;\n stickerSetShortName?: string;\n onClose: () => void;\n};\n\ntype StateProps = {\n canSendStickers?: boolean;\n stickerSet?: ApiStickerSet;\n canScheduleUntilOnline?: boolean;\n shouldSchedule?: boolean;\n isSavedMessages?: boolean;\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst StickerSetModal: FC<OwnProps & StateProps> = ({\n isOpen,\n fromSticker,\n stickerSetShortName,\n stickerSet,\n canSendStickers,\n canScheduleUntilOnline,\n shouldSchedule,\n isSavedMessages,\n onClose,\n}) => {\n const {\n loadStickers,\n toggleStickerSet,\n sendMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const lang = useLang();\n\n const [requestCalendar, calendar] = useSchedule(canScheduleUntilOnline);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE, isDisabled: !isOpen });\n\n useEffect(() => {\n if (isOpen) {\n if (fromSticker) {\n const { stickerSetId, stickerSetAccessHash } = fromSticker;\n loadStickers({\n stickerSetId,\n stickerSetAccessHash,\n });\n } else if (stickerSetShortName) {\n loadStickers({\n stickerSetShortName,\n });\n }\n }\n }, [isOpen, fromSticker, loadStickers, stickerSetShortName]);\n\n const handleSelect = useCallback((sticker: ApiSticker, isSilent?: boolean, isScheduleRequested?: boolean) => {\n sticker = {\n ...sticker,\n isPreloadedGlobally: true,\n };\n\n if (shouldSchedule || isScheduleRequested) {\n requestCalendar((scheduledAt) => {\n sendMessage({ sticker, isSilent, scheduledAt });\n onClose();\n });\n } else {\n sendMessage({ sticker, isSilent });\n onClose();\n }\n }, [onClose, requestCalendar, sendMessage, shouldSchedule]);\n\n const handleButtonClick = useCallback(() => {\n if (stickerSet) {\n toggleStickerSet({ stickerSetId: stickerSet.id });\n onClose();\n }\n }, [onClose, stickerSet, toggleStickerSet]);\n\n return (\n <Modal\n className=\"StickerSetModal\"\n isOpen={isOpen}\n onClose={onClose}\n hasCloseButton\n title={stickerSet ? renderText(stickerSet.title, ['emoji', 'links']) : lang('AccDescrStickerSet')}\n >\n {stickerSet?.stickers ? (\n <>\n <div ref={containerRef} className=\"stickers custom-scroll\">\n {stickerSet.stickers.map((sticker) => (\n <StickerButton\n sticker={sticker}\n size={STICKER_SIZE_MODAL}\n observeIntersection={observeIntersection}\n onClick={canSendStickers ? handleSelect : undefined}\n clickArg={sticker}\n isSavedMessages={isSavedMessages}\n />\n ))}\n </div>\n <div className=\"button-wrapper\">\n <Button\n size=\"smaller\"\n fluid\n color={stickerSet.installedDate ? 'danger' : 'primary'}\n onClick={handleButtonClick}\n >\n {lang(\n stickerSet.installedDate ? 'StickerPack.RemoveStickerCount' : 'StickerPack.AddStickerCount',\n stickerSet.count,\n 'i',\n )}\n </Button>\n </div>\n </>\n ) : (\n <Loading />\n )}\n {calendar}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { fromSticker, stickerSetShortName }): StateProps => {\n const currentMessageList = selectCurrentMessageList(global);\n const { chatId, threadId } = currentMessageList || {};\n const chat = chatId && selectChat(global, chatId);\n const sendOptions = chat ? getAllowedAttachmentOptions(chat) : undefined;\n const canSendStickers = Boolean(\n chat && threadId && getCanPostInChat(chat, threadId) && sendOptions?.canSendStickers,\n );\n const isSavedMessages = Boolean(chatId) && selectIsChatWithSelf(global, chatId);\n\n return {\n canScheduleUntilOnline: Boolean(chatId) && selectCanScheduleUntilOnline(global, chatId),\n canSendStickers,\n isSavedMessages,\n shouldSchedule: selectShouldSchedule(global),\n stickerSet: fromSticker\n ? selectStickerSet(global, fromSticker.stickerSetId)\n : stickerSetShortName\n ? selectStickerSetByShortName(global, stickerSetShortName)\n : undefined,\n };\n },\n)(StickerSetModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiBotCommand, ApiChat } from '../../api/types';\nimport type { IAnchorPosition } from '../../types';\n\nimport { REPLIES_USER_ID } from '../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { disableScrolling, enableScrolling } from '../../util/scrollLock';\nimport {\n selectChat, selectNotifySettings, selectNotifyExceptions, selectUser, selectChatBot,\n} from '../../global/selectors';\nimport {\n isUserId, getCanDeleteChat, selectIsChatMuted, getCanAddContact, isChatChannel, isChatGroup,\n} from '../../global/helpers';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useLang from '../../hooks/useLang';\n\nimport Portal from '../ui/Portal';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\nimport DeleteChatModal from '../common/DeleteChatModal';\nimport ReportModal from '../common/ReportModal';\n\nimport './HeaderMenuContainer.scss';\n\nconst BOT_BUTTONS: Record<string, { icon: string; label: string }> = {\n settings: {\n icon: 'bots',\n label: 'BotSettings',\n },\n privacy: {\n icon: 'info',\n label: 'Privacy',\n },\n help: {\n icon: 'help',\n label: 'BotHelp',\n },\n};\n\nexport type OwnProps = {\n chatId: string;\n threadId: number;\n isOpen: boolean;\n withExtraActions: boolean;\n anchor: IAnchorPosition;\n isChannel?: boolean;\n canStartBot?: boolean;\n canRestartBot?: boolean;\n canSubscribe?: boolean;\n canSearch?: boolean;\n canCall?: boolean;\n canMute?: boolean;\n canViewStatistics?: boolean;\n canLeave?: boolean;\n canEnterVoiceChat?: boolean;\n canCreateVoiceChat?: boolean;\n onSubscribeChannel: () => void;\n onSearchClick: () => void;\n onClose: () => void;\n onCloseAnimationEnd: () => void;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n botCommands?: ApiBotCommand[];\n isPrivate?: boolean;\n isMuted?: boolean;\n canAddContact?: boolean;\n canReportChat?: boolean;\n canDeleteChat?: boolean;\n hasLinkedChat?: boolean;\n};\n\nconst HeaderMenuContainer: FC<OwnProps & StateProps> = ({\n chatId,\n isOpen,\n withExtraActions,\n anchor,\n isChannel,\n botCommands,\n canStartBot,\n canRestartBot,\n canSubscribe,\n canSearch,\n canCall,\n canMute,\n canViewStatistics,\n canLeave,\n canEnterVoiceChat,\n canCreateVoiceChat,\n chat,\n isPrivate,\n isMuted,\n canReportChat,\n canDeleteChat,\n hasLinkedChat,\n canAddContact,\n onSubscribeChannel,\n onSearchClick,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const {\n updateChatMutedState,\n enterMessageSelectMode,\n sendBotCommand,\n restartBot,\n joinGroupCall,\n createGroupCall,\n openLinkedChat,\n openAddContactDialog,\n requestCall,\n toggleStatistics,\n } = getActions();\n const [isMenuOpen, setIsMenuOpen] = useState(true);\n const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);\n const [isReportModalOpen, setIsReportModalOpen] = useState(false);\n const { x, y } = anchor;\n\n useShowTransition(isOpen, onCloseAnimationEnd, undefined, false);\n\n const handleReport = useCallback(() => {\n setIsMenuOpen(false);\n setIsReportModalOpen(true);\n }, []);\n\n const closeReportModal = useCallback(() => {\n setIsReportModalOpen(false);\n onClose();\n }, [onClose]);\n\n const handleDelete = useCallback(() => {\n setIsMenuOpen(false);\n setIsDeleteModalOpen(true);\n }, []);\n\n const closeMenu = useCallback(() => {\n setIsMenuOpen(false);\n onClose();\n }, [onClose]);\n\n const closeDeleteModal = useCallback(() => {\n setIsDeleteModalOpen(false);\n onClose();\n }, [onClose]);\n\n const handleStartBot = useCallback(() => {\n sendBotCommand({ command: '/start' });\n }, [sendBotCommand]);\n\n const handleRestartBot = useCallback(() => {\n restartBot({ chatId });\n }, [chatId, restartBot]);\n\n const handleToggleMuteClick = useCallback(() => {\n updateChatMutedState({ chatId, isMuted: !isMuted });\n closeMenu();\n }, [chatId, closeMenu, isMuted, updateChatMutedState]);\n\n const handleEnterVoiceChatClick = useCallback(() => {\n if (canCreateVoiceChat) {\n // TODO show popup to schedule\n createGroupCall({\n chatId,\n });\n } else {\n joinGroupCall({\n chatId,\n });\n }\n closeMenu();\n }, [closeMenu, canCreateVoiceChat, chatId, joinGroupCall, createGroupCall]);\n\n const handleLinkedChatClick = useCallback(() => {\n openLinkedChat({ id: chatId });\n closeMenu();\n }, [chatId, closeMenu, openLinkedChat]);\n\n const handleAddContactClick = useCallback(() => {\n openAddContactDialog({ userId: chatId });\n closeMenu();\n }, [openAddContactDialog, chatId, closeMenu]);\n\n const handleSubscribe = useCallback(() => {\n onSubscribeChannel();\n closeMenu();\n }, [closeMenu, onSubscribeChannel]);\n\n const handleVideoCall = useCallback(() => {\n requestCall({ userId: chatId, isVideo: true });\n closeMenu();\n }, [chatId, closeMenu, requestCall]);\n\n const handleCall = useCallback(() => {\n requestCall({ userId: chatId });\n closeMenu();\n }, [chatId, closeMenu, requestCall]);\n\n const handleSearch = useCallback(() => {\n onSearchClick();\n closeMenu();\n }, [closeMenu, onSearchClick]);\n\n const handleStatisticsClick = useCallback(() => {\n toggleStatistics();\n closeMenu();\n }, [closeMenu, toggleStatistics]);\n\n const handleSelectMessages = useCallback(() => {\n enterMessageSelectMode();\n closeMenu();\n }, [closeMenu, enterMessageSelectMode]);\n\n useEffect(() => {\n disableScrolling();\n\n return enableScrolling;\n }, []);\n\n const lang = useLang();\n\n const botButtons = useMemo(() => {\n return botCommands?.map(({ command }) => {\n const cmd = BOT_BUTTONS[command];\n if (!cmd) return undefined;\n const handleClick = () => {\n sendBotCommand({ command: `/${command}` });\n closeMenu();\n };\n\n return (\n <MenuItem\n key={command}\n icon={cmd.icon}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={handleClick}\n >\n {lang(cmd.label)}\n </MenuItem>\n );\n });\n }, [botCommands, closeMenu, lang, sendBotCommand]);\n\n return (\n <Portal>\n <div className=\"HeaderMenuContainer\">\n <Menu\n isOpen={isMenuOpen}\n positionX=\"right\"\n style={`left: ${x}px;top: ${y}px;`}\n onClose={closeMenu}\n >\n {withExtraActions && canStartBot && (\n <MenuItem\n icon=\"bots\"\n onClick={handleStartBot}\n >\n {lang('BotStart')}\n </MenuItem>\n )}\n {withExtraActions && canRestartBot && (\n <MenuItem\n icon=\"bots\"\n onClick={handleRestartBot}\n >\n {lang('BotRestart')}\n </MenuItem>\n )}\n {withExtraActions && canSubscribe && (\n <MenuItem\n icon={isChannel ? 'channel' : 'group'}\n onClick={handleSubscribe}\n >\n {lang(isChannel ? 'ProfileJoinChannel' : 'ProfileJoinGroup')}\n </MenuItem>\n )}\n {canAddContact && (\n <MenuItem\n icon=\"add-user\"\n onClick={handleAddContactClick}\n >\n {lang('AddContact')}\n </MenuItem>\n )}\n {IS_SINGLE_COLUMN_LAYOUT && canCall && (\n <MenuItem\n icon=\"phone\"\n onClick={handleCall}\n >\n {lang('Call')}\n </MenuItem>\n )}\n {canCall && (\n <MenuItem\n icon=\"video-outlined\"\n onClick={handleVideoCall}\n >\n {lang('VideoCall')}\n </MenuItem>\n )}\n {IS_SINGLE_COLUMN_LAYOUT && canSearch && (\n <MenuItem\n icon=\"search\"\n onClick={handleSearch}\n >\n {lang('Search')}\n </MenuItem>\n )}\n {canMute && (\n <MenuItem\n icon={isMuted ? 'unmute' : 'mute'}\n onClick={handleToggleMuteClick}\n >\n {lang(isMuted ? 'ChatsUnmute' : 'ChatsMute')}\n </MenuItem>\n )}\n {(canEnterVoiceChat || canCreateVoiceChat) && (\n <MenuItem\n icon=\"voice-chat\"\n onClick={handleEnterVoiceChatClick}\n >\n {lang(canCreateVoiceChat ? 'StartVoipChat' : 'VoipGroupJoinCall')}\n </MenuItem>\n )}\n {hasLinkedChat && (\n <MenuItem\n icon={isChannel ? 'comments' : 'channel'}\n onClick={handleLinkedChatClick}\n >\n {lang(isChannel ? 'ViewDiscussion' : 'lng_profile_view_channel')}\n </MenuItem>\n )}\n <MenuItem\n icon=\"select\"\n onClick={handleSelectMessages}\n >\n {lang('ReportSelectMessages')}\n </MenuItem>\n {canViewStatistics && (\n <MenuItem\n icon=\"stats\"\n onClick={handleStatisticsClick}\n >\n {lang('Statistics')}\n </MenuItem>\n )}\n {canReportChat && (\n <MenuItem\n icon=\"flag\"\n onClick={handleReport}\n >\n {lang('ReportPeer.Report')}\n </MenuItem>\n )}\n {botButtons}\n {canLeave && (\n <MenuItem\n destructive\n icon=\"delete\"\n onClick={handleDelete}\n >\n {lang(isPrivate\n ? 'DeleteChatUser'\n : (canDeleteChat ? 'GroupInfo.DeleteAndExit' : (isChannel ? 'LeaveChannel' : 'Group.LeaveGroup')))}\n </MenuItem>\n )}\n </Menu>\n {chat && (\n <DeleteChatModal\n isOpen={isDeleteModalOpen}\n onClose={closeDeleteModal}\n chat={chat}\n />\n )}\n {canReportChat && chat?.id && (\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n subject=\"peer\"\n chatId={chat.id}\n />\n )}\n </div>\n </Portal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n if (!chat || chat.isRestricted) {\n return {};\n }\n const isPrivate = isUserId(chat.id);\n const user = isPrivate ? selectUser(global, chatId) : undefined;\n const canAddContact = user && getCanAddContact(user);\n const canReportChat = isChatChannel(chat) || isChatGroup(chat) || (user && !user.isSelf);\n\n const chatBot = chatId !== REPLIES_USER_ID ? selectChatBot(global, chatId) : undefined;\n\n return {\n chat,\n isMuted: selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)),\n isPrivate,\n canAddContact,\n canReportChat,\n canDeleteChat: getCanDeleteChat(chat),\n hasLinkedChat: Boolean(chat?.fullInfo?.linkedChatId),\n botCommands: chatBot?.fullInfo?.botInfo?.commands,\n };\n },\n)(HeaderMenuContainer));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState, useLayoutEffect,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChat } from '../../api/types';\n\nimport { debounce } from '../../util/schedulers';\nimport { selectCurrentTextSearch, selectCurrentChat } from '../../global/selectors';\nimport { getDayStartAt } from '../../util/dateFormat';\n\nimport Button from '../ui/Button';\nimport SearchInput from '../ui/SearchInput';\n\nimport './MobileSearch.scss';\n\nexport type OwnProps = {\n isActive: boolean;\n};\n\ntype StateProps = {\n isActive?: boolean;\n chat?: ApiChat;\n query?: string;\n totalCount?: number;\n foundIds?: number[];\n isHistoryCalendarOpen?: boolean;\n};\n\nconst runDebouncedForSearch = debounce((cb) => cb(), 200, false);\n\nconst MobileSearchFooter: FC<StateProps> = ({\n isActive,\n chat,\n query,\n totalCount,\n foundIds,\n isHistoryCalendarOpen,\n}) => {\n const {\n setLocalTextSearchQuery,\n searchTextMessagesLocal,\n focusMessage,\n closeLocalTextSearch,\n openHistoryCalendar,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n const [focusedIndex, setFocusedIndex] = useState(0);\n\n // Fix for iOS keyboard\n useEffect(() => {\n const { visualViewport } = window as any;\n if (!visualViewport) {\n return undefined;\n }\n\n const mainEl = document.getElementById('Main') as HTMLDivElement;\n const handleResize = () => {\n const { activeElement } = document;\n if (activeElement && (activeElement === inputRef.current)) {\n const { pageTop, height } = visualViewport;\n mainEl.style.transform = `translateY(${pageTop}px)`;\n mainEl.style.height = `${height}px`;\n document.documentElement.scrollTop = pageTop;\n } else {\n mainEl.style.transform = '';\n mainEl.style.height = '';\n }\n };\n\n visualViewport.addEventListener('resize', handleResize);\n\n return () => {\n visualViewport.removeEventListener('resize', handleResize);\n };\n }, []);\n\n // Focus message\n useEffect(() => {\n if (chat?.id && foundIds?.length) {\n focusMessage({ chatId: chat.id, messageId: foundIds[0] });\n setFocusedIndex(0);\n } else {\n setFocusedIndex(-1);\n }\n }, [chat?.id, focusMessage, foundIds]);\n\n // Disable native up/down buttons on iOS\n useEffect(() => {\n Array.from(document.querySelectorAll<HTMLInputElement>('input')).forEach((input) => {\n input.disabled = Boolean(isActive && input !== inputRef.current);\n });\n\n Array.from(document.querySelectorAll<HTMLDivElement>('div[contenteditable]')).forEach((div) => {\n div.contentEditable = isActive ? 'false' : 'true';\n });\n }, [isActive]);\n\n // Blur on exit\n useEffect(() => {\n if (!isActive) {\n inputRef.current!.blur();\n }\n }, [isActive]);\n\n useLayoutEffect(() => {\n const searchInput = document.querySelector<HTMLInputElement>('#MobileSearch input')!;\n searchInput.blur();\n }, [isHistoryCalendarOpen]);\n\n const handleMessageSearchQueryChange = useCallback((newQuery: string) => {\n setLocalTextSearchQuery({ query: newQuery });\n\n if (newQuery.length) {\n runDebouncedForSearch(searchTextMessagesLocal);\n }\n }, [searchTextMessagesLocal, setLocalTextSearchQuery]);\n\n const handleUp = useCallback(() => {\n if (chat && foundIds) {\n const newFocusIndex = focusedIndex + 1;\n focusMessage({ chatId: chat.id, messageId: foundIds[newFocusIndex] });\n setFocusedIndex(newFocusIndex);\n }\n }, [chat, focusedIndex, focusMessage, foundIds]);\n\n const handleDown = useCallback(() => {\n if (chat && foundIds) {\n const newFocusIndex = focusedIndex - 1;\n focusMessage({ chatId: chat.id, messageId: foundIds[newFocusIndex] });\n setFocusedIndex(newFocusIndex);\n }\n }, [chat, focusedIndex, focusMessage, foundIds]);\n\n return (\n <div id=\"MobileSearch\" className={isActive ? 'active' : ''}>\n <div className=\"header\">\n <Button\n size=\"smaller\"\n round\n color=\"translucent\"\n onClick={closeLocalTextSearch}\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <SearchInput\n ref={inputRef}\n value={query}\n onChange={handleMessageSearchQueryChange}\n />\n </div>\n <div className=\"footer\">\n <div className=\"counter\">\n {query ? (\n foundIds?.length ? (\n `${focusedIndex + 1} of ${totalCount}`\n ) : foundIds && !foundIds.length ? (\n 'No results'\n ) : (\n ''\n )\n ) : (\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openHistoryCalendar({ selectedAt: getDayStartAt(Date.now()) })}\n ariaLabel=\"Search messages by date\"\n >\n <i className=\"icon-calendar\" />\n </Button>\n )}\n </div>\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={handleUp}\n disabled={!foundIds || !foundIds.length || focusedIndex === foundIds.length - 1}\n >\n <i className=\"icon-up\" />\n </Button>\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={handleDown}\n disabled={!foundIds || !foundIds.length || focusedIndex === 0}\n >\n <i className=\"icon-down\" />\n </Button>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const chat = selectCurrentChat(global);\n if (!chat) {\n return {};\n }\n\n const { query, results } = selectCurrentTextSearch(global) || {};\n const { totalCount, foundIds } = results || {};\n\n return {\n chat,\n query,\n totalCount,\n foundIds,\n isHistoryCalendarOpen: Boolean(global.historyCalendarSelectedAt),\n };\n },\n)(MobileSearchFooter));\n","export default function findInViewport(\n container: HTMLElement,\n selectorOrElements: string | NodeListOf<HTMLElement> | HTMLElement[],\n margin = 0,\n isDense = false,\n shouldContainBottom = false,\n isHorizontal = false,\n) {\n const viewportY1 = container[isHorizontal ? 'scrollLeft' : 'scrollTop'];\n const viewportY2 = viewportY1 + container[isHorizontal ? 'offsetWidth' : 'offsetHeight'];\n const allElements = typeof selectorOrElements === 'string'\n ? container.querySelectorAll<HTMLElement>(selectorOrElements)\n : selectorOrElements;\n const { length } = allElements;\n const visibleIndexes: number[] = [];\n let isFound = false;\n\n for (let i = 0; i < length; i++) {\n const element = allElements[i];\n const y1 = element[isHorizontal ? 'offsetLeft' : 'offsetTop'];\n const y2 = y1 + element[isHorizontal ? 'offsetWidth' : 'offsetHeight'];\n const isVisible = shouldContainBottom\n ? y2 >= viewportY1 - margin && y2 <= viewportY2 + margin\n : y1 <= viewportY2 + margin && y2 >= viewportY1 - margin;\n\n if (isVisible) {\n visibleIndexes.push(i);\n isFound = true;\n } else if (isFound && !isDense) {\n break;\n }\n }\n\n return { allElements, visibleIndexes };\n}\n","function isFullyVisible(container: HTMLElement, element: HTMLElement, isHorizontal = false) {\n const viewportY1 = container[isHorizontal ? 'scrollLeft' : 'scrollTop'];\n const viewportY2 = viewportY1 + container[isHorizontal ? 'offsetWidth' : 'offsetHeight'];\n const y1 = element[isHorizontal ? 'offsetLeft' : 'offsetTop'];\n const y2 = y1 + element[isHorizontal ? 'offsetWidth' : 'offsetHeight'];\n return y1 > viewportY1 && y2 < viewportY2;\n}\n\nexport default isFullyVisible;\n","import findInViewport from './findInViewport';\nimport isFullyVisible from './isFullyVisible';\nimport fastSmoothScroll from './fastSmoothScroll';\n\nconst VIEWPORT_MARGIN = 8;\nconst SCROLL_MARGIN = 10;\n\nexport default function setTooltipItemVisible(selector: string, index: number, containerRef: Record<string, any>) {\n const container = containerRef.current!;\n if (!container || index < 0) {\n return;\n }\n const { visibleIndexes, allElements } = findInViewport(\n container,\n selector,\n VIEWPORT_MARGIN,\n true,\n true,\n );\n\n if (!allElements.length || !allElements[index]) {\n return;\n }\n const first = visibleIndexes[0];\n if (!visibleIndexes.includes(index)\n || (index === first && !isFullyVisible(container, allElements[first]))) {\n const position = index > visibleIndexes[visibleIndexes.length - 1] ? 'start' : 'end';\n fastSmoothScroll(container, allElements[index], position, SCROLL_MARGIN);\n }\n}\n","import { useCallback, useEffect, useState } from '../../../../lib/teact/teact';\nimport captureKeyboardListeners from '../../../../util/captureKeyboardListeners';\nimport cycleRestrict from '../../../../util/cycleRestrict';\n\nexport function useKeyboardNavigation({\n isActive,\n isHorizontal,\n shouldSaveSelectionOnUpdateItems,\n shouldRemoveSelectionOnReset,\n noArrowNavigation,\n items,\n shouldSelectOnTab,\n onSelect,\n onClose,\n}: {\n isActive: boolean;\n isHorizontal?: boolean;\n shouldSaveSelectionOnUpdateItems?: boolean;\n shouldRemoveSelectionOnReset?: boolean;\n noArrowNavigation?: boolean;\n items?: any[];\n shouldSelectOnTab?: boolean;\n onSelect: AnyToVoidFunction;\n onClose: NoneToVoidFunction;\n}) {\n const [selectedItemIndex, setSelectedItemIndex] = useState(-1);\n\n const getSelectedIndex = useCallback((newIndex: number) => {\n if (!items) {\n return -1;\n }\n\n return cycleRestrict(items.length, newIndex);\n }, [items]);\n\n const handleArrowKey = useCallback((value: number, e: KeyboardEvent) => {\n e.preventDefault();\n setSelectedItemIndex((index) => (getSelectedIndex(index + value)));\n }, [setSelectedItemIndex, getSelectedIndex]);\n\n const handleItemSelect = useCallback((e: KeyboardEvent) => {\n if (items && items.length && selectedItemIndex > -1) {\n const item = items[selectedItemIndex];\n if (item) {\n e.preventDefault();\n onSelect(item);\n }\n }\n }, [items, onSelect, selectedItemIndex]);\n\n const isSelectionOutOfRange = !items || selectedItemIndex > items.length - 1;\n useEffect(() => {\n if (!shouldSaveSelectionOnUpdateItems || isSelectionOutOfRange) {\n setSelectedItemIndex(shouldRemoveSelectionOnReset ? -1 : 0);\n }\n }, [isSelectionOutOfRange, shouldRemoveSelectionOnReset, shouldSaveSelectionOnUpdateItems]);\n\n useEffect(() => (isActive ? captureKeyboardListeners({\n onEsc: onClose,\n onUp: noArrowNavigation || isHorizontal ? undefined : (e: KeyboardEvent) => handleArrowKey(-1, e),\n onDown: noArrowNavigation || isHorizontal ? undefined : (e: KeyboardEvent) => handleArrowKey(1, e),\n onLeft: noArrowNavigation || !isHorizontal ? undefined : (e: KeyboardEvent) => handleArrowKey(-1, e),\n onRight: noArrowNavigation || !isHorizontal ? undefined : (e: KeyboardEvent) => handleArrowKey(1, e),\n onTab: shouldSelectOnTab ? handleItemSelect : undefined,\n onEnter: handleItemSelect,\n }) : undefined), [\n noArrowNavigation, handleArrowKey, handleItemSelect, isActive, isHorizontal, onClose, shouldSelectOnTab,\n ]);\n\n return selectedItemIndex;\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useCallback, useEffect, useRef, memo,\n} from '../../../lib/teact/teact';\nimport { getGlobal } from '../../../global';\n\nimport type { ApiUser } from '../../../api/types';\n\nimport buildClassName from '../../../util/buildClassName';\nimport setTooltipItemVisible from '../../../util/setTooltipItemVisible';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation';\n\nimport ListItem from '../../ui/ListItem';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\n\nimport './MentionTooltip.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n onInsertUserName: (user: ApiUser, forceFocus?: boolean) => void;\n filteredUsers?: ApiUser[];\n};\n\nconst MentionTooltip: FC<OwnProps> = ({\n isOpen,\n onClose,\n onInsertUserName,\n filteredUsers,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, undefined, undefined, false);\n\n const handleUserSelect = useCallback((userId: string, forceFocus = false) => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const user = usersById[userId];\n if (!user) {\n return;\n }\n\n onInsertUserName(user, forceFocus);\n }, [onInsertUserName]);\n\n const handleSelectMention = useCallback((member: ApiUser) => {\n handleUserSelect(member.id, true);\n }, [handleUserSelect]);\n\n const selectedMentionIndex = useKeyboardNavigation({\n isActive: isOpen,\n items: filteredUsers,\n onSelect: handleSelectMention,\n shouldSelectOnTab: true,\n shouldSaveSelectionOnUpdateItems: true,\n onClose,\n });\n\n useEffect(() => {\n setTooltipItemVisible('.chat-item-clickable', selectedMentionIndex, containerRef);\n }, [selectedMentionIndex]);\n\n useEffect(() => {\n if (filteredUsers && !filteredUsers.length) {\n onClose();\n }\n }, [filteredUsers, onClose]);\n\n const prevChatMembers = usePrevious(\n filteredUsers?.length\n ? filteredUsers\n : undefined,\n shouldRender,\n );\n const renderedChatMembers = filteredUsers && !filteredUsers.length\n ? prevChatMembers\n : filteredUsers;\n\n if (!shouldRender || (renderedChatMembers && !renderedChatMembers.length)) {\n return undefined;\n }\n\n const className = buildClassName(\n 'MentionTooltip composer-tooltip custom-scroll',\n transitionClassNames,\n );\n\n return (\n <div className={className} ref={containerRef}>\n {renderedChatMembers?.map(({ id }, index) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable scroll-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleUserSelect(id)}\n focus={selectedMentionIndex === index}\n >\n <PrivateChatInfo\n userId={id}\n avatarSize=\"small\"\n withUsername\n />\n </ListItem>\n ))}\n </div>\n );\n};\n\nexport default memo(MentionTooltip);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport type { ApiAttachment, ApiChatMember } from '../../../api/types';\n\nimport {\n CONTENT_TYPES_WITH_PREVIEW,\n EDITABLE_INPUT_MODAL_ID,\n SUPPORTED_AUDIO_CONTENT_TYPES,\n SUPPORTED_IMAGE_CONTENT_TYPES,\n SUPPORTED_VIDEO_CONTENT_TYPES,\n} from '../../../config';\nimport { getFileExtension } from '../../common/helpers/documentInfo';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\n\nimport usePrevious from '../../../hooks/usePrevious';\nimport useMentionTooltip from './hooks/useMentionTooltip';\nimport useEmojiTooltip from './hooks/useEmojiTooltip';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';\nimport { useStateRef } from '../../../hooks/useStateRef';\n\nimport Button from '../../ui/Button';\nimport Modal from '../../ui/Modal';\nimport File from '../../common/File';\nimport MessageInput from './MessageInput';\nimport MentionTooltip from './MentionTooltip';\nimport EmojiTooltip from './EmojiTooltip.async';\nimport CustomSendMenu from './CustomSendMenu.async';\n\nimport './AttachmentModal.scss';\n\nexport type OwnProps = {\n chatId: string;\n threadId: number;\n attachments: ApiAttachment[];\n caption: string;\n canShowCustomSendMenu?: boolean;\n isReady?: boolean;\n isChatWithSelf?: boolean;\n currentUserId?: string;\n groupChatMembers?: ApiChatMember[];\n recentEmojis: string[];\n baseEmojiKeywords?: Record<string, string[]>;\n emojiKeywords?: Record<string, string[]>;\n shouldSchedule?: boolean;\n addRecentEmoji: AnyToVoidFunction;\n onCaptionUpdate: (html: string) => void;\n onSend: () => void;\n onFileAppend: (files: File[], isQuick: boolean) => void;\n onClear: () => void;\n onSendSilent: () => void;\n onSendScheduled: () => void;\n};\n\nconst DROP_LEAVE_TIMEOUT_MS = 150;\n\nconst AttachmentModal: FC<OwnProps> = ({\n chatId,\n threadId,\n attachments,\n caption,\n canShowCustomSendMenu,\n isReady,\n isChatWithSelf,\n currentUserId,\n groupChatMembers,\n recentEmojis,\n baseEmojiKeywords,\n emojiKeywords,\n shouldSchedule,\n addRecentEmoji,\n onCaptionUpdate,\n onSend,\n onFileAppend,\n onClear,\n onSendSilent,\n onSendScheduled,\n}) => {\n const captionRef = useStateRef(caption);\n // eslint-disable-next-line no-null/no-null\n const mainButtonRef = useStateRef<HTMLButtonElement | null>(null);\n const hideTimeoutRef = useRef<number>();\n const prevAttachments = usePrevious(attachments);\n const renderingAttachments = attachments.length ? attachments : prevAttachments;\n const isOpen = Boolean(attachments.length);\n const [isHovered, markHovered, unmarkHovered] = useFlag();\n const isQuick = Boolean(renderingAttachments && renderingAttachments.every((a) => a.quick));\n const lang = useLang();\n\n const {\n isMentionTooltipOpen, closeMentionTooltip, insertMention, mentionFilteredUsers,\n } = useMentionTooltip(\n isOpen,\n captionRef,\n onCaptionUpdate,\n EDITABLE_INPUT_MODAL_ID,\n groupChatMembers,\n undefined,\n currentUserId,\n );\n const {\n isEmojiTooltipOpen, closeEmojiTooltip, filteredEmojis, insertEmoji,\n } = useEmojiTooltip(\n isOpen,\n captionRef,\n recentEmojis,\n EDITABLE_INPUT_MODAL_ID,\n onCaptionUpdate,\n baseEmojiKeywords,\n emojiKeywords,\n !isReady,\n );\n\n useEffect(() => (isOpen ? captureEscKeyListener(onClear) : undefined), [isOpen, onClear]);\n\n const {\n isContextMenuOpen: isCustomSendMenuOpen,\n handleContextMenu,\n handleContextMenuClose,\n handleContextMenuHide,\n } = useContextMenuHandlers(mainButtonRef, !canShowCustomSendMenu || !isOpen);\n\n const sendAttachments = useCallback(() => {\n if (isOpen) {\n if (shouldSchedule) {\n onSendScheduled();\n } else {\n onSend();\n }\n }\n }, [isOpen, onSendScheduled, onSend, shouldSchedule]);\n\n const handleDragLeave = (e: React.DragEvent<HTMLElement>) => {\n const { relatedTarget: toTarget, target: fromTarget } = e;\n\n // Esc button pressed during drag event\n if ((fromTarget as HTMLDivElement).matches('.drop-target') && !toTarget) {\n hideTimeoutRef.current = window.setTimeout(unmarkHovered, DROP_LEAVE_TIMEOUT_MS);\n }\n\n // Prevent DragLeave event from firing when the pointer moves inside the AttachmentModal drop target\n if (fromTarget && (fromTarget as HTMLElement).closest('.AttachmentModal.hovered')) {\n return;\n }\n\n if (toTarget) {\n e.stopPropagation();\n }\n\n unmarkHovered();\n };\n\n const handleFilesDrop = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n unmarkHovered();\n\n const { dataTransfer: { files } } = e;\n\n if (files?.length) {\n const newFiles = isQuick\n ? Array.from(files).filter((file) => {\n return file.type && CONTENT_TYPES_WITH_PREVIEW.has(file.type);\n })\n : Array.from(files);\n\n onFileAppend(newFiles, isQuick);\n }\n }, [isQuick, onFileAppend, unmarkHovered]);\n\n function handleDragOver(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n e.preventDefault();\n e.stopPropagation();\n\n if (hideTimeoutRef.current) {\n window.clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = undefined;\n }\n }\n\n if (!renderingAttachments) {\n return undefined;\n }\n\n const areAllPhotos = renderingAttachments.every((a) => SUPPORTED_IMAGE_CONTENT_TYPES.has(a.mimeType));\n const areAllVideos = renderingAttachments.every((a) => SUPPORTED_VIDEO_CONTENT_TYPES.has(a.mimeType));\n const areAllAudios = renderingAttachments.every((a) => SUPPORTED_AUDIO_CONTENT_TYPES.has(a.mimeType));\n\n let title = '';\n if (areAllPhotos) {\n title = lang('PreviewSender.SendPhoto', renderingAttachments.length, 'i');\n } else if (areAllVideos) {\n title = lang('PreviewSender.SendVideo', renderingAttachments.length, 'i');\n } else if (areAllAudios) {\n title = lang('PreviewSender.SendAudio', renderingAttachments.length, 'i');\n } else {\n title = lang('PreviewSender.SendFile', renderingAttachments.length, 'i');\n }\n\n function renderHeader() {\n if (!renderingAttachments) {\n return undefined;\n }\n\n return (\n <div className=\"modal-header-condensed\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel=\"Cancel attachments\" onClick={onClear}>\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{title}</div>\n <div className=\"AttachmentModal--send-wrapper\">\n <Button\n ref={mainButtonRef}\n color=\"primary\"\n size=\"smaller\"\n className=\"modal-action-button\"\n onClick={sendAttachments}\n onContextMenu={canShowCustomSendMenu ? handleContextMenu : undefined}\n >\n {lang('Send')}\n </Button>\n {canShowCustomSendMenu && (\n <CustomSendMenu\n isOpen={isCustomSendMenuOpen}\n isOpenToBottom\n onSendSilent={!isChatWithSelf ? onSendSilent : undefined}\n onSendSchedule={onSendScheduled}\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n isSavedMessages={isChatWithSelf}\n />\n )}\n </div>\n </div>\n );\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClear}\n header={renderHeader()}\n className={`AttachmentModal ${isHovered ? 'hovered' : ''}`}\n >\n <div\n className=\"drop-target\"\n onDragEnter={markHovered}\n onDrop={handleFilesDrop}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n data-attach-description={lang('Preview.Dragging.AddItems', 10)}\n >\n {isQuick ? (\n <div className=\"media-wrapper custom-scroll\">\n {renderingAttachments.map((attachment) => (\n attachment.mimeType.startsWith('image/')\n ? <img src={attachment.blobUrl} alt=\"\" />\n : <video src={attachment.blobUrl} autoPlay muted loop />\n ))}\n </div>\n ) : (\n <div className=\"document-wrapper custom-scroll\">\n {renderingAttachments.map((attachment) => (\n <File\n name={attachment.filename}\n extension={getFileExtension(attachment.filename, attachment.mimeType)}\n previewData={attachment.previewBlobUrl}\n size={attachment.size}\n smaller\n />\n ))}\n </div>\n )}\n\n <div className=\"attachment-caption-wrapper\">\n <MentionTooltip\n isOpen={isMentionTooltipOpen}\n onClose={closeMentionTooltip}\n onInsertUserName={insertMention}\n filteredUsers={mentionFilteredUsers}\n />\n <EmojiTooltip\n isOpen={isEmojiTooltipOpen}\n emojis={filteredEmojis}\n onClose={closeEmojiTooltip}\n onEmojiSelect={insertEmoji}\n addRecentEmoji={addRecentEmoji}\n />\n <MessageInput\n id=\"caption-input-text\"\n chatId={chatId}\n threadId={threadId}\n isAttachmentModalInput\n html={caption}\n editableInputId={EDITABLE_INPUT_MODAL_ID}\n placeholder={lang('Caption')}\n onUpdate={onCaptionUpdate}\n onSend={sendAttachments}\n canAutoFocus={Boolean(isReady && attachments.length)}\n />\n </div>\n </div>\n </Modal>\n );\n};\n\nexport default memo(AttachmentModal);\n","import type { ChangeEvent, RefObject } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useLayoutEffect, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport type { ApiNewPoll } from '../../../api/types';\n\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport parseMessageInput from '../../../util/parseMessageInput';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport Modal from '../../ui/Modal';\nimport InputText from '../../ui/InputText';\nimport Checkbox from '../../ui/Checkbox';\nimport RadioGroup from '../../ui/RadioGroup';\n\nimport './PollModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n shouldBeAnonimous?: boolean;\n isQuiz?: boolean;\n onSend: (pollSummary: ApiNewPoll) => void;\n onClear: () => void;\n};\n\nconst MAX_LIST_HEIGHT = 320;\nconst MAX_OPTIONS_COUNT = 10;\nconst MAX_OPTION_LENGTH = 100;\nconst MAX_QUESTION_LENGTH = 255;\nconst MAX_SOLUTION_LENGTH = 200;\n\nconst PollModal: FC<OwnProps> = ({\n isOpen, isQuiz, shouldBeAnonimous, onSend, onClear,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const questionInputRef = useRef<HTMLInputElement>(null);\n // eslint-disable-next-line no-null/no-null\n const optionsListRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const solutionRef = useRef<HTMLDivElement>(null);\n\n const [question, setQuestion] = useState<string>('');\n const [options, setOptions] = useState<string[]>(['']);\n const [isAnonymous, setIsAnonymous] = useState(true);\n const [isMultipleAnswers, setIsMultipleAnswers] = useState(false);\n const [isQuizMode, setIsQuizMode] = useState(isQuiz || false);\n const [solution, setSolution] = useState<string>('');\n const [correctOption, setCorrectOption] = useState<string>();\n const [hasErrors, setHasErrors] = useState<boolean>(false);\n\n const lang = useLang();\n\n const focusInput = useCallback((ref: RefObject<HTMLInputElement>) => {\n if (isOpen && ref.current) {\n ref.current.focus();\n }\n }, [isOpen]);\n\n useEffect(() => (isOpen ? captureEscKeyListener(onClear) : undefined), [isOpen, onClear]);\n useEffect(() => {\n if (!isOpen) {\n setQuestion('');\n setOptions(['']);\n setIsAnonymous(true);\n setIsMultipleAnswers(false);\n setIsQuizMode(isQuiz || false);\n setSolution('');\n setCorrectOption('');\n setHasErrors(false);\n }\n }, [isQuiz, isOpen]);\n\n useEffect(() => focusInput(questionInputRef), [focusInput, isOpen]);\n\n useLayoutEffect(() => {\n const solutionEl = solutionRef.current;\n\n if (solutionEl && solution !== solutionEl.innerHTML) {\n solutionEl.innerHTML = solution;\n }\n }, [solution]);\n\n const addNewOption = useCallback((newOptions: string[] = []) => {\n setOptions([...newOptions, '']);\n requestAnimationFrame(() => {\n const list = optionsListRef.current;\n if (!list) {\n return;\n }\n\n list.classList.toggle('overflown', list.scrollHeight > MAX_LIST_HEIGHT);\n list.scrollTo({ top: list.scrollHeight, behavior: 'smooth' });\n });\n }, []);\n\n const handleCreate = useCallback(() => {\n setHasErrors(false);\n if (!isOpen) {\n return;\n }\n\n const questionTrimmed = question.trim().substring(0, MAX_QUESTION_LENGTH);\n const optionsTrimmed = options.map((o) => o.trim().substring(0, MAX_OPTION_LENGTH)).filter((o) => o.length);\n\n if (!questionTrimmed || optionsTrimmed.length < 2) {\n setQuestion(questionTrimmed);\n if (optionsTrimmed.length) {\n if (optionsTrimmed.length < 2) {\n addNewOption(optionsTrimmed);\n } else {\n setOptions(optionsTrimmed);\n }\n } else {\n addNewOption();\n }\n setHasErrors(true);\n return;\n }\n\n if (isQuizMode && (!correctOption || !optionsTrimmed[Number(correctOption)])) {\n setHasErrors(true);\n return;\n }\n\n const answers = optionsTrimmed\n .map((text, index) => ({\n text: text.trim(),\n option: String(index),\n ...(String(index) === correctOption && { correct: true }),\n }));\n\n const payload: ApiNewPoll = {\n summary: {\n question: questionTrimmed,\n answers,\n ...(!isAnonymous && { isPublic: true }),\n ...(isMultipleAnswers && { multipleChoice: true }),\n ...(isQuizMode && { quiz: true }),\n },\n };\n\n if (isQuizMode) {\n const { text, entities } = (solution && parseMessageInput(solution.substring(0, MAX_SOLUTION_LENGTH))) || {};\n\n payload.quiz = {\n correctAnswers: [correctOption],\n ...(text && { solution: text }),\n ...(entities && { solutionEntities: entities }),\n };\n }\n\n onSend(payload);\n }, [\n isOpen,\n question,\n options,\n isQuizMode,\n correctOption,\n isAnonymous,\n isMultipleAnswers,\n onSend,\n addNewOption,\n solution,\n ]);\n\n const updateOption = useCallback((index: number, text: string) => {\n const newOptions = [...options];\n newOptions[index] = text;\n if (newOptions[newOptions.length - 1].trim().length && newOptions.length < MAX_OPTIONS_COUNT) {\n addNewOption(newOptions);\n } else {\n setOptions(newOptions);\n }\n }, [options, addNewOption]);\n\n const removeOption = useCallback((index: number) => {\n const newOptions = [...options];\n newOptions.splice(index, 1);\n setOptions(newOptions);\n requestAnimationFrame(() => {\n if (!optionsListRef.current) {\n return;\n }\n\n optionsListRef.current.classList.toggle('overflown', optionsListRef.current.scrollHeight > MAX_LIST_HEIGHT);\n });\n }, [options]);\n\n const handleCorrectOptionChange = useCallback((newValue: string) => {\n setCorrectOption(newValue);\n }, [setCorrectOption]);\n\n const handleIsAnonymousChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsAnonymous(e.target.checked);\n }, []);\n\n const handleMultipleAnswersChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsMultipleAnswers(e.target.checked);\n }, []);\n\n const handleQuizModeChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsQuizMode(e.target.checked);\n }, []);\n\n const handleKeyPress = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.keyCode === 13) {\n handleCreate();\n }\n }, [handleCreate]);\n\n const handleQuestionChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setQuestion(e.target.value);\n }, []);\n\n const getQuestionError = useCallback(() => {\n if (hasErrors && !question.trim().length) {\n return lang('lng_polls_choose_question');\n }\n\n return undefined;\n }, [hasErrors, lang, question]);\n\n const getOptionsError = useCallback((index: number) => {\n const optionsTrimmed = options.map((o) => o.trim()).filter((o) => o.length);\n if (hasErrors && optionsTrimmed.length < 2 && !options[index].trim().length) {\n return lang('lng_polls_choose_answers');\n }\n return undefined;\n }, [hasErrors, lang, options]);\n\n function renderHeader() {\n return (\n <div className=\"modal-header-condensed\">\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel=\"Cancel poll creation\" onClick={onClear}>\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{lang('NewPoll')}</div>\n <Button\n color=\"primary\"\n size=\"smaller\"\n className=\"modal-action-button\"\n onClick={handleCreate}\n >\n {lang('Create')}\n </Button>\n </div>\n );\n }\n\n function renderOptions() {\n return options.map((option, index) => (\n <div className=\"option-wrapper\">\n <InputText\n label={index !== options.length - 1 || options.length === MAX_OPTIONS_COUNT\n ? lang('OptionHint')\n : lang('CreatePoll.AddOption')}\n error={getOptionsError(index)}\n value={option}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={(e) => updateOption(index, e.currentTarget.value)}\n onKeyPress={handleKeyPress}\n />\n {index !== options.length - 1 && (\n <Button\n className=\"option-remove-button\"\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Delete')}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => removeOption(index)}\n >\n <i className=\"icon-close\" />\n </Button>\n )}\n </div>\n ));\n }\n\n function renderRadioOptions() {\n return renderOptions()\n .map((label, index) => ({ value: String(index), label, hidden: index === options.length - 1 }));\n }\n\n function renderQuizNoOptionError() {\n const optionsTrimmed = options.map((o) => o.trim()).filter((o) => o.length);\n\n return isQuizMode && (!correctOption || !optionsTrimmed[Number(correctOption)]) && (\n <p className=\"error\">{lang('lng_polls_choose_correct')}</p>\n );\n }\n\n return (\n <Modal isOpen={isOpen} onClose={onClear} header={renderHeader()} className=\"PollModal\">\n <InputText\n ref={questionInputRef}\n label={lang('AskAQuestion')}\n value={question}\n error={getQuestionError()}\n onChange={handleQuestionChange}\n onKeyPress={handleKeyPress}\n />\n <div className=\"options-divider\" />\n\n <div className=\"options-list custom-scroll\" ref={optionsListRef}>\n <h3 className=\"options-header\">{lang('PollOptions')}</h3>\n\n {hasErrors && renderQuizNoOptionError()}\n {isQuizMode ? (\n <RadioGroup\n name=\"correctOption\"\n options={renderRadioOptions()}\n onChange={handleCorrectOptionChange}\n />\n ) : (\n renderOptions()\n )}\n\n </div>\n\n <div className=\"options-divider\" />\n\n <div className=\"quiz-mode\">\n {!shouldBeAnonimous && (\n <Checkbox\n label={lang('PollAnonymous')}\n checked={isAnonymous}\n onChange={handleIsAnonymousChange}\n />\n )}\n <Checkbox\n label={lang('PollMultiple')}\n checked={isMultipleAnswers}\n disabled={isQuizMode}\n onChange={handleMultipleAnswersChange}\n />\n <Checkbox\n label={lang('PollQuiz')}\n checked={isQuizMode}\n disabled={isMultipleAnswers || isQuiz !== undefined}\n onChange={handleQuizModeChange}\n />\n {isQuizMode && (\n <>\n <h3 className=\"options-header\">{lang('lng_polls_solution_title')}</h3>\n <div\n ref={solutionRef}\n className=\"form-control\"\n contentEditable\n dir=\"auto\"\n onChange={(e) => setSolution(e.currentTarget.innerHTML)}\n />\n <div className=\"note\">{lang('CreatePoll.ExplanationInfo')}</div>\n </>\n )}\n </div>\n </Modal>\n );\n};\n\nexport default memo(PollModal);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\n\nimport { IS_EMOJI_SUPPORTED } from '../../../util/environment';\nimport { handleEmojiLoad, LOADED_EMOJIS } from '../../../util/emoji';\nimport buildClassName from '../../../util/buildClassName';\n\nimport './EmojiButton.scss';\n\ntype OwnProps = {\n emoji: Emoji;\n focus?: boolean;\n onClick: (emoji: string, name: string) => void;\n};\n\nconst EmojiButton: FC<OwnProps> = ({ emoji, focus, onClick }) => {\n const handleClick = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n // Preventing safari from losing focus on Composer MessageInput\n e.preventDefault();\n\n onClick(emoji.native, emoji.id);\n }, [emoji, onClick]);\n\n const className = buildClassName(\n 'EmojiButton',\n focus && 'focus',\n );\n\n const src = `./img-apple-64/${emoji.image}.png`;\n const isLoaded = LOADED_EMOJIS.has(src);\n\n return (\n <div\n className={className}\n onMouseDown={handleClick}\n title={`:${emoji.names[0]}:`}\n >\n {IS_EMOJI_SUPPORTED ? emoji.native : (\n <img\n src={src}\n className={!isLoaded ? 'opacity-transition shown' : undefined}\n alt={emoji.native}\n loading=\"lazy\"\n data-path={src}\n onLoad={!isLoaded ? handleEmojiLoad : undefined}\n />\n )}\n </div>\n );\n};\n\nexport default memo(EmojiButton);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useRef } from '../../../lib/teact/teact';\n\nimport { RECENT_SYMBOL_SET_ID } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport buildClassName from '../../../util/buildClassName';\nimport windowSize from '../../../util/windowSize';\n\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useOnIntersect } from '../../../hooks/useIntersectionObserver';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport useLang from '../../../hooks/useLang';\n\nimport EmojiButton from './EmojiButton';\n\nconst EMOJIS_PER_ROW_ON_DESKTOP = 9;\nconst EMOJI_MARGIN = 4;\nconst MOBILE_CONTAINER_PADDING = 8;\nconst EMOJI_SIZE = 40;\n\ntype OwnProps = {\n category: EmojiCategory;\n index: number;\n allEmojis: AllEmojis;\n observeIntersection: ObserveFn;\n shouldRender: boolean;\n onEmojiSelect: (emoji: string, name: string) => void;\n};\n\nconst EmojiCategory: FC<OwnProps> = ({\n category, index, allEmojis, observeIntersection, shouldRender, onEmojiSelect,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n useOnIntersect(ref, observeIntersection);\n\n const transitionClassNames = useMediaTransition(shouldRender);\n\n const lang = useLang();\n\n const emojisPerRow = IS_SINGLE_COLUMN_LAYOUT\n ? Math.floor((windowSize.get().width - MOBILE_CONTAINER_PADDING) / (EMOJI_SIZE + EMOJI_MARGIN))\n : EMOJIS_PER_ROW_ON_DESKTOP;\n const height = Math.ceil(category.emojis.length / emojisPerRow) * (EMOJI_SIZE + EMOJI_MARGIN);\n\n return (\n <div\n ref={ref}\n key={category.id}\n id={`emoji-category-${index}`}\n className=\"symbol-set\"\n >\n <div className=\"symbol-set-header\">\n <p className=\"symbol-set-name\" dir=\"auto\">\n {lang(category.id === RECENT_SYMBOL_SET_ID ? 'RecentStickers' : `Emoji${index}`)}\n </p>\n </div>\n <div\n className={buildClassName('symbol-set-container', transitionClassNames)}\n style={`height: ${height}px;`}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n {shouldRender && category.emojis.map((name) => {\n const emoji = allEmojis[name];\n // Recent emojis may contain emoticons that are no longer in the list\n if (!emoji) {\n return undefined;\n }\n // Some emojis have multiple skins and are represented as an Object with emojis for all skins.\n // For now, we select only the first emoji with 'neutral' skin.\n const displayedEmoji = 'id' in emoji ? emoji : emoji[1];\n\n return (\n <EmojiButton\n key={displayedEmoji.id}\n emoji={displayedEmoji}\n onClick={onEmojiSelect}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default memo(EmojiCategory);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useState, useEffect, memo, useRef, useMemo, useCallback,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { GlobalState } from '../../../global/types';\n\nimport { MENU_TRANSITION_DURATION, RECENT_SYMBOL_SET_ID } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport type {\n EmojiModule,\n EmojiRawData,\n EmojiData,\n} from '../../../util/emoji';\nimport {\n uncompressEmoji,\n} from '../../../util/emoji';\nimport fastSmoothScroll from '../../../util/fastSmoothScroll';\nimport buildClassName from '../../../util/buildClassName';\nimport { pick } from '../../../util/iteratees';\nimport fastSmoothScrollHorizontal from '../../../util/fastSmoothScrollHorizontal';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport Loading from '../../ui/Loading';\nimport EmojiCategory from './EmojiCategory';\n\nimport './EmojiPicker.scss';\n\ntype OwnProps = {\n className?: string;\n onEmojiSelect: (emoji: string, name: string) => void;\n};\n\ntype StateProps = Pick<GlobalState, 'recentEmojis'>;\ntype EmojiCategoryData = { id: string; name: string; emojis: string[] };\n\nconst ICONS_BY_CATEGORY: Record<string, string> = {\n recent: 'icon-recent',\n people: 'icon-smile',\n nature: 'icon-animals',\n foods: 'icon-eats',\n activity: 'icon-sport',\n places: 'icon-car',\n objects: 'icon-lamp',\n symbols: 'icon-language',\n flags: 'icon-flag',\n};\n\nconst OPEN_ANIMATION_DELAY = 200;\n// Only a few categories are above this height.\nconst SMOOTH_SCROLL_DISTANCE = 800;\nconst FOCUS_MARGIN = 50;\nconst HEADER_BUTTON_WIDTH = 42; // px. Includes margins\nconst INTERSECTION_THROTTLE = 200;\n\nconst categoryIntersections: boolean[] = [];\n\nlet emojiDataPromise: Promise<EmojiModule>;\nlet emojiRawData: EmojiRawData;\nlet emojiData: EmojiData;\n\nconst EmojiPicker: FC<OwnProps & StateProps> = ({\n className, onEmojiSelect, recentEmojis,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const headerRef = useRef<HTMLDivElement>(null);\n\n const [categories, setCategories] = useState<EmojiCategoryData[]>();\n const [emojis, setEmojis] = useState<AllEmojis>();\n const [activeCategoryIndex, setActiveCategoryIndex] = useState(0);\n\n const { observe: observeIntersection } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n }, (entries) => {\n entries.forEach((entry) => {\n const { id } = entry.target as HTMLDivElement;\n if (!id || !id.startsWith('emoji-category-')) {\n return;\n }\n\n const index = Number(id.replace('emoji-category-', ''));\n categoryIntersections[index] = entry.isIntersecting;\n });\n\n const intersectingWithIndexes = categoryIntersections\n .map((isIntersecting, index) => ({ index, isIntersecting }))\n .filter(({ isIntersecting }) => isIntersecting);\n\n if (!intersectingWithIndexes.length) {\n return;\n }\n\n setActiveCategoryIndex(intersectingWithIndexes[Math.floor(intersectingWithIndexes.length / 2)].index);\n });\n\n useHorizontalScroll(headerRef.current, !IS_SINGLE_COLUMN_LAYOUT);\n\n // Scroll header when active set updates\n useEffect(() => {\n if (!categories) {\n return;\n }\n\n const header = headerRef.current;\n if (!header) {\n return;\n }\n\n const newLeft = activeCategoryIndex * HEADER_BUTTON_WIDTH - header.offsetWidth / 2 + HEADER_BUTTON_WIDTH / 2;\n\n fastSmoothScrollHorizontal(header, newLeft);\n }, [categories, activeCategoryIndex]);\n\n const lang = useLang();\n\n const allCategories = useMemo(() => {\n if (!categories) {\n return MEMO_EMPTY_ARRAY;\n }\n const themeCategories = [...categories];\n if (recentEmojis?.length) {\n themeCategories.unshift({\n id: RECENT_SYMBOL_SET_ID,\n name: lang('RecentStickers'),\n emojis: recentEmojis,\n });\n }\n\n return themeCategories;\n }, [categories, lang, recentEmojis]);\n\n // Initialize data on first render.\n useEffect(() => {\n setTimeout(() => {\n const exec = () => {\n setCategories(emojiData.categories);\n\n setEmojis(emojiData.emojis as AllEmojis);\n };\n\n if (emojiData) {\n exec();\n } else {\n ensureEmojiData()\n .then(exec);\n }\n }, OPEN_ANIMATION_DELAY);\n }, []);\n\n const selectCategory = useCallback((index: number) => {\n setActiveCategoryIndex(index);\n const categoryEl = document.getElementById(`emoji-category-${index}`)!;\n fastSmoothScroll(containerRef.current!, categoryEl, 'start', FOCUS_MARGIN, SMOOTH_SCROLL_DISTANCE);\n }, []);\n\n const handleEmojiSelect = useCallback((emoji: string, name: string) => {\n onEmojiSelect(emoji, name);\n }, [onEmojiSelect]);\n\n const canRenderContents = useAsyncRendering([], MENU_TRANSITION_DURATION);\n\n function renderCategoryButton(category: EmojiCategoryData, index: number) {\n const icon = ICONS_BY_CATEGORY[category.id];\n\n return icon && (\n <Button\n className={`symbol-set-button ${index === activeCategoryIndex ? 'activated' : ''}`}\n round\n faded\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => selectCategory(index)}\n ariaLabel={category.name}\n >\n <i className={icon} />\n </Button>\n );\n }\n\n const containerClassName = buildClassName('EmojiPicker', className);\n\n if (!emojis || !canRenderContents) {\n return (\n <div className={containerClassName}>\n <Loading />\n </div>\n );\n }\n\n return (\n <div className={containerClassName}>\n <div ref={headerRef} className=\"EmojiPicker-header\" dir={lang.isRtl ? 'rtl' : ''}>\n {allCategories.map(renderCategoryButton)}\n </div>\n <div\n ref={containerRef}\n className={buildClassName('EmojiPicker-main no-selection', IS_TOUCH_ENV ? 'no-scrollbar' : 'custom-scroll')}\n >\n {allCategories.map((category, i) => (\n <EmojiCategory\n category={category}\n index={i}\n allEmojis={emojis}\n observeIntersection={observeIntersection}\n shouldRender={activeCategoryIndex >= i - 1 && activeCategoryIndex <= i + 1}\n onEmojiSelect={handleEmojiSelect}\n />\n ))}\n </div>\n </div>\n );\n};\n\nasync function ensureEmojiData() {\n if (!emojiDataPromise) {\n emojiDataPromise = import('emoji-data-ios/emoji-data.json');\n emojiRawData = (await emojiDataPromise).default;\n\n emojiData = uncompressEmoji(emojiRawData);\n }\n\n return emojiDataPromise;\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => pick(global, ['recentEmojis']),\n)(EmojiPicker));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { ApiSticker } from '../../../api/types';\nimport type { StickerSetOrRecent } from '../../../types';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useOnIntersect } from '../../../hooks/useIntersectionObserver';\n\nimport { FAVORITE_SYMBOL_SET_ID, RECENT_SYMBOL_SET_ID, STICKER_SIZE_PICKER } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport windowSize from '../../../util/windowSize';\nimport buildClassName from '../../../util/buildClassName';\n\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\n\nimport StickerButton from '../../common/StickerButton';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\ntype OwnProps = {\n stickerSet: StickerSetOrRecent;\n loadAndPlay: boolean;\n index: number;\n shouldRender: boolean;\n favoriteStickers?: ApiSticker[];\n isSavedMessages?: boolean;\n observeIntersection: ObserveFn;\n onStickerSelect: (sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => void;\n onStickerUnfave: (sticker: ApiSticker) => void;\n onStickerFave: (sticker: ApiSticker) => void;\n onStickerRemoveRecent: (sticker: ApiSticker) => void;\n};\n\nconst STICKERS_PER_ROW_ON_DESKTOP = 5;\nconst STICKER_MARGIN = IS_SINGLE_COLUMN_LAYOUT ? 8 : 16;\nconst MOBILE_CONTAINER_PADDING = 8;\n\nconst StickerSet: FC<OwnProps> = ({\n stickerSet,\n loadAndPlay,\n index,\n shouldRender,\n favoriteStickers,\n isSavedMessages,\n observeIntersection,\n onStickerSelect,\n onStickerUnfave,\n onStickerFave,\n onStickerRemoveRecent,\n}) => {\n const { clearRecentStickers } = getActions();\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n const [isConfirmModalOpen, openConfirmModal, closeConfirmModal] = useFlag();\n const lang = useLang();\n\n useOnIntersect(ref, observeIntersection);\n\n const transitionClassNames = useMediaTransition(shouldRender);\n\n const handleClearRecent = useCallback(() => {\n clearRecentStickers();\n closeConfirmModal();\n }, [clearRecentStickers, closeConfirmModal]);\n\n const stickersPerRow = IS_SINGLE_COLUMN_LAYOUT\n ? Math.floor((windowSize.get().width - MOBILE_CONTAINER_PADDING) / (STICKER_SIZE_PICKER + STICKER_MARGIN))\n : STICKERS_PER_ROW_ON_DESKTOP;\n const height = Math.ceil(stickerSet.count / stickersPerRow) * (STICKER_SIZE_PICKER + STICKER_MARGIN);\n\n const favoriteStickerIdsSet = useMemo(() => (\n favoriteStickers ? new Set(favoriteStickers.map(({ id }) => id)) : undefined\n ), [favoriteStickers]);\n\n const isRecent = stickerSet.id === RECENT_SYMBOL_SET_ID;\n\n return (\n <div\n ref={ref}\n key={stickerSet.id}\n id={`sticker-set-${index}`}\n className=\"symbol-set\"\n >\n <div className=\"symbol-set-header\">\n <p className=\"symbol-set-name\">{stickerSet.title}</p>\n {isRecent && (\n <i className=\"symbol-set-remove icon-close\" onClick={openConfirmModal} />\n )}\n </div>\n <div\n className={buildClassName('symbol-set-container', transitionClassNames)}\n style={`height: ${height}px;`}\n >\n {shouldRender && stickerSet.stickers && stickerSet.stickers.map((sticker) => (\n <StickerButton\n key={sticker.id}\n sticker={sticker}\n size={STICKER_SIZE_PICKER}\n observeIntersection={observeIntersection}\n noAnimate={!loadAndPlay}\n onClick={onStickerSelect}\n clickArg={sticker}\n onUnfaveClick={stickerSet.id === FAVORITE_SYMBOL_SET_ID && favoriteStickerIdsSet?.has(sticker.id)\n ? onStickerUnfave : undefined}\n onFaveClick={!favoriteStickerIdsSet?.has(sticker.id) ? onStickerFave : undefined}\n onRemoveRecentClick={isRecent ? onStickerRemoveRecent : undefined}\n isSavedMessages={isSavedMessages}\n canViewSet\n />\n ))}\n </div>\n\n {isRecent && (\n <ConfirmDialog\n text={lang('ClearRecentEmoji')}\n isOpen={isConfirmModalOpen}\n onClose={closeConfirmModal}\n confirmHandler={handleClearRecent}\n confirmIsDestructive\n />\n )}\n </div>\n );\n};\n\nexport default memo(StickerSet);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useState, useEffect, memo, useRef, useMemo, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiStickerSet, ApiSticker, ApiChat } from '../../../api/types';\nimport type { StickerSetOrRecent } from '../../../types';\n\nimport {\n CHAT_STICKER_SET_ID,\n FAVORITE_SYMBOL_SET_ID, RECENT_SYMBOL_SET_ID, SLIDE_TRANSITION_DURATION, STICKER_SIZE_PICKER_HEADER,\n} from '../../../config';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport fastSmoothScroll from '../../../util/fastSmoothScroll';\nimport buildClassName from '../../../util/buildClassName';\nimport fastSmoothScrollHorizontal from '../../../util/fastSmoothScrollHorizontal';\nimport { pickTruthy } from '../../../util/iteratees';\nimport { selectChat, selectIsChatWithSelf } from '../../../global/selectors';\n\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useLang from '../../../hooks/useLang';\nimport useSendMessageAction from '../../../hooks/useSendMessageAction';\n\nimport Avatar from '../../common/Avatar';\nimport Loading from '../../ui/Loading';\nimport Button from '../../ui/Button';\nimport StickerButton from '../../common/StickerButton';\nimport StickerSet from './StickerSet';\nimport StickerSetCover from './StickerSetCover';\nimport StickerSetCoverAnimated from './StickerSetCoverAnimated';\n\nimport './StickerPicker.scss';\n\ntype OwnProps = {\n chatId: string;\n threadId?: number;\n className: string;\n loadAndPlay: boolean;\n canSendStickers: boolean;\n onStickerSelect: (sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n recentStickers: ApiSticker[];\n favoriteStickers: ApiSticker[];\n stickerSetsById: Record<string, ApiStickerSet>;\n addedSetIds?: string[];\n shouldPlay?: boolean;\n isSavedMessages?: boolean;\n};\n\nconst SMOOTH_SCROLL_DISTANCE = 500;\nconst HEADER_BUTTON_WIDTH = 52; // px (including margin)\nconst STICKER_INTERSECTION_THROTTLE = 200;\n\nconst stickerSetIntersections: boolean[] = [];\n\nconst StickerPicker: FC<OwnProps & StateProps> = ({\n chat,\n threadId,\n className,\n loadAndPlay,\n canSendStickers,\n recentStickers,\n favoriteStickers,\n addedSetIds,\n stickerSetsById,\n shouldPlay,\n isSavedMessages,\n onStickerSelect,\n}) => {\n const {\n loadRecentStickers,\n addRecentSticker,\n unfaveSticker,\n faveSticker,\n removeRecentSticker,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const headerRef = useRef<HTMLDivElement>(null);\n const [activeSetIndex, setActiveSetIndex] = useState<number>(0);\n\n const sendMessageAction = useSendMessageAction(chat!.id, threadId);\n\n const { observe: observeIntersection } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: STICKER_INTERSECTION_THROTTLE,\n }, (entries) => {\n entries.forEach((entry) => {\n const { id } = entry.target as HTMLDivElement;\n if (!id || !id.startsWith('sticker-set-')) {\n return;\n }\n\n const index = Number(id.replace('sticker-set-', ''));\n stickerSetIntersections[index] = entry.isIntersecting;\n });\n\n const intersectingWithIndexes = stickerSetIntersections\n .map((isIntersecting, index) => ({ index, isIntersecting }))\n .filter(({ isIntersecting }) => isIntersecting);\n\n if (!intersectingWithIndexes.length) {\n return;\n }\n\n setActiveSetIndex(intersectingWithIndexes[Math.floor(intersectingWithIndexes.length / 2)].index);\n });\n const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: headerRef });\n\n const lang = useLang();\n\n const areAddedLoaded = Boolean(addedSetIds);\n\n const allSets = useMemo(() => {\n if (!addedSetIds) {\n return MEMO_EMPTY_ARRAY;\n }\n\n const defaultSets = [];\n\n if (favoriteStickers.length) {\n defaultSets.push({\n id: FAVORITE_SYMBOL_SET_ID,\n title: lang('FavoriteStickers'),\n stickers: favoriteStickers,\n count: favoriteStickers.length,\n });\n }\n\n if (recentStickers.length) {\n defaultSets.push({\n id: RECENT_SYMBOL_SET_ID,\n title: lang('RecentStickers'),\n stickers: recentStickers,\n count: recentStickers.length,\n });\n }\n\n if (chat?.fullInfo?.stickerSet) {\n const fullSet = stickerSetsById[chat.fullInfo.stickerSet.id];\n if (fullSet) {\n defaultSets.push({\n id: CHAT_STICKER_SET_ID,\n title: lang('GroupStickers'),\n stickers: fullSet.stickers,\n count: fullSet.stickers!.length,\n });\n }\n }\n\n return [\n ...defaultSets,\n ...Object.values(pickTruthy(stickerSetsById, addedSetIds)),\n ];\n }, [addedSetIds, favoriteStickers, recentStickers, chat, lang, stickerSetsById]);\n\n const noPopulatedSets = useMemo(() => (\n areAddedLoaded\n && allSets.filter((set) => set.stickers?.length).length === 0\n ), [allSets, areAddedLoaded]);\n\n useEffect(() => {\n if (loadAndPlay) {\n loadRecentStickers();\n sendMessageAction({ type: 'chooseSticker' });\n }\n }, [loadAndPlay, loadRecentStickers, sendMessageAction]);\n\n useHorizontalScroll(headerRef.current);\n\n // Scroll container and header when active set changes\n useEffect(() => {\n if (!areAddedLoaded) {\n return;\n }\n\n const header = headerRef.current;\n if (!header) {\n return;\n }\n\n const newLeft = activeSetIndex * HEADER_BUTTON_WIDTH - (header.offsetWidth / 2 - HEADER_BUTTON_WIDTH / 2);\n\n fastSmoothScrollHorizontal(header, newLeft);\n }, [areAddedLoaded, activeSetIndex]);\n\n const selectStickerSet = useCallback((index: number) => {\n setActiveSetIndex(index);\n const stickerSetEl = document.getElementById(`sticker-set-${index}`)!;\n fastSmoothScroll(containerRef.current!, stickerSetEl, 'start', undefined, SMOOTH_SCROLL_DISTANCE);\n }, []);\n\n const handleStickerSelect = useCallback((sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => {\n onStickerSelect(sticker, isSilent, shouldSchedule);\n addRecentSticker({ sticker });\n }, [addRecentSticker, onStickerSelect]);\n\n const handleStickerUnfave = useCallback((sticker: ApiSticker) => {\n unfaveSticker({ sticker });\n }, [unfaveSticker]);\n\n const handleStickerFave = useCallback((sticker: ApiSticker) => {\n faveSticker({ sticker });\n }, [faveSticker]);\n\n const handleMouseMove = useCallback(() => {\n sendMessageAction({ type: 'chooseSticker' });\n }, [sendMessageAction]);\n\n const handleRemoveRecentSticker = useCallback((sticker: ApiSticker) => {\n removeRecentSticker({ sticker });\n }, [removeRecentSticker]);\n\n const canRenderContents = useAsyncRendering([], SLIDE_TRANSITION_DURATION);\n\n function renderCover(stickerSet: StickerSetOrRecent, index: number) {\n const firstSticker = stickerSet.stickers?.[0];\n const buttonClassName = buildClassName(\n 'symbol-set-button sticker-set-button',\n index === activeSetIndex && 'activated',\n );\n\n if (stickerSet.id === RECENT_SYMBOL_SET_ID\n || stickerSet.id === FAVORITE_SYMBOL_SET_ID\n || stickerSet.id === CHAT_STICKER_SET_ID\n || stickerSet.hasThumbnail\n || !firstSticker) {\n return (\n <Button\n key={stickerSet.id}\n className={buttonClassName}\n ariaLabel={stickerSet.title}\n round\n faded={stickerSet.id === RECENT_SYMBOL_SET_ID || stickerSet.id === FAVORITE_SYMBOL_SET_ID}\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => selectStickerSet(index)}\n >\n {stickerSet.id === RECENT_SYMBOL_SET_ID ? (\n <i className=\"icon-recent\" />\n ) : stickerSet.id === FAVORITE_SYMBOL_SET_ID ? (\n <i className=\"icon-favorite\" />\n ) : stickerSet.id === CHAT_STICKER_SET_ID ? (\n <Avatar chat={chat} size=\"small\" />\n ) : stickerSet.isLottie ? (\n <StickerSetCoverAnimated\n stickerSet={stickerSet as ApiStickerSet}\n observeIntersection={observeIntersectionForCovers}\n />\n ) : (\n <StickerSetCover\n stickerSet={stickerSet as ApiStickerSet}\n observeIntersection={observeIntersectionForCovers}\n />\n )}\n </Button>\n );\n } else {\n return (\n <StickerButton\n key={stickerSet.id}\n sticker={firstSticker}\n size={STICKER_SIZE_PICKER_HEADER}\n title={stickerSet.title}\n className={buttonClassName}\n observeIntersection={observeIntersectionForCovers}\n onClick={selectStickerSet}\n clickArg={index}\n noContextMenu\n />\n );\n }\n }\n\n const fullClassName = buildClassName('StickerPicker', className);\n\n if (!areAddedLoaded || !canRenderContents || noPopulatedSets || !canSendStickers) {\n return (\n <div className={fullClassName}>\n {!canSendStickers ? (\n <div className=\"picker-disabled\">{lang('ErrorSendRestrictedStickersAll')}</div>\n ) : noPopulatedSets ? (\n <div className=\"picker-disabled\">{lang('NoStickers')}</div>\n ) : (\n <Loading />\n )}\n </div>\n );\n }\n\n return (\n <div className={fullClassName}>\n <div\n ref={headerRef}\n className=\"StickerPicker-header no-selection no-scrollbar\"\n >\n {allSets.map(renderCover)}\n </div>\n <div\n ref={containerRef}\n onMouseMove={handleMouseMove}\n className={buildClassName('StickerPicker-main no-selection', IS_TOUCH_ENV ? 'no-scrollbar' : 'custom-scroll')}\n >\n {allSets.map((stickerSet, i) => (\n <StickerSet\n key={stickerSet.id}\n stickerSet={stickerSet}\n loadAndPlay={Boolean(shouldPlay && loadAndPlay)}\n index={i}\n observeIntersection={observeIntersection}\n shouldRender={activeSetIndex >= i - 1 && activeSetIndex <= i + 1}\n onStickerSelect={handleStickerSelect}\n onStickerUnfave={handleStickerUnfave}\n onStickerFave={handleStickerFave}\n onStickerRemoveRecent={handleRemoveRecentSticker}\n favoriteStickers={favoriteStickers}\n isSavedMessages={isSavedMessages}\n />\n ))}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const {\n setsById,\n added,\n recent,\n favorite,\n } = global.stickers;\n\n const isSavedMessages = selectIsChatWithSelf(global, chatId);\n const chat = selectChat(global, chatId);\n\n return {\n chat,\n recentStickers: recent.stickers,\n favoriteStickers: favorite.stickers,\n stickerSetsById: setsById,\n addedSetIds: added.setIds,\n shouldPlay: global.settings.byKey.shouldLoopStickers,\n isSavedMessages,\n };\n },\n)(StickerPicker));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../lib/teact/teact';\n\nimport type { ApiVideo } from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport buildClassName from '../../util/buildClassName';\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur';\n\nimport useMedia from '../../hooks/useMedia';\nimport useVideoCleanup from '../../hooks/useVideoCleanup';\nimport useBuffering from '../../hooks/useBuffering';\nimport useCanvasBlur from '../../hooks/useCanvasBlur';\nimport useLang from '../../hooks/useLang';\nimport useContextMenuPosition from '../../hooks/useContextMenuPosition';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\n\nimport Spinner from '../ui/Spinner';\nimport Button from '../ui/Button';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\n\nimport './GifButton.scss';\n\ntype OwnProps = {\n gif: ApiVideo;\n observeIntersection: ObserveFn;\n isDisabled?: boolean;\n className?: string;\n onClick?: (gif: ApiVideo, isSilent?: boolean, shouldSchedule?: boolean) => void;\n onUnsaveClick?: (gif: ApiVideo) => void;\n isSavedMessages?: boolean;\n};\n\nconst GifButton: FC<OwnProps> = ({\n gif,\n isDisabled,\n className,\n observeIntersection,\n onClick,\n onUnsaveClick,\n isSavedMessages,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef<HTMLVideoElement>(null);\n\n const lang = useLang();\n\n const hasThumbnail = Boolean(gif.thumbnail?.dataUri);\n const localMediaHash = `gif${gif.id}`;\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n const loadAndPlay = isIntersecting && !isDisabled;\n const previewBlobUrl = useMedia(`${localMediaHash}?size=m`, !loadAndPlay, ApiMediaFormat.BlobUrl);\n const thumbRef = useCanvasBlur(gif.thumbnail?.dataUri, Boolean(previewBlobUrl));\n const videoData = useMedia(localMediaHash, !loadAndPlay, ApiMediaFormat.BlobUrl);\n const shouldRenderVideo = Boolean(loadAndPlay && videoData);\n const { isBuffered, bufferingHandlers } = useBuffering(true);\n const shouldRenderSpinner = loadAndPlay && !isBuffered;\n const isVideoReady = loadAndPlay && isBuffered;\n\n useVideoCleanup(videoRef, [shouldRenderVideo]);\n\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(ref);\n\n const getTriggerElement = useCallback(() => ref.current, []);\n\n const getRootElement = useCallback(\n () => ref.current!.closest('.custom-scroll, .no-scrollbar'),\n [],\n );\n\n const getMenuElement = useCallback(\n () => ref.current!.querySelector('.gif-context-menu .bubble'),\n [],\n );\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style: menuStyle,\n } = useContextMenuPosition(\n contextMenuPosition,\n getTriggerElement,\n getRootElement,\n getMenuElement,\n );\n\n const handleClick = useCallback(() => {\n if (isContextMenuOpen || !onClick) return;\n onClick({\n ...gif,\n blobUrl: videoData,\n });\n }, [isContextMenuOpen, onClick, gif, videoData]);\n\n const handleUnsaveClick = useCallback((e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n onUnsaveClick!(gif);\n }, [onUnsaveClick, gif]);\n\n const handleContextDelete = useCallback(() => {\n onUnsaveClick?.(gif);\n }, [gif, onUnsaveClick]);\n\n const handleSendQuiet = useCallback(() => {\n onClick!({\n ...gif,\n blobUrl: videoData,\n }, true);\n }, [gif, onClick, videoData]);\n\n const handleSendScheduled = useCallback(() => {\n onClick!({\n ...gif,\n blobUrl: videoData,\n }, undefined, true);\n }, [gif, onClick, videoData]);\n\n const handleMouseDown = useCallback((e: React.MouseEvent<HTMLElement>) => {\n preventMessageInputBlurWithBubbling(e);\n handleBeforeContextMenu(e);\n }, [handleBeforeContextMenu]);\n\n useEffect(() => {\n if (isDisabled) handleContextMenuClose();\n }, [handleContextMenuClose, isDisabled]);\n\n const fullClassName = buildClassName(\n 'GifButton',\n gif.width && gif.height && gif.width < gif.height ? 'vertical' : 'horizontal',\n onClick && 'interactive',\n localMediaHash,\n className,\n );\n\n return (\n <div\n ref={ref}\n className={fullClassName}\n onMouseDown={handleMouseDown}\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n >\n {!IS_TOUCH_ENV && onUnsaveClick && (\n <Button\n className=\"gif-unsave-button\"\n color=\"dark\"\n pill\n onClick={handleUnsaveClick}\n >\n <i className=\"icon-close gif-unsave-button-icon\" />\n </Button>\n )}\n {hasThumbnail && (\n <canvas\n ref={thumbRef}\n className=\"thumbnail\"\n // We need to always render to avoid blur re-calculation\n style={isVideoReady ? 'display: none;' : undefined}\n />\n )}\n {previewBlobUrl && !isVideoReady && (\n <img\n src={previewBlobUrl}\n alt=\"\"\n className=\"preview\"\n />\n )}\n {shouldRenderVideo && (\n <video\n ref={videoRef}\n autoPlay\n loop\n muted\n playsInline\n preload=\"none\"\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...bufferingHandlers}\n >\n <source src={videoData} />\n </video>\n )}\n {shouldRenderSpinner && (\n <Spinner color={previewBlobUrl || hasThumbnail ? 'white' : 'black'} />\n )}\n {onClick && contextMenuPosition !== undefined && (\n <Menu\n isOpen={isContextMenuOpen}\n transformOriginX={transformOriginX}\n transformOriginY={transformOriginY}\n positionX={positionX}\n positionY={positionY}\n style={menuStyle}\n className=\"gif-context-menu\"\n autoClose\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n >\n {!isSavedMessages && <MenuItem onClick={handleSendQuiet} icon=\"mute\">{lang('SendWithoutSound')}</MenuItem>}\n <MenuItem onClick={handleSendScheduled} icon=\"calendar\">\n {lang(isSavedMessages ? 'SetReminder' : 'ScheduleMessage')}\n </MenuItem>\n {onUnsaveClick && (\n <MenuItem destructive icon=\"delete\" onClick={handleContextDelete}>{lang('Delete')}</MenuItem>\n )}\n </Menu>\n )}\n </div>\n );\n};\n\nexport default memo(GifButton);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useEffect, memo, useRef, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiVideo } from '../../../api/types';\n\nimport { SLIDE_TRANSITION_DURATION } from '../../../config';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport buildClassName from '../../../util/buildClassName';\nimport { selectCurrentMessageList, selectIsChatWithSelf } from '../../../global/selectors';\n\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\n\nimport Loading from '../../ui/Loading';\nimport GifButton from '../../common/GifButton';\n\nimport './GifPicker.scss';\n\ntype OwnProps = {\n className: string;\n loadAndPlay: boolean;\n canSendGifs: boolean;\n onGifSelect: (gif: ApiVideo, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\ntype StateProps = {\n savedGifs?: ApiVideo[];\n isSavedMessages?: boolean;\n};\n\nconst INTERSECTION_DEBOUNCE = 300;\n\nconst GifPicker: FC<OwnProps & StateProps> = ({\n className,\n loadAndPlay,\n canSendGifs,\n savedGifs,\n isSavedMessages,\n onGifSelect,\n}) => {\n const { loadSavedGifs, saveGif } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, debounceMs: INTERSECTION_DEBOUNCE });\n\n useEffect(() => {\n if (loadAndPlay) {\n loadSavedGifs();\n }\n }, [loadAndPlay, loadSavedGifs]);\n\n const handleUnsaveClick = useCallback((gif: ApiVideo) => {\n saveGif({ gif, shouldUnsave: true });\n }, [saveGif]);\n\n const canRenderContents = useAsyncRendering([], SLIDE_TRANSITION_DURATION);\n\n return (\n <div\n ref={containerRef}\n className={buildClassName('GifPicker', className, IS_TOUCH_ENV ? 'no-scrollbar' : 'custom-scroll')}\n >\n {!canSendGifs ? (\n <div className=\"picker-disabled\">Sending GIFs is not allowed in this chat.</div>\n ) : canRenderContents && savedGifs && savedGifs.length ? (\n savedGifs.map((gif) => (\n <GifButton\n key={gif.id}\n gif={gif}\n observeIntersection={observeIntersection}\n isDisabled={!loadAndPlay}\n onClick={canSendGifs ? onGifSelect : undefined}\n onUnsaveClick={handleUnsaveClick}\n isSavedMessages={isSavedMessages}\n />\n ))\n ) : canRenderContents && savedGifs ? (\n <div className=\"picker-disabled\">No saved GIFs.</div>\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { chatId } = selectCurrentMessageList(global) || {};\n const isSavedMessages = Boolean(chatId) && selectIsChatWithSelf(global, chatId);\n return {\n savedGifs: global.gifs.saved.gifs,\n isSavedMessages,\n };\n },\n)(GifPicker));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\n\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\n\ntype OwnProps = {\n activeTab: SymbolMenuTabs;\n onSwitchTab: (tab: SymbolMenuTabs) => void;\n onRemoveSymbol: () => void;\n onSearchOpen: (type: 'stickers' | 'gifs') => void;\n};\n\nexport enum SymbolMenuTabs {\n 'Emoji',\n 'Stickers',\n 'GIFs',\n}\n\n// Getting enum string values for display in Tabs.\n// See: https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings\nexport const SYMBOL_MENU_TAB_TITLES = Object.values(SymbolMenuTabs)\n .filter((value): value is string => typeof value === 'string');\n\nconst SYMBOL_MENU_TAB_ICONS = {\n [SymbolMenuTabs.Emoji]: 'icon-smile',\n [SymbolMenuTabs.Stickers]: 'icon-stickers',\n [SymbolMenuTabs.GIFs]: 'icon-gifs',\n};\n\nconst SymbolMenuFooter: FC<OwnProps> = ({\n activeTab, onSwitchTab, onRemoveSymbol, onSearchOpen,\n}) => {\n const lang = useLang();\n\n function renderTabButton(tab: SymbolMenuTabs) {\n return (\n <Button\n className={`symbol-tab-button ${activeTab === tab ? 'activated' : ''}`}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onSwitchTab(tab)}\n ariaLabel={SYMBOL_MENU_TAB_TITLES[tab]}\n round\n faded\n color=\"translucent\"\n >\n <i className={SYMBOL_MENU_TAB_ICONS[tab]} />\n </Button>\n );\n }\n\n const handleSearchOpen = useCallback(() => {\n onSearchOpen(activeTab === SymbolMenuTabs.Stickers ? 'stickers' : 'gifs');\n }, [activeTab, onSearchOpen]);\n\n function stopPropagation(event: any) {\n event.stopPropagation();\n }\n\n return (\n <div className=\"SymbolMenu-footer\" onClick={stopPropagation} dir={lang.isRtl ? 'rtl' : undefined}>\n {activeTab !== SymbolMenuTabs.Emoji && (\n <Button\n className=\"symbol-search-button\"\n ariaLabel={activeTab === SymbolMenuTabs.Stickers ? 'Search Stickers' : 'Search GIFs'}\n round\n faded\n color=\"translucent\"\n onClick={handleSearchOpen}\n >\n <i className=\"icon-search\" />\n </Button>\n )}\n\n {renderTabButton(SymbolMenuTabs.Emoji)}\n {renderTabButton(SymbolMenuTabs.Stickers)}\n {renderTabButton(SymbolMenuTabs.GIFs)}\n\n {activeTab === SymbolMenuTabs.Emoji && (\n <Button\n className=\"symbol-delete-button\"\n onClick={onRemoveSymbol}\n ariaLabel=\"Remove Symbol\"\n round\n faded\n color=\"translucent\"\n >\n <i className=\"icon-delete-left\" />\n </Button>\n )}\n </div>\n );\n};\n\nexport default memo(SymbolMenuFooter);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useLayoutEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { ApiSticker, ApiVideo } from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport { fastRaf } from '../../../util/schedulers';\nimport buildClassName from '../../../util/buildClassName';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport Menu from '../../ui/Menu';\nimport Transition from '../../ui/Transition';\nimport EmojiPicker from './EmojiPicker';\nimport StickerPicker from './StickerPicker';\nimport GifPicker from './GifPicker';\nimport SymbolMenuFooter, { SYMBOL_MENU_TAB_TITLES, SymbolMenuTabs } from './SymbolMenuFooter';\nimport Portal from '../../ui/Portal';\n\nimport './SymbolMenu.scss';\n\nconst ANIMATION_DURATION = 350;\n\nexport type OwnProps = {\n chatId: string;\n threadId?: number;\n isOpen: boolean;\n canSendStickers: boolean;\n canSendGifs: boolean;\n onLoad: () => void;\n onClose: () => void;\n onEmojiSelect: (emoji: string) => void;\n onStickerSelect: (\n sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean, shouldPreserveInput?: boolean\n ) => void;\n onGifSelect: (gif: ApiVideo, isSilent?: boolean, shouldSchedule?: boolean) => void;\n onRemoveSymbol: () => void;\n onSearchOpen: (type: 'stickers' | 'gifs') => void;\n addRecentEmoji: AnyToVoidFunction;\n};\n\ntype StateProps = {\n isLeftColumnShown: boolean;\n};\n\nlet isActivated = false;\n\nconst SymbolMenu: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n isOpen,\n canSendStickers,\n canSendGifs,\n isLeftColumnShown,\n onLoad,\n onClose,\n onEmojiSelect,\n onStickerSelect,\n onGifSelect,\n onRemoveSymbol,\n onSearchOpen,\n addRecentEmoji,\n}) => {\n const [activeTab, setActiveTab] = useState<number>(0);\n const [recentEmojis, setRecentEmojis] = useState<string[]>([]);\n\n const [handleMouseEnter, handleMouseLeave] = useMouseInside(isOpen, onClose, undefined, IS_SINGLE_COLUMN_LAYOUT);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, onClose, false, false);\n\n if (!isActivated && isOpen) {\n isActivated = true;\n }\n\n useEffect(() => {\n onLoad();\n }, [onLoad]);\n\n useLayoutEffect(() => {\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n return undefined;\n }\n\n if (isOpen) {\n document.body.classList.add('enable-symbol-menu-transforms');\n document.body.classList.add('is-symbol-menu-open');\n }\n\n return () => {\n if (isOpen) {\n fastRaf(() => {\n document.body.classList.remove('is-symbol-menu-open');\n setTimeout(() => {\n document.body.classList.remove('enable-symbol-menu-transforms');\n }, ANIMATION_DURATION);\n });\n }\n };\n }, [isOpen]);\n\n const recentEmojisRef = useRef(recentEmojis);\n recentEmojisRef.current = recentEmojis;\n useEffect(() => {\n if (!recentEmojisRef.current.length) {\n return;\n }\n\n recentEmojisRef.current.forEach((name) => {\n addRecentEmoji({ emoji: name });\n });\n\n setRecentEmojis([]);\n }, [isOpen, activeTab, addRecentEmoji]);\n\n const handleEmojiSelect = useCallback((emoji: string, name: string) => {\n setRecentEmojis((emojis) => {\n return [...emojis, name];\n });\n\n onEmojiSelect(emoji);\n }, [onEmojiSelect]);\n\n const handleSearch = useCallback((type: 'stickers' | 'gifs') => {\n onClose();\n onSearchOpen(type);\n }, [onClose, onSearchOpen]);\n\n const handleStickerSelect = useCallback((sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => {\n onStickerSelect(sticker, isSilent, shouldSchedule, true);\n }, [onStickerSelect]);\n\n const lang = useLang();\n\n function renderContent(isActive: boolean, isFrom: boolean) {\n switch (activeTab) {\n case SymbolMenuTabs.Emoji:\n return (\n <EmojiPicker\n className=\"picker-tab\"\n onEmojiSelect={handleEmojiSelect}\n />\n );\n case SymbolMenuTabs.Stickers:\n return (\n <StickerPicker\n className=\"picker-tab\"\n loadAndPlay={canSendStickers ? isOpen && (isActive || isFrom) : false}\n canSendStickers={canSendStickers}\n onStickerSelect={handleStickerSelect}\n chatId={chatId}\n threadId={threadId}\n />\n );\n case SymbolMenuTabs.GIFs:\n return (\n <GifPicker\n className=\"picker-tab\"\n loadAndPlay={canSendGifs ? isOpen && (isActive || isFrom) : false}\n canSendGifs={canSendGifs}\n onGifSelect={onGifSelect}\n />\n );\n }\n\n return undefined;\n }\n\n function stopPropagation(event: any) {\n event.stopPropagation();\n }\n\n const content = (\n <>\n <div className=\"SymbolMenu-main\" onClick={stopPropagation}>\n {isActivated && (\n <Transition name=\"slide\" activeKey={activeTab} renderCount={SYMBOL_MENU_TAB_TITLES.length}>\n {renderContent}\n </Transition>\n )}\n </div>\n {IS_SINGLE_COLUMN_LAYOUT && (\n <Button\n round\n faded\n color=\"translucent\"\n ariaLabel={lang('Close')}\n className=\"symbol-close-button\"\n size=\"tiny\"\n onClick={onClose}\n >\n <i className=\"icon-close\" />\n </Button>\n )}\n <SymbolMenuFooter\n activeTab={activeTab}\n onSwitchTab={setActiveTab}\n onRemoveSymbol={onRemoveSymbol}\n onSearchOpen={handleSearch}\n />\n </>\n );\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n if (!shouldRender) {\n return undefined;\n }\n\n const className = buildClassName(\n 'SymbolMenu mobile-menu',\n transitionClassNames,\n isLeftColumnShown && 'left-column-open',\n );\n\n return (\n <Portal>\n <div className={className}>\n {content}\n </div>\n </Portal>\n );\n }\n\n return (\n <Menu\n isOpen={isOpen}\n positionX=\"left\"\n positionY=\"bottom\"\n onClose={onClose}\n className=\"SymbolMenu\"\n onCloseAnimationEnd={onClose}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCloseOnBackdrop={!IS_TOUCH_ENV}\n noCompact\n >\n {content}\n </Menu>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n isLeftColumnShown: global.isLeftColumnShown,\n };\n },\n)(SymbolMenu));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport type { ApiBotCommand, ApiUser } from '../../../api/types';\n\nimport renderText from '../../common/helpers/renderText';\nimport buildClassName from '../../../util/buildClassName';\n\nimport ListItem from '../../ui/ListItem';\nimport Avatar from '../../common/Avatar';\n\nimport './BotCommand.scss';\n\ntype OwnProps = {\n botCommand: ApiBotCommand;\n bot?: ApiUser;\n withAvatar?: boolean;\n focus?: boolean;\n onClick: (botCommand: ApiBotCommand) => void;\n};\n\nconst BotCommand: FC<OwnProps> = ({\n withAvatar,\n focus,\n botCommand,\n bot,\n onClick,\n}) => {\n return (\n <ListItem\n key={botCommand.command}\n className={buildClassName('BotCommand chat-item-clickable scroll-item', withAvatar && 'with-avatar')}\n multiline\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onClick(botCommand)}\n focus={focus}\n >\n {withAvatar && (\n <Avatar size=\"small\" user={bot} />\n )}\n <div className=\"content-inner\">\n <span className=\"title\">/{botCommand.command}</span>\n <span className=\"subtitle\">{renderText(botCommand.description)}</span>\n </div>\n </ListItem>\n );\n};\n\nexport default memo(BotCommand);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useCallback, useEffect, useRef, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiBotCommand, ApiUser } from '../../../api/types';\n\nimport buildClassName from '../../../util/buildClassName';\nimport setTooltipItemVisible from '../../../util/setTooltipItemVisible';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport usePrevious from '../../../hooks/usePrevious';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation';\n\nimport BotCommand from './BotCommand';\n\nimport './BotCommandTooltip.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n withUsername?: boolean;\n botCommands?: ApiBotCommand[];\n onClick: NoneToVoidFunction;\n onClose: NoneToVoidFunction;\n};\n\ntype StateProps = {\n usersById: Record<string, ApiUser>;\n};\n\nconst BotCommandTooltip: FC<OwnProps & StateProps> = ({\n usersById,\n isOpen,\n withUsername,\n botCommands,\n onClick,\n onClose,\n}) => {\n const { sendBotCommand } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, undefined, undefined, false);\n\n const handleSendCommand = useCallback(({ botId, command }: ApiBotCommand) => {\n const bot = usersById[botId];\n sendBotCommand({\n command: `/${command}${withUsername && bot ? `@${bot.username}` : ''}`,\n botId,\n });\n onClick();\n }, [onClick, sendBotCommand, usersById, withUsername]);\n\n const selectedCommandIndex = useKeyboardNavigation({\n isActive: isOpen,\n items: botCommands,\n onSelect: handleSendCommand,\n onClose,\n });\n\n useEffect(() => {\n if (botCommands && !botCommands.length) {\n onClose();\n }\n }, [botCommands, onClose]);\n\n useEffect(() => {\n setTooltipItemVisible('.chat-item-clickable', selectedCommandIndex, containerRef);\n }, [selectedCommandIndex]);\n\n const prevCommands = usePrevious(botCommands && botCommands.length ? botCommands : undefined, shouldRender);\n const renderedCommands = botCommands && !botCommands.length ? prevCommands : botCommands;\n\n if (!shouldRender || (renderedCommands && !renderedCommands.length)) {\n return undefined;\n }\n\n const className = buildClassName(\n 'BotCommandTooltip composer-tooltip custom-scroll',\n transitionClassNames,\n );\n\n return (\n <div className={className} ref={containerRef}>\n {renderedCommands && renderedCommands.map((chatBotCommand, index) => (\n <BotCommand\n key={`${chatBotCommand.botId}_${chatBotCommand.command}`}\n botCommand={chatBotCommand}\n bot={usersById[chatBotCommand.botId]}\n withAvatar\n onClick={handleSendCommand}\n focus={selectedCommandIndex === index}\n />\n ))}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => ({\n usersById: global.users.byId,\n }),\n)(BotCommandTooltip));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\n\nimport type { ApiBotCommand } from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport useMouseInside from '../../../hooks/useMouseInside';\n\nimport Menu from '../../ui/Menu';\nimport BotCommand from './BotCommand';\n\nimport './BotCommandMenu.scss';\nimport { getActions } from '../../../global';\n\nexport type OwnProps = {\n isOpen: boolean;\n botCommands: ApiBotCommand[];\n onClose: NoneToVoidFunction;\n};\n\nconst BotCommandMenu: FC<OwnProps> = ({\n isOpen, botCommands, onClose,\n}) => {\n const { sendBotCommand } = getActions();\n\n const [handleMouseEnter, handleMouseLeave] = useMouseInside(isOpen, onClose, undefined, IS_SINGLE_COLUMN_LAYOUT);\n\n const handleClick = useCallback((botCommand: ApiBotCommand) => {\n sendBotCommand({\n command: `/${botCommand.command}`,\n botId: botCommand.botId,\n });\n onClose();\n }, [onClose, sendBotCommand]);\n\n return (\n <Menu\n isOpen={isOpen}\n positionX=\"left\"\n positionY=\"bottom\"\n onClose={onClose}\n className=\"BotCommandMenu\"\n onCloseAnimationEnd={onClose}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCloseOnBackdrop={!IS_TOUCH_ENV}\n noCompact\n >\n {botCommands.map((botCommand) => (\n <BotCommand\n key={botCommand.command}\n botCommand={botCommand}\n onClick={handleClick}\n />\n ))}\n </Menu>\n );\n};\n\nexport default memo(BotCommandMenu);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useEffect, useRef } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiSticker } from '../../../api/types';\n\nimport { STICKER_SIZE_PICKER } from '../../../config';\nimport buildClassName from '../../../util/buildClassName';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useSendMessageAction from '../../../hooks/useSendMessageAction';\nimport { selectIsChatWithSelf } from '../../../global/selectors';\n\nimport Loading from '../../ui/Loading';\nimport StickerButton from '../../common/StickerButton';\n\nimport './StickerTooltip.scss';\n\nexport type OwnProps = {\n chatId: string;\n threadId?: number;\n isOpen: boolean;\n onStickerSelect: (sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\ntype StateProps = {\n stickers?: ApiSticker[];\n isSavedMessages?: boolean;\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst StickerTooltip: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n isOpen,\n stickers,\n isSavedMessages,\n onStickerSelect,\n}) => {\n const { clearStickersForEmoji } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, undefined, undefined, false);\n const prevStickers = usePrevious(stickers, true);\n const displayedStickers = stickers || prevStickers;\n const sendMessageAction = useSendMessageAction(chatId, threadId);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE });\n\n useEffect(() => (isOpen ? captureEscKeyListener(clearStickersForEmoji) : undefined), [isOpen, clearStickersForEmoji]);\n\n const handleMouseMove = () => {\n sendMessageAction({ type: 'chooseSticker' });\n };\n\n const className = buildClassName(\n 'StickerTooltip composer-tooltip custom-scroll',\n transitionClassNames,\n !(displayedStickers?.length) && 'hidden',\n );\n\n return (\n <div\n ref={containerRef}\n className={className}\n onMouseMove={handleMouseMove}\n >\n {shouldRender && displayedStickers ? (\n displayedStickers.map((sticker) => (\n <StickerButton\n key={sticker.id}\n sticker={sticker}\n size={STICKER_SIZE_PICKER}\n observeIntersection={observeIntersection}\n onClick={onStickerSelect}\n clickArg={sticker}\n isSavedMessages={isSavedMessages}\n canViewSet\n />\n ))\n ) : shouldRender ? (\n <Loading />\n ) : undefined}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { stickers } = global.stickers.forEmoji;\n const isSavedMessages = selectIsChatWithSelf(global, chatId);\n\n return { stickers, isSavedMessages };\n },\n)(StickerTooltip));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useLang from '../../../hooks/useLang';\n\nimport Menu from '../../ui/Menu';\nimport MenuItem from '../../ui/MenuItem';\n\nimport './CustomSendMenu.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n isOpenToBottom?: boolean;\n isSavedMessages?: boolean;\n onSendSilent?: NoneToVoidFunction;\n onSendSchedule?: NoneToVoidFunction;\n onClose: NoneToVoidFunction;\n onCloseAnimationEnd?: NoneToVoidFunction;\n};\n\nconst CustomSendMenu: FC<OwnProps> = ({\n isOpen,\n isOpenToBottom = false,\n isSavedMessages,\n onSendSilent,\n onSendSchedule,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const [handleMouseEnter, handleMouseLeave] = useMouseInside(isOpen, onClose);\n\n const lang = useLang();\n\n return (\n <Menu\n isOpen={isOpen}\n autoClose\n positionX=\"right\"\n positionY={isOpenToBottom ? 'top' : 'bottom'}\n className=\"CustomSendMenu\"\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCloseOnBackdrop={!IS_TOUCH_ENV}\n >\n {onSendSilent && <MenuItem icon=\"mute\" onClick={onSendSilent}>{lang('SendWithoutSound')}</MenuItem>}\n {onSendSchedule && (\n <MenuItem icon=\"schedule\" onClick={onSendSchedule}>\n {lang(isSavedMessages ? 'SetReminder' : 'ScheduleMessage')}\n </MenuItem>\n )}\n </Menu>\n );\n};\n\nexport default memo(CustomSendMenu);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport buildClassName from '../../../util/buildClassName';\nimport findInViewport from '../../../util/findInViewport';\nimport isFullyVisible from '../../../util/isFullyVisible';\nimport fastSmoothScrollHorizontal from '../../../util/fastSmoothScrollHorizontal';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport usePrevDuringAnimation from '../../../hooks/usePrevDuringAnimation';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation';\n\nimport Loading from '../../ui/Loading';\nimport EmojiButton from './EmojiButton';\n\nimport './EmojiTooltip.scss';\n\nconst VIEWPORT_MARGIN = 8;\nconst EMOJI_BUTTON_WIDTH = 44;\nconst CLOSE_DURATION = 350;\n\nfunction setItemVisible(index: number, containerRef: Record<string, any>) {\n const container = containerRef.current!;\n if (!container) {\n return;\n }\n\n const { visibleIndexes, allElements } = findInViewport(\n container,\n '.EmojiButton',\n VIEWPORT_MARGIN,\n true,\n true,\n true,\n );\n\n if (!allElements.length || !allElements[index]) {\n return;\n }\n const first = visibleIndexes[0];\n if (!visibleIndexes.includes(index)\n || (index === first && !isFullyVisible(container, allElements[first], true))) {\n const position = index > visibleIndexes[visibleIndexes.length - 1] ? 'start' : 'end';\n const newLeft = position === 'start' ? index * EMOJI_BUTTON_WIDTH : 0;\n\n fastSmoothScrollHorizontal(container, newLeft);\n }\n}\n\nexport type OwnProps = {\n isOpen: boolean;\n onEmojiSelect: (text: string) => void;\n onClose: NoneToVoidFunction;\n addRecentEmoji: AnyToVoidFunction;\n emojis: Emoji[];\n};\n\nconst EmojiTooltip: FC<OwnProps> = ({\n isOpen,\n emojis,\n onClose,\n onEmojiSelect,\n addRecentEmoji,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, undefined, undefined, false);\n const listEmojis: Emoji[] = usePrevDuringAnimation(emojis.length ? emojis : undefined, CLOSE_DURATION) || [];\n\n const handleSelectEmoji = useCallback((emoji: Emoji) => {\n onEmojiSelect(emoji.native);\n addRecentEmoji({ emoji: emoji.id });\n }, [addRecentEmoji, onEmojiSelect]);\n\n const handleClick = useCallback((native: string, id: string) => {\n onEmojiSelect(native);\n addRecentEmoji({ emoji: id });\n }, [addRecentEmoji, onEmojiSelect]);\n\n const selectedIndex = useKeyboardNavigation({\n isActive: isOpen,\n isHorizontal: true,\n items: emojis,\n onSelect: handleSelectEmoji,\n onClose,\n });\n\n useEffect(() => {\n setItemVisible(selectedIndex, containerRef);\n }, [selectedIndex]);\n\n const className = buildClassName(\n 'EmojiTooltip composer-tooltip custom-scroll-x',\n transitionClassNames,\n );\n\n return (\n <div\n ref={containerRef}\n className={className}\n >\n {shouldRender && listEmojis ? (\n listEmojis.map((emoji, index) => (\n <EmojiButton\n key={emoji.id}\n emoji={emoji}\n focus={selectedIndex === index}\n onClick={handleClick}\n />\n ))\n ) : shouldRender ? (\n <Loading />\n ) : undefined}\n </div>\n );\n};\n\nexport default memo(EmojiTooltip);\n","import type { FC, TeactNode } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport type { ApiWebDocument } from '../../../../api/types';\n\nimport { getFirstLetters } from '../../../../util/textFormat';\nimport renderText from '../../../common/helpers/renderText';\nimport useMedia from '../../../../hooks/useMedia';\nimport { preventMessageInputBlurWithBubbling } from '../../helpers/preventMessageInputBlur';\n\nimport ListItem from '../../../ui/ListItem';\n\nimport './BaseResult.scss';\n\nexport type OwnProps = {\n focus?: boolean;\n thumbnail?: ApiWebDocument;\n thumbUrl?: string;\n title?: string;\n description?: string;\n transitionClassNames?: string;\n onClick: NoneToVoidFunction;\n};\n\nconst BaseResult: FC<OwnProps> = ({\n title,\n description,\n thumbnail,\n thumbUrl,\n focus,\n transitionClassNames = '',\n onClick,\n}) => {\n let content: TeactNode | undefined;\n\n const thumbnailDataUrl = useMedia(thumbnail ? `webDocument:${thumbnail.url}` : undefined);\n thumbUrl = thumbUrl || thumbnailDataUrl;\n\n if (thumbUrl) {\n content = (\n <img src={thumbUrl} className={transitionClassNames} alt=\"\" decoding=\"async\" draggable=\"false\" />\n );\n } else if (title) {\n content = getFirstLetters(title, 1);\n }\n\n return (\n <ListItem\n focus={focus}\n className=\"BaseResult chat-item-clickable\"\n onMouseDown={preventMessageInputBlurWithBubbling}\n onClick={onClick}\n >\n <span className=\"thumb\">\n {typeof content === 'string' ? renderText(content) : content}\n </span>\n <div className=\"content-inner\">\n {title && (<div className=\"title\">{title}</div>)}\n {description && (<div className=\"description\">{description}</div>)}\n </div>\n </ListItem>\n );\n};\n\nexport default memo(BaseResult);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport type {\n ApiBotInlineMediaResult, ApiBotInlineResult, ApiPhoto, ApiThumbnail, ApiWebDocument,\n} from '../../../../api/types';\n\nimport buildClassName from '../../../../util/buildClassName';\nimport useMedia from '../../../../hooks/useMedia';\nimport useMediaTransition from '../../../../hooks/useMediaTransition';\n\nimport BaseResult from './BaseResult';\n\nimport './MediaResult.scss';\n\nexport type OwnProps = {\n focus?: boolean;\n isForGallery?: boolean;\n inlineResult: ApiBotInlineMediaResult | ApiBotInlineResult;\n onClick: (result: ApiBotInlineResult) => void;\n};\n\nconst MediaResult: FC<OwnProps> = ({\n focus, isForGallery, inlineResult, onClick,\n}) => {\n let photo: ApiPhoto | undefined;\n let thumbnail: ApiThumbnail | undefined;\n let webThumbnail: ApiWebDocument | undefined;\n\n if ('photo' in inlineResult) {\n photo = inlineResult.photo;\n }\n // For results with type=video (for example @stikstokbot)\n if ('thumbnail' in inlineResult) {\n thumbnail = inlineResult.thumbnail;\n }\n if ('webThumbnail' in inlineResult && isForGallery) {\n webThumbnail = inlineResult.webThumbnail;\n }\n\n const thumbnailDataUrl = useMedia(webThumbnail ? `webDocument:${webThumbnail.url}` : undefined);\n const mediaBlobUrl = useMedia(photo && `photo${photo.id}?size=m`);\n const transitionClassNames = useMediaTransition(mediaBlobUrl);\n\n const handleClick = useCallback(() => {\n onClick(inlineResult);\n }, [inlineResult, onClick]);\n\n if (isForGallery) {\n return (\n <div className=\"MediaResult chat-item-clickable\" onClick={handleClick}>\n <img src={(photo?.thumbnail?.dataUri) || thumbnailDataUrl} alt=\"\" />\n <img src={mediaBlobUrl} className={buildClassName('full-media', transitionClassNames)} alt=\"\" />\n </div>\n );\n }\n\n const { title, description } = inlineResult;\n\n return (\n <BaseResult\n focus={focus}\n thumbUrl={mediaBlobUrl || (thumbnail?.dataUri || thumbnailDataUrl)}\n transitionClassNames={transitionClassNames}\n title={title}\n description={description}\n onClick={handleClick}\n />\n );\n};\n\nexport default memo(MediaResult);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport type { ApiBotInlineResult } from '../../../../api/types';\n\nimport BaseResult from './BaseResult';\n\nexport type OwnProps = {\n focus?: boolean;\n inlineResult: ApiBotInlineResult;\n onClick: (result: ApiBotInlineResult) => void;\n};\n\nconst ArticleResult: FC<OwnProps> = ({ focus, inlineResult, onClick }) => {\n const {\n title, url, description, webThumbnail,\n } = inlineResult;\n\n const handleClick = useCallback(() => {\n onClick(inlineResult);\n }, [inlineResult, onClick]);\n\n return (\n <BaseResult\n focus={focus}\n thumbnail={webThumbnail}\n title={title || url}\n description={description}\n onClick={handleClick}\n />\n );\n};\n\nexport default memo(ArticleResult);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport type { ApiBotInlineMediaResult, ApiBotInlineResult, ApiVideo } from '../../../../api/types';\n\nimport type { ObserveFn } from '../../../../hooks/useIntersectionObserver';\n\nimport GifButton from '../../../common/GifButton';\n\ntype OwnProps = {\n inlineResult: ApiBotInlineMediaResult;\n isSavedMessages?: boolean;\n canSendGifs?: boolean;\n observeIntersection: ObserveFn;\n onClick: (result: ApiBotInlineResult, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\nconst GifResult: FC<OwnProps> = ({\n inlineResult, isSavedMessages, canSendGifs, observeIntersection, onClick,\n}) => {\n const { gif } = inlineResult;\n\n const handleClick = useCallback((_gif: ApiVideo, isSilent?: boolean, shouldSchedule?: boolean) => {\n onClick(inlineResult, isSilent, shouldSchedule);\n }, [inlineResult, onClick]);\n\n if (!gif) {\n return undefined;\n }\n\n return (\n <GifButton\n gif={gif}\n observeIntersection={observeIntersection}\n className=\"chat-item-clickable\"\n onClick={canSendGifs ? handleClick : undefined}\n isSavedMessages={isSavedMessages}\n />\n );\n};\n\nexport default memo(GifResult);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport type { ApiBotInlineMediaResult, ApiBotInlineResult } from '../../../../api/types';\n\nimport { STICKER_SIZE_INLINE_BOT_RESULT } from '../../../../config';\nimport type { ObserveFn } from '../../../../hooks/useIntersectionObserver';\n\nimport StickerButton from '../../../common/StickerButton';\n\ntype OwnProps = {\n inlineResult: ApiBotInlineMediaResult;\n isSavedMessages?: boolean;\n observeIntersection: ObserveFn;\n onClick: (result: ApiBotInlineResult, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\nconst StickerResult: FC<OwnProps> = ({\n inlineResult,\n isSavedMessages,\n observeIntersection,\n onClick,\n}) => {\n const { sticker } = inlineResult;\n\n if (!sticker) {\n return undefined;\n }\n\n return (\n <StickerButton\n sticker={sticker}\n size={STICKER_SIZE_INLINE_BOT_RESULT}\n observeIntersection={observeIntersection}\n title={sticker.emoji}\n className=\"chat-item-clickable\"\n onClick={onClick}\n clickArg={inlineResult}\n isSavedMessages={isSavedMessages}\n canViewSet\n />\n );\n};\n\nexport default memo(StickerResult);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { ApiBotInlineMediaResult, ApiBotInlineResult, ApiBotInlineSwitchPm } from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport setTooltipItemVisible from '../../../util/setTooltipItemVisible';\nimport buildClassName from '../../../util/buildClassName';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport { throttle } from '../../../util/schedulers';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport usePrevious from '../../../hooks/usePrevious';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation';\n\nimport MediaResult from './inlineResults/MediaResult';\nimport ArticleResult from './inlineResults/ArticleResult';\nimport GifResult from './inlineResults/GifResult';\nimport StickerResult from './inlineResults/StickerResult';\nimport ListItem from '../../ui/ListItem';\nimport InfiniteScroll from '../../ui/InfiniteScroll';\n\nimport './InlineBotTooltip.scss';\n\nconst INTERSECTION_DEBOUNCE_MS = 200;\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nexport type OwnProps = {\n isOpen: boolean;\n botId?: string;\n isGallery?: boolean;\n inlineBotResults?: (ApiBotInlineResult | ApiBotInlineMediaResult)[];\n switchPm?: ApiBotInlineSwitchPm;\n isSavedMessages?: boolean;\n canSendGifs?: boolean;\n onSelectResult: (\n inlineResult: ApiBotInlineMediaResult | ApiBotInlineResult, isSilent?: boolean, shouldSchedule?: boolean\n ) => void;\n loadMore: NoneToVoidFunction;\n onClose: NoneToVoidFunction;\n};\n\nconst InlineBotTooltip: FC<OwnProps> = ({\n isOpen,\n botId,\n isGallery,\n inlineBotResults,\n switchPm,\n isSavedMessages,\n canSendGifs,\n loadMore,\n onClose,\n onSelectResult,\n}) => {\n const {\n openChat,\n startBot,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, undefined, undefined, false);\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({\n rootRef: containerRef,\n debounceMs: INTERSECTION_DEBOUNCE_MS,\n isDisabled: !isOpen,\n });\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (direction === LoadMoreDirection.Backwards) {\n runThrottled(loadMore);\n }\n }, [loadMore]);\n\n const selectedIndex = useKeyboardNavigation({\n isActive: isOpen,\n shouldRemoveSelectionOnReset: isGallery,\n noArrowNavigation: isGallery,\n items: inlineBotResults,\n onSelect: onSelectResult,\n onClose,\n });\n\n useEffect(() => {\n setTooltipItemVisible('.chat-item-clickable', selectedIndex, containerRef);\n }, [selectedIndex]);\n\n const handleSendPm = useCallback(() => {\n openChat({ id: botId });\n startBot({ botId, param: switchPm!.startParam });\n }, [botId, openChat, startBot, switchPm]);\n\n const prevInlineBotResults = usePrevious(\n inlineBotResults?.length\n ? inlineBotResults\n : undefined,\n shouldRender,\n );\n const renderedInlineBotResults = inlineBotResults && !inlineBotResults.length\n ? prevInlineBotResults\n : inlineBotResults;\n\n if (!shouldRender || !(renderedInlineBotResults?.length || switchPm)) {\n return undefined;\n }\n\n const className = buildClassName(\n 'InlineBotTooltip composer-tooltip',\n IS_TOUCH_ENV ? 'no-scrollbar' : 'custom-scroll',\n isGallery && 'gallery',\n transitionClassNames,\n );\n\n function renderSwitchPm() {\n return (\n <ListItem ripple className=\"switch-pm scroll-item\" onClick={handleSendPm}>\n <span className=\"title\">{switchPm!.text}</span>\n </ListItem>\n );\n }\n\n function renderContent() {\n return renderedInlineBotResults!.map((inlineBotResult, index) => {\n switch (inlineBotResult.type) {\n case 'gif':\n return (\n <GifResult\n key={inlineBotResult.id}\n inlineResult={inlineBotResult}\n observeIntersection={observeIntersection}\n onClick={onSelectResult}\n isSavedMessages={isSavedMessages}\n canSendGifs={canSendGifs}\n />\n );\n\n case 'photo':\n return (\n <MediaResult\n key={inlineBotResult.id}\n isForGallery={isGallery}\n inlineResult={inlineBotResult}\n onClick={onSelectResult}\n />\n );\n\n case 'sticker':\n return (\n <StickerResult\n key={inlineBotResult.id}\n inlineResult={inlineBotResult}\n observeIntersection={observeIntersection}\n onClick={onSelectResult}\n isSavedMessages={isSavedMessages}\n />\n );\n\n case 'video':\n case 'file':\n case 'game':\n return (\n <MediaResult\n key={inlineBotResult.id}\n focus={selectedIndex === index}\n inlineResult={inlineBotResult}\n onClick={onSelectResult}\n />\n );\n case 'article':\n case 'audio':\n return (\n <ArticleResult\n key={inlineBotResult.id}\n focus={selectedIndex === index}\n inlineResult={inlineBotResult}\n onClick={onSelectResult}\n />\n );\n\n default:\n return undefined;\n }\n });\n }\n\n return (\n <InfiniteScroll\n ref={containerRef}\n className={className}\n items={renderedInlineBotResults}\n itemSelector=\".chat-item-clickable\"\n noFastList\n onLoadMore={handleLoadMore}\n sensitiveArea={160}\n >\n {switchPm && renderSwitchPm()}\n {renderedInlineBotResults?.length && renderContent()}\n </InfiniteScroll>\n );\n};\n\nexport default memo(InlineBotTooltip);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useCallback, useEffect, useRef, memo,\n} from '../../../lib/teact/teact';\n\nimport setTooltipItemVisible from '../../../util/setTooltipItemVisible';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport renderText from '../../common/helpers/renderText';\nimport { getUserFullName, isUserId } from '../../../global/helpers';\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useLang from '../../../hooks/useLang';\nimport buildClassName from '../../../util/buildClassName';\nimport { getActions, getGlobal } from '../../../global';\n\nimport ListItem from '../../ui/ListItem';\nimport Avatar from '../../common/Avatar';\nimport Menu from '../../ui/Menu';\n\nimport './SendAsMenu.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n chatId?: string;\n selectedSendAsId?: string;\n sendAsIds?: string[];\n};\n\nconst SendAsMenu: FC<OwnProps> = ({\n isOpen,\n onClose,\n chatId,\n selectedSendAsId,\n sendAsIds,\n}) => {\n const { saveDefaultSendAs } = getActions();\n\n // No need for expensive global updates on users and chats, so we avoid them\n const usersById = getGlobal().users.byId;\n const chatsById = getGlobal().chats.byId;\n\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [handleMouseEnter, handleMouseLeave, markMouseInside] = useMouseInside(isOpen, onClose, undefined);\n\n useEffect(() => {\n if (isOpen) {\n markMouseInside();\n }\n }, [isOpen, markMouseInside]);\n\n const handleUserSelect = useCallback((id: string) => {\n onClose();\n saveDefaultSendAs({ chatId, sendAsId: id });\n }, [chatId, onClose, saveDefaultSendAs]);\n\n const selectedSendAsIndex = useKeyboardNavigation({\n isActive: isOpen,\n items: sendAsIds,\n onSelect: handleUserSelect,\n shouldSelectOnTab: true,\n shouldSaveSelectionOnUpdateItems: true,\n onClose,\n });\n\n useEffect(() => {\n setTooltipItemVisible('.chat-item-clickable', selectedSendAsIndex, containerRef);\n }, [selectedSendAsIndex]);\n\n useEffect(() => {\n if (sendAsIds && !sendAsIds.length) {\n onClose();\n }\n }, [sendAsIds, onClose]);\n\n return (\n <Menu\n isOpen={isOpen}\n positionX=\"left\"\n positionY=\"bottom\"\n onClose={onClose}\n className=\"SendAsMenu\"\n onCloseAnimationEnd={onClose}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCloseOnBackdrop={!IS_TOUCH_ENV}\n noCompact\n >\n <div className=\"send-as-title\" dir=\"auto\">{lang('SendMessageAsTitle')}</div>\n {usersById && chatsById && sendAsIds?.map((id, index) => {\n const user = isUserId(id) ? usersById[id] : undefined;\n const chat = !user ? chatsById[id] : undefined;\n const fullName = user ? getUserFullName(user) : chat?.title;\n\n return (\n <ListItem\n key={id}\n className=\"SendAsItem chat-item-clickable scroll-item with-avatar\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleUserSelect(id)}\n focus={selectedSendAsIndex === index}\n >\n <Avatar\n size=\"small\"\n user={user}\n chat={chat}\n className={buildClassName(selectedSendAsId === id && 'selected')}\n />\n <div className=\"info\">\n <div className=\"title\">\n <h3 dir=\"auto\">{fullName && renderText(fullName)}</h3>\n </div>\n <span className=\"subtitle\">{user\n ? lang('VoipGroupPersonalAccount')\n : lang('Subscribers', chat?.membersCount, 'i')}\n </span>\n </div>\n </ListItem>\n );\n })}\n </Menu>\n );\n};\n\nexport default memo(SendAsMenu);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useMemo, memo, useRef } from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport type { ApiMessage, ApiUser, ApiChat } from '../../api/types';\n\nimport { MEMO_EMPTY_ARRAY } from '../../util/memo';\nimport {\n selectUser,\n selectChatMessages,\n selectChat,\n selectCurrentTextSearch,\n} from '../../global/selectors';\nimport {\n getChatTitle,\n getUserFullName,\n isChatChannel,\n} from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport { renderMessageSummary } from '../common/helpers/renderMessageText';\nimport renderText from '../common/helpers/renderText';\n\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport ListItem from '../ui/ListItem';\nimport LastMessageMeta from '../common/LastMessageMeta';\nimport Avatar from '../common/Avatar';\n\nimport './RightSearch.scss';\n\nexport type OwnProps = {\n chatId: string;\n threadId: number;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n messagesById?: Record<number, ApiMessage>;\n query?: string;\n totalCount?: number;\n foundIds?: number[];\n};\n\nconst RightSearch: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n onClose,\n isActive,\n chat,\n messagesById,\n query,\n totalCount,\n foundIds,\n}) => {\n const {\n searchTextMessagesLocal,\n focusMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const [viewportIds, getMore] = useInfiniteScroll(searchTextMessagesLocal, foundIds);\n\n const viewportResults = useMemo(() => {\n if (!query || !viewportIds?.length || !messagesById) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return viewportIds.map((id) => {\n const message = messagesById[id];\n if (!message) {\n return undefined;\n }\n\n const senderUser = message.senderId ? selectUser(getGlobal(), message.senderId) : undefined;\n\n let senderChat;\n if (chat && isChatChannel(chat)) {\n senderChat = chat;\n } else if (message.forwardInfo) {\n const { isChannelPost, fromChatId } = message.forwardInfo;\n senderChat = isChannelPost && fromChatId ? selectChat(getGlobal(), fromChatId) : undefined;\n } else {\n senderChat = message.senderId ? selectChat(getGlobal(), message.senderId) : undefined;\n }\n\n return {\n message,\n senderUser,\n senderChat,\n onClick: () => focusMessage({ chatId, threadId, messageId: id }),\n };\n }).filter(Boolean);\n }, [query, viewportIds, messagesById, chat, focusMessage, chatId, threadId]);\n\n const handleKeyDown = useKeyboardListNavigation(containerRef, true, (index) => {\n const foundResult = viewportResults?.[index === -1 ? 0 : index];\n if (foundResult) {\n foundResult.onClick();\n }\n }, '.ListItem-button', true);\n\n const renderSearchResult = ({\n message, senderUser, senderChat, onClick,\n }: {\n message: ApiMessage;\n senderUser?: ApiUser;\n senderChat?: ApiChat;\n onClick: NoneToVoidFunction;\n }) => {\n const title = senderChat ? getChatTitle(lang, senderChat) : getUserFullName(senderUser);\n const text = renderMessageSummary(lang, message, undefined, query);\n\n return (\n <ListItem\n key={message.id}\n teactOrderKey={-message.date}\n className=\"chat-item-clickable search-result-message m-0\"\n onClick={onClick}\n >\n <Avatar chat={senderChat} user={senderUser} />\n <div className=\"info\">\n <div className=\"title\">\n <h3 dir=\"auto\">{title && renderText(title)}</h3>\n <LastMessageMeta message={message} />\n </div>\n <div className=\"subtitle\" dir=\"auto\">\n {text}\n </div>\n </div>\n </ListItem>\n );\n };\n\n const isOnTop = viewportIds?.[0] === foundIds?.[0];\n\n return (\n <InfiniteScroll\n ref={containerRef}\n className=\"RightSearch custom-scroll\"\n items={viewportResults}\n preloadBackwards={0}\n onLoadMore={getMore}\n onKeyDown={handleKeyDown}\n >\n {isOnTop && (\n <p key=\"helper-text\" className=\"helper-text\" dir=\"auto\">\n {!query ? (\n lang('lng_dlg_search_for_messages')\n ) : (totalCount === 0 || !viewportResults.length) ? (\n lang('lng_search_no_results')\n ) : totalCount === 1 ? (\n '1 message found'\n ) : (\n `${(viewportResults.length && (totalCount || viewportResults.length))} messages found`\n )}\n </p>\n )}\n {viewportResults.map(renderSearchResult)}\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const messagesById = chat && selectChatMessages(global, chat.id);\n if (!chat || !messagesById) {\n return {};\n }\n\n const { query, results } = selectCurrentTextSearch(global) || {};\n const { totalCount, foundIds } = results || {};\n\n return {\n chat,\n messagesById,\n query,\n totalCount,\n foundIds,\n };\n },\n)(RightSearch));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useEffect, memo, useMemo, useCallback,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiStickerSet } from '../../api/types';\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\n\nimport { STICKER_SIZE_SEARCH } from '../../config';\nimport { selectShouldLoopStickers, selectStickerSet } from '../../global/selectors';\nimport useFlag from '../../hooks/useFlag';\nimport useOnChange from '../../hooks/useOnChange';\nimport useLang from '../../hooks/useLang';\n\nimport Button from '../ui/Button';\nimport StickerButton from '../common/StickerButton';\nimport StickerSetModal from '../common/StickerSetModal.async';\nimport Spinner from '../ui/Spinner';\n\ntype OwnProps = {\n stickerSetId: string;\n observeIntersection: ObserveFn;\n isSomeModalOpen: boolean;\n onModalToggle: (isOpen: boolean) => void;\n};\n\ntype StateProps = {\n set?: ApiStickerSet;\n shouldPlay?: boolean;\n};\n\nconst STICKERS_TO_DISPLAY = 5;\n\nconst StickerSetResult: FC<OwnProps & StateProps> = ({\n stickerSetId, observeIntersection, set, shouldPlay,\n isSomeModalOpen, onModalToggle,\n}) => {\n const { loadStickers, toggleStickerSet } = getActions();\n\n const lang = useLang();\n const isAdded = set && Boolean(set.installedDate);\n const areStickersLoaded = Boolean(set?.stickers);\n\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n useOnChange(() => {\n onModalToggle(isModalOpen);\n }, [isModalOpen, onModalToggle]);\n\n const displayedStickers = useMemo(() => {\n if (!set) {\n return [];\n }\n\n const coverStickerIds = (set.covers || []).map(({ id }) => id);\n const otherStickers = set.stickers ? set.stickers.filter(({ id }) => !coverStickerIds.includes(id)) : [];\n\n return [...(set.covers || []), ...otherStickers].slice(0, STICKERS_TO_DISPLAY);\n }, [set]);\n\n useEffect(() => {\n // Featured stickers are initialized with one sticker in collection (cover of SickerSet)\n if (!areStickersLoaded && displayedStickers.length < STICKERS_TO_DISPLAY) {\n loadStickers({ stickerSetId });\n }\n }, [areStickersLoaded, displayedStickers.length, loadStickers, stickerSetId]);\n\n const handleAddClick = useCallback(() => {\n toggleStickerSet({ stickerSetId });\n }, [toggleStickerSet, stickerSetId]);\n\n if (!set) {\n return undefined;\n }\n\n const canRenderStickers = displayedStickers.length > 0;\n\n return (\n <div key={set.id} className=\"sticker-set\" dir={lang.isRtl ? 'rtl' : undefined}>\n <div className=\"sticker-set-header\">\n <div className=\"title-wrapper\">\n <h3 className=\"title\" dir=\"auto\">{set.title}</h3>\n <p className=\"count\" dir=\"auto\">{lang('Stickers', set.count, 'i')}</p>\n </div>\n <Button\n className={isAdded ? 'is-added' : undefined}\n color=\"primary\"\n size=\"tiny\"\n pill\n fluid\n onClick={handleAddClick}\n >\n {lang(isAdded ? 'Stickers.Installed' : 'Stickers.Install')}\n </Button>\n </div>\n <div className=\"sticker-set-main\">\n {!canRenderStickers && <Spinner />}\n {canRenderStickers && displayedStickers.map((sticker) => (\n <StickerButton\n sticker={sticker}\n size={STICKER_SIZE_SEARCH}\n observeIntersection={observeIntersection}\n noAnimate={!shouldPlay || isModalOpen || isSomeModalOpen}\n clickArg={undefined}\n onClick={openModal}\n noContextMenu\n />\n ))}\n </div>\n {canRenderStickers && (\n <StickerSetModal\n isOpen={isModalOpen}\n fromSticker={displayedStickers[0]}\n onClose={closeModal}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { stickerSetId }): StateProps => {\n return {\n set: selectStickerSet(global, stickerSetId),\n shouldPlay: selectShouldLoopStickers(global),\n };\n },\n)(StickerSetResult));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { throttle } from '../../util/schedulers';\nimport { selectCurrentStickerSearch } from '../../global/selectors';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\n\nimport Loading from '../ui/Loading';\nimport StickerSetResult from './StickerSetResult';\n\nimport './StickerSearch.scss';\n\ntype OwnProps = {\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n query?: string;\n featuredIds?: string[];\n resultIds?: string[];\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst StickerSearch: FC<OwnProps & StateProps> = ({\n onClose,\n isActive,\n query,\n featuredIds,\n resultIds,\n}) => {\n const { loadFeaturedStickers } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE });\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadFeaturedStickers();\n });\n });\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n function renderContent() {\n if (query === undefined) {\n return undefined;\n }\n\n if (!query && featuredIds) {\n return featuredIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n if (resultIds) {\n if (!resultIds.length) {\n return <p className=\"helper-text\" dir=\"auto\">Nothing found.</p>;\n }\n\n return resultIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n return <Loading />;\n }\n\n return (\n <div ref={containerRef} className=\"StickerSearch custom-scroll\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderContent()}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const currentSearch = selectCurrentStickerSearch(global);\n const { query, resultIds } = currentSearch || {};\n const { featured } = global.stickers;\n\n return {\n query,\n featuredIds: featured.setIds,\n resultIds,\n };\n },\n)(StickerSearch));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useRef, useCallback } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChat, ApiVideo } from '../../api/types';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport {\n selectCurrentGifSearch,\n selectChat,\n selectIsChatWithBot,\n selectCurrentMessageList,\n selectCanScheduleUntilOnline,\n selectIsChatWithSelf,\n} from '../../global/selectors';\nimport { getAllowedAttachmentOptions, getCanPostInChat } from '../../global/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport useSchedule from '../../hooks/useSchedule';\n\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport GifButton from '../common/GifButton';\nimport Loading from '../ui/Loading';\n\nimport './GifSearch.scss';\n\ntype OwnProps = {\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n query?: string;\n results?: ApiVideo[];\n chat?: ApiChat;\n isChatWithBot?: boolean;\n canScheduleUntilOnline?: boolean;\n isSavedMessages?: boolean;\n canPostInChat?: boolean;\n};\n\nconst PRELOAD_BACKWARDS = 96; // GIF Search bot results are multiplied by 24\nconst INTERSECTION_DEBOUNCE = 300;\n\nconst GifSearch: FC<OwnProps & StateProps> = ({\n isActive,\n query,\n results,\n chat,\n isChatWithBot,\n canScheduleUntilOnline,\n isSavedMessages,\n canPostInChat,\n onClose,\n}) => {\n const {\n searchMoreGifs,\n sendMessage,\n setGifSearchQuery,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [requestCalendar, calendar] = useSchedule(canScheduleUntilOnline);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, debounceMs: INTERSECTION_DEBOUNCE });\n\n const canSendGifs = canPostInChat && getAllowedAttachmentOptions(chat, isChatWithBot).canSendGifs;\n\n const handleGifClick = useCallback((gif: ApiVideo, isSilent?: boolean, shouldSchedule?: boolean) => {\n if (canSendGifs) {\n if (shouldSchedule) {\n requestCalendar((scheduledAt) => {\n sendMessage({ gif, scheduledAt, isSilent });\n });\n } else {\n sendMessage({ gif, isSilent });\n }\n }\n\n if (IS_TOUCH_ENV) {\n setGifSearchQuery({ query: undefined });\n }\n }, [canSendGifs, requestCalendar, sendMessage, setGifSearchQuery]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n function renderContent() {\n if (query === undefined) {\n return undefined;\n }\n\n if (!results) {\n return (\n <Loading />\n );\n }\n\n if (!results.length) {\n return (\n <p className=\"helper-text\" dir=\"auto\">{lang('NoGIFsFound')}</p>\n );\n }\n\n return results.map((gif) => (\n <GifButton\n key={gif.id}\n gif={gif}\n observeIntersection={observeIntersection}\n onClick={canSendGifs ? handleGifClick : undefined}\n isSavedMessages={isSavedMessages}\n />\n ));\n }\n\n const hasResults = Boolean(query !== undefined && results && results.length);\n\n return (\n <div className=\"GifSearch\" dir={lang.isRtl ? 'rtl' : undefined}>\n <InfiniteScroll\n ref={containerRef}\n className={buildClassName('gif-container custom-scroll', hasResults && 'grid')}\n items={results}\n itemSelector=\".GifButton\"\n preloadBackwards={PRELOAD_BACKWARDS}\n noFastList\n onLoadMore={searchMoreGifs}\n >\n {renderContent()}\n </InfiniteScroll>\n {calendar}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const currentSearch = selectCurrentGifSearch(global);\n const { query, results } = currentSearch || {};\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n const chat = chatId ? selectChat(global, chatId) : undefined;\n const isChatWithBot = chat ? selectIsChatWithBot(global, chat) : undefined;\n const isSavedMessages = Boolean(chatId) && selectIsChatWithSelf(global, chatId);\n const canPostInChat = Boolean(chat) && Boolean(threadId) && getCanPostInChat(chat, threadId);\n\n return {\n query,\n results,\n chat,\n isChatWithBot,\n isSavedMessages,\n canPostInChat,\n canScheduleUntilOnline: Boolean(chatId) && selectCanScheduleUntilOnline(global, chatId),\n };\n },\n)(GifSearch));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport type {\n ApiChannelStatistics, ApiGroupStatistics, ApiMessageStatistics, StatisticsOverviewItem,\n} from '../../../api/types';\n\nimport { formatInteger, formatIntegerCompact } from '../../../util/textFormat';\nimport { formatFullDate } from '../../../util/dateFormat';\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\n\nimport './StatisticsOverview.scss';\n\ntype OverviewCell = {\n name: string;\n title: string;\n isPercentage?: boolean;\n isPlain?: boolean;\n isApproximate?: boolean;\n};\n\nconst CHANNEL_OVERVIEW: OverviewCell[][] = [\n [\n { name: 'followers', title: 'ChannelStats.Overview.Followers' },\n { name: 'enabledNotifications', title: 'ChannelStats.Overview.EnabledNotifications', isPercentage: true },\n ],\n [\n { name: 'viewsPerPost', title: 'ChannelStats.Overview.ViewsPerPost' },\n { name: 'sharesPerPost', title: 'ChannelStats.Overview.SharesPerPost' },\n ],\n];\n\nconst GROUP_OVERVIEW: OverviewCell[][] = [\n [\n { name: 'members', title: 'Stats.GroupMembers' },\n { name: 'messages', title: 'Stats.GroupMessages' },\n ],\n [\n { name: 'viewers', title: 'Stats.GroupViewers' },\n { name: 'posters', title: 'Stats.GroupPosters' },\n ],\n];\n\nconst MESSAGE_OVERVIEW: OverviewCell[][] = [\n [\n { name: 'views', title: 'Stats.Message.Views', isPlain: true },\n {\n name: 'forwards', title: 'Stats.Message.PrivateShares', isPlain: true, isApproximate: true,\n },\n ],\n [\n { name: 'publicForwards', title: 'Stats.Message.PublicShares', isPlain: true },\n ],\n];\n\nexport type OwnProps = {\n isGroup?: boolean;\n isMessage?: boolean;\n statistics: ApiChannelStatistics | ApiGroupStatistics | ApiMessageStatistics;\n};\n\nconst StatisticsOverview: FC<OwnProps> = ({ isGroup, isMessage, statistics }) => {\n const lang = useLang();\n\n const renderOverviewItemValue = ({ change, percentage }: StatisticsOverviewItem) => {\n if (!change) {\n return undefined;\n }\n\n const isChangeNegative = Number(change) < 0;\n\n return (\n <span className={buildClassName('StatisticsOverview__value', isChangeNegative && 'negative')}>\n {isChangeNegative ? `-${formatIntegerCompact(Math.abs(change))}` : `+${formatIntegerCompact(change)}`}\n {percentage && (\n <>\n {' '}\n ({percentage}%)\n </>\n )}\n </span>\n );\n };\n\n const { period } = (statistics as ApiGroupStatistics);\n\n return (\n <div className=\"StatisticsOverview\">\n <div className=\"StatisticsOverview__header\">\n <div className=\"StatisticsOverview__title\">{lang('StatisticOverview')}</div>\n\n {period && (\n <div className=\"StatisticsOverview__caption\">\n {formatFullDate(lang, period.minDate * 1000)} — {formatFullDate(lang, period.maxDate * 1000)}\n </div>\n )}\n </div>\n\n <table className=\"StatisticsOverview__table\">\n {(isMessage ? MESSAGE_OVERVIEW : isGroup ? GROUP_OVERVIEW : CHANNEL_OVERVIEW).map((row) => (\n <tr>\n {row.map((cell: OverviewCell) => {\n const field = (statistics as any)[cell.name];\n\n if (cell.isPlain) {\n return (\n <td className=\"StatisticsOverview__table-cell\">\n <b className=\"StatisticsOverview__table-value\">\n {cell.isApproximate ? `≈${formatInteger(field)}` : formatInteger(field)}\n </b>\n <h3 className=\"StatisticsOverview__table-heading\">{lang(cell.title)}</h3>\n </td>\n );\n }\n\n if (cell.isPercentage) {\n return (\n <td className=\"StatisticsOverview__table-cell\">\n <b className=\"StatisticsOverview__table-value\">{field.percentage}%</b>\n <h3 className=\"StatisticsOverview__table-heading\">{lang(cell.title)}</h3>\n </td>\n );\n }\n\n return (\n <td className=\"StatisticsOverview__table-cell\">\n <b className=\"StatisticsOverview__table-value\">\n {formatIntegerCompact(field.current)}\n </b>\n {' '}\n {renderOverviewItemValue(field)}\n <h3 className=\"StatisticsOverview__table-heading\">{lang(cell.title)}</h3>\n </td>\n );\n })}\n </tr>\n ))}\n </table>\n </div>\n );\n};\n\nexport default memo(StatisticsOverview);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\n\nimport type { LangFn } from '../../../hooks/useLang';\nimport useLang from '../../../hooks/useLang';\nimport { getActions } from '../../../global';\n\nimport type { ApiMessage, StatisticsRecentMessage as StatisticsRecentMessageType } from '../../../api/types';\n\nimport buildClassName from '../../../util/buildClassName';\nimport { formatDateTimeToString } from '../../../util/dateFormat';\nimport {\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessageVideo,\n getMessageRoundVideo,\n} from '../../../global/helpers';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\nimport useMedia from '../../../hooks/useMedia';\n\nimport './StatisticsRecentMessage.scss';\n\nexport type OwnProps = {\n message: ApiMessage & StatisticsRecentMessageType;\n};\n\nconst StatisticsRecentMessage: FC<OwnProps> = ({ message }) => {\n const lang = useLang();\n const { toggleMessageStatistics } = getActions();\n\n const mediaThumbnail = getMessageMediaThumbDataUri(message);\n const mediaBlobUrl = useMedia(getMessageMediaHash(message, 'micro'));\n const isRoundVideo = Boolean(getMessageRoundVideo(message));\n\n const handleClick = useCallback(() => {\n toggleMessageStatistics({ messageId: message.id });\n }, [toggleMessageStatistics, message.id]);\n\n return (\n <div\n className={buildClassName(\n 'StatisticsRecentMessage',\n Boolean(mediaBlobUrl || mediaThumbnail) && 'StatisticsRecentMessage--with-image',\n )}\n onClick={handleClick}\n >\n <div className=\"StatisticsRecentMessage__title\">\n <div className=\"StatisticsRecentMessage__summary\">\n {renderSummary(lang, message, mediaBlobUrl || mediaThumbnail, isRoundVideo)}\n </div>\n <div className=\"StatisticsRecentMessage__meta\">\n {lang('ChannelStats.ViewsCount', message.views, 'i')}\n </div>\n </div>\n\n <div className=\"StatisticsRecentMessage__info\">\n <div className=\"StatisticsRecentMessage__date\">\n {formatDateTimeToString(message.date * 1000, lang.code)}\n </div>\n <div className=\"StatisticsRecentMessage__meta\">\n {message.forwards ? lang('ChannelStats.SharesCount', message.forwards) : 'No shares'}\n </div>\n </div>\n </div>\n );\n};\n\nfunction renderSummary(lang: LangFn, message: ApiMessage, blobUrl?: string, isRoundVideo?: boolean) {\n if (!blobUrl) {\n return renderMessageSummary(lang, message);\n }\n\n return (\n <span className=\"media-preview\">\n <img src={blobUrl} alt=\"\" className={buildClassName('media-preview__image', isRoundVideo && 'round')} />\n {getMessageVideo(message) && <i className=\"icon-play\" />}\n {renderMessageSummary(lang, message, true)}\n </span>\n );\n}\n\nexport default memo(StatisticsRecentMessage);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useState, useEffect, useRef, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { callApi } from '../../../api/gramjs';\nimport type {\n ApiMessage,\n ApiChannelStatistics,\n ApiGroupStatistics,\n StatisticsRecentMessage as StatisticsRecentMessageType,\n StatisticsGraph,\n} from '../../../api/types';\nimport { selectChat, selectStatistics } from '../../../global/selectors';\n\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\nimport useForceUpdate from '../../../hooks/useForceUpdate';\n\nimport Loading from '../../ui/Loading';\nimport StatisticsOverview from './StatisticsOverview';\nimport StatisticsRecentMessage from './StatisticsRecentMessage';\n\nimport './Statistics.scss';\n\ntype ILovelyChart = { create: Function };\nlet lovelyChartPromise: Promise<ILovelyChart>;\nlet LovelyChart: ILovelyChart;\n\nasync function ensureLovelyChart() {\n if (!lovelyChartPromise) {\n lovelyChartPromise = import('../../../lib/lovely-chart/LovelyChart') as Promise<ILovelyChart>;\n LovelyChart = await lovelyChartPromise;\n }\n\n return lovelyChartPromise;\n}\n\nconst CHANNEL_GRAPHS_TITLES = {\n growthGraph: 'ChannelStats.Graph.Growth',\n followersGraph: 'ChannelStats.Graph.Followers',\n muteGraph: 'ChannelStats.Graph.Notifications',\n topHoursGraph: 'ChannelStats.Graph.ViewsByHours',\n viewsBySourceGraph: 'ChannelStats.Graph.ViewsBySource',\n newFollowersBySourceGraph: 'ChannelStats.Graph.NewFollowersBySource',\n languagesGraph: 'ChannelStats.Graph.Language',\n interactionsGraph: 'ChannelStats.Graph.Interactions',\n};\nconst CHANNEL_GRAPHS = Object.keys(CHANNEL_GRAPHS_TITLES) as (keyof ApiChannelStatistics)[];\n\nconst GROUP_GRAPHS_TITLES = {\n growthGraph: 'Stats.GroupGrowthTitle',\n membersGraph: 'Stats.GroupMembersTitle',\n languagesGraph: 'Stats.GroupLanguagesTitle',\n messagesGraph: 'Stats.GroupMessagesTitle',\n actionsGraph: 'Stats.GroupActionsTitle',\n topHoursGraph: 'Stats.GroupTopHoursTitle',\n};\nconst GROUP_GRAPHS = Object.keys(GROUP_GRAPHS_TITLES) as (keyof ApiGroupStatistics)[];\n\nexport type OwnProps = {\n chatId: string;\n};\n\nexport type StateProps = {\n statistics: ApiChannelStatistics | ApiGroupStatistics;\n dcId?: number;\n isGroup: boolean;\n};\n\nconst Statistics: FC<OwnProps & StateProps> = ({\n chatId,\n statistics,\n dcId,\n isGroup,\n}) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const [isReady, setIsReady] = useState(false);\n const loadedCharts = useRef<string[]>([]);\n\n const { loadStatistics, loadStatisticsAsyncGraph } = getActions();\n const forceUpdate = useForceUpdate();\n\n useEffect(() => {\n loadStatistics({ chatId, isGroup });\n }, [chatId, loadStatistics, isGroup]);\n\n const graphs = useMemo(() => {\n return isGroup ? GROUP_GRAPHS : CHANNEL_GRAPHS;\n }, [isGroup]);\n\n const graphTitles = useMemo(() => {\n return isGroup ? GROUP_GRAPHS_TITLES : CHANNEL_GRAPHS_TITLES;\n }, [isGroup]);\n\n // Load async graphs\n useEffect(() => {\n if (!statistics) {\n return;\n }\n\n graphs.forEach((name) => {\n const graph = statistics[name as keyof typeof statistics];\n const isAsync = typeof graph === 'string';\n\n if (isAsync) {\n loadStatisticsAsyncGraph({\n name,\n chatId,\n token: graph,\n // Hardcode percentage for languages graph, since API does not return `percentage` flag\n isPercentage: name === 'languagesGraph',\n });\n }\n });\n }, [graphs, chatId, statistics, loadStatisticsAsyncGraph]);\n\n useEffect(() => {\n (async () => {\n await ensureLovelyChart();\n\n if (!isReady) {\n setIsReady(true);\n return;\n }\n\n if (!statistics || !containerRef.current) {\n return;\n }\n\n graphs.forEach((name, index: number) => {\n const graph = statistics[name as keyof typeof statistics];\n const isAsync = typeof graph === 'string';\n\n if (isAsync || loadedCharts.current.includes(name)) {\n return;\n }\n\n if (!graph) {\n loadedCharts.current.push(name);\n\n return;\n }\n\n const { zoomToken } = graph;\n\n LovelyChart.create(\n containerRef.current!.children[index],\n {\n title: lang((graphTitles as Record<string, string>)[name]),\n ...zoomToken ? {\n onZoom: (x: number) => callApi('fetchStatisticsAsyncGraph', { token: zoomToken, x, dcId }),\n zoomOutLabel: lang('Graph.ZoomOut'),\n } : {},\n ...graph as StatisticsGraph,\n },\n );\n\n loadedCharts.current.push(name);\n\n containerRef.current!.children[index].classList.remove('hidden');\n });\n\n forceUpdate();\n })();\n }, [\n graphs, graphTitles, isReady, statistics, lang, chatId, loadStatisticsAsyncGraph, dcId, forceUpdate,\n ]);\n\n if (!isReady || !statistics) {\n return <Loading />;\n }\n\n return (\n <div className={buildClassName('Statistics custom-scroll', isReady && 'ready')}>\n <StatisticsOverview statistics={statistics} isGroup={isGroup} />\n\n {!loadedCharts.current.length && <Loading />}\n\n <div ref={containerRef}>\n {graphs.map((graph) => (\n <div key={graph} className=\"Statistics__graph hidden\" />\n ))}\n </div>\n\n {Boolean((statistics as ApiChannelStatistics).recentTopMessages?.length) && (\n <div className=\"Statistics__messages\">\n <h2 className=\"Statistics__messages-title\">{lang('ChannelStats.Recent.Header')}</h2>\n\n {(statistics as ApiChannelStatistics).recentTopMessages.map((message) => (\n <StatisticsRecentMessage message={message as ApiMessage & StatisticsRecentMessageType} />\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const statistics = selectStatistics(global, chatId);\n const chat = selectChat(global, chatId);\n const dcId = chat?.fullInfo?.statisticsDcId;\n const isGroup = chat?.type === 'chatTypeSuperGroup';\n\n return {\n statistics, dcId, isGroup,\n };\n },\n)(Statistics));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\n\nimport useLang from '../../../hooks/useLang';\nimport { getActions } from '../../../global';\nimport type { ApiMessagePublicForward } from '../../../api/types';\n\nimport Avatar from '../../common/Avatar';\n\nimport './StatisticsPublicForward.scss';\n\nexport type OwnProps = {\n data: ApiMessagePublicForward;\n};\n\nconst StatisticsPublicForward: FC<OwnProps> = ({ data }) => {\n const lang = useLang();\n const { openChatByUsername } = getActions();\n\n const handleClick = useCallback(() => {\n openChatByUsername({ username: data.chat.username, messageId: data.messageId });\n }, [data, openChatByUsername]);\n\n return (\n <div className=\"StatisticsPublicForward\" onClick={handleClick}>\n <Avatar size=\"medium\" chat={data.chat} />\n\n <div className=\"StatisticsPublicForward__info\">\n <div className=\"StatisticsPublicForward__title\">\n {data.title}\n </div>\n\n <div className=\"StatisticsPublicForward__views\">\n {lang('ChannelStats.ViewsCount', data.views, 'i')}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(StatisticsPublicForward);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useState, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { callApi } from '../../../api/gramjs';\nimport type { ApiMessageStatistics, ApiMessagePublicForward, StatisticsGraph } from '../../../api/types';\nimport { selectChat } from '../../../global/selectors';\n\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\nimport useForceUpdate from '../../../hooks/useForceUpdate';\n\nimport Loading from '../../ui/Loading';\nimport StatisticsOverview from './StatisticsOverview';\nimport StatisticsPublicForward from './StatisticsPublicForward';\n\nimport './Statistics.scss';\n\ntype ILovelyChart = { create: Function };\nlet lovelyChartPromise: Promise<ILovelyChart>;\nlet LovelyChart: ILovelyChart;\n\nasync function ensureLovelyChart() {\n if (!lovelyChartPromise) {\n lovelyChartPromise = import('../../../lib/lovely-chart/LovelyChart') as Promise<ILovelyChart>;\n LovelyChart = await lovelyChartPromise;\n }\n\n return lovelyChartPromise;\n}\n\nconst GRAPH_TITLES = {\n viewsGraph: 'Stats.MessageInteractionsTitle',\n};\nconst GRAPHS = Object.keys(GRAPH_TITLES) as (keyof ApiMessageStatistics)[];\n\nexport type OwnProps = {\n chatId: string;\n isActive: boolean;\n};\n\nexport type StateProps = {\n statistics?: ApiMessageStatistics;\n messageId?: number;\n dcId?: number;\n};\n\nconst Statistics: FC<OwnProps & StateProps> = ({\n chatId,\n isActive,\n statistics,\n dcId,\n messageId,\n}) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const [isReady, setIsReady] = useState(false);\n const loadedCharts = useRef<string[]>([]);\n\n const { loadMessageStatistics, loadStatisticsAsyncGraph } = getActions();\n const forceUpdate = useForceUpdate();\n\n useEffect(() => {\n if (messageId) {\n loadMessageStatistics({ chatId, messageId });\n }\n }, [chatId, loadMessageStatistics, messageId]);\n\n useEffect(() => {\n if (!isActive || messageId) {\n loadedCharts.current = [];\n setIsReady(false);\n }\n }, [isActive, messageId]);\n\n // Load async graphs\n useEffect(() => {\n if (!statistics) {\n return;\n }\n\n GRAPHS.forEach((name) => {\n const graph = statistics[name as keyof typeof statistics];\n const isAsync = typeof graph === 'string';\n\n if (isAsync) {\n loadStatisticsAsyncGraph({ name, chatId, token: graph });\n }\n });\n }, [chatId, statistics, loadStatisticsAsyncGraph]);\n\n useEffect(() => {\n (async () => {\n await ensureLovelyChart();\n\n if (!isReady) {\n setIsReady(true);\n return;\n }\n\n if (!statistics || !containerRef.current) {\n return;\n }\n\n GRAPHS.forEach((name, index: number) => {\n const graph = statistics[name as keyof typeof statistics];\n const isAsync = typeof graph === 'string';\n\n if (isAsync || loadedCharts.current.includes(name)) {\n return;\n }\n\n if (!graph) {\n loadedCharts.current.push(name);\n\n return;\n }\n\n const { zoomToken } = graph as StatisticsGraph;\n\n LovelyChart.create(\n containerRef.current!.children[index],\n {\n title: lang((GRAPH_TITLES as Record<string, string>)[name]),\n ...zoomToken ? {\n onZoom: (x: number) => callApi('fetchStatisticsAsyncGraph', { token: zoomToken, x, dcId }),\n zoomOutLabel: lang('Graph.ZoomOut'),\n } : {},\n ...graph as StatisticsGraph,\n },\n );\n\n loadedCharts.current.push(name);\n });\n\n forceUpdate();\n })();\n }, [\n isReady, statistics, lang, chatId, messageId, loadStatisticsAsyncGraph, dcId, forceUpdate,\n ]);\n\n if (!isReady || !statistics || !messageId) {\n return <Loading />;\n }\n\n return (\n <div className={buildClassName('Statistics custom-scroll', isReady && 'ready')}>\n <StatisticsOverview statistics={statistics} isMessage />\n\n {!loadedCharts.current.length && <Loading />}\n\n <div ref={containerRef}>\n {GRAPHS.map((graph) => (\n <div className={buildClassName('Statistics__graph', !loadedCharts.current.includes(graph) && 'hidden')} />\n ))}\n </div>\n\n {Boolean(statistics.publicForwards) && (\n <div className=\"Statistics__public-forwards\">\n <h2 className=\"Statistics__public-forwards-title\">{lang('Stats.Message.PublicShares')}</h2>\n\n {statistics.publicForwardsData!.map((item: ApiMessagePublicForward) => (\n <StatisticsPublicForward data={item} />\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const dcId = chat?.fullInfo?.statisticsDcId;\n const statistics = global.statistics.currentMessage;\n const messageId = global.statistics.currentMessageId;\n\n return { statistics, dcId, messageId };\n },\n)(Statistics));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, useState, memo, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type {\n ApiChat,\n ApiMessage,\n ApiPollAnswer,\n ApiPollResult,\n} from '../../api/types';\nimport usePrevious from '../../hooks/usePrevious';\nimport useLang from '../../hooks/useLang';\n\nimport ShowMoreButton from '../ui/ShowMoreButton';\nimport Loading from '../ui/Loading';\nimport ListItem from '../ui/ListItem';\nimport PrivateChatInfo from '../common/PrivateChatInfo';\n\nimport './PollAnswerResults.scss';\n\ntype OwnProps = {\n chat: ApiChat;\n message: ApiMessage;\n answer: ApiPollAnswer;\n answerVote: ApiPollResult;\n totalVoters: number;\n};\n\ntype StateProps = {\n voters?: string[];\n offset: string;\n};\n\nconst INITIAL_LIMIT = 4;\nconst VIEW_MORE_LIMIT = 50;\n\nconst PollAnswerResults: FC<OwnProps & StateProps> = ({\n chat,\n message,\n answer,\n answerVote,\n totalVoters,\n voters,\n offset,\n}) => {\n const {\n loadPollOptionResults,\n openChat,\n closePollResults,\n } = getActions();\n\n const prevVotersCount = usePrevious<number>(answerVote.votersCount);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const areVotersLoaded = Boolean(voters);\n const { option, text } = answer;\n const lang = useLang();\n\n useEffect(() => {\n // For update when new votes arrive or when the user takes back his vote\n if (!areVotersLoaded || prevVotersCount !== answerVote.votersCount) {\n loadPollOptionResults({\n chat, messageId: message.id, option, offset, limit: INITIAL_LIMIT, shouldResetVoters: true,\n });\n }\n // eslint-disable-next-line\n }, [answerVote.votersCount, areVotersLoaded]);\n\n const handleViewMoreClick = useCallback(() => {\n setIsLoading(true);\n loadPollOptionResults({\n chat, messageId: message.id, option, offset, limit: VIEW_MORE_LIMIT,\n });\n }, [chat, loadPollOptionResults, message.id, offset, option]);\n\n useEffect(() => {\n setIsLoading(false);\n }, [voters]);\n\n const handleMemberClick = useCallback((id: string) => {\n openChat({ id });\n closePollResults();\n }, [closePollResults, openChat]);\n\n function renderViewMoreButton() {\n const leftVotersCount = answerVote.votersCount - voters!.length;\n\n return answerVote.votersCount > INITIAL_LIMIT && leftVotersCount > 0 && (\n <ShowMoreButton\n count={leftVotersCount}\n itemName=\"voter\"\n isLoading={isLoading}\n onClick={handleViewMoreClick}\n />\n );\n }\n\n return (\n <div className=\"PollAnswerResults\">\n <div className=\"poll-voters\">\n {voters\n ? voters.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleMemberClick(id)}\n >\n <PrivateChatInfo\n avatarSize=\"tiny\"\n userId={id}\n forceShowSelf\n noStatusOrTyping\n />\n </ListItem>\n ))\n : <Loading />}\n {voters && renderViewMoreButton()}\n </div>\n <div className=\"answer-head\" dir={lang.isRtl ? 'rtl' : undefined}>\n <span className=\"answer-title\" dir=\"auto\">{text}</span>\n <span className=\"answer-percent\" dir={lang.isRtl ? 'auto' : undefined}>\n {getPercentage(answerVote.votersCount, totalVoters)}%\n </span>\n </div>\n </div>\n );\n};\n\nfunction getPercentage(value: number, total: number) {\n return total > 0 ? ((value / total) * 100).toFixed() : 0;\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { answer }: OwnProps): StateProps => {\n const { voters, offsets } = global.pollResults;\n\n return {\n voters: voters?.[answer.option],\n offset: (offsets?.[answer.option]) || '',\n };\n },\n)(PollAnswerResults));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport type { ApiMessage, ApiChat } from '../../api/types';\nimport { selectChat, selectChatMessage } from '../../global/selectors';\nimport { buildCollectionByKey } from '../../util/iteratees';\nimport { getMessagePoll } from '../../global/helpers';\nimport renderText from '../common/helpers/renderText';\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\n\nimport PollAnswerResults from './PollAnswerResults';\nimport Loading from '../ui/Loading';\n\nimport './PollResults.scss';\n\ntype OwnProps = {\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n message?: ApiMessage;\n lastSyncTime?: number;\n};\n\nconst PollResults: FC<OwnProps & StateProps> = ({\n onClose,\n isActive,\n chat,\n message,\n lastSyncTime,\n}) => {\n const lang = useLang();\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n if (!message || !chat) {\n return <Loading />;\n }\n\n const { summary, results } = getMessagePoll(message)!;\n if (!results.results) {\n return undefined;\n }\n\n const resultsByOption = buildCollectionByKey(results.results, 'option');\n\n return (\n <div className=\"PollResults\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"poll-question\" dir=\"auto\">{renderText(summary.question, ['emoji', 'br'])}</h3>\n <div className=\"poll-results-list custom-scroll\">\n {lastSyncTime && summary.answers.map((answer) => (\n <PollAnswerResults\n key={`${message.id}-${answer.option}`}\n chat={chat}\n message={message}\n answer={answer}\n answerVote={resultsByOption[answer.option]}\n totalVoters={results.totalVoters!}\n />\n ))}\n {!lastSyncTime && <Loading />}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n pollResults: { chatId, messageId },\n lastSyncTime,\n } = global;\n\n if (!chatId || !messageId) {\n return {};\n }\n\n const chat = selectChat(global, chatId);\n const message = selectChatMessage(global, chatId, messageId);\n\n return {\n chat,\n message,\n lastSyncTime,\n };\n },\n)(PollResults));\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiUser } from '../../../api/types';\nimport { ManagementProgress } from '../../../types';\n\nimport {\n selectChat, selectNotifyExceptions, selectNotifySettings, selectUser,\n} from '../../../global/selectors';\nimport { selectIsChatMuted } from '../../../global/helpers';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport InputText from '../../ui/InputText';\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\nimport './Management.scss';\n\ntype OwnProps = {\n userId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n user?: ApiUser;\n progress?: ManagementProgress;\n isMuted?: boolean;\n};\n\nconst ERROR_FIRST_NAME_MISSING = 'Please provide first name';\n\nconst ManageUser: FC<OwnProps & StateProps> = ({\n userId,\n user,\n progress,\n isMuted,\n onClose,\n isActive,\n}) => {\n const {\n updateContact,\n deleteContact,\n closeManagement,\n } = getActions();\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [error, setError] = useState<string | undefined>();\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const currentFirstName = user ? (user.firstName || '') : '';\n const currentLastName = user ? (user.lastName || '') : '';\n\n const [firstName, setFirstName] = useState(currentFirstName);\n const [lastName, setLastName] = useState(currentLastName);\n const [isNotificationsEnabled, setIsNotificationsEnabled] = useState(!isMuted);\n\n useEffect(() => {\n setIsNotificationsEnabled(!isMuted);\n }, [isMuted]);\n\n useEffect(() => {\n setIsProfileFieldsTouched(false);\n closeDeleteDialog();\n }, [closeDeleteDialog, userId]);\n\n useEffect(() => {\n setFirstName(currentFirstName);\n setLastName(currentLastName);\n }, [currentFirstName, currentLastName, user]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n closeDeleteDialog();\n }\n }, [closeDeleteDialog, progress]);\n\n const handleFirstNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleLastNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleNotificationChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsNotificationsEnabled(e.target.checked);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleProfileSave = useCallback(() => {\n const trimmedFirstName = firstName.trim();\n const trimmedLastName = lastName.trim();\n\n if (!trimmedFirstName.length) {\n setError(ERROR_FIRST_NAME_MISSING);\n }\n\n updateContact({\n userId,\n isMuted: !isNotificationsEnabled,\n firstName: trimmedFirstName,\n lastName: trimmedLastName,\n });\n }, [firstName, lastName, updateContact, userId, isNotificationsEnabled]);\n\n const handleDeleteContact = useCallback(() => {\n deleteContact({ userId });\n closeDeleteDialog();\n closeManagement();\n }, [closeDeleteDialog, closeManagement, deleteContact, userId]);\n\n if (!user) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <PrivateChatInfo\n userId={user.id}\n avatarSize=\"jumbo\"\n status=\"original name\"\n withFullInfo\n />\n <InputText\n id=\"user-first-name\"\n label={lang('UserInfo.FirstNamePlaceholder')}\n onChange={handleFirstNameChange}\n value={firstName}\n error={error === ERROR_FIRST_NAME_MISSING ? error : undefined}\n />\n <InputText\n id=\"user-last-name\"\n label={lang('UserInfo.LastNamePlaceholder')}\n onChange={handleLastNameChange}\n value={lastName}\n />\n <div className=\"ListItem no-selection narrow\">\n <Checkbox\n checked={isNotificationsEnabled}\n label={lang('Notifications')}\n subLabel={lang(isNotificationsEnabled\n ? 'UserInfo.NotificationsEnabled'\n : 'UserInfo.NotificationsDisabled')}\n onChange={handleNotificationChange}\n />\n </div>\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {lang('DeleteContact')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleProfileSave}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n text={lang('AreYouSureDeleteContact')}\n confirmLabel={lang('DeleteContact')}\n confirmHandler={handleDeleteContact}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n const user = selectUser(global, userId);\n const chat = selectChat(global, userId)!;\n const { progress } = global.management;\n const isMuted = selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global));\n\n return {\n user, progress, isMuted,\n };\n },\n)(ManageUser));\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ManagementScreens, ManagementProgress } from '../../../types';\nimport type { ApiChat, ApiChatBannedRights, ApiExportedInvite } from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\n\nimport { getChatAvatarHash, getHasAdminRight, isChatBasicGroup } from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport { selectChat } from '../../../global/selectors';\nimport { formatInteger } from '../../../util/textFormat';\nimport renderText from '../../common/helpers/renderText';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport InputText from '../../ui/InputText';\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport Spinner from '../../ui/Spinner';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\nimport './Management.scss';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n progress?: ManagementProgress;\n isBasicGroup: boolean;\n hasLinkedChannel: boolean;\n canChangeInfo?: boolean;\n canBanUsers?: boolean;\n canInvite?: boolean;\n exportedInvites?: ApiExportedInvite[];\n lastSyncTime?: number;\n availableReactionsCount?: number;\n};\n\nconst GROUP_TITLE_EMPTY = 'Group title can\\'t be empty';\n\n// Some checkboxes control multiple rights, and some rights are not controlled from Permissions screen,\n// so we need to define the amount manually\nconst TOTAL_PERMISSIONS_COUNT = 8;\n\nconst ManageGroup: FC<OwnProps & StateProps> = ({\n chatId,\n chat,\n progress,\n isBasicGroup,\n hasLinkedChannel,\n canChangeInfo,\n canBanUsers,\n canInvite,\n onScreenSelect,\n onClose,\n isActive,\n exportedInvites,\n lastSyncTime,\n availableReactionsCount,\n}) => {\n const {\n togglePreHistoryHidden,\n updateChat,\n deleteChat,\n leaveChannel,\n deleteChannel,\n closeManagement,\n openChat,\n loadExportedChatInvites,\n loadChatJoinRequests,\n } = getActions();\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const currentTitle = chat.title;\n const currentAbout = chat.fullInfo ? (chat.fullInfo.about || '') : '';\n\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [title, setTitle] = useState(currentTitle || '');\n const [about, setAbout] = useState(currentAbout);\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n const imageHash = getChatAvatarHash(chat);\n const currentAvatarBlobUrl = useMedia(imageHash, false, ApiMediaFormat.BlobUrl);\n const isPublicGroup = chat.username || hasLinkedChannel;\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (lastSyncTime && canInvite) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, canInvite, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handleClickEditType = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatPrivacyType);\n }, [onScreenSelect]);\n\n const handleClickDiscussion = useCallback(() => {\n onScreenSelect(ManagementScreens.Discussion);\n }, [onScreenSelect]);\n\n const handleClickReactions = useCallback(() => {\n onScreenSelect(ManagementScreens.Reactions);\n }, [onScreenSelect]);\n\n const handleClickPermissions = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupPermissions);\n }, [onScreenSelect]);\n\n const handleClickAdministrators = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }, [onScreenSelect]);\n\n const handleClickInvites = useCallback(() => {\n onScreenSelect(ManagementScreens.Invites);\n }, [onScreenSelect]);\n\n const handleClickRequests = useCallback(() => {\n onScreenSelect(ManagementScreens.JoinRequests);\n }, [onScreenSelect]);\n\n const handleSetPhoto = useCallback((file: File) => {\n setPhoto(file);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleAboutChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setAbout(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUpdateGroup = useCallback(() => {\n const trimmedTitle = title.trim();\n const trimmedAbout = about.trim();\n\n if (!trimmedTitle.length) {\n setError(GROUP_TITLE_EMPTY);\n return;\n }\n\n updateChat({\n chatId,\n title: trimmedTitle,\n about: trimmedAbout,\n photo,\n });\n }, [about, chatId, photo, title, updateChat]);\n\n const handleClickMembers = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupMembers);\n }, [onScreenSelect]);\n\n const handleTogglePreHistory = useCallback(() => {\n if (!chat.fullInfo) {\n return;\n }\n\n const { isPreHistoryHidden } = chat.fullInfo;\n\n togglePreHistoryHidden({ chatId: chat.id, isEnabled: !isPreHistoryHidden });\n }, [chat, togglePreHistoryHidden]);\n\n const enabledReactionsCount = chat.fullInfo?.enabledReactions?.length || 0;\n\n const enabledPermissionsCount = useMemo(() => {\n if (!chat.defaultBannedRights) {\n return 0;\n }\n\n let totalCount = [\n 'sendMessages',\n 'sendMedia',\n 'embedLinks',\n 'sendPolls',\n 'changeInfo',\n 'inviteUsers',\n 'pinMessages',\n ].filter(\n (key) => !chat.defaultBannedRights![key as keyof ApiChatBannedRights],\n ).length;\n\n const { sendStickers, sendGifs } = chat.defaultBannedRights;\n\n // These two rights are controlled with a single checkbox\n if (!sendStickers && !sendGifs) {\n totalCount += 1;\n }\n\n return totalCount;\n }, [chat]);\n\n const adminsCount = (chat.fullInfo?.adminMembers?.length) || 0;\n\n const handleDeleteGroup = useCallback(() => {\n if (isBasicGroup) {\n deleteChat({ chatId: chat.id });\n } else if (!chat.isCreator) {\n leaveChannel({ chatId: chat.id });\n } else {\n deleteChannel({ chatId: chat.id });\n }\n closeDeleteDialog();\n closeManagement();\n openChat({ id: undefined });\n }, [\n isBasicGroup, chat.isCreator, chat.id,\n closeDeleteDialog, closeManagement, leaveChannel, deleteChannel, deleteChat, openChat,\n ]);\n\n if (chat.isRestricted || chat.isForbidden) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handleSetPhoto}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-title\"\n label={lang('GroupName')}\n onChange={handleTitleChange}\n value={title}\n error={error === GROUP_TITLE_EMPTY ? error : undefined}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n disabled={!canChangeInfo}\n />\n {chat.isCreator && (\n <ListItem icon=\"lock\" multiline onClick={handleClickEditType}>\n <span className=\"title\">{lang('GroupType')}</span>\n <span className=\"subtitle\">{chat.username ? lang('TypePublic') : lang('TypePrivate')}</span>\n </ListItem>\n )}\n {hasLinkedChannel && (\n <ListItem\n icon=\"message\"\n multiline\n onClick={handleClickDiscussion}\n >\n <span className=\"title\">{lang('LinkedChannel')}</span>\n <span className=\"subtitle\">{lang('DiscussionUnlink')}</span>\n </ListItem>\n )}\n <ListItem\n icon=\"permissions\"\n multiline\n onClick={handleClickPermissions}\n disabled={!canBanUsers}\n >\n <span className=\"title\">{lang('ChannelPermissions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledPermissionsCount}/{TOTAL_PERMISSIONS_COUNT}\n </span>\n </ListItem>\n\n <ListItem\n icon=\"heart-outline\"\n multiline\n onClick={handleClickReactions}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Reactions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledReactionsCount}/{availableReactionsCount}\n </span>\n </ListItem>\n <ListItem\n icon=\"admin\"\n multiline\n onClick={handleClickAdministrators}\n >\n <span className=\"title\">{lang('ChannelAdministrators')}</span>\n <span className=\"subtitle\">{formatInteger(adminsCount)}</span>\n </ListItem>\n {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('MemberRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n </div>\n <div className=\"section\">\n <ListItem icon=\"group\" multiline onClick={handleClickMembers}>\n <span className=\"title\">{lang('GroupMembers')}</span>\n <span className=\"subtitle\">{formatInteger(chat.membersCount ?? 0)}</span>\n </ListItem>\n\n {!isPublicGroup && chat.fullInfo && (\n <div className=\"ListItem narrow no-selection\">\n <Checkbox\n checked={!chat.fullInfo.isPreHistoryHidden}\n label={lang('ChatHistory')}\n onChange={handleTogglePreHistory}\n disabled={!canBanUsers}\n />\n </div>\n )}\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {lang('DeleteMega')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleUpdateGroup}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n textParts={renderText(\n isBasicGroup || !chat.isCreator\n ? lang('AreYouSureDeleteAndExit')\n : lang('AreYouSureDeleteThisChatWithGroup', chat.title),\n ['br', 'simple_markdown'],\n )}\n confirmLabel={isBasicGroup || !chat.isCreator ? lang('DeleteMega') : lang('DeleteGroupForAll')}\n confirmHandler={handleDeleteGroup}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { progress } = global.management;\n const hasLinkedChannel = Boolean(chat.fullInfo?.linkedChatId);\n const isBasicGroup = isChatBasicGroup(chat);\n const { invites } = global.management.byChatId[chatId] || {};\n\n return {\n chat,\n progress,\n isBasicGroup,\n hasLinkedChannel,\n canChangeInfo: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'changeInfo'),\n canBanUsers: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'banUsers'),\n canInvite: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'inviteUsers'),\n exportedInvites: invites,\n lastSyncTime: global.lastSyncTime,\n availableReactionsCount: global.availableReactions?.filter((l) => !l.isInactive).length,\n };\n },\n)(ManageGroup));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ManagementScreens } from '../../../types';\nimport type { ApiChat, ApiChatBannedRights, ApiChatMember } from '../../../api/types';\n\nimport useLang from '../../../hooks/useLang';\nimport { selectChat } from '../../../global/selectors';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onChatMemberSelect: (memberId: string, isPromotedByCurrentUser?: boolean) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n currentUserId?: string;\n};\n\nconst FLOATING_BUTTON_ANIMATION_TIMEOUT_MS = 250;\n\nfunction getLangKeyForBannedRightKey(key: string) {\n switch (key) {\n case 'sendMessages':\n return 'UserRestrictionsNoSend';\n case 'sendMedia':\n return 'UserRestrictionsNoSendMedia';\n case 'sendStickers':\n return 'UserRestrictionsNoSendStickers';\n case 'embedLinks':\n return 'UserRestrictionsNoEmbedLinks';\n case 'sendPolls':\n return 'UserRestrictionsNoSendPolls';\n case 'changeInfo':\n return 'UserRestrictionsNoChangeInfo';\n case 'inviteUsers':\n return 'UserRestrictionsInviteUsers';\n case 'pinMessages':\n return 'UserRestrictionsPinMessages';\n default:\n return undefined;\n }\n}\n\nconst ManageGroupPermissions: FC<OwnProps & StateProps> = ({\n onScreenSelect,\n onChatMemberSelect,\n chat,\n currentUserId,\n onClose,\n isActive,\n}) => {\n const { updateChatDefaultBannedRights } = getActions();\n\n const [permissions, setPermissions] = useState<ApiChatBannedRights>({});\n const [havePermissionChanged, setHavePermissionChanged] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const handleRemovedUsersClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupRemovedUsers);\n }, [onScreenSelect]);\n\n const handleAddExceptionClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupUserPermissionsCreate);\n }, [onScreenSelect]);\n\n const handleExceptionMemberClick = useCallback((member: ApiChatMember) => {\n onChatMemberSelect(member.userId, member.promotedByUserId === currentUserId);\n onScreenSelect(ManagementScreens.GroupUserPermissions);\n }, [currentUserId, onChatMemberSelect, onScreenSelect]);\n\n useEffect(() => {\n setPermissions((chat?.defaultBannedRights) || {});\n setHavePermissionChanged(false);\n setTimeout(() => {\n setIsLoading(false);\n }, FLOATING_BUTTON_ANIMATION_TIMEOUT_MS);\n }, [chat]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as Exclude<keyof ApiChatBannedRights, 'untilDate'>]),\n ...(name === 'sendStickers' && {\n sendGifs: getUpdatedPermissionValue(p[name]),\n }),\n }));\n setHavePermissionChanged(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!chat) {\n return;\n }\n\n setIsLoading(true);\n updateChatDefaultBannedRights({ chatId: chat.id, bannedRights: permissions });\n }, [chat, permissions, updateChatDefaultBannedRights]);\n\n const removedUsersCount = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.kickedMembers) {\n return 0;\n }\n\n return chat.fullInfo.kickedMembers.length;\n }, [chat]);\n\n const exceptionMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.members) {\n return [];\n }\n\n return chat.fullInfo.members.filter(({ bannedRights }) => Boolean(bannedRights));\n }, [chat]);\n\n const getMemberExceptions = useCallback((member: ApiChatMember) => {\n const { bannedRights } = member;\n if (!bannedRights || !chat) {\n return undefined;\n }\n\n const { defaultBannedRights } = chat;\n\n return Object.keys(bannedRights).reduce((result, key) => {\n if (\n !bannedRights[key as keyof ApiChatBannedRights]\n || (defaultBannedRights?.[key as keyof ApiChatBannedRights])\n || key === 'sendInline' || key === 'viewMessages' || key === 'sendGames'\n ) {\n return result;\n }\n\n const langKey = getLangKeyForBannedRightKey(key);\n\n if (!langKey) {\n return result;\n }\n\n const translatedString = lang(langKey);\n\n return `${result}${!result.length ? translatedString : `, ${translatedString}`}`;\n }, '');\n }, [chat, lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <h3 className=\"section-heading\" dir=\"auto\">{lang('ChannelPermissionsHeader')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMessages\"\n checked={!permissions.sendMessages}\n label={lang('UserRestrictionsSend')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMedia\"\n checked={!permissions.sendMedia}\n label={lang('UserRestrictionsSendMedia')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendStickers\"\n checked={!permissions.sendStickers && !permissions.sendGifs}\n label={lang('UserRestrictionsSendStickers')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendPolls\"\n checked={!permissions.sendPolls}\n label={lang('UserRestrictionsSendPolls')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"embedLinks\"\n checked={!permissions.embedLinks}\n label={lang('UserRestrictionsEmbedLinks')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={!permissions.inviteUsers}\n label={lang('UserRestrictionsInviteUsers')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={!permissions.pinMessages}\n label={lang('UserRestrictionsPinMessages')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!permissions.changeInfo}\n label={lang('UserRestrictionsChangeInfo')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n </div>\n\n <div className=\"section\">\n <ListItem\n icon=\"delete-user\"\n multiline\n narrow\n onClick={handleRemovedUsersClick}\n >\n <span className=\"title\">{lang('ChannelBlockedUsers')}</span>\n <span className=\"subtitle\">{removedUsersCount}</span>\n </ListItem>\n </div>\n\n <div className=\"section\">\n <h3 className=\"section-heading\" dir=\"auto\">{lang('PrivacyExceptions')}</h3>\n\n <ListItem\n icon=\"add-user\"\n onClick={handleAddExceptionClick}\n >\n {lang('ChannelAddException')}\n </ListItem>\n\n {exceptionMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable exceptions-member\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleExceptionMemberClick(member)}\n >\n <PrivateChatInfo\n userId={member.userId}\n status={getMemberExceptions(member)}\n />\n </ListItem>\n ))}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={havePermissionChanged}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n\n return { chat, currentUserId: global.currentUserId };\n },\n)(ManageGroupPermissions));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useMemo, useState, memo, useRef, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { ApiChat } from '../../../api/types';\n\nimport { filterUsersByName } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\n\nimport ChatOrUserPicker from '../../common/ChatOrUserPicker';\n\nexport type OwnProps = {\n chat: ApiChat;\n isOpen: boolean;\n onClose: NoneToVoidFunction;\n};\n\ntype StateProps = {\n currentUserId?: string;\n};\n\nconst RemoveGroupUserModal: FC<OwnProps & StateProps> = ({\n chat,\n currentUserId,\n isOpen,\n onClose,\n}) => {\n const {\n loadMoreMembers,\n deleteChatMember,\n } = getActions();\n\n const lang = useLang();\n const [filter, setFilter] = useState('');\n // eslint-disable-next-line no-null/no-null\n const filterRef = useRef<HTMLInputElement>(null);\n\n const usersId = useMemo(() => {\n const availableMemberIds = (chat.fullInfo?.members || [])\n .reduce((acc: string[], member) => {\n if (!member.isAdmin && !member.isOwner && member.userId !== currentUserId) {\n acc.push(member.userId);\n }\n return acc;\n }, []);\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n return filterUsersByName(availableMemberIds, usersById, filter);\n }, [chat.fullInfo?.members, currentUserId, filter]);\n\n const handleRemoveUser = useCallback((userId: string) => {\n deleteChatMember({ chatId: chat.id, userId });\n onClose();\n }, [chat.id, deleteChatMember, onClose]);\n\n return (\n <ChatOrUserPicker\n isOpen={isOpen}\n chatOrUserIds={usersId}\n filterRef={filterRef}\n filterPlaceholder={lang('ChannelBlockUser')}\n filter={filter}\n onFilterChange={setFilter}\n loadMore={loadMoreMembers}\n onSelectChatOrUser={handleRemoveUser}\n onClose={onClose}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId } = global;\n\n return { currentUserId };\n },\n)(RemoveGroupUserModal));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiChatMember, ApiUser } from '../../../api/types';\n\nimport { selectChat } from '../../../global/selectors';\nimport { getHasAdminRight, getUserFullName, isChatChannel } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useFlag from '../../../hooks/useFlag';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport ListItem from '../../ui/ListItem';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport RemoveGroupUserModal from './RemoveGroupUserModal';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n usersById: Record<string, ApiUser>;\n canDeleteMembers?: boolean;\n isChannel?: boolean;\n};\n\nconst ManageChatRemovedUsers: FC<OwnProps & StateProps> = ({\n chat,\n usersById,\n canDeleteMembers,\n isChannel,\n onClose,\n isActive,\n}) => {\n const { updateChatMemberBannedRights } = getActions();\n\n const lang = useLang();\n const [isRemoveUserModalOpen, openRemoveUserModal, closeRemoveUserModal] = useFlag();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const removedMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.kickedMembers) {\n return [];\n }\n\n return chat.fullInfo.kickedMembers;\n }, [chat]);\n\n const getRemovedBy = useCallback((member: ApiChatMember) => {\n if (!member.kickedByUserId) {\n return undefined;\n }\n\n const kickedByUser = usersById[member.kickedByUserId];\n if (!kickedByUser) {\n return undefined;\n }\n\n return lang('UserRemovedBy', getUserFullName(kickedByUser));\n }, [lang, usersById]);\n\n const getContextActions = useCallback((member: ApiChatMember) => {\n if (!chat) {\n return undefined;\n }\n\n return [{\n title: lang('Unblock'),\n icon: 'delete',\n destructive: true,\n handler: () => updateChatMemberBannedRights({\n chatId: chat.id,\n userId: member.userId,\n bannedRights: {},\n }),\n }];\n }, [lang, chat, updateChatMemberBannedRights]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <p className=\"text-muted\">{lang(isChannel ? 'NoBlockedChannel2' : 'NoBlockedGroup2')}</p>\n\n {removedMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable\"\n ripple\n contextActions={getContextActions(member)}\n >\n <PrivateChatInfo\n userId={member.userId}\n status={getRemovedBy(member)}\n />\n </ListItem>\n ))}\n {canDeleteMembers && (\n <FloatingActionButton\n isShown\n onClick={openRemoveUserModal}\n ariaLabel={lang('Channel.EditAdmin.Permission.BanUsers')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n )}\n {chat && canDeleteMembers && (\n <RemoveGroupUserModal\n chat={chat}\n isOpen={isRemoveUserModalOpen}\n onClose={closeRemoveUserModal}\n />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { byId: usersById } = global.users;\n const canDeleteMembers = chat && (getHasAdminRight(chat, 'banUsers') || chat.isCreator);\n\n return {\n chat,\n usersById,\n canDeleteMembers,\n isChannel: chat && isChatChannel(chat),\n };\n },\n)(ManageChatRemovedUsers));\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ManagementScreens, ManagementProgress } from '../../../types';\nimport type { ApiChat, ApiExportedInvite } from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\n\nimport { getChatAvatarHash, getHasAdminRight } from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\nimport { selectChat } from '../../../global/selectors';\nimport useFlag from '../../../hooks/useFlag';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { formatInteger } from '../../../util/textFormat';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport InputText from '../../ui/InputText';\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport Spinner from '../../ui/Spinner';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\nimport './Management.scss';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n progress?: ManagementProgress;\n isSignaturesShown: boolean;\n canChangeInfo?: boolean;\n canInvite?: boolean;\n exportedInvites?: ApiExportedInvite[];\n lastSyncTime?: number;\n availableReactionsCount?: number;\n};\n\nconst CHANNEL_TITLE_EMPTY = 'Channel title can\\'t be empty';\n\nconst ManageChannel: FC<OwnProps & StateProps> = ({\n chatId,\n chat,\n progress,\n isSignaturesShown,\n canChangeInfo,\n canInvite,\n exportedInvites,\n lastSyncTime,\n availableReactionsCount,\n onScreenSelect,\n onClose,\n isActive,\n}) => {\n const {\n updateChat,\n toggleSignatures,\n closeManagement,\n leaveChannel,\n deleteChannel,\n openChat,\n loadExportedChatInvites,\n loadChatJoinRequests,\n } = getActions();\n\n const currentTitle = chat ? (chat.title || '') : '';\n const currentAbout = chat?.fullInfo ? (chat.fullInfo.about || '') : '';\n const hasLinkedChat = chat?.fullInfo?.linkedChatId;\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [title, setTitle] = useState(currentTitle);\n const [about, setAbout] = useState(currentAbout);\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n const imageHash = chat && getChatAvatarHash(chat);\n const currentAvatarBlobUrl = useMedia(imageHash, false, ApiMediaFormat.BlobUrl);\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (lastSyncTime) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const adminsCount = (chat?.fullInfo?.adminMembers?.length) || 0;\n const removedUsersCount = (chat?.fullInfo?.kickedMembers?.length) || 0;\n\n const handleClickEditType = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatPrivacyType);\n }, [onScreenSelect]);\n\n const handleClickDiscussion = useCallback(() => {\n onScreenSelect(ManagementScreens.Discussion);\n }, [onScreenSelect]);\n\n const handleClickReactions = useCallback(() => {\n onScreenSelect(ManagementScreens.Reactions);\n }, [onScreenSelect]);\n\n const handleClickAdministrators = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }, [onScreenSelect]);\n\n const handleClickInvites = useCallback(() => {\n onScreenSelect(ManagementScreens.Invites);\n }, [onScreenSelect]);\n\n const handleClickRequests = useCallback(() => {\n onScreenSelect(ManagementScreens.JoinRequests);\n }, [onScreenSelect]);\n\n const handleSetPhoto = useCallback((file: File) => {\n setPhoto(file);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleAboutChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setAbout(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUpdateChannel = useCallback(() => {\n const trimmedTitle = title.trim();\n const trimmedAbout = about.trim();\n\n if (!trimmedTitle.length) {\n setError(CHANNEL_TITLE_EMPTY);\n return;\n }\n\n updateChat({\n chatId,\n title: trimmedTitle,\n about: trimmedAbout,\n photo,\n });\n }, [about, chatId, photo, title, updateChat]);\n\n const handleToggleSignatures = useCallback(() => {\n toggleSignatures({ chatId, isEnabled: !isSignaturesShown });\n }, [chatId, isSignaturesShown, toggleSignatures]);\n\n const handleClickSubscribers = useCallback(() => {\n onScreenSelect(ManagementScreens.ChannelSubscribers);\n }, [onScreenSelect]);\n\n const handleRemovedUsersClick = useCallback(() => {\n onScreenSelect(ManagementScreens.ChannelRemovedUsers);\n }, [onScreenSelect]);\n\n const handleDeleteChannel = useCallback(() => {\n if (chat.isCreator) {\n deleteChannel({ chatId: chat.id });\n } else {\n leaveChannel({ chatId: chat.id });\n }\n\n closeDeleteDialog();\n closeManagement();\n openChat({ id: undefined });\n }, [chat.isCreator, chat.id, closeDeleteDialog, closeManagement, leaveChannel, deleteChannel, openChat]);\n\n const enabledReactionsCount = chat.fullInfo?.enabledReactions?.length || 0;\n\n if (chat.isRestricted || chat.isForbidden) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handleSetPhoto}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"channel-title\"\n label={lang('EnterChannelName')}\n onChange={handleTitleChange}\n value={title}\n error={error === CHANNEL_TITLE_EMPTY ? error : undefined}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"channel-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n disabled={!canChangeInfo}\n />\n {chat.isCreator && (\n <ListItem icon=\"lock\" multiline onClick={handleClickEditType}>\n <span className=\"title\">{lang('ChannelType')}</span>\n <span className=\"subtitle\">{chat.username ? lang('TypePublic') : lang('TypePrivate')}</span>\n </ListItem>\n )}\n <ListItem\n icon=\"message\"\n multiline\n onClick={handleClickDiscussion}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Discussion')}</span>\n <span className=\"subtitle\">{hasLinkedChat ? lang('DiscussionUnlink') : lang('Add')}</span>\n </ListItem>\n {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('SubscribeRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n <ListItem\n icon=\"heart-outline\"\n multiline\n onClick={handleClickReactions}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Reactions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledReactionsCount}/{availableReactionsCount}\n </span>\n </ListItem>\n <div className=\"ListItem no-selection narrow\">\n <Checkbox\n checked={isSignaturesShown}\n label={lang('ChannelSignMessages')}\n onChange={handleToggleSignatures}\n />\n </div>\n </div>\n <div className=\"section\">\n <ListItem\n icon=\"admin\"\n multiline\n onClick={handleClickAdministrators}\n >\n <span className=\"title\">{lang('ChannelAdministrators')}</span>\n <span className=\"subtitle\">{adminsCount}</span>\n </ListItem>\n <ListItem\n icon=\"group\"\n multiline\n onClick={handleClickSubscribers}\n >\n <span className=\"title\" dir=\"auto\">{lang('ChannelSubscribers')}</span>\n <span className=\"subtitle\" dir=\"auto\">{lang('Subscribers', chat.membersCount ?? 0, 'i')}</span>\n </ListItem>\n <ListItem\n icon=\"delete-user\"\n multiline\n narrow\n onClick={handleRemovedUsersClick}\n >\n <span className=\"title\">{lang('ChannelBlockedUsers')}</span>\n <span className=\"subtitle\">{removedUsersCount}</span>\n </ListItem>\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {chat.isCreator ? lang('ChannelDelete') : lang('LeaveChannel')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleUpdateChannel}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n text={chat.isCreator ? lang('ChannelDeleteAlert') : lang('ChannelLeaveAlert')}\n confirmLabel={chat.isCreator ? lang('ChannelDelete') : lang('LeaveChannel')}\n confirmHandler={handleDeleteChannel}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { progress } = global.management;\n const isSignaturesShown = Boolean(chat?.isSignaturesShown);\n const { invites } = global.management.byChatId[chatId] || {};\n\n return {\n chat,\n progress,\n isSignaturesShown,\n canChangeInfo: getHasAdminRight(chat, 'changeInfo'),\n canInvite: getHasAdminRight(chat, 'inviteUsers'),\n lastSyncTime: global.lastSyncTime,\n exportedInvites: invites,\n availableReactionsCount: global.availableReactions?.filter((l) => !l.isInactive).length,\n };\n },\n)(ManageChannel));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat } from '../../../api/types';\nimport { ManagementProgress } from '../../../types';\n\nimport { selectChat, selectManagement } from '../../../global/selectors';\nimport { isChatChannel } from '../../../global/helpers';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport SafeLink from '../../common/SafeLink';\nimport ListItem from '../../ui/ListItem';\nimport RadioGroup from '../../ui/RadioGroup';\nimport Loading from '../../ui/Loading';\nimport Spinner from '../../ui/Spinner';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport UsernameInput from '../../common/UsernameInput';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\ntype PrivacyType = 'private' | 'public';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n isChannel: boolean;\n progress?: ManagementProgress;\n isUsernameAvailable?: boolean;\n isProtected?: boolean;\n};\n\nconst ManageChatPrivacyType: FC<OwnProps & StateProps> = ({\n chat,\n onClose,\n isActive,\n isChannel,\n progress,\n isUsernameAvailable,\n isProtected,\n}) => {\n const {\n checkPublicLink,\n updatePublicLink,\n updatePrivateLink,\n toggleIsProtected,\n } = getActions();\n\n const isPublic = Boolean(chat.username);\n const privateLink = chat.fullInfo?.inviteLink;\n\n const [privacyType, setPrivacyType] = useState<PrivacyType>(isPublic ? 'public' : 'private');\n const [username, setUsername] = useState();\n const [isRevokeConfirmDialogOpen, openRevokeConfirmDialog, closeRevokeConfirmDialog] = useFlag();\n\n const canUpdate = Boolean(\n (privacyType === 'public' && username && isUsernameAvailable)\n || (privacyType === 'private' && isPublic),\n );\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (privacyType && !privateLink) {\n updatePrivateLink();\n }\n }, [privacyType, privateLink, updatePrivateLink]);\n\n const handleOptionChange = useCallback((value: string) => {\n setPrivacyType(value as PrivacyType);\n }, []);\n\n const handleForwardingOptionChange = useCallback((value: string) => {\n toggleIsProtected({\n chatId: chat.id,\n isProtected: value === 'protected',\n });\n }, [chat.id, toggleIsProtected]);\n\n const handleSave = useCallback(() => {\n updatePublicLink({ username: privacyType === 'public' ? username : '' });\n }, [privacyType, updatePublicLink, username]);\n\n const handleRevokePrivateLink = useCallback(() => {\n closeRevokeConfirmDialog();\n updatePrivateLink();\n }, [closeRevokeConfirmDialog, updatePrivateLink]);\n\n const lang = useLang();\n const langPrefix1 = isChannel ? 'Channel' : 'Mega';\n const langPrefix2 = isChannel ? 'Channel' : 'Group';\n\n const options = [\n { value: 'private', label: lang(`${langPrefix1}Private`), subLabel: lang(`${langPrefix1}PrivateInfo`) },\n { value: 'public', label: lang(`${langPrefix1}Public`), subLabel: lang(`${langPrefix1}PublicInfo`) },\n ];\n\n const forwardingOptions = [{\n value: 'allowed',\n label: lang('ChannelVisibility.Forwarding.Enabled'),\n }, {\n value: 'protected',\n label: lang('ChannelVisibility.Forwarding.Disabled'),\n }];\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">{lang(`${langPrefix2}Type`)}</h3>\n <RadioGroup\n selected={privacyType}\n name=\"channel-type\"\n options={options}\n onChange={handleOptionChange}\n />\n </div>\n {privacyType === 'private' ? (\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n {privateLink ? (\n <>\n <SafeLink url={privateLink} className=\"group-link\" text={privateLink} />\n <p className=\"section-info\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang(`${langPrefix1}PrivateLinkHelp`)}\n </p>\n\n <ListItem icon=\"delete\" ripple destructive onClick={openRevokeConfirmDialog}>\n {lang('RevokeLink')}\n </ListItem>\n <ConfirmDialog\n isOpen={isRevokeConfirmDialogOpen}\n onClose={closeRevokeConfirmDialog}\n text={lang('RevokeAlert')}\n confirmLabel={lang('RevokeButton')}\n confirmHandler={handleRevokePrivateLink}\n confirmIsDestructive\n />\n </>\n ) : (\n <Loading />\n )}\n </div>\n ) : (\n <div className=\"section no-border\">\n <UsernameInput\n asLink\n currentUsername={chat.username}\n isLoading={isLoading}\n isUsernameAvailable={isUsernameAvailable}\n checkUsername={checkPublicLink}\n onChange={setUsername}\n />\n <p className=\"section-info\" dir=\"auto\">\n {lang(`${langPrefix2}.Username.CreatePublicLinkHelp`)}\n </p>\n </div>\n )}\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">\n {lang(isChannel ? 'ChannelVisibility.Forwarding.ChannelTitle' : 'ChannelVisibility.Forwarding.GroupTitle')}\n </h3>\n <RadioGroup\n selected={isProtected ? 'protected' : 'allowed'}\n name=\"forwarding-type\"\n options={forwardingOptions}\n onChange={handleForwardingOptionChange}\n />\n <p className=\"section-info\">\n {isChannel\n ? lang('ChannelVisibility.Forwarding.ChannelInfo')\n : lang('ChannelVisibility.Forwarding.GroupInfo')}\n </p>\n </div>\n </div>\n <FloatingActionButton\n isShown={canUpdate}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n onClick={handleSave}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { isUsernameAvailable } = selectManagement(global, chatId)!;\n\n return {\n chat,\n isChannel: isChatChannel(chat),\n progress: global.management.progress,\n isUsernameAvailable,\n isProtected: chat?.isProtected,\n };\n },\n)(ManageChatPrivacyType));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { STICKER_SIZE_DISCUSSION_GROUPS } from '../../../config';\nimport { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets';\nimport { selectChat } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport NothingFound from '../../common/NothingFound';\nimport GroupChatInfo from '../../common/GroupChatInfo';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport useFlag from '../../../hooks/useFlag';\nimport renderText from '../../common/helpers/renderText';\nimport Avatar from '../../common/Avatar';\nimport { isChatChannel } from '../../../global/helpers';\nimport AnimatedIcon from '../../common/AnimatedIcon';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n chatsByIds: Record<string, ApiChat>;\n linkedChat?: ApiChat;\n forDiscussionIds?: string[];\n isChannel?: boolean;\n};\n\nconst ManageDiscussion: FC<OwnProps & StateProps> = ({\n chat,\n onClose,\n isActive,\n chatId,\n chatsByIds,\n linkedChat,\n forDiscussionIds,\n isChannel,\n onScreenSelect,\n}) => {\n const {\n loadGroupsForDiscussion,\n linkDiscussionGroup,\n unlinkDiscussionGroup,\n } = getActions();\n\n const [linkedGroupId, setLinkedGroupId] = useState<string>();\n const [isConfirmUnlinkGroupDialogOpen, openConfirmUnlinkGroupDialog, closeConfirmUnlinkGroupDialog] = useFlag();\n const [isConfirmLinkGroupDialogOpen, openConfirmLinkGroupDialog, closeConfirmLinkGroupDialog] = useFlag();\n const lang = useLang();\n const linkedChatId = linkedChat?.id;\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n loadGroupsForDiscussion();\n }, [loadGroupsForDiscussion]);\n\n const handleUnlinkGroupSessions = useCallback(() => {\n closeConfirmUnlinkGroupDialog();\n unlinkDiscussionGroup({ channelId: isChannel ? chatId : linkedChatId });\n if (!isChannel) {\n onScreenSelect(ManagementScreens.Initial);\n }\n }, [closeConfirmUnlinkGroupDialog, unlinkDiscussionGroup, isChannel, chatId, linkedChatId, onScreenSelect]);\n\n const handleLinkGroupSessions = useCallback(() => {\n closeConfirmLinkGroupDialog();\n linkDiscussionGroup({ channelId: chatId, chatId: linkedGroupId });\n }, [closeConfirmLinkGroupDialog, linkDiscussionGroup, chatId, linkedGroupId]);\n\n const onDiscussionClick = (groupId: string) => {\n setLinkedGroupId(groupId);\n openConfirmLinkGroupDialog();\n };\n\n function renderUnlinkGroupHeader() {\n return (\n <div className=\"modal-header\">\n <Avatar\n size=\"tiny\"\n chat={linkedChat}\n />\n <div className=\"modal-title\">\n {lang(isChannel ? 'DiscussionUnlinkGroup' : 'DiscussionUnlinkChannel')}\n </div>\n </div>\n );\n }\n\n function renderLinkGroupHeader() {\n const linkedGroup = chatsByIds[linkedGroupId];\n\n if (!linkedGroup) {\n return undefined;\n }\n\n return (\n <div className=\"modal-header\">\n <Avatar\n size=\"tiny\"\n chat={linkedGroup}\n />\n <div className=\"modal-title\">\n {lang('Channel.DiscussionGroup.LinkGroup')}\n </div>\n </div>\n );\n }\n\n function renderLinkGroupConfirmText() {\n const linkedGroup = chatsByIds[linkedGroupId];\n\n if (!linkedGroup) {\n return undefined;\n }\n\n if (linkedGroup.hasPrivateLink) {\n return renderText(\n `Do you want to make **${linkedGroup.title}** the discussion board for **${chat!.title}**?`,\n ['br', 'simple_markdown'],\n );\n }\n\n return renderText(\n // eslint-disable-next-line max-len\n `Do you want to make **${linkedGroup.title}** the discussion board for **${chat!.title}**?\\n\\nAnyone from the channel will be able to see messages in this group.`,\n ['br', 'simple_markdown'],\n );\n }\n\n function renderLinkedGroup() {\n return (\n <div>\n <ListItem\n className=\"chat-item-clickable\"\n inactive\n >\n <GroupChatInfo chatId={linkedChat!.id} />\n </ListItem>\n <ListItem\n icon=\"delete\"\n ripple\n destructive\n onClick={openConfirmUnlinkGroupDialog}\n >\n {lang(isChannel ? 'DiscussionUnlinkGroup' : 'DiscussionUnlinkChannel')}\n </ListItem>\n <ConfirmDialog\n isOpen={isConfirmUnlinkGroupDialogOpen}\n onClose={closeConfirmUnlinkGroupDialog}\n header={renderUnlinkGroupHeader()}\n textParts={renderText(\n lang(isChannel ? 'DiscussionUnlinkChannelAlert' : 'DiscussionUnlinkGroupAlert', linkedChat!.title),\n ['br', 'simple_markdown'],\n )}\n confirmLabel={lang(isChannel ? 'DiscussionUnlinkGroup' : 'DiscussionUnlinkChannel')}\n confirmHandler={handleUnlinkGroupSessions}\n confirmIsDestructive\n />\n </div>\n );\n }\n\n function renderDiscussionGroups() {\n return (\n <div>\n <p className=\"section-help\" dir=\"auto\">{lang('DiscussionChannelHelp')}</p>\n\n <div teactFastList>\n <ListItem\n key=\"create-group\"\n icon=\"group\"\n ripple\n teactOrderKey={0}\n className=\"not-implemented\"\n >\n {lang('DiscussionCreateGroup')}\n </ListItem>\n {forDiscussionIds ? (\n forDiscussionIds.map((id, i) => (\n <ListItem\n key={id}\n teactOrderKey={i + 1}\n className=\"chat-item-clickable scroll-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => {\n onDiscussionClick(id);\n }}\n >\n <GroupChatInfo chatId={id} />\n </ListItem>\n ))\n ) : (\n <NothingFound key=\"nothing-found\" teactOrderKey={0} text=\"No discussion groups found\" />\n )}\n </div>\n <p className=\"mt-4 mb-0 section-help\" dir=\"auto\">{lang('DiscussionChannelHelp2')}</p>\n <ConfirmDialog\n isOpen={isConfirmLinkGroupDialogOpen}\n onClose={closeConfirmLinkGroupDialog}\n header={renderLinkGroupHeader()}\n textParts={renderLinkGroupConfirmText()}\n confirmLabel={lang('DiscussionLinkGroup')}\n confirmHandler={handleLinkGroupSessions}\n isButtonsInOneRow\n />\n </div>\n );\n }\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AnimatedIcon\n tgsUrl={LOCAL_TGS_URLS.DiscussionGroups}\n size={STICKER_SIZE_DISCUSSION_GROUPS}\n className=\"section-icon\"\n />\n {linkedChat && renderLinkedGroup()}\n {!linkedChat && renderDiscussionGroups()}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { forDiscussionIds, byId: chatsByIds } = global.chats;\n const linkedChat = chat?.fullInfo?.linkedChatId\n ? selectChat(global, chat.fullInfo.linkedChatId)\n : undefined;\n\n return {\n chat,\n chatsByIds,\n forDiscussionIds,\n linkedChat,\n isChannel: chat && isChatChannel(chat),\n };\n },\n)(ManageDiscussion));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiChatBannedRights } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { selectChat } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\ntype OwnProps = {\n chatId: string;\n selectedChatMemberId?: string;\n isPromotedByCurrentUser?: boolean;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n isFormFullyDisabled?: boolean;\n};\n\nconst ManageGroupUserPermissions: FC<OwnProps & StateProps> = ({\n chat,\n selectedChatMemberId,\n onScreenSelect,\n isFormFullyDisabled,\n onClose,\n isActive,\n}) => {\n const { updateChatMemberBannedRights } = getActions();\n\n const [permissions, setPermissions] = useState<ApiChatBannedRights>({});\n const [havePermissionChanged, setHavePermissionChanged] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [isBanConfirmationDialogOpen, openBanConfirmationDialog, closeBanConfirmationDialog] = useFlag();\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const selectedChatMember = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.members) {\n return undefined;\n }\n\n return chat.fullInfo.members.find(({ userId }) => userId === selectedChatMemberId);\n }, [chat, selectedChatMemberId]);\n\n useEffect(() => {\n if (chat?.fullInfo && selectedChatMemberId && !selectedChatMember) {\n onScreenSelect(ManagementScreens.GroupPermissions);\n }\n }, [chat, onScreenSelect, selectedChatMember, selectedChatMemberId]);\n\n useEffect(() => {\n setPermissions((selectedChatMember?.bannedRights) || (chat?.defaultBannedRights) || {});\n setHavePermissionChanged(false);\n setIsLoading(false);\n }, [chat, selectedChatMember]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as Exclude<keyof ApiChatBannedRights, 'untilDate'>]),\n ...(name === 'sendStickers' && {\n sendGifs: getUpdatedPermissionValue(p[name]),\n }),\n }));\n setHavePermissionChanged(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!chat || !selectedChatMemberId) {\n return;\n }\n\n setIsLoading(true);\n updateChatMemberBannedRights({\n chatId: chat.id,\n userId: selectedChatMemberId,\n bannedRights: permissions,\n });\n }, [chat, selectedChatMemberId, permissions, updateChatMemberBannedRights]);\n\n const handleBanFromGroup = useCallback(() => {\n if (!chat || !selectedChatMemberId) {\n return;\n }\n\n updateChatMemberBannedRights({\n chatId: chat.id,\n userId: selectedChatMemberId,\n bannedRights: {\n viewMessages: true,\n },\n });\n }, [chat, selectedChatMemberId, updateChatMemberBannedRights]);\n\n const getControlIsDisabled = useCallback((key: Exclude<keyof ApiChatBannedRights, 'untilDate'>) => {\n if (isFormFullyDisabled) {\n return true;\n }\n\n if (!chat || !chat.defaultBannedRights) {\n return false;\n }\n\n return chat.defaultBannedRights[key];\n }, [chat, isFormFullyDisabled]);\n\n if (!selectedChatMember) {\n return undefined;\n }\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo userId={selectedChatMember.userId} />\n </ListItem>\n\n <h3 className=\"section-heading mt-4\" dir=\"auto\">{lang('UserRestrictionsCanDo')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMessages\"\n checked={!permissions.sendMessages}\n label={lang('UserRestrictionsSend')}\n blocking\n disabled={getControlIsDisabled('sendMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMedia\"\n checked={!permissions.sendMedia}\n label={lang('UserRestrictionsSendMedia')}\n blocking\n disabled={getControlIsDisabled('sendMedia')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendStickers\"\n checked={!permissions.sendStickers && !permissions.sendGifs}\n label={lang('UserRestrictionsSendStickers')}\n blocking\n disabled={getControlIsDisabled('sendStickers')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendPolls\"\n checked={!permissions.sendPolls}\n label={lang('UserRestrictionsSendPolls')}\n blocking\n disabled={getControlIsDisabled('sendPolls')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"embedLinks\"\n checked={!permissions.embedLinks}\n label={lang('UserRestrictionsEmbedLinks')}\n blocking\n disabled={getControlIsDisabled('embedLinks')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={!permissions.inviteUsers}\n label={lang('UserRestrictionsInviteUsers')}\n blocking\n disabled={getControlIsDisabled('inviteUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={!permissions.pinMessages}\n label={lang('UserRestrictionsPinMessages')}\n blocking\n disabled={getControlIsDisabled('pinMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!permissions.changeInfo}\n label={lang('UserRestrictionsChangeInfo')}\n blocking\n disabled={getControlIsDisabled('changeInfo')}\n onChange={handlePermissionChange}\n />\n </div>\n </div>\n\n {!isFormFullyDisabled && (\n <div className=\"section\">\n <ListItem icon=\"delete-user\" ripple destructive onClick={openBanConfirmationDialog}>\n {lang('UserRestrictionsBlock')}\n </ListItem>\n </div>\n )}\n </div>\n\n <FloatingActionButton\n isShown={havePermissionChanged}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n\n <ConfirmDialog\n isOpen={isBanConfirmationDialogOpen}\n onClose={closeBanConfirmationDialog}\n text=\"Are you sure you want to ban and remove this user from the group?\"\n confirmLabel=\"Remove\"\n confirmHandler={handleBanFromGroup}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, isPromotedByCurrentUser }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const isFormFullyDisabled = !(chat.isCreator || isPromotedByCurrentUser);\n\n return { chat, isFormFullyDisabled };\n },\n)(ManageGroupUserPermissions));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getGlobal, withGlobal } from '../../../global';\n\nimport { ManagementScreens } from '../../../types';\nimport type { ApiChat, ApiChatMember } from '../../../api/types';\n\nimport { getUserFullName, isChatChannel } from '../../../global/helpers';\nimport { selectChat } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onChatMemberSelect: (memberId: string, isPromotedByCurrentUser?: boolean) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n currentUserId?: string;\n isChannel: boolean;\n};\n\nconst ManageChatAdministrators: FC<OwnProps & StateProps> = ({\n chat,\n isChannel,\n currentUserId,\n onScreenSelect,\n onChatMemberSelect,\n onClose,\n isActive,\n}) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const handleRecentActionsClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupRecentActions);\n }, [onScreenSelect]);\n\n const adminMembers = useMemo(() => {\n if (!chat.fullInfo || !chat.fullInfo.adminMembers) {\n return [];\n }\n\n return chat.fullInfo.adminMembers.sort((a, b) => {\n if (a.isOwner) {\n return -1;\n } else if (b.isOwner) {\n return 1;\n }\n\n return 0;\n });\n }, [chat]);\n\n const handleAdminMemberClick = useCallback((member: ApiChatMember) => {\n onChatMemberSelect(member.userId, member.promotedByUserId === currentUserId);\n onScreenSelect(ManagementScreens.ChatAdminRights);\n }, [currentUserId, onChatMemberSelect, onScreenSelect]);\n\n const handleAddAdminClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupAddAdmins);\n }, [onScreenSelect]);\n\n const getMemberStatus = useCallback((member: ApiChatMember) => {\n if (member.isOwner) {\n return lang('ChannelCreator');\n }\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const promotedByUser = member.promotedByUserId ? usersById[member.promotedByUserId] : undefined;\n\n if (promotedByUser) {\n return lang('EditAdminPromotedBy', getUserFullName(promotedByUser));\n }\n\n return lang('ChannelAdmin');\n }, [lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem\n icon=\"recent\"\n multiline\n onClick={handleRecentActionsClick}\n >\n <span className=\"title\">{lang('EventLog')}</span>\n <span className=\"subtitle\">{lang(isChannel ? 'EventLogInfoDetailChannel' : 'EventLogInfoDetail')}</span>\n </ListItem>\n </div>\n\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <p className=\"text-muted\" dir=\"auto\">\n {isChannel\n ? 'You can add administrators to help you manage your channel.'\n : 'You can add administrators to help you manage your group.'}\n </p>\n\n {adminMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleAdminMemberClick(member)}\n >\n <PrivateChatInfo\n userId={member.userId}\n status={getMemberStatus(member)}\n forceShowSelf\n />\n </ListItem>\n ))}\n\n <FloatingActionButton\n isShown\n onClick={handleAddAdminClick}\n ariaLabel={lang('Channel.Management.AddModerator')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n\n return {\n chat,\n currentUserId: global.currentUserId,\n isChannel: isChatChannel(chat),\n };\n },\n)(ManageChatAdministrators));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiChatMember } from '../../../api/types';\nimport useLang from '../../../hooks/useLang';\nimport { selectChat } from '../../../global/selectors';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n};\n\nconst ManageGroupRecentActions: FC<OwnProps & StateProps> = ({ chat, onClose, isActive }) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const adminMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.adminMembers) {\n return [];\n }\n\n return chat.fullInfo.adminMembers.sort((a, b) => {\n if (a.isOwner) {\n return -1;\n } else if (b.isOwner) {\n return 1;\n }\n\n return 0;\n });\n }, [chat]);\n\n const getMemberStatus = useCallback((member: ApiChatMember) => {\n if (member.isOwner) {\n return lang('ChannelCreator');\n }\n\n return lang('ChannelAdmin');\n }, [lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section not-implemented\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\" dir=\"auto\">Actions</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogAllEvents')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterNewAdmins')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterNewMembers')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterChannelInfo')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterDeletedMessages')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterEditedMessages')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterLeavingMembers')}\n onChange={undefined}\n />\n </div>\n </div>\n\n <div className=\"section not-implemented\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\" dir=\"auto\">{lang('Channel.Management.Title')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogAllAdmins')}\n onChange={undefined}\n />\n </div>\n\n {adminMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable picker-list-item\"\n onClick={undefined}\n ripple\n >\n <Checkbox label=\"\" checked={!false} />\n <PrivateChatInfo\n userId={member.userId}\n status={getMemberStatus(member)}\n forceShowSelf\n />\n </ListItem>\n ))}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n\n return { chat };\n },\n)(ManageGroupRecentActions));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiChatAdminRights, ApiUser } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { selectChat } from '../../../global/selectors';\nimport { getUserFullName, isChatBasicGroup, isChatChannel } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport InputText from '../../ui/InputText';\n\ntype OwnProps = {\n chatId: string;\n selectedUserId?: string;\n isPromotedByCurrentUser?: boolean;\n isNewAdmin?: boolean;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n usersById: Record<string, ApiUser>;\n currentUserId?: string;\n isChannel: boolean;\n isFormFullyDisabled: boolean;\n defaultRights?: ApiChatAdminRights;\n};\n\nconst CUSTOM_TITLE_MAX_LENGTH = 16;\n\nconst ManageGroupAdminRights: FC<OwnProps & StateProps> = ({\n isNewAdmin,\n selectedUserId,\n defaultRights,\n onScreenSelect,\n chat,\n usersById,\n currentUserId,\n isChannel,\n isFormFullyDisabled,\n onClose,\n isActive,\n}) => {\n const { updateChatAdmin } = getActions();\n\n const [permissions, setPermissions] = useState<ApiChatAdminRights>({});\n const [isTouched, setIsTouched] = useState(Boolean(isNewAdmin));\n const [isLoading, setIsLoading] = useState(false);\n const [isDismissConfirmationDialogOpen, openDismissConfirmationDialog, closeDismissConfirmationDialog] = useFlag();\n const [customTitle, setCustomTitle] = useState('');\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const selectedChatMember = useMemo(() => {\n const selectedAdminMember = chat.fullInfo?.adminMembers?.find(({ userId }) => userId === selectedUserId);\n\n // If `selectedAdminMember` variable is filled with a value, then we have already saved the administrator,\n // so now we need to return to the list of administrators\n if (isNewAdmin && (selectedAdminMember || !selectedUserId)) {\n return undefined;\n }\n\n if (isNewAdmin) {\n const user = getGlobal().users.byId[selectedUserId!];\n\n return user ? {\n userId: user.id,\n adminRights: defaultRights,\n customTitle: lang('ChannelAdmin'),\n isOwner: false,\n promotedByUserId: undefined,\n } : undefined;\n }\n\n return selectedAdminMember;\n }, [chat.fullInfo?.adminMembers, defaultRights, isNewAdmin, lang, selectedUserId]);\n\n useEffect(() => {\n if (chat?.fullInfo && selectedUserId && !selectedChatMember) {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }\n }, [chat, onScreenSelect, selectedChatMember, selectedUserId]);\n\n useEffect(() => {\n setPermissions(selectedChatMember?.adminRights || {});\n setCustomTitle((selectedChatMember?.customTitle || '').substr(0, CUSTOM_TITLE_MAX_LENGTH));\n setIsTouched(Boolean(isNewAdmin));\n setIsLoading(false);\n }, [defaultRights, isNewAdmin, selectedChatMember]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as keyof ApiChatAdminRights]),\n }));\n setIsTouched(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!selectedUserId) {\n return;\n }\n\n setIsLoading(true);\n updateChatAdmin({\n chatId: chat.id,\n userId: selectedUserId,\n adminRights: permissions,\n customTitle,\n });\n }, [selectedUserId, updateChatAdmin, chat.id, permissions, customTitle]);\n\n const handleDismissAdmin = useCallback(() => {\n if (!selectedUserId) {\n return;\n }\n\n updateChatAdmin({\n chatId: chat.id,\n userId: selectedUserId,\n adminRights: {},\n });\n closeDismissConfirmationDialog();\n }, [chat.id, closeDismissConfirmationDialog, selectedUserId, updateChatAdmin]);\n\n const getControlIsDisabled = useCallback((key: keyof ApiChatAdminRights) => {\n if (isChatBasicGroup(chat)) {\n return false;\n }\n\n if (isFormFullyDisabled || !chat.adminRights) {\n return true;\n }\n\n return !chat.adminRights![key];\n }, [chat, isFormFullyDisabled]);\n\n const memberStatus = useMemo(() => {\n if (isNewAdmin || !selectedChatMember) {\n return undefined;\n }\n\n if (selectedChatMember.isOwner) {\n return lang('ChannelCreator');\n }\n\n const promotedByUser = selectedChatMember.promotedByUserId\n ? usersById[selectedChatMember.promotedByUserId]\n : undefined;\n\n if (promotedByUser) {\n return lang('EditAdminPromotedBy', getUserFullName(promotedByUser));\n }\n\n return lang('ChannelAdmin');\n }, [isNewAdmin, selectedChatMember, usersById, lang]);\n\n const handleCustomTitleChange = useCallback((e) => {\n const { value } = e.target;\n setCustomTitle(value);\n setIsTouched(true);\n }, []);\n\n if (!selectedChatMember) {\n return undefined;\n }\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo\n userId={selectedChatMember.userId}\n status={memberStatus}\n forceShowSelf\n />\n </ListItem>\n\n <h3 className=\"section-heading mt-4\" dir=\"auto\">{lang('EditAdminWhatCanDo')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={Boolean(permissions.changeInfo)}\n label={lang(isChannel ? 'EditAdminChangeChannelInfo' : 'EditAdminChangeGroupInfo')}\n blocking\n disabled={getControlIsDisabled('changeInfo')}\n onChange={handlePermissionChange}\n />\n </div>\n {isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"postMessages\"\n checked={Boolean(permissions.postMessages)}\n label={lang('EditAdminPostMessages')}\n blocking\n disabled={getControlIsDisabled('postMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n {isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"editMessages\"\n checked={Boolean(permissions.editMessages)}\n label={lang('EditAdminEditMessages')}\n blocking\n disabled={getControlIsDisabled('editMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"deleteMessages\"\n checked={Boolean(permissions.deleteMessages)}\n label={lang(isChannel ? 'EditAdminDeleteMessages' : 'EditAdminGroupDeleteMessages')}\n blocking\n disabled={getControlIsDisabled('deleteMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"banUsers\"\n checked={Boolean(permissions.banUsers)}\n label={lang('EditAdminBanUsers')}\n blocking\n disabled={getControlIsDisabled('banUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={Boolean(permissions.inviteUsers)}\n label={lang('EditAdminAddUsers')}\n blocking\n disabled={getControlIsDisabled('inviteUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={Boolean(permissions.pinMessages)}\n label={lang('EditAdminPinMessages')}\n blocking\n disabled={getControlIsDisabled('pinMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"addAdmins\"\n checked={Boolean(permissions.addAdmins)}\n label={lang('EditAdminAddAdmins')}\n blocking\n disabled={getControlIsDisabled('addAdmins')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"manageCall\"\n checked={Boolean(permissions.manageCall)}\n label={lang('StartVoipChatPermission')}\n blocking\n disabled={getControlIsDisabled('manageCall')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"anonymous\"\n checked={Boolean(permissions.anonymous)}\n label={lang('EditAdminSendAnonymously')}\n blocking\n disabled={getControlIsDisabled('anonymous')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n\n {isFormFullyDisabled && (\n <p className=\"section-info mb-4\" dir=\"auto\">\n {lang('Channel.EditAdmin.CannotEdit')}\n </p>\n )}\n\n {!isChannel && (\n <InputText\n id=\"admin-title\"\n label={lang('EditAdminRank')}\n onChange={handleCustomTitleChange}\n value={customTitle}\n disabled={isFormFullyDisabled}\n maxLength={CUSTOM_TITLE_MAX_LENGTH}\n />\n )}\n\n {currentUserId !== selectedUserId && !isFormFullyDisabled && !isNewAdmin && (\n <ListItem icon=\"delete\" ripple destructive onClick={openDismissConfirmationDialog}>\n {lang('EditAdminRemoveAdmin')}\n </ListItem>\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isTouched}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n\n {!isNewAdmin && (\n <ConfirmDialog\n isOpen={isDismissConfirmationDialogOpen}\n onClose={closeDismissConfirmationDialog}\n text=\"Are you sure you want to dismiss this admin?\"\n confirmLabel={lang('Channel.Admin.Dismiss')}\n confirmHandler={handleDismissAdmin}\n confirmIsDestructive\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, isPromotedByCurrentUser }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { byId: usersById } = global.users;\n const { currentUserId } = global;\n const isChannel = isChatChannel(chat);\n const isFormFullyDisabled = !(chat.isCreator || isPromotedByCurrentUser);\n\n return {\n chat,\n usersById,\n currentUserId,\n isChannel,\n isFormFullyDisabled,\n defaultRights: chat.adminRights,\n };\n },\n)(ManageGroupAdminRights));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { ApiChatMember, ApiUserStatus } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { unique } from '../../../util/iteratees';\nimport { selectChat } from '../../../global/selectors';\nimport {\n sortUserIds, isChatChannel, filterUsersByName, sortChatIds, isUserBot,\n} from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useInfiniteScroll from '../../../hooks/useInfiniteScroll';\nimport useKeyboardListNavigation from '../../../hooks/useKeyboardListNavigation';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport NothingFound from '../../common/NothingFound';\nimport ListItem from '../../ui/ListItem';\nimport InputText from '../../ui/InputText';\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Loading from '../../ui/Loading';\n\ntype OwnProps = {\n chatId: string;\n isActive: boolean;\n noAdmins?: boolean;\n onClose: NoneToVoidFunction;\n onScreenSelect?: (screen: ManagementScreens) => void;\n onChatMemberSelect?: (memberId: string, isPromotedByCurrentUser?: boolean) => void;\n};\n\ntype StateProps = {\n userStatusesById: Record<string, ApiUserStatus>;\n members?: ApiChatMember[];\n adminMembers?: ApiChatMember[];\n isChannel?: boolean;\n localContactIds?: string[];\n searchQuery?: string;\n isSearching?: boolean;\n localUserIds?: string[];\n globalUserIds?: string[];\n serverTimeOffset: number;\n};\n\nconst ManageGroupMembers: FC<OwnProps & StateProps> = ({\n noAdmins,\n members,\n adminMembers,\n userStatusesById,\n isChannel,\n isActive,\n globalUserIds,\n localContactIds,\n localUserIds,\n isSearching,\n searchQuery,\n serverTimeOffset,\n onClose,\n onScreenSelect,\n onChatMemberSelect,\n}) => {\n const { openChat, setUserSearchQuery, closeManagement } = getActions();\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const adminIds = useMemo(() => {\n return noAdmins ? adminMembers?.map(({ userId }) => userId) || [] : [];\n }, [adminMembers, noAdmins]);\n\n const memberIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n if (!members || !usersById) {\n return [];\n }\n\n const userIds = sortUserIds(\n members.map(({ userId }) => userId),\n usersById,\n userStatusesById,\n undefined,\n serverTimeOffset,\n );\n\n return noAdmins ? userIds.filter((userId) => !adminIds.includes(userId)) : userIds;\n }, [members, userStatusesById, serverTimeOffset, noAdmins, adminIds]);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const chatsById = getGlobal().chats.byId;\n const shouldUseSearchResults = Boolean(searchQuery);\n const listedIds = !shouldUseSearchResults\n ? memberIds\n : (localContactIds ? filterUsersByName(localContactIds, usersById, searchQuery) : []);\n\n return sortChatIds(\n unique([\n ...listedIds,\n ...(shouldUseSearchResults ? localUserIds || [] : []),\n ...(shouldUseSearchResults ? globalUserIds || [] : []),\n ]).filter((contactId) => {\n const user = usersById[contactId];\n if (!user) {\n return true;\n }\n\n return (isChannel || user.canBeInvitedToGroup || !isUserBot(user))\n && (!noAdmins || !adminIds.includes(contactId));\n }),\n chatsById,\n true,\n );\n }, [memberIds, localContactIds, searchQuery, localUserIds, globalUserIds, isChannel, noAdmins, adminIds]);\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, displayedIds, Boolean(searchQuery));\n\n const handleMemberClick = useCallback((id: string) => {\n if (noAdmins) {\n onChatMemberSelect!(id, false);\n onScreenSelect!(ManagementScreens.ChatNewAdminRights);\n } else {\n closeManagement();\n openChat({ id });\n }\n }, [closeManagement, noAdmins, onChatMemberSelect, onScreenSelect, openChat]);\n\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setUserSearchQuery({ query: e.target.value });\n }, [setUserSearchQuery]);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isActive, (index) => {\n if (viewportIds && viewportIds.length > 0) {\n handleMemberClick(viewportIds[index === -1 ? 0 : index]);\n }\n }, '.ListItem-button', true);\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n function renderSearchField() {\n return (\n <div className=\"Management__filter\" dir={lang.isRtl ? 'rtl' : undefined}>\n <InputText\n ref={inputRef}\n value={searchQuery}\n onChange={handleFilterChange}\n placeholder={lang('Search')}\n />\n </div>\n );\n }\n\n return (\n <div className=\"Management\">\n {noAdmins && renderSearchField()}\n <div className=\"custom-scroll\">\n <div className=\"section\">\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"picker-list custom-scroll\"\n items={displayedIds}\n onLoadMore={getMore}\n noScrollRestore={Boolean(searchQuery)}\n ref={containerRef}\n onKeyDown={handleKeyDown}\n >\n {viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable scroll-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleMemberClick(id)}\n >\n <PrivateChatInfo userId={id} forceShowSelf />\n </ListItem>\n ))}\n </InfiniteScroll>\n ) : !isSearching && viewportIds && !viewportIds.length ? (\n <NothingFound\n teactOrderKey={0}\n key=\"nothing-found\"\n text={isChannel ? 'No subscribers found' : 'No members found'}\n />\n ) : (\n <Loading />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { statusesById: userStatusesById } = global.users;\n const members = chat?.fullInfo?.members;\n const adminMembers = chat?.fullInfo?.adminMembers;\n const isChannel = chat && isChatChannel(chat);\n const { userIds: localContactIds } = global.contactList || {};\n\n const {\n query: searchQuery,\n fetchingStatus,\n globalUserIds,\n localUserIds,\n } = global.userSearch;\n\n return {\n members,\n adminMembers,\n userStatusesById,\n isChannel,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus,\n globalUserIds,\n localUserIds,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageGroupMembers));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { ApiChatMember, ApiUser, ApiUserStatus } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { selectChat } from '../../../global/selectors';\nimport { sortUserIds, isChatChannel } from '../../../global/helpers';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport ListItem from '../../ui/ListItem';\nimport NothingFound from '../../common/NothingFound';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onChatMemberSelect: (memberId: string) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n usersById: Record<string, ApiUser>;\n userStatusesById: Record<string, ApiUserStatus>;\n members?: ApiChatMember[];\n isChannel?: boolean;\n serverTimeOffset: number;\n};\n\nconst ManageGroupUserPermissionsCreate: FC<OwnProps & StateProps> = ({\n usersById,\n userStatusesById,\n members,\n isChannel,\n onScreenSelect,\n onChatMemberSelect,\n onClose,\n isActive,\n serverTimeOffset,\n}) => {\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const memberIds = useMemo(() => {\n if (!members || !usersById) {\n return undefined;\n }\n\n return sortUserIds(\n members.filter((member) => !member.isOwner).map(({ userId }) => userId),\n usersById,\n userStatusesById,\n undefined,\n serverTimeOffset,\n );\n }, [members, serverTimeOffset, usersById, userStatusesById]);\n\n const handleExceptionMemberClick = useCallback((memberId: string) => {\n onChatMemberSelect(memberId);\n onScreenSelect(ManagementScreens.GroupUserPermissions);\n }, [onChatMemberSelect, onScreenSelect]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" teactFastList>\n {memberIds ? (\n memberIds.map((id, i) => (\n <ListItem\n key={id}\n teactOrderKey={i}\n className=\"chat-item-clickable scroll-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleExceptionMemberClick(id)}\n >\n <PrivateChatInfo userId={id} forceShowSelf />\n </ListItem>\n ))\n ) : (\n <NothingFound\n teactOrderKey={0}\n key=\"nothing-found\"\n text={isChannel ? 'No subscribers found' : 'No members found'}\n />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { byId: usersById, statusesById: userStatusesById } = global.users;\n const members = chat?.fullInfo?.members;\n const isChannel = chat && isChatChannel(chat);\n\n return {\n members,\n usersById,\n userStatusesById,\n isChannel,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageGroupUserPermissionsCreate));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiExportedInvite } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { STICKER_SIZE_INVITES } from '../../../config';\nimport { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useLang from '../../../hooks/useLang';\nimport { formatCountdown, MILLISECONDS_IN_DAY } from '../../../util/dateFormat';\nimport useInterval from '../../../hooks/useInterval';\nimport useForceUpdate from '../../../hooks/useForceUpdate';\nimport { selectChat } from '../../../global/selectors';\nimport { copyTextToClipboard } from '../../../util/clipboard';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { getServerTime } from '../../../util/serverTime';\nimport useFlag from '../../../hooks/useFlag';\nimport { isChatChannel } from '../../../global/helpers';\n\nimport ListItem from '../../ui/ListItem';\nimport NothingFound from '../../common/NothingFound';\nimport Button from '../../ui/Button';\nimport DropdownMenu from '../../ui/DropdownMenu';\nimport MenuItem from '../../ui/MenuItem';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport AnimatedIcon from '../../common/AnimatedIcon';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n onScreenSelect: (screen: ManagementScreens) => void;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n isChannel?: boolean;\n exportedInvites?: ApiExportedInvite[];\n revokedExportedInvites?: ApiExportedInvite[];\n serverTimeOffset: number;\n};\n\nconst BULLET = '\\u2022';\n\nfunction inviteComparator(i1: ApiExportedInvite, i2: ApiExportedInvite) {\n const { isPermanent: i1IsPermanent, usage: i1Usage = 0, date: i1Date } = i1;\n const { isPermanent: i2IsPermanent, usage: i2Usage = 0, date: i2Date } = i2;\n if (i1IsPermanent || i2IsPermanent) return Number(i1IsPermanent) - Number(i2IsPermanent);\n if (i1Usage || i2Usage) return i2Usage - i1Usage;\n return i2Date - i1Date;\n}\n\nconst ManageInvites: FC<OwnProps & StateProps> = ({\n chatId,\n chat,\n exportedInvites,\n revokedExportedInvites,\n isActive,\n isChannel,\n serverTimeOffset,\n onClose,\n onScreenSelect,\n}) => {\n const {\n setEditingExportedInvite,\n showNotification,\n editExportedChatInvite,\n deleteExportedChatInvite,\n deleteRevokedExportedChatInvites,\n setOpenedInviteInfo,\n } = getActions();\n\n const lang = useLang();\n\n const [isDeleteRevokeAllDialogOpen, openDeleteRevokeAllDialog, closeDeleteRevokeAllDialog] = useFlag();\n const [isRevokeDialogOpen, openRevokeDialog, closeRevokeDialog] = useFlag();\n const [revokingInvite, setRevokingInvite] = useState<ApiExportedInvite | undefined>();\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const [deletingInvite, setDeletingInvite] = useState<ApiExportedInvite | undefined>();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const hasDetailedCountdown = useMemo(() => {\n if (!exportedInvites) return undefined;\n return exportedInvites\n .some(({ expireDate }) => (\n expireDate && (expireDate - getServerTime(serverTimeOffset) < MILLISECONDS_IN_DAY / 1000)\n ));\n }, [exportedInvites, serverTimeOffset]);\n const forceUpdate = useForceUpdate();\n useInterval(() => {\n forceUpdate();\n }, hasDetailedCountdown ? 1000 : undefined);\n\n const primaryInvite = exportedInvites?.find(({ isPermanent }) => isPermanent);\n const primaryInviteLink = chat?.username ? `t.me/${chat.username}` : primaryInvite?.link;\n const temporalInvites = useMemo(() => {\n const invites = chat?.username ? exportedInvites : exportedInvites?.filter(({ isPermanent }) => !isPermanent);\n return invites?.sort(inviteComparator);\n }, [chat?.username, exportedInvites]);\n\n const editInvite = (invite: ApiExportedInvite) => {\n setEditingExportedInvite({ chatId, invite });\n onScreenSelect(ManagementScreens.EditInvite);\n };\n\n const revokeInvite = useCallback((invite: ApiExportedInvite) => {\n const {\n link, title, isRequestNeeded, expireDate, usageLimit,\n } = invite;\n editExportedChatInvite({\n chatId,\n link,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n isRevoked: true,\n });\n }, [chatId, editExportedChatInvite]);\n\n const askToRevoke = useCallback((invite: ApiExportedInvite) => {\n setRevokingInvite(invite);\n openRevokeDialog();\n }, [openRevokeDialog]);\n\n const handleRevoke = useCallback(() => {\n if (!revokingInvite) return;\n revokeInvite(revokingInvite);\n setRevokingInvite(undefined);\n closeRevokeDialog();\n }, [closeRevokeDialog, revokeInvite, revokingInvite]);\n\n const handleCreateNewClick = useCallback(() => {\n onScreenSelect(ManagementScreens.EditInvite);\n }, [onScreenSelect]);\n\n const handlePrimaryRevoke = useCallback(() => {\n if (primaryInvite) {\n askToRevoke(primaryInvite);\n }\n }, [askToRevoke, primaryInvite]);\n\n const handleDeleteAllRevoked = useCallback(() => {\n deleteRevokedExportedChatInvites({ chatId });\n closeDeleteRevokeAllDialog();\n }, [chatId, closeDeleteRevokeAllDialog, deleteRevokedExportedChatInvites]);\n\n const showInviteInfo = useCallback((invite: ApiExportedInvite) => {\n setOpenedInviteInfo({ chatId, invite });\n onScreenSelect(ManagementScreens.InviteInfo);\n }, [chatId, onScreenSelect, setOpenedInviteInfo]);\n\n const deleteInvite = useCallback((invite: ApiExportedInvite) => {\n deleteExportedChatInvite({ chatId, link: invite.link });\n }, [chatId, deleteExportedChatInvite]);\n\n const askToDelete = useCallback((invite: ApiExportedInvite) => {\n setDeletingInvite(invite);\n openDeleteDialog();\n }, [openDeleteDialog]);\n\n const handleDelete = useCallback(() => {\n if (!deletingInvite) return;\n deleteInvite(deletingInvite);\n setDeletingInvite(undefined);\n closeDeleteDialog();\n }, [closeDeleteDialog, deleteInvite, deletingInvite]);\n\n const copyLink = useCallback((link: string) => {\n copyTextToClipboard(link);\n showNotification({\n message: lang('LinkCopied'),\n });\n }, [lang, showNotification]);\n\n const handleCopyPrimaryClicked = useCallback(() => {\n copyLink(primaryInviteLink!);\n }, [copyLink, primaryInviteLink]);\n\n const prepareUsageText = (invite: ApiExportedInvite) => {\n const {\n usage = 0, usageLimit, expireDate, isPermanent, requested, isRevoked,\n } = invite;\n let text = '';\n if (!isRevoked && usageLimit && usage < usageLimit) {\n text = lang('CanJoin', usageLimit - usage);\n } else if (usage) {\n text = lang('PeopleJoined', usage);\n } else {\n text = lang('NoOneJoined');\n }\n\n if (isRevoked) {\n text += ` ${BULLET} ${lang('Revoked')}`;\n return text;\n }\n\n if (requested) {\n text += ` ${BULLET} ${lang('JoinRequests', requested)}`;\n }\n\n if (usageLimit !== undefined && usage === usageLimit) {\n text += ` ${BULLET} ${lang('LinkLimitReached')}`;\n } else if (expireDate) {\n const diff = (expireDate - getServerTime(serverTimeOffset)) * 1000;\n text += ` ${BULLET} `;\n if (diff > 0) {\n text += lang('InviteLink.ExpiresIn', formatCountdown(lang, diff));\n } else {\n text += lang('InviteLink.Expired');\n }\n } else if (isPermanent) {\n text += ` ${BULLET} ${lang('Permanent')}`;\n }\n\n return text;\n };\n\n const prepareContextActions = (invite: ApiExportedInvite) => {\n const actions = [];\n actions.push({\n title: lang('Copy'),\n icon: 'copy',\n handler: () => copyLink(invite.link),\n });\n\n if (!invite.isPermanent && !invite.isRevoked) {\n actions.push({\n title: lang('Edit'),\n icon: 'edit',\n handler: () => editInvite(invite),\n });\n }\n\n if (!invite.isRevoked) {\n actions.push({\n title: lang('RevokeButton'),\n icon: 'delete',\n handler: () => askToRevoke(invite),\n destructive: true,\n });\n } else {\n actions.push({\n title: lang('DeleteLink'),\n icon: 'delete',\n handler: () => askToDelete(invite),\n destructive: true,\n });\n }\n return actions;\n };\n\n const PrimaryLinkMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"Actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n return (\n <div className=\"Management ManageInvites\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AnimatedIcon\n tgsUrl={LOCAL_TGS_URLS.Invite}\n size={STICKER_SIZE_INVITES}\n className=\"section-icon\"\n />\n <p className=\"text-muted\">{isChannel ? lang('PrimaryLinkHelpChannel') : lang('PrimaryLinkHelp')}</p>\n </div>\n {primaryInviteLink && (\n <div className=\"section\">\n <p className=\"text-muted\">\n {chat?.username ? lang('PublicLink') : lang('lng_create_permanent_link_title')}\n </p>\n <div className=\"primary-link\">\n <input\n className=\"form-control primary-link-input\"\n value={primaryInviteLink}\n readOnly\n onClick={handleCopyPrimaryClicked}\n />\n <DropdownMenu\n className=\"primary-link-more-menu\"\n trigger={PrimaryLinkMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"copy\" onClick={handleCopyPrimaryClicked}>{lang('Copy')}</MenuItem>\n {!chat?.username && (\n <MenuItem icon=\"delete\" onClick={handlePrimaryRevoke} destructive>{lang('RevokeButton')}</MenuItem>\n )}\n </DropdownMenu>\n </div>\n <Button onClick={handleCopyPrimaryClicked}>{lang('CopyLink')}</Button>\n </div>\n )}\n <div className=\"section\" teactFastList>\n <Button isText key=\"create\" className=\"create-link\" onClick={handleCreateNewClick}>\n {lang('CreateNewLink')}\n </Button>\n {(!temporalInvites || !temporalInvites.length) && <NothingFound text=\"No links found\" key=\"nothing\" />}\n {temporalInvites?.map((invite) => (\n <ListItem\n icon=\"link\"\n secondaryIcon=\"more\"\n multiline\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => showInviteInfo(invite)}\n contextActions={prepareContextActions(invite)}\n key={invite.link}\n >\n <span className=\"title invite-title\">{invite.title || invite.link}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {prepareUsageText(invite)}\n </span>\n </ListItem>\n ))}\n <p className=\"text-muted hint\" key=\"links-hint\">{lang('ManageLinksInfoHelp')}</p>\n </div>\n {revokedExportedInvites && Boolean(revokedExportedInvites.length) && (\n <div className=\"section\" teactFastList>\n <p className=\"text-muted\" key=\"title\">{lang('RevokedLinks')}</p>\n <ListItem\n icon=\"delete\"\n destructive\n key=\"delete\"\n onClick={openDeleteRevokeAllDialog}\n >\n <span className=\"title\">{lang('DeleteAllRevokedLinks')}</span>\n </ListItem>\n {revokedExportedInvites?.map((invite) => (\n <ListItem\n icon=\"link\"\n secondaryIcon=\"more\"\n multiline\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => showInviteInfo(invite)}\n contextActions={prepareContextActions(invite)}\n key={invite.link}\n >\n <span className=\"title\">{invite.title || invite.link}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {prepareUsageText(invite)}\n </span>\n </ListItem>\n ))}\n </div>\n )}\n </div>\n <ConfirmDialog\n isOpen={isDeleteRevokeAllDialogOpen}\n onClose={closeDeleteRevokeAllDialog}\n title={lang('DeleteAllRevokedLinks')}\n text={lang('DeleteAllRevokedLinkHelp')}\n confirmIsDestructive\n confirmLabel={lang('DeleteAll')}\n confirmHandler={handleDeleteAllRevoked}\n />\n <ConfirmDialog\n isOpen={isRevokeDialogOpen}\n onClose={closeRevokeDialog}\n title={lang('RevokeLink')}\n text={lang('RevokeAlert')}\n confirmIsDestructive\n confirmLabel={lang('RevokeButton')}\n confirmHandler={handleRevoke}\n />\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n title={lang('DeleteLink')}\n text={lang('DeleteLinkHelp')}\n confirmIsDestructive\n confirmLabel={lang('Delete')}\n confirmHandler={handleDelete}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { invites, revokedInvites } = global.management.byChatId[chatId];\n const chat = selectChat(global, chatId);\n const isChannel = chat && isChatChannel(chat);\n\n return {\n exportedInvites: invites,\n revokedExportedInvites: revokedInvites,\n chat,\n serverTimeOffset: global.serverTimeOffset,\n isChannel,\n };\n },\n)(ManageInvites));\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useState } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiExportedInvite } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useLang from '../../../hooks/useLang';\nimport { formatFullDate, formatTime } from '../../../util/dateFormat';\nimport useFlag from '../../../hooks/useFlag';\nimport { getServerTime } from '../../../util/serverTime';\n\nimport Checkbox from '../../ui/Checkbox';\nimport InputText from '../../ui/InputText';\nimport RadioGroup from '../../ui/RadioGroup';\nimport Button from '../../ui/Button';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport useOnChange from '../../../hooks/useOnChange';\nimport CalendarModal from '../../common/CalendarModal';\n\nconst DEFAULT_USAGE_LIMITS = [1, 10, 100];\nconst DEFAULT_EXPIRE_DATE = {\n hour: 3600000,\n day: 86400000,\n week: 604800000,\n};\nconst DEFAULT_CUSTOM_EXPIRE_DATE = DEFAULT_EXPIRE_DATE.hour;\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n onScreenSelect: (screen: ManagementScreens) => void;\n isActive: boolean;\n};\n\ntype StateProps = {\n editingInvite?: ApiExportedInvite;\n serverTimeOffset: number;\n};\n\nconst ManageInvite: FC<OwnProps & StateProps> = ({\n chatId,\n editingInvite,\n isActive,\n serverTimeOffset,\n onClose,\n onScreenSelect,\n}) => {\n const { editExportedChatInvite, exportChatInvite } = getActions();\n\n const lang = useLang();\n const [isCalendarOpened, openCalendar, closeCalendar] = useFlag();\n const [isRequestNeeded, setIsRequestNeeded] = useState(false);\n const [title, setTitle] = useState('');\n const [customExpireDate, setCustomExpireDate] = useState<number>(Date.now() + DEFAULT_CUSTOM_EXPIRE_DATE);\n const [selectedExpireOption, setSelectedExpireOption] = useState('unlimited');\n const [customUsageLimit, setCustomUsageLimit] = useState<number | undefined>(10);\n const [selectedUsageOption, setSelectedUsageOption] = useState('0');\n const [isSubmitBlocked, setIsSubmitBlocked] = useState(false);\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n useOnChange(([oldEditingInvite]) => {\n if (oldEditingInvite === editingInvite) return;\n if (!editingInvite) {\n setTitle('');\n setSelectedExpireOption('unlimited');\n setSelectedUsageOption('0');\n setCustomExpireDate(getServerTime(serverTimeOffset) * 1000 + DEFAULT_CUSTOM_EXPIRE_DATE);\n setCustomUsageLimit(10);\n setIsRequestNeeded(false);\n } else {\n const {\n title: editingTitle, usageLimit, expireDate, isRequestNeeded: editingIsRequestNeeded,\n } = editingInvite;\n if (editingTitle) setTitle(editingTitle);\n if (usageLimit) {\n setSelectedUsageOption(DEFAULT_USAGE_LIMITS.includes(usageLimit) ? usageLimit.toString() : 'custom');\n setCustomUsageLimit(usageLimit);\n }\n if (expireDate) {\n const minSafeDate = getServerTime(serverTimeOffset) + DEFAULT_CUSTOM_EXPIRE_DATE;\n setSelectedExpireOption('custom');\n setCustomExpireDate(Math.max(expireDate, minSafeDate) * 1000);\n }\n if (editingIsRequestNeeded) {\n setIsRequestNeeded(true);\n }\n }\n }, [editingInvite, serverTimeOffset]);\n\n const handleIsRequestChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsRequestNeeded(e.target.checked);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n }, []);\n\n const handleCustomUsageLimitChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setCustomUsageLimit(Number.parseInt(e.target.value, 10));\n }, []);\n\n const handleExpireDateChange = useCallback((date: Date) => {\n setCustomExpireDate(date.getTime());\n closeCalendar();\n }, [closeCalendar]);\n\n const handleSaveClick = useCallback(() => {\n setIsSubmitBlocked(true);\n const usageLimit = selectedUsageOption === 'custom' ? customUsageLimit : selectedUsageOption;\n let expireDate;\n switch (selectedExpireOption) {\n case 'custom':\n expireDate = getServerTime(serverTimeOffset) + (customExpireDate - Date.now()) / 1000;\n break;\n case 'hour':\n case 'day':\n case 'week':\n expireDate = getServerTime(serverTimeOffset) + DEFAULT_EXPIRE_DATE[selectedExpireOption] / 1000;\n break;\n case 'unlimited':\n expireDate = 0;\n break;\n default:\n expireDate = undefined;\n }\n\n if (editingInvite) {\n editExportedChatInvite({\n link: editingInvite.link,\n chatId,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n });\n } else {\n exportChatInvite({\n chatId,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n });\n }\n onScreenSelect(ManagementScreens.Invites);\n }, [\n chatId, customExpireDate, customUsageLimit, editExportedChatInvite, editingInvite,\n exportChatInvite, isRequestNeeded, selectedExpireOption, selectedUsageOption, title, onScreenSelect,\n serverTimeOffset,\n ]);\n\n return (\n <div className=\"Management ManageInvite\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <Checkbox\n label={lang('ApproveNewMembers')}\n subLabel={lang('ApproveNewMembersDescription')}\n checked={isRequestNeeded}\n onChange={handleIsRequestChange}\n />\n </div>\n <div className=\"section\">\n <InputText\n className=\"link-name\"\n placeholder={lang('LinkNameHint')}\n value={title}\n onChange={handleTitleChange}\n />\n <p className=\"text-muted hint\">{lang('LinkNameHelp')}</p>\n </div>\n <div className=\"section\">\n <div className=\"section-header\">{lang('LimitByPeriod')}</div>\n <RadioGroup\n name=\"expireOptions\"\n options={[\n {\n value: 'hour',\n label: lang('Hours', 1),\n },\n {\n value: 'day',\n label: lang('Days', 1),\n },\n {\n value: 'week',\n label: lang('Weeks', 1),\n },\n {\n value: 'unlimited',\n label: lang('NoLimit'),\n },\n {\n value: 'custom',\n label: lang('lng_group_invite_expire_custom'),\n },\n ]}\n onChange={setSelectedExpireOption}\n selected={selectedExpireOption}\n />\n {selectedExpireOption === 'custom' && (\n <Button className=\"expire-limit\" isText onClick={openCalendar}>\n {formatFullDate(lang, customExpireDate)} {formatTime(lang, customExpireDate)}\n </Button>\n )}\n <p className=\"text-muted hint\">{lang('TimeLimitHelp')}</p>\n </div>\n {!isRequestNeeded && (\n <div className=\"section\">\n <div className=\"section-header\">{lang('LimitNumberOfUses')}</div>\n <RadioGroup\n name=\"usageOptions\"\n options={[\n ...DEFAULT_USAGE_LIMITS.map((n) => ({ value: n.toString(), label: n })),\n {\n value: '0',\n label: lang('NoLimit'),\n },\n {\n value: 'custom',\n label: lang('lng_group_invite_usage_custom'),\n },\n ]}\n onChange={setSelectedUsageOption}\n selected={selectedUsageOption}\n />\n {selectedUsageOption === 'custom' && (\n <input\n className=\"form-control usage-limit\"\n type=\"number\"\n min=\"1\"\n max=\"99999\"\n value={customUsageLimit}\n onChange={handleCustomUsageLimitChange}\n />\n )}\n <p className=\"text-muted hint\">{lang('UsesLimitHelp')}</p>\n </div>\n )}\n <FloatingActionButton\n isShown\n onClick={handleSaveClick}\n disabled={isSubmitBlocked}\n ariaLabel={editingInvite ? lang('SaveLink') : lang('CreateLink')}\n >\n <i className=\"icon-check\" />\n </FloatingActionButton>\n </div>\n <CalendarModal\n isOpen={isCalendarOpened}\n isFutureMode\n withTimePicker\n onClose={closeCalendar}\n onSubmit={handleExpireDateChange}\n selectedAt={customExpireDate}\n submitButtonLabel={lang('Save')}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { editingInvite } = global.management.byChatId[chatId];\n\n return {\n editingInvite,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageInvite));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiAvailableReaction, ApiChat } from '../../../api/types';\n\nimport { selectChat } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport Checkbox from '../../ui/Checkbox';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n availableReactions?: ApiAvailableReaction[];\n enabledReactions?: string[];\n};\n\nconst ManageReactions: FC<OwnProps & StateProps> = ({\n availableReactions,\n enabledReactions,\n chat,\n isActive,\n onClose,\n}) => {\n const { setChatEnabledReactions } = getActions();\n\n const lang = useLang();\n const [isTouched, setIsTouched] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [localEnabledReactions, setLocalEnabledReactions] = useState(enabledReactions || []);\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const handleSaveReactions = useCallback(() => {\n if (!chat) return;\n setIsLoading(true);\n\n setChatEnabledReactions({\n chatId: chat.id,\n enabledReactions: localEnabledReactions,\n });\n }, [chat, localEnabledReactions, setChatEnabledReactions]);\n\n useEffect(() => {\n if (enabledReactions) {\n setIsLoading(false);\n setIsTouched(false);\n setLocalEnabledReactions(enabledReactions);\n }\n }, [enabledReactions]);\n\n const handleReactionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (!chat || !availableReactions) return;\n\n const { name, checked } = e.currentTarget;\n const newEnabledReactions = name === 'all' ? (checked ? availableReactions.map((l) => l.reaction) : [])\n : (!checked\n ? localEnabledReactions.filter((l) => l !== name)\n : [...localEnabledReactions, name]);\n\n setLocalEnabledReactions(newEnabledReactions);\n setIsTouched(true);\n }, [availableReactions, chat, localEnabledReactions]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"all\"\n checked={!localEnabledReactions || localEnabledReactions.length > 0}\n label={lang('EnableReactions')}\n onChange={handleReactionChange}\n />\n </div>\n {availableReactions?.filter((l) => !l.isInactive).map(({ reaction, title }) => (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name={reaction}\n checked={!localEnabledReactions || localEnabledReactions?.includes(reaction)}\n disabled={localEnabledReactions?.length === 0}\n label={(\n <div className=\"Reaction\">\n <ReactionStaticEmoji reaction={reaction} />\n {title}\n </div>\n )}\n onChange={handleReactionChange}\n />\n </div>\n ))}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isTouched}\n onClick={handleSaveReactions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n\n return {\n enabledReactions: chat.fullInfo?.enabledReactions,\n availableReactions: global.availableReactions,\n chat,\n };\n },\n)(ManageReactions));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChatInviteImporter, ApiExportedInvite, ApiUser } from '../../../api/types';\n\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useLang from '../../../hooks/useLang';\nimport { copyTextToClipboard } from '../../../util/clipboard';\nimport { getServerTime } from '../../../util/serverTime';\nimport { formatFullDate, formatMediaDateTime, formatTime } from '../../../util/dateFormat';\nimport { isChatChannel } from '../../../global/helpers';\nimport { selectChat } from '../../../global/selectors';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport ListItem from '../../ui/ListItem';\nimport Button from '../../ui/Button';\nimport Spinner from '../../ui/Spinner';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n invite?: ApiExportedInvite;\n importers?: ApiChatInviteImporter[];\n requesters?: ApiChatInviteImporter[];\n admin?: ApiUser;\n isChannel?: boolean;\n serverTimeOffset: number;\n};\n\nconst ManageInviteInfo: FC<OwnProps & StateProps> = ({\n chatId,\n invite,\n importers,\n requesters,\n isChannel,\n isActive,\n serverTimeOffset,\n onClose,\n}) => {\n const {\n showNotification,\n loadChatInviteImporters,\n loadChatInviteRequesters,\n openChat,\n } = getActions();\n\n const lang = useLang();\n const {\n usage = 0, usageLimit, link, adminId,\n } = invite || {};\n const expireDate = invite?.expireDate && (invite.expireDate - getServerTime(serverTimeOffset)) * 1000 + Date.now();\n const isExpired = ((invite?.expireDate || 0) - getServerTime(serverTimeOffset)) < 0;\n\n useEffect(() => {\n if (link) {\n loadChatInviteImporters({ chatId, link });\n loadChatInviteRequesters({ chatId, link });\n }\n }, [chatId, link, loadChatInviteImporters, loadChatInviteRequesters]);\n\n const handleCopyClicked = useCallback(() => {\n copyTextToClipboard(invite!.link);\n showNotification({\n message: lang('LinkCopied'),\n });\n }, [invite, lang, showNotification]);\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const renderImporters = () => {\n if (!importers?.length && requesters?.length) return undefined;\n if (!importers) return <Spinner />;\n return (\n <div className=\"section\">\n <p>{importers.length ? lang('PeopleJoined', usage) : lang('NoOneJoined')}</p>\n <p className=\"text-muted\">\n {!importers.length && (\n usageLimit ? lang('PeopleCanJoinViaLinkCount', usageLimit - usage) : lang('NoOneJoinedYet')\n )}\n {importers.map((importer) => (\n <ListItem\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openChat({ id: importer.userId })}\n >\n <PrivateChatInfo\n userId={importer.userId}\n status={formatMediaDateTime(lang, importer.date * 1000, true)}\n forceShowSelf\n />\n </ListItem>\n ))}\n </p>\n </div>\n );\n };\n\n const renderRequesters = () => {\n if (invite?.isRevoked) return undefined;\n if (!requesters && importers) return <Spinner />;\n if (!requesters?.length) return undefined;\n return (\n <div className=\"section\">\n <p>{isChannel ? lang('SubscribeRequests') : lang('MemberRequests')}</p>\n <p className=\"text-muted\">\n {requesters.map((requester) => (\n <ListItem\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openChat({ id: requester.userId })}\n >\n <PrivateChatInfo\n userId={requester.userId}\n status={formatMediaDateTime(lang, requester.date * 1000, true)}\n forceShowSelf\n />\n </ListItem>\n ))}\n </p>\n </div>\n );\n };\n\n return (\n <div className=\"Management ManageInviteInfo\">\n <div className=\"custom-scroll\">\n {!invite && (\n <p className=\"text-muted\">{lang('Loading')}</p>\n )}\n {invite && (\n <>\n <div className=\"section\">\n <h3 className=\"link-title\">{invite.title || invite.link}</h3>\n <input\n className=\"form-control\"\n value={invite.link}\n readOnly\n onClick={handleCopyClicked}\n />\n <Button className=\"copy-link\" onClick={handleCopyClicked}>{lang('CopyLink')}</Button>\n {expireDate && (\n <p className=\"text-muted\">\n {isExpired\n ? lang('ExpiredLink')\n : lang('LinkExpiresIn', `${formatFullDate(lang, expireDate)} ${formatTime(lang, expireDate)}`)}\n </p>\n )}\n </div>\n {adminId && (\n <div className=\"section\">\n <p>{lang('LinkCreatedeBy')}</p>\n <ListItem\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openChat({ id: adminId })}\n >\n <PrivateChatInfo\n userId={adminId}\n status={formatMediaDateTime(lang, invite.date * 1000, true)}\n forceShowSelf\n />\n </ListItem>\n </div>\n )}\n {renderImporters()}\n {renderRequesters()}\n </>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { inviteInfo } = global.management.byChatId[chatId];\n const { invite, importers, requesters } = inviteInfo || {};\n const chat = selectChat(global, chatId);\n const isChannel = chat && isChatChannel(chat);\n\n return {\n invite,\n importers,\n requesters,\n isChannel,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageInviteInfo));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiUser } from '../../../api/types';\n\nimport useLang from '../../../hooks/useLang';\nimport { getUserFullName } from '../../../global/helpers';\nimport { selectUser } from '../../../global/selectors';\nimport { formatHumanDate, formatTime, isToday } from '../../../util/dateFormat';\nimport { getServerTime } from '../../../util/serverTime';\nimport { createClassNameBuilder } from '../../../util/buildClassName';\n\nimport Avatar from '../../common/Avatar';\nimport Button from '../../ui/Button';\n\nimport './JoinRequest.scss';\n\ntype OwnProps = {\n userId: string;\n about?: string;\n isChannel?: boolean;\n date: number;\n chatId: string;\n};\n\ntype StateProps = {\n user?: ApiUser;\n isSavedMessages?: boolean;\n serverTimeOffset: number;\n};\n\nconst JoinRequest: FC<OwnProps & StateProps> = ({\n userId,\n about,\n date,\n isChannel,\n user,\n serverTimeOffset,\n chatId,\n}) => {\n const { openChat, hideChatJoinRequest } = getActions();\n\n const buildClassName = createClassNameBuilder('JoinRequest');\n const lang = useLang();\n\n const fullName = getUserFullName(user);\n const fixedDate = (date - getServerTime(serverTimeOffset)) * 1000 + Date.now();\n\n const dateString = isToday(new Date(fixedDate))\n ? formatTime(lang, fixedDate) : formatHumanDate(lang, fixedDate, true, false, true);\n\n const handleUserClick = () => {\n openChat({ id: userId });\n };\n\n const handleAcceptRequest = useCallback(() => {\n hideChatJoinRequest({ chatId, userId, isApproved: true });\n }, [chatId, hideChatJoinRequest, userId]);\n\n const handleRejectRequest = useCallback(() => {\n hideChatJoinRequest({ chatId, userId, isApproved: false });\n }, [chatId, hideChatJoinRequest, userId]);\n\n return (\n <div className={buildClassName('&')}>\n <div className={buildClassName('top')}>\n <div className={buildClassName('user')} onClick={handleUserClick}>\n <Avatar\n key={userId}\n size=\"medium\"\n user={user}\n />\n <div className={buildClassName('user-info')}>\n <div className={buildClassName('user-name')}>{fullName}</div>\n <div className={buildClassName('user-subtitle')}>{about}</div>\n </div>\n </div>\n <div className={buildClassName('date')}>{dateString}</div>\n </div>\n <div className={buildClassName('buttons')}>\n <Button className={buildClassName('button')} onClick={handleAcceptRequest}>\n {isChannel ? lang('ChannelAddToChannel') : lang('ChannelAddToGroup')}\n </Button>\n <Button className={buildClassName('button')} isText onClick={handleRejectRequest}>\n {lang('DismissRequest')}\n </Button>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n const user = selectUser(global, userId);\n\n return {\n user,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(JoinRequest));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat } from '../../../api/types';\n\nimport { STICKER_SIZE_JOIN_REQUESTS } from '../../../config';\nimport { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { selectChat } from '../../../global/selectors';\nimport { isChatChannel, isUserId } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\n\nimport JoinRequest from './JoinRequest';\nimport Button from '../../ui/Button';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport Spinner from '../../ui/Spinner';\nimport AnimatedIcon from '../../common/AnimatedIcon';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n isChannel?: boolean;\n serverTimeOffset: number;\n};\n\nconst ManageJoinRequests: FC<OwnProps & StateProps> = ({\n chat,\n chatId,\n isActive,\n isChannel,\n onClose,\n}) => {\n const { hideAllChatJoinRequests, loadChatJoinRequests } = getActions();\n const [isAcceptAllDialogOpen, openAcceptAllDialog, closeAcceptAllDialog] = useFlag();\n const [isRejectAllDialogOpen, openRejectAllDialog, closeRejectAllDialog] = useFlag();\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (!chat?.joinRequests && !isUserId(chatId)) {\n loadChatJoinRequests({ chatId });\n }\n }, [chat, chatId, loadChatJoinRequests]);\n\n const handleAcceptAllRequests = useCallback(() => {\n hideAllChatJoinRequests({ chatId, isApproved: true });\n closeAcceptAllDialog();\n }, [hideAllChatJoinRequests, chatId, closeAcceptAllDialog]);\n\n const handleRejectAllRequests = useCallback(() => {\n hideAllChatJoinRequests({ chatId, isApproved: false });\n closeRejectAllDialog();\n }, [hideAllChatJoinRequests, chatId, closeRejectAllDialog]);\n\n return (\n <div className=\"Management ManageJoinRequests\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AnimatedIcon\n tgsUrl={LOCAL_TGS_URLS.JoinRequest}\n size={STICKER_SIZE_JOIN_REQUESTS}\n className=\"section-icon\"\n />\n {Boolean(chat?.joinRequests?.length) && (\n <div className=\"bulk-actions\">\n <Button className=\"bulk-action-button\" onClick={openAcceptAllDialog}>Accept all</Button>\n <Button className=\"bulk-action-button\" onClick={openRejectAllDialog} isText>Dismiss all</Button>\n </div>\n )}\n </div>\n <div className=\"section\" teactFastList>\n <p key=\"title\">\n {!chat?.joinRequests ? lang('Loading') : chat.joinRequests.length\n ? lang('JoinRequests', chat.joinRequests.length) : lang('NoMemberRequests')}\n </p>\n {!chat?.joinRequests && (\n <Spinner key=\"loading\" />\n )}\n {chat?.joinRequests?.length === 0 && (\n <p className=\"text-muted\" key=\"empty\">\n {isChannel ? lang('NoSubscribeRequestsDescription') : lang('NoMemberRequestsDescription')}\n </p>\n )}\n {chat?.joinRequests?.map(({ userId, about, date }) => (\n <JoinRequest\n userId={userId}\n about={about}\n date={date}\n isChannel={isChannel}\n chatId={chatId}\n key={userId}\n />\n ))}\n </div>\n </div>\n <ConfirmDialog\n isOpen={isAcceptAllDialogOpen}\n onClose={closeAcceptAllDialog}\n title=\"Accept all requests?\"\n text=\"Are you sure you want to accept all requests?\"\n confirmHandler={handleAcceptAllRequests}\n />\n <ConfirmDialog\n isOpen={isRejectAllDialogOpen}\n onClose={closeRejectAllDialog}\n title=\"Reject all requests?\"\n text=\"Are you sure you want to reject all requests?\"\n confirmHandler={handleRejectAllRequests}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n\n return {\n chat,\n serverTimeOffset: global.serverTimeOffset,\n isChannel: chat && isChatChannel(chat),\n };\n },\n)(ManageJoinRequests));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { ManagementType } from '../../../types';\nimport { ManagementScreens } from '../../../types';\n\nimport { selectCurrentManagementType } from '../../../global/selectors';\n\nimport ManageUser from './ManageUser';\nimport ManageGroup from './ManageGroup';\nimport ManageGroupPermissions from './ManageGroupPermissions';\nimport ManageChatRemovedUsers from './ManageChatRemovedUsers';\nimport ManageChannel from './ManageChannel';\nimport ManageChatPrivacyType from './ManageChatPrivacyType';\nimport ManageDiscussion from './ManageDiscussion';\nimport ManageGroupUserPermissions from './ManageGroupUserPermissions';\nimport ManageChatAdministrators from './ManageChatAdministrators';\nimport ManageGroupRecentActions from './ManageGroupRecentActions';\nimport ManageGroupAdminRights from './ManageGroupAdminRights';\nimport ManageGroupMembers from './ManageGroupMembers';\nimport ManageGroupUserPermissionsCreate from './ManageGroupUserPermissionsCreate';\nimport ManageInvites from './ManageInvites';\nimport ManageInvite from './ManageInvite';\nimport ManageReactions from './ManageReactions';\nimport ManageInviteInfo from './ManageInviteInfo';\nimport ManageJoinRequests from './ManageJoinRequests';\n\nexport type OwnProps = {\n chatId: string;\n currentScreen: ManagementScreens;\n selectedChatMemberId?: string;\n isPromotedByCurrentUser?: boolean;\n onScreenSelect: (screen: ManagementScreens) => void;\n onChatMemberSelect: (memberId: string, isPromotedByCurrentUser?: boolean) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n managementType?: ManagementType;\n};\n\nconst Management: FC<OwnProps & StateProps> = ({\n chatId,\n currentScreen,\n selectedChatMemberId,\n isPromotedByCurrentUser,\n onScreenSelect,\n onChatMemberSelect,\n onClose,\n isActive,\n managementType,\n}) => {\n switch (currentScreen) {\n case ManagementScreens.Initial: {\n switch (managementType) {\n case 'user':\n return (\n <ManageUser\n key={chatId}\n userId={chatId}\n onClose={onClose}\n isActive={isActive}\n />\n );\n case 'group':\n return (\n <ManageGroup\n key={chatId}\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onClose={onClose}\n isActive={isActive || [\n ManagementScreens.ChatPrivacyType,\n ManagementScreens.Discussion,\n ManagementScreens.GroupPermissions,\n ManagementScreens.ChatAdministrators,\n ManagementScreens.GroupRemovedUsers,\n ManagementScreens.GroupUserPermissionsCreate,\n ManagementScreens.GroupUserPermissions,\n ManagementScreens.ChatAdminRights,\n ManagementScreens.ChatNewAdminRights,\n ManagementScreens.GroupRecentActions,\n ].includes(currentScreen)}\n />\n );\n case 'channel':\n return (\n <ManageChannel\n key={chatId}\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onClose={onClose}\n isActive={isActive || [\n ManagementScreens.ChannelSubscribers,\n ManagementScreens.ChatAdministrators,\n ManagementScreens.ChannelRemovedUsers,\n ManagementScreens.Discussion,\n ManagementScreens.ChatPrivacyType,\n ManagementScreens.ChatAdminRights,\n ManagementScreens.ChatNewAdminRights,\n ManagementScreens.GroupRecentActions,\n ].includes(currentScreen)}\n />\n );\n }\n\n break;\n }\n\n case ManagementScreens.ChatPrivacyType:\n return (\n <ManageChatPrivacyType\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.Discussion:\n return (\n <ManageDiscussion\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupPermissions:\n return (\n <ManageGroupPermissions\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onChatMemberSelect={onChatMemberSelect}\n isActive={isActive || [\n ManagementScreens.GroupRemovedUsers,\n ManagementScreens.GroupUserPermissionsCreate,\n ManagementScreens.GroupUserPermissions,\n ].includes(currentScreen)}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChannelRemovedUsers:\n case ManagementScreens.GroupRemovedUsers:\n return (\n <ManageChatRemovedUsers\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupUserPermissionsCreate:\n return (\n <ManageGroupUserPermissionsCreate\n chatId={chatId}\n onChatMemberSelect={onChatMemberSelect}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n ManagementScreens.GroupUserPermissions,\n ].includes(currentScreen)}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupUserPermissions:\n return (\n <ManageGroupUserPermissions\n chatId={chatId}\n selectedChatMemberId={selectedChatMemberId}\n isPromotedByCurrentUser={isPromotedByCurrentUser}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChatAdministrators:\n return (\n <ManageChatAdministrators\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onChatMemberSelect={onChatMemberSelect}\n isActive={isActive || [\n ManagementScreens.ChatAdminRights,\n ManagementScreens.ChatNewAdminRights,\n ManagementScreens.GroupRecentActions,\n ].includes(currentScreen)}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupRecentActions:\n return (\n <ManageGroupRecentActions\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChatNewAdminRights:\n case ManagementScreens.ChatAdminRights:\n return (\n <ManageGroupAdminRights\n chatId={chatId}\n isNewAdmin={currentScreen === ManagementScreens.ChatNewAdminRights}\n selectedUserId={selectedChatMemberId}\n isPromotedByCurrentUser={isPromotedByCurrentUser}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChannelSubscribers:\n case ManagementScreens.GroupMembers:\n return (\n <ManageGroupMembers\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n case ManagementScreens.Invites:\n return (\n <ManageInvites\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n onScreenSelect={onScreenSelect}\n />\n );\n case ManagementScreens.EditInvite:\n return (\n <ManageInvite\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n onScreenSelect={onScreenSelect}\n />\n );\n case ManagementScreens.GroupAddAdmins:\n return (\n <ManageGroupMembers\n chatId={chatId}\n noAdmins\n isActive={isActive}\n onClose={onClose}\n onScreenSelect={onScreenSelect}\n onChatMemberSelect={onChatMemberSelect}\n />\n );\n\n case ManagementScreens.Reactions:\n return (\n <ManageReactions\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n case ManagementScreens.InviteInfo:\n return (\n <ManageInviteInfo\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n case ManagementScreens.JoinRequests:\n return (\n <ManageJoinRequests\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n }\n\n return undefined; // Never reached\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const managementType = selectCurrentManagementType(global);\n\n return {\n managementType,\n };\n },\n)(Management));\n","const VISA = /^4[0-9]{12}(?:[0-9]{1,3})?$/;\nconst MASTERCARD1 = /^5[1-5][0-9]{11,14}$/;\nconst MASTERCARD2 = /^2[2-7][0-9]{11,14}$/;\n\nexport enum CardType {\n Default,\n Visa,\n Mastercard,\n}\n\nconst cards: Record<number, string> = {\n [CardType.Default]: '',\n [CardType.Visa]: 'visa',\n [CardType.Mastercard]: 'mastercard',\n};\n\nexport function detectCardType(cardNumber: string): number {\n cardNumber = cardNumber.replace(/\\s/g, '');\n if (VISA.test(cardNumber)) {\n return CardType.Visa;\n }\n if (MASTERCARD1.test(cardNumber) || MASTERCARD2.test(cardNumber)) {\n return CardType.Mastercard;\n }\n return CardType.Default;\n}\n\nexport function detectCardTypeText(cardNumber: string): string {\n const cardType = detectCardType(cardNumber);\n return cards[cardType as number] || '';\n}\n","import type { StateReducer, Dispatch } from '../useReducer';\nimport useReducer from '../useReducer';\n\nexport type FormState = {\n streetLine1: string;\n streetLine2: string;\n city: string;\n state: string;\n countryIso2: string;\n postCode: string;\n fullName: string;\n email: string;\n phone: string;\n shipping: string;\n cardNumber: string;\n cardholder: string;\n expiry: string;\n cvv: string;\n billingCountry: string;\n billingZip: string;\n saveInfo: boolean;\n saveCredentials: boolean;\n formErrors: Record<string, string>;\n};\n\nexport type FormActions = (\n 'changeAddress1' | 'changeAddress2' | 'changeCity' | 'changeState' | 'changeCountry' |\n 'changePostCode' | 'changeFullName' | 'changeEmail' | 'changePhone' | 'changeShipping' | 'updateUserInfo' |\n 'changeCardNumber' | 'changeCardholder' | 'changeExpiryDate' | 'changeCvvCode' | 'changeBillingCountry' |\n 'changeBillingZip' | 'changeSaveInfo' | 'changeSaveCredentials' | 'setFormErrors'\n);\nexport type FormEditDispatch = Dispatch<FormActions>;\n\nconst INITIAL_STATE: FormState = {\n streetLine1: '',\n streetLine2: '',\n city: '',\n state: '',\n countryIso2: '',\n postCode: '',\n fullName: '',\n email: '',\n phone: '',\n shipping: '',\n cardNumber: '',\n cardholder: '',\n expiry: '',\n cvv: '',\n billingCountry: '',\n billingZip: '',\n saveInfo: true,\n saveCredentials: false,\n formErrors: {},\n};\n\nconst reducer: StateReducer<FormState, FormActions> = (state, action) => {\n switch (action.type) {\n case 'changeAddress1':\n return {\n ...state,\n streetLine1: action.payload,\n formErrors: {\n ...state.formErrors,\n streetLine1: undefined,\n },\n };\n case 'changeAddress2':\n return {\n ...state,\n streetLine2: action.payload,\n formErrors: {\n ...state.formErrors,\n streetLine2: undefined,\n },\n };\n case 'changeCity':\n return {\n ...state,\n city: action.payload,\n formErrors: {\n ...state.formErrors,\n city: undefined,\n },\n };\n case 'changeState':\n return {\n ...state,\n state: action.payload,\n formErrors: {\n ...state.formErrors,\n state: undefined,\n },\n };\n case 'changeCountry':\n return {\n ...state,\n countryIso2: action.payload.iso2,\n billingCountry: action.payload.defaultName,\n formErrors: {\n ...state.formErrors,\n countryIso2: undefined,\n },\n };\n case 'changePostCode':\n return {\n ...state,\n postCode: action.payload,\n formErrors: {\n ...state.formErrors,\n postCode: undefined,\n },\n };\n case 'changeFullName':\n return {\n ...state,\n fullName: action.payload,\n formErrors: {\n ...state.formErrors,\n fullName: undefined,\n },\n };\n case 'changeEmail':\n return {\n ...state,\n email: action.payload,\n formErrors: {\n ...state.formErrors,\n email: undefined,\n },\n };\n case 'changePhone':\n return {\n ...state,\n phone: action.payload,\n formErrors: {\n ...state.formErrors,\n phone: undefined,\n },\n };\n case 'changeShipping':\n return { ...state, shipping: action.payload };\n case 'changeCardNumber':\n return {\n ...state,\n cardNumber: action.payload,\n formErrors: {\n ...state.formErrors,\n cardNumber: undefined,\n },\n };\n case 'changeCardholder':\n return {\n ...state,\n cardholder: action.payload,\n formErrors: {\n ...state.formErrors,\n cardholder: undefined,\n },\n };\n case 'changeExpiryDate':\n return {\n ...state,\n expiry: action.payload,\n formErrors: {\n ...state.formErrors,\n expiry: undefined,\n },\n };\n case 'changeCvvCode':\n return {\n ...state,\n cvv: action.payload,\n formErrors: {\n ...state.formErrors,\n cvv: undefined,\n },\n };\n case 'changeBillingCountry':\n return {\n ...state,\n billingCountry: action.payload,\n formErrors: {\n ...state.formErrors,\n billingCountry: undefined,\n },\n };\n case 'changeBillingZip':\n return {\n ...state,\n billingZip: action.payload,\n formErrors: {\n ...state.formErrors,\n billingZip: undefined,\n },\n };\n case 'changeSaveInfo':\n return { ...state, saveInfo: action.payload };\n case 'changeSaveCredentials':\n return { ...state, saveCredentials: action.payload };\n case 'updateUserInfo':\n if (action.payload.country) {\n return {\n ...state,\n ...action.payload,\n billingCountry: action.payload.country,\n };\n }\n return { ...state, ...action.payload };\n case 'setFormErrors':\n return {\n ...state,\n formErrors: {\n ...state.formErrors,\n ...action.payload,\n },\n };\n default:\n return state;\n }\n};\n\nconst usePaymentReducer = () => {\n return useReducer(reducer, INITIAL_STATE);\n};\n\nexport default usePaymentReducer;\n","import type { RefObject } from 'react';\n\nimport { IS_TOUCH_ENV } from '../util/environment';\nimport { fastRaf } from '../util/schedulers';\nimport { useEffect } from '../lib/teact/teact';\n\nconst DEFAULT_DURATION = 400;\n\nexport default function useFocusAfterAnimation(\n ref: RefObject<HTMLInputElement>, animationDuration = DEFAULT_DURATION,\n) {\n useEffect(() => {\n if (IS_TOUCH_ENV) {\n return;\n }\n\n setTimeout(() => {\n fastRaf(() => {\n if (ref.current) {\n ref.current.focus();\n }\n });\n }, animationDuration);\n }, [ref, animationDuration]);\n}\n","import type { ChangeEvent, RefObject } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\ntype OwnProps = {\n id?: string;\n value?: string;\n label?: string;\n error?: string;\n ref?: RefObject<HTMLSelectElement>;\n hasArrow?: boolean;\n placeholder?: string;\n onChange?: (e: ChangeEvent<HTMLSelectElement>) => void;\n children: React.ReactNode;\n};\n\nconst Select: FC<OwnProps> = (props) => {\n const {\n id,\n value,\n label,\n hasArrow,\n error,\n ref,\n placeholder,\n onChange,\n children,\n } = props;\n const labelText = error || label;\n const fullClassName = buildClassName(\n 'input-group',\n value && 'touched',\n error && 'error',\n labelText && 'with-label',\n hasArrow && 'with-arrow',\n 'input-group',\n );\n\n return (\n <div className={fullClassName}>\n <select\n className=\"form-control\"\n id={id}\n value={value || ''}\n onChange={onChange}\n placeholder={placeholder || label}\n ref={ref}\n >\n {children}\n </select>\n {labelText && id && (\n <label htmlFor={id}>{labelText}</label>\n )}\n </div>\n );\n};\n\nexport default memo(Select);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useRef, useCallback, useEffect, memo,\n} from '../../lib/teact/teact';\n\nimport type { ApiCountry } from '../../api/types';\n\nimport type { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer';\nimport useFocusAfterAnimation from '../../hooks/useFocusAfterAnimation';\nimport useLang from '../../hooks/useLang';\n\nimport InputText from '../ui/InputText';\nimport Select from '../ui/Select';\nimport Checkbox from '../ui/Checkbox';\n\nimport './ShippingInfo.scss';\n\nexport type OwnProps = {\n state: FormState;\n needEmail: boolean;\n needPhone: boolean;\n needName: boolean;\n needAddress: boolean;\n countryList: ApiCountry[];\n dispatch: FormEditDispatch;\n};\n\nconst ShippingInfo: FC<OwnProps> = ({\n state,\n needEmail,\n needPhone,\n needName,\n needAddress,\n countryList,\n dispatch,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n // eslint-disable-next-line no-null/no-null\n const phoneRef = useRef<HTMLInputElement>(null);\n // eslint-disable-next-line no-null/no-null\n const selectCountryRef = useRef<HTMLSelectElement>(null);\n\n useEffect(() => {\n if (selectCountryRef.current\n && selectCountryRef.current.value !== state.countryIso2) {\n selectCountryRef.current.value = state.countryIso2;\n }\n }, [state.countryIso2]);\n\n const lang = useLang();\n\n useFocusAfterAnimation(inputRef);\n\n const handleAddress1Change = useCallback((e) => {\n dispatch({ type: 'changeAddress1', payload: e.target.value });\n }, [dispatch]);\n\n const handleAddress2Change = useCallback((e) => {\n dispatch({ type: 'changeAddress2', payload: e.target.value });\n }, [dispatch]);\n\n const handleCityChange = useCallback((e) => {\n dispatch({ type: 'changeCity', payload: e.target.value });\n }, [dispatch]);\n\n const handleStateChange = useCallback((e) => {\n dispatch({ type: 'changeState', payload: e.target.value });\n }, [dispatch]);\n\n const handleCountryChange = useCallback((e) => {\n dispatch({ type: 'changeCountry', payload: countryList.find((country) => country.iso2 === e.target.value) });\n }, [countryList, dispatch]);\n\n const handlePostCodeChange = useCallback((e) => {\n dispatch({ type: 'changePostCode', payload: e.target.value });\n }, [dispatch]);\n\n const handleFullNameChange = useCallback((e) => {\n dispatch({ type: 'changeFullName', payload: e.target.value });\n }, [dispatch]);\n\n const handleEmailChange = useCallback((e) => {\n dispatch({ type: 'changeEmail', payload: e.target.value });\n }, [dispatch]);\n\n const handlePhoneChange = useCallback((e) => {\n let { value } = e.target;\n value = `+${value.replace(/\\D/g, '')}`;\n if (phoneRef.current) {\n phoneRef.current.value = value;\n }\n dispatch({ type: 'changePhone', payload: value });\n }, [dispatch]);\n\n const handleSaveInfoChange = useCallback((e) => {\n dispatch({ type: 'changeSaveInfo', payload: e.target.value });\n }, [dispatch]);\n\n const { formErrors } = state;\n return (\n <div className=\"ShippingInfo\">\n <form>\n {needAddress ? (\n <div>\n <h5>{lang('PaymentShippingAddress')}</h5>\n <InputText\n ref={inputRef}\n label={lang('PaymentShippingAddress1Placeholder')}\n onChange={handleAddress1Change}\n value={state.streetLine1}\n inputMode=\"text\"\n error={formErrors.streetLine1}\n />\n <InputText\n label={lang('PaymentShippingAddress2Placeholder')}\n onChange={handleAddress2Change}\n value={state.streetLine2}\n inputMode=\"text\"\n error={formErrors.streetLine2}\n />\n <InputText\n label={lang('PaymentShippingCityPlaceholder')}\n onChange={handleCityChange}\n value={state.city}\n inputMode=\"text\"\n error={formErrors.city}\n />\n <InputText\n label={lang('PaymentShippingStatePlaceholder')}\n onChange={handleStateChange}\n value={state.state}\n inputMode=\"text\"\n error={formErrors.state}\n />\n <Select\n label={lang('PaymentShippingCountry')}\n placeholder={lang('PaymentShippingCountry')}\n onChange={handleCountryChange}\n value={state.countryIso2}\n hasArrow={Boolean(true)}\n id=\"shipping-country\"\n error={formErrors.countryIso2}\n ref={selectCountryRef}\n >\n {countryList.map(({ defaultName, name, iso2 }) => (\n <option\n value={iso2}\n className=\"county-item\"\n >\n {defaultName || name}\n </option>\n ))}\n </Select>\n\n <InputText\n label={lang('PaymentShippingZipPlaceholder')}\n onChange={handlePostCodeChange}\n value={state.postCode}\n inputMode=\"text\"\n error={formErrors.postCode}\n />\n </div>\n ) : undefined}\n { needName || needEmail || needPhone ? (\n <h5>{lang('PaymentShippingReceiver')}</h5>\n ) : undefined }\n { needName && (\n <InputText\n label={lang('PaymentShippingName')}\n onChange={handleFullNameChange}\n value={state.fullName}\n inputMode=\"text\"\n error={formErrors.fullName}\n />\n ) }\n { needEmail && (\n <InputText\n label={lang('PaymentShippingEmailPlaceholder')}\n onChange={handleEmailChange}\n value={state.email}\n inputMode=\"email\"\n error={formErrors.email}\n />\n ) }\n { needPhone && (\n <InputText\n label={lang('PaymentShippingPhoneNumber')}\n onChange={handlePhoneChange}\n value={state.phone}\n inputMode=\"tel\"\n error={formErrors.phone}\n ref={phoneRef}\n />\n ) }\n <Checkbox\n label={lang('PaymentShippingSave')}\n subLabel={lang('PaymentShippingSaveInfo')}\n checked={Boolean(state.saveInfo)}\n onChange={handleSaveInfoChange}\n />\n </form>\n </div>\n );\n};\n\nexport default memo(ShippingInfo);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, memo, useMemo, useEffect,\n} from '../../lib/teact/teact';\n\nimport type { ShippingOption } from '../../types';\n\nimport { formatCurrency } from '../../util/formatCurrency';\nimport type { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer';\nimport useLang from '../../hooks/useLang';\n\nimport RadioGroup from '../ui/RadioGroup';\n\nimport './Shipping.scss';\n\nexport type OwnProps = {\n state: FormState;\n shippingOptions: ShippingOption[];\n currency?: string;\n dispatch: FormEditDispatch;\n};\n\nconst Shipping: FC<OwnProps> = ({\n state,\n shippingOptions,\n currency,\n dispatch,\n}) => {\n const lang = useLang();\n\n useEffect(() => {\n if (!shippingOptions || state.shipping) {\n return;\n }\n dispatch({ type: 'changeShipping', payload: shippingOptions[0].id });\n }, [shippingOptions, state.shipping, dispatch]);\n\n const handleShippingSelect = useCallback((value) => {\n dispatch({ type: 'changeShipping', payload: value });\n }, [dispatch]);\n\n const options = useMemo(() => (shippingOptions.map(({ id: value, title: label, amount }) => ({\n label,\n subLabel: formatCurrency(amount, currency, lang.code),\n value,\n }))), [shippingOptions, currency, lang.code]);\n\n return (\n <div className=\"Shipping\">\n <form>\n <p>{lang('PaymentShippingMethod')}</p>\n <RadioGroup\n name=\"shipping-options\"\n options={options}\n onChange={handleShippingSelect}\n selected={state.shipping}\n />\n </form>\n </div>\n );\n};\n\nexport default memo(Shipping);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport type { LangCode, Price } from '../../types';\n\nimport { formatCurrency } from '../../util/formatCurrency';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport './Checkout.scss';\n\nexport type OwnProps = {\n invoiceContent?: {\n title?: string;\n text?: string;\n photoUrl?: string;\n };\n checkoutInfo?: {\n paymentMethod?: string;\n paymentProvider?: string;\n shippingAddress?: string;\n name?: string;\n phone?: string;\n shippingMethod?: string;\n };\n prices?: Price[];\n totalPrice?: number;\n shippingPrices?: Price[];\n currency?: string;\n};\n\nconst Checkout: FC<OwnProps> = ({\n invoiceContent,\n prices,\n shippingPrices,\n checkoutInfo,\n currency,\n totalPrice,\n}) => {\n const lang = useLang();\n\n const { photoUrl, title, text } = invoiceContent || {};\n const {\n paymentMethod,\n paymentProvider,\n shippingAddress,\n name,\n phone,\n shippingMethod,\n } = (checkoutInfo || {});\n\n return (\n <div className=\"Checkout\">\n <div className=\"description has-image\">\n {photoUrl && <img src={photoUrl} alt=\"\" />}\n <div className=\"text\">\n <h5>{title}</h5>\n <p>{text}</p>\n </div>\n </div>\n <div className=\"price-info\">\n { prices && prices.map((item) => (\n renderPaymentItem(lang.code, item.label, item.amount, currency)\n )) }\n { shippingPrices && shippingPrices.map((item) => (\n renderPaymentItem(lang.code, item.label, item.amount, currency)\n )) }\n { totalPrice !== undefined && (\n renderPaymentItem(lang.code, lang('Checkout.TotalAmount'), totalPrice, currency, true)\n ) }\n </div>\n <div className=\"invoice-info\">\n {paymentMethod && renderCheckoutItem('icon-card', paymentMethod, lang('PaymentCheckoutMethod'))}\n {paymentProvider && renderCheckoutItem(\n buildClassName('provider', paymentProvider.toLowerCase()),\n paymentProvider,\n lang('PaymentCheckoutProvider'),\n )}\n {shippingAddress && renderCheckoutItem('icon-location', shippingAddress, lang('PaymentShippingAddress'))}\n {name && renderCheckoutItem('icon-user', name, lang('PaymentCheckoutName'))}\n {phone && renderCheckoutItem('icon-phone', phone, lang('PaymentCheckoutPhoneNumber'))}\n {shippingMethod && renderCheckoutItem('icon-truck', shippingMethod, lang('PaymentCheckoutShippingMethod'))}\n </div>\n </div>\n );\n};\n\nfunction renderPaymentItem(\n langCode: LangCode | undefined, title: string, value: number, currency?: string, main = false,\n) {\n return (\n <div className={`price-info-item ${main ? 'price-info-item-main' : ''}`}>\n <div className=\"title\">\n { title }\n </div>\n <div className=\"value\">\n {formatCurrency(value, currency, langCode)}\n </div>\n </div>\n );\n}\n\nfunction renderCheckoutItem(icon: string, title: string, data: string) {\n return (\n <div className=\"checkout-info-item\">\n <i className={icon}> </i>\n <div className=\"info\">\n <div className=\"title\">\n { title }\n </div>\n <p className=\"data\">\n { data }\n </p>\n </div>\n </div>\n );\n}\n\nexport default memo(Checkout);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback, useRef } from '../../lib/teact/teact';\n\nimport { formatCardExpiry } from '../middle/helpers/inputFormatters';\n\nimport InputText from '../ui/InputText';\nimport useLang from '../../hooks/useLang';\n\nconst MAX_FIELD_LENGTH = 5;\n\nexport type OwnProps = {\n value: string;\n error?: string;\n onChange: (value: string) => void;\n};\n\nconst ExpiryInput : FC<OwnProps> = ({ value, error, onChange }) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const expiryInputRef = useRef<HTMLInputElement>(null);\n\n const handleKeyDown = useCallback((e) => {\n if (e.key === 'Backspace' && value.charAt(value.length - 1) === '/') {\n const newValue = value.slice(0, value.length - 1);\n if (expiryInputRef.current) {\n expiryInputRef.current.value = newValue;\n }\n }\n }, [value]);\n\n const handleChange = useCallback((e) => {\n onChange(formatCardExpiry(e.target.value));\n }, [onChange]);\n\n return (\n <InputText\n label={lang('PaymentCardExpireDate')}\n ref={expiryInputRef}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n value={value}\n error={error}\n inputMode=\"numeric\"\n maxLength={MAX_FIELD_LENGTH}\n />\n );\n};\n\nexport default memo(ExpiryInput);\n","export function formatCardExpiry(input: string) {\n input = input.replace(/[^\\d]/g, '').slice(0, 4);\n const parts = input.match(/.{1,2}/g);\n if (parts?.[0] && Number(parts[0]) > 12) {\n parts[0] = '12';\n }\n if (parts?.[0] && parts[0].length === 2 && !parts[1]) {\n parts[1] = '';\n }\n return parts ? parts.join('/') : '';\n}\n\nexport function formatCardNumber(input: string) {\n input = input.replace(/[^\\d]/g, '');\n const parts = input.match(/.{1,4}/g);\n return parts ? parts.join(' ') : '';\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useState, useRef, useEffect,\n} from '../../lib/teact/teact';\n\nimport { formatCardNumber } from '../middle/helpers/inputFormatters';\nimport { detectCardType, CardType } from '../common/helpers/detectCardType';\nimport useFocusAfterAnimation from '../../hooks/useFocusAfterAnimation';\nimport useLang from '../../hooks/useLang';\n\nimport InputText from '../ui/InputText';\n\nimport './CardInput.scss';\n\nimport mastercardIconPath from '../../assets/mastercard.svg';\nimport visaIconPath from '../../assets/visa.svg';\n\nconst CARD_NUMBER_MAX_LENGTH = 23;\n\nexport type OwnProps = {\n value: string;\n error?: string;\n onChange: (value: string) => void;\n};\n\nconst CardInput : FC<OwnProps> = ({ value, error, onChange }) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const cardNumberRef = useRef<HTMLInputElement>(null);\n\n useFocusAfterAnimation(cardNumberRef);\n\n const [cardType, setCardType] = useState<number>(CardType.Default);\n useEffect(() => {\n const newCardType = detectCardType(value);\n setCardType(newCardType);\n // eslint-disable-next-line\n }, []);\n\n const handleChange = useCallback((e) => {\n const newValue = formatCardNumber(e.target.value);\n const newCardType = detectCardType(e.target.value);\n setCardType(newCardType);\n onChange(newValue);\n if (cardNumberRef.current) {\n cardNumberRef.current.value = newValue;\n }\n }, [onChange, cardNumberRef]);\n\n const cardIcon = getCardIcon(cardType);\n\n return (\n <div className=\"CardInput\">\n <span className=\"left-addon\">{cardIcon}</span>\n <InputText\n ref={cardNumberRef}\n label={lang('PaymentCardNumber')}\n onChange={handleChange}\n value={value}\n inputMode=\"numeric\"\n className={cardType ? 'has-left-addon' : ''}\n error={error}\n maxLength={CARD_NUMBER_MAX_LENGTH}\n />\n </div>\n );\n};\n\nexport default memo(CardInput);\n\nfunction getCardIcon(cardType: CardType) {\n switch (cardType) {\n case CardType.Mastercard:\n return <img src={mastercardIconPath} alt=\"\" />;\n case CardType.Visa:\n return <img src={visaIconPath} alt=\"\" />;\n default:\n return undefined;\n }\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, memo, useRef, useEffect,\n} from '../../lib/teact/teact';\n\nimport type { ApiCountry } from '../../api/types';\n\nimport type { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer';\nimport useLang from '../../hooks/useLang';\n\nimport InputText from '../ui/InputText';\nimport Checkbox from '../ui/Checkbox';\nimport Select from '../ui/Select';\nimport ExpiryInput from './ExpiryInput';\nimport CardInput from './CardInput';\n\nimport './PaymentInfo.scss';\n\nexport type OwnProps = {\n state: FormState;\n canSaveCredentials: boolean;\n needCardholderName?: boolean;\n needCountry?: boolean;\n needZip?: boolean;\n countryList: ApiCountry[];\n dispatch: FormEditDispatch;\n};\n\nconst PaymentInfo: FC<OwnProps> = ({\n state,\n canSaveCredentials,\n needCardholderName,\n needCountry,\n needZip,\n countryList,\n dispatch,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const selectCountryRef = useRef<HTMLSelectElement>(null);\n\n useEffect(() => {\n if (selectCountryRef.current\n && selectCountryRef.current.value !== state.billingCountry) {\n selectCountryRef.current.value = state.billingCountry;\n }\n }, [state.billingCountry]);\n\n const handleCardNumberChange = useCallback((value) => {\n dispatch({ type: 'changeCardNumber', payload: value });\n }, [dispatch]);\n\n const handleCardholderChange = useCallback((e) => {\n dispatch({ type: 'changeCardholder', payload: e.target.value.toUpperCase() });\n }, [dispatch]);\n\n const handleExpiryChange = useCallback((value) => {\n dispatch({ type: 'changeExpiryDate', payload: value });\n }, [dispatch]);\n\n const handleCvvChange = useCallback((e) => {\n dispatch({ type: 'changeCvvCode', payload: e.target.value });\n }, [dispatch]);\n\n const handleCountryChange = useCallback((e) => {\n dispatch({ type: 'changeBillingCountry', payload: e.target.value });\n }, [dispatch]);\n\n const handleBillingPostCodeChange = useCallback((e) => {\n dispatch({ type: 'changeBillingZip', payload: e.target.value });\n }, [dispatch]);\n\n const handleChangeSaveCredentials = useCallback((e) => {\n dispatch({ type: 'changeSaveCredentials', payload: e.target.value });\n }, [dispatch]);\n\n const lang = useLang();\n\n const { formErrors = {} } = state;\n\n return (\n <div className=\"PaymentInfo\">\n <form>\n <h5>{lang('PaymentCardTitle')}</h5>\n <CardInput\n onChange={handleCardNumberChange}\n value={state.cardNumber}\n error={formErrors.cardNumber}\n />\n { needCardholderName && (\n <InputText\n label={lang('PaymentCardName')}\n onChange={handleCardholderChange}\n value={state.cardholder}\n inputMode=\"text\"\n error={formErrors.cardholder}\n />\n )}\n <section className=\"inline-inputs\">\n <ExpiryInput\n value={state.expiry}\n onChange={handleExpiryChange}\n error={formErrors.expiry}\n />\n <InputText\n label={lang('lng_payments_card_cvc')}\n onChange={handleCvvChange}\n value={state.cvv}\n inputMode=\"numeric\"\n maxLength={3}\n error={formErrors.cvv}\n />\n </section>\n { needCountry || needZip ? (\n <h5>{lang('PaymentBillingAddress')}</h5>\n ) : undefined }\n { needCountry && (\n <Select\n label={lang('PaymentShippingCountry')}\n placeholder={lang('PaymentShippingCountry')}\n onChange={handleCountryChange}\n value={state.billingCountry}\n hasArrow={Boolean(true)}\n id=\"billing-country\"\n error={formErrors.billingCountry}\n ref={selectCountryRef}\n >\n {\n countryList.map(({ defaultName, name }) => (\n <option\n value={defaultName}\n className=\"county-item\"\n >\n {defaultName || name}\n </option>\n ))\n }\n </Select>\n ) }\n { needZip && (\n <InputText\n label={lang('PaymentShippingZipPlaceholder')}\n onChange={handleBillingPostCodeChange}\n value={state.billingZip}\n inputMode=\"text\"\n error={formErrors.billingZip}\n />\n )}\n { canSaveCredentials && (\n <Checkbox\n label={lang('PaymentCardSavePaymentInformation')}\n checked={state.saveCredentials}\n onChange={handleChangeSaveCredentials}\n />\n ) }\n </form>\n </div>\n );\n};\n\nexport default memo(PaymentInfo);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\n\nimport './ConfirmPayment.scss';\n\nexport type OwnProps = {\n url: string;\n};\n\nconst ConfirmPayment: FC<OwnProps> = ({ url }) => {\n const lang = useLang();\n\n return (\n <div className=\"ConfirmPayment\">\n <iframe\n src={url}\n title={lang('Checkout.WebConfirmation.Title')}\n allow=\"payment\"\n sandbox=\"allow-forms allow-scripts allow-same-origin allow-top-navigation\"\n className=\"ConfirmPayment__content\"\n />\n </div>\n );\n};\n\nexport default memo(ConfirmPayment);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { GlobalState } from '../../global/types';\nimport type { ApiCountry } from '../../api/types';\nimport type { ShippingOption, Price } from '../../types';\nimport { PaymentStep } from '../../types';\n\nimport { formatCurrency } from '../../util/formatCurrency';\nimport { detectCardTypeText } from '../common/helpers/detectCardType';\nimport type { FormState } from '../../hooks/reducers/usePaymentReducer';\nimport usePaymentReducer from '../../hooks/reducers/usePaymentReducer';\nimport useLang from '../../hooks/useLang';\n\nimport ShippingInfo from './ShippingInfo';\nimport Shipping from './Shipping';\nimport Checkout from './Checkout';\nimport PaymentInfo from './PaymentInfo';\nimport Button from '../ui/Button';\nimport Modal from '../ui/Modal';\nimport Transition from '../ui/Transition';\nimport Spinner from '../ui/Spinner';\nimport ConfirmPayment from './ConfirmPayment';\n\nimport './PaymentModal.scss';\n\nconst DEFAULT_PROVIDER = 'stripe';\nconst DONATE_PROVIDER = 'smartglocal';\nconst SUPPORTED_PROVIDERS = new Set([DEFAULT_PROVIDER, DONATE_PROVIDER]);\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n};\n\ntype StateProps = {\n nameRequested?: boolean;\n shippingAddressRequested?: boolean;\n phoneRequested?: boolean;\n emailRequested?: boolean;\n flexible?: boolean;\n phoneToProvider?: boolean;\n emailToProvider?: boolean;\n currency?: string;\n prices?: Price[];\n isProviderError: boolean;\n needCardholderName?: boolean;\n needCountry?: boolean;\n needZip?: boolean;\n confirmPaymentUrl?: string;\n countryList: ApiCountry[];\n};\n\ntype GlobalStateProps = Pick<GlobalState['payment'], (\n 'step' | 'shippingOptions' |\n 'savedInfo' | 'canSaveCredentials' | 'nativeProvider' | 'passwordMissing' | 'invoiceContent' |\n 'error'\n)>;\n\nconst Invoice: FC<OwnProps & StateProps & GlobalStateProps> = ({\n isOpen,\n onClose,\n step,\n shippingOptions,\n savedInfo,\n canSaveCredentials,\n nameRequested,\n shippingAddressRequested,\n phoneRequested,\n emailRequested,\n phoneToProvider,\n emailToProvider,\n currency,\n passwordMissing,\n isProviderError,\n invoiceContent,\n nativeProvider,\n prices,\n needCardholderName,\n needCountry,\n needZip,\n confirmPaymentUrl,\n error,\n countryList,\n}) => {\n const {\n validateRequestedInfo,\n sendPaymentForm,\n setPaymentStep,\n sendCredentialsInfo,\n clearPaymentError,\n } = getActions();\n\n const [paymentState, paymentDispatch] = usePaymentReducer();\n const [isLoading, setIsLoading] = useState(false);\n const lang = useLang();\n const canRenderFooter = step !== PaymentStep.ConfirmPayment;\n\n useEffect(() => {\n if (step || error) {\n setIsLoading(false);\n }\n }, [step, error]);\n\n useEffect(() => {\n if (error?.field) {\n paymentDispatch({\n type: 'setFormErrors',\n payload: {\n [error.field]: error.message,\n },\n });\n }\n }, [error, paymentDispatch]);\n\n useEffect(() => {\n if (savedInfo) {\n const {\n name: fullName, phone, email, shippingAddress,\n } = savedInfo;\n const {\n countryIso2, ...shippingAddressRest\n } = shippingAddress || {};\n const shippingCountry = countryIso2 && countryList.find(({ iso2 }) => iso2 === countryIso2)!.defaultName;\n paymentDispatch({\n type: 'updateUserInfo',\n payload: {\n fullName,\n phone: phone && phone.charAt(0) !== '+'\n ? `+${phone}`\n : phone,\n email,\n ...(shippingCountry && {\n country: shippingCountry,\n ...shippingAddressRest,\n }),\n },\n });\n }\n }, [savedInfo, paymentDispatch, countryList]);\n\n const handleErrorModalClose = useCallback(() => {\n clearPaymentError();\n }, [clearPaymentError]);\n\n const totalPrice = useMemo(() => {\n if (step !== PaymentStep.Checkout) {\n return 0;\n }\n\n return getTotalPrice(prices, shippingOptions, paymentState.shipping);\n }, [step, paymentState.shipping, prices, shippingOptions]);\n\n const checkoutInfo = useMemo(() => {\n if (step !== PaymentStep.Checkout) {\n return undefined;\n }\n return getCheckoutInfo(paymentState, shippingOptions, nativeProvider || '');\n }, [step, paymentState, shippingOptions, nativeProvider]);\n\n function renderError() {\n if (!error) {\n return undefined;\n }\n return (\n <Modal\n className=\"error\"\n isOpen={Boolean(error)}\n onClose={handleErrorModalClose}\n >\n <h4>{error.description || 'Error'}</h4>\n <p>{error.description || 'Error'}</p>\n <Button\n isText\n onClick={clearPaymentError}\n >\n {lang('OK')}\n </Button>\n </Modal>\n );\n }\n\n function renderModalContent(currentStep: PaymentStep) {\n switch (currentStep) {\n case PaymentStep.ShippingInfo:\n return (\n <ShippingInfo\n state={paymentState}\n dispatch={paymentDispatch}\n needAddress={Boolean(shippingAddressRequested)}\n needEmail={Boolean(emailRequested || emailToProvider)}\n needPhone={Boolean(phoneRequested || phoneToProvider)}\n needName={Boolean(nameRequested)}\n countryList={countryList}\n />\n );\n case PaymentStep.Shipping:\n return (\n <Shipping\n state={paymentState}\n dispatch={paymentDispatch}\n shippingOptions={shippingOptions || []}\n currency={currency}\n />\n );\n case PaymentStep.PaymentInfo:\n return (\n <PaymentInfo\n state={paymentState}\n dispatch={paymentDispatch}\n canSaveCredentials={Boolean(!passwordMissing && canSaveCredentials)}\n needCardholderName={needCardholderName}\n needCountry={needCountry}\n needZip={needZip}\n countryList={countryList}\n />\n );\n case PaymentStep.Checkout:\n return (\n <Checkout\n prices={prices}\n shippingPrices={paymentState.shipping && shippingOptions\n ? getShippingPrices(shippingOptions, paymentState.shipping)\n : undefined}\n totalPrice={totalPrice}\n invoiceContent={invoiceContent}\n checkoutInfo={checkoutInfo}\n currency={currency}\n />\n );\n case PaymentStep.ConfirmPayment:\n return (\n <ConfirmPayment\n url={confirmPaymentUrl!}\n />\n );\n default:\n return undefined;\n }\n }\n\n const validateRequest = useCallback(() => {\n const { saveInfo } = paymentState;\n const requestInfo = getRequestInfo(paymentState);\n validateRequestedInfo({ requestInfo, saveInfo });\n }, [validateRequestedInfo, paymentState]);\n\n const sendCredentials = useCallback(() => {\n const credentials = getCredentials(paymentState);\n sendCredentialsInfo({\n credentials,\n });\n }, [sendCredentialsInfo, paymentState]);\n\n const sendForm = useCallback(() => {\n sendPaymentForm({\n shippingOptionId: paymentState.shipping,\n saveCredentials: paymentState.saveCredentials,\n });\n }, [sendPaymentForm, paymentState]);\n\n const setStep = useCallback((nextStep) => {\n setPaymentStep({ step: nextStep });\n }, [setPaymentStep]);\n\n const handleButtonClick = useCallback(() => {\n setIsLoading(true);\n switch (step) {\n case PaymentStep.ShippingInfo:\n return validateRequest();\n case PaymentStep.Shipping:\n return setStep(PaymentStep.PaymentInfo);\n case PaymentStep.PaymentInfo:\n return sendCredentials();\n case PaymentStep.Checkout:\n return sendForm();\n default:\n return () => {\n };\n }\n }, [step, validateRequest, setStep, sendCredentials, sendForm]);\n\n const modalHeader = useMemo(() => {\n switch (step) {\n case PaymentStep.ShippingInfo:\n return lang('PaymentShippingInfo');\n case PaymentStep.Shipping:\n return lang('PaymentShippingMethod');\n case PaymentStep.PaymentInfo:\n return lang('PaymentCardInfo');\n case PaymentStep.Checkout:\n return lang('PaymentCheckout');\n case PaymentStep.ConfirmPayment:\n return lang('Checkout.WebConfirmation.Title');\n default:\n return '';\n }\n }, [step, lang]);\n\n const buttonText = useMemo(() => {\n switch (step) {\n case PaymentStep.Checkout:\n return lang('Checkout.PayPrice', formatCurrency(totalPrice, currency, lang.code));\n default:\n return lang('Next');\n }\n }, [step, lang, currency, totalPrice]);\n\n if (isProviderError) {\n return (\n <Modal\n className=\"error\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <p>\n Sorry, Telegram WebZ doesn't support payments with this provider yet. <br />\n Please use one of our mobile apps to do this.\n </p>\n <Button\n isText\n onClick={onClose}\n >\n {lang('OK')}\n </Button>\n </Modal>\n );\n }\n\n return (\n <Modal\n className=\"PaymentModal\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <div className=\"header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n className=\"close-button\"\n color=\"translucent\"\n round\n size=\"smaller\"\n onClick={onClose}\n ariaLabel=\"Close\"\n >\n <i className=\"icon-close\" />\n </Button>\n <h3>{modalHeader}</h3>\n </div>\n {step !== undefined ? (\n <Transition name=\"slide\" activeKey={step}>\n <div className=\"content custom-scroll\">\n {renderModalContent(step)}\n </div>\n </Transition>\n ) : (\n <div className=\"empty-content\">\n <Spinner color=\"gray\" />\n </div>\n )}\n {canRenderFooter && (\n <div className=\"footer\">\n <Button\n type=\"submit\"\n onClick={handleButtonClick}\n disabled={isLoading}\n isLoading={isLoading}\n >\n {buttonText}\n </Button>\n </div>\n )}\n {error && !error.field && renderError()}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps & GlobalStateProps => {\n const {\n step,\n shippingOptions,\n savedInfo,\n canSaveCredentials,\n invoice,\n invoiceContent,\n nativeProvider,\n nativeParams,\n passwordMissing,\n error,\n confirmPaymentUrl,\n } = global.payment;\n\n const isProviderError = Boolean(invoice && (!nativeProvider || !SUPPORTED_PROVIDERS.has(nativeProvider)));\n const { needCardholderName, needCountry, needZip } = (nativeParams || {});\n const {\n nameRequested,\n phoneRequested,\n emailRequested,\n shippingAddressRequested,\n flexible,\n phoneToProvider,\n emailToProvider,\n currency,\n prices,\n } = (invoice || {});\n\n return {\n step,\n shippingOptions,\n savedInfo,\n canSaveCredentials,\n nativeProvider,\n passwordMissing,\n nameRequested,\n shippingAddressRequested,\n phoneRequested,\n emailRequested,\n flexible,\n phoneToProvider,\n emailToProvider,\n currency,\n prices,\n isProviderError,\n invoiceContent,\n needCardholderName,\n needCountry,\n needZip,\n error,\n confirmPaymentUrl,\n countryList: global.countryList.general,\n };\n },\n)(Invoice));\n\nfunction findShippingOption(shippingOptions: ShippingOption[], optionId: string) {\n return shippingOptions.find(({ id }) => id === optionId);\n}\n\nfunction getShippingPrices(shippingOptions: ShippingOption[], shippingOption: string) {\n const option = findShippingOption(shippingOptions, shippingOption);\n return option?.prices;\n}\n\nfunction getTotalPrice(prices: Price[] = [], shippingOptions: ShippingOption[] | undefined, shippingOption: string) {\n const shippingPrices = shippingOptions\n ? getShippingPrices(shippingOptions, shippingOption)\n : [];\n let total = 0;\n const totalPrices = prices.concat(shippingPrices || []);\n total = totalPrices.reduce((acc, cur) => {\n return acc + cur.amount;\n }, total);\n return total;\n}\n\nfunction getCheckoutInfo(state: FormState, shippingOptions: ShippingOption[] | undefined, paymentProvider: string) {\n const cardTypeText = detectCardTypeText(state.cardNumber);\n const paymentMethod = `${cardTypeText} *${state.cardNumber.slice(-4)}`;\n const shippingAddress = state.streetLine1\n ? `${state.streetLine1}, ${state.city}, ${state.countryIso2}`\n : undefined;\n const { phone, fullName: name } = state;\n const shippingOption = shippingOptions ? findShippingOption(shippingOptions, state.shipping) : undefined;\n const shippingMethod = shippingOption?.title;\n return {\n paymentMethod,\n paymentProvider,\n shippingAddress,\n name,\n phone,\n shippingMethod,\n };\n}\n\nfunction getRequestInfo(paymentState: FormState) {\n const {\n streetLine1,\n streetLine2,\n city,\n state,\n countryIso2,\n postCode,\n fullName: name,\n phone,\n email,\n } = paymentState;\n\n const shippingAddress = {\n streetLine1,\n streetLine2,\n city,\n state,\n countryIso2,\n postCode,\n };\n\n return {\n name,\n phone,\n email,\n shippingAddress,\n };\n}\n\nfunction getCredentials(paymentState: FormState) {\n const {\n cardNumber, cardholder, expiry, cvv, billingCountry, billingZip,\n } = paymentState;\n const [expiryMonth, expiryYear] = expiry.split('/');\n const data = {\n cardNumber,\n cardholder,\n expiryMonth,\n expiryYear,\n cvv,\n country: billingCountry,\n zip: billingZip,\n };\n\n return {\n data,\n };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useMemo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport type { Price } from '../../types';\nimport type { ApiShippingAddress } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport Checkout from './Checkout';\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nimport './PaymentModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n};\n\ntype StateProps = {\n prices?: Price[];\n shippingPrices: any;\n totalAmount?: number;\n currency?: string;\n info?: {\n shippingAddress?: ApiShippingAddress;\n phone?: string;\n name?: string;\n };\n photoUrl?: string;\n text?: string;\n title?: string;\n credentialsTitle?: string;\n shippingMethod?: string;\n};\n\nconst ReceiptModal: FC<OwnProps & StateProps> = ({\n isOpen,\n onClose,\n prices,\n shippingPrices,\n totalAmount,\n currency,\n info,\n photoUrl,\n text,\n title,\n credentialsTitle,\n shippingMethod,\n}) => {\n const lang = useLang();\n const checkoutInfo = useMemo(() => {\n return getCheckoutInfo(credentialsTitle, info, shippingMethod);\n }, [info, shippingMethod, credentialsTitle]);\n\n return (\n <Modal\n className=\"PaymentModal PaymentModal-receipt\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <div>\n <div className=\"header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n className=\"close-button\"\n color=\"translucent\"\n round\n size=\"smaller\"\n onClick={onClose}\n ariaLabel=\"Close\"\n >\n <i className=\"icon-close\" />\n </Button>\n <h3> {lang('PaymentReceipt')} </h3>\n </div>\n <div className=\"receipt-content custom-scroll\">\n <Checkout\n prices={prices}\n shippingPrices={shippingPrices}\n totalPrice={totalAmount}\n invoiceContent={{\n photoUrl,\n text,\n title,\n }}\n checkoutInfo={checkoutInfo}\n currency={currency}\n />\n </div>\n </div>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { receipt } = global.payment;\n const {\n currency,\n prices,\n info,\n totalAmount,\n credentialsTitle,\n shippingPrices,\n shippingMethod,\n photoUrl,\n text,\n title,\n } = (receipt || {});\n\n return {\n currency,\n prices,\n info,\n totalAmount,\n credentialsTitle,\n shippingPrices,\n shippingMethod,\n photoUrl,\n text,\n title,\n };\n },\n)(ReceiptModal));\n\nfunction getCheckoutInfo(paymentMethod?: string,\n info?:\n { phone?: string;\n name?: string;\n shippingAddress?: ApiShippingAddress;\n },\n shippingMethod?: string) {\n if (!info) {\n return { paymentMethod };\n }\n const { shippingAddress } = info;\n const fullAddress = shippingAddress?.streetLine1\n ? `${shippingAddress.streetLine1}, ${shippingAddress.city}, ${shippingAddress.countryIso2}`\n : undefined;\n const { phone, name } = info;\n return {\n paymentMethod,\n paymentProvider: 'Stripe',\n shippingAddress: fullAddress,\n name,\n phone,\n shippingMethod,\n };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo } from '../../lib/teact/teact';\n\nimport { STICKER_SIZE_AUTH, STICKER_SIZE_AUTH_MOBILE, STICKER_SIZE_TWO_FA } from '../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { LOCAL_TGS_URLS } from './helpers/animatedAssets';\n\nimport AnimatedSticker from './AnimatedSticker';\n\nimport useTimeout from '../../hooks/useTimeout';\nimport useFlag from '../../hooks/useFlag';\n\nimport './PasswordMonkey.scss';\n\ntype OwnProps = {\n isPasswordVisible: boolean;\n isBig?: boolean;\n};\n\nconst PEEK_MONKEY_SHOW_DELAY = 2000;\nconst SEGMENT_COVER_EYES: [number, number] = [0, 50];\nconst SEGMENT_UNCOVER_EYE: [number, number] = [0, 20];\nconst SEGMENT_COVER_EYE: [number, number] = [20, 0];\nconst STICKER_SIZE = IS_SINGLE_COLUMN_LAYOUT ? STICKER_SIZE_AUTH_MOBILE : STICKER_SIZE_AUTH;\n\nconst PasswordMonkey: FC<OwnProps> = ({ isPasswordVisible, isBig }) => {\n const [isFirstMonkeyLoaded, markFirstMonkeyLoaded] = useFlag(false);\n const [isPeekShown, markPeekShown] = useFlag(false);\n\n useTimeout(markPeekShown, PEEK_MONKEY_SHOW_DELAY);\n const handleFirstMonkeyLoad = useCallback(markFirstMonkeyLoaded, [markFirstMonkeyLoaded]);\n\n return (\n <div id=\"monkey\" className={isBig ? 'big' : ''}>\n {!isFirstMonkeyLoaded && (\n <div className=\"monkey-preview\" />\n )}\n <AnimatedSticker\n size={isBig ? STICKER_SIZE_TWO_FA : STICKER_SIZE}\n className={isPeekShown ? 'hidden' : 'shown'}\n tgsUrl={LOCAL_TGS_URLS.MonkeyClose}\n playSegment={SEGMENT_COVER_EYES}\n noLoop\n onLoad={handleFirstMonkeyLoad}\n />\n <AnimatedSticker\n size={isBig ? STICKER_SIZE_TWO_FA : STICKER_SIZE}\n className={isPeekShown ? 'shown' : 'hidden'}\n tgsUrl={LOCAL_TGS_URLS.MonkeyPeek}\n playSegment={isPasswordVisible ? SEGMENT_UNCOVER_EYE : SEGMENT_COVER_EYE}\n noLoop\n />\n </div>\n );\n};\n\nexport default memo(PasswordMonkey);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useEffect, useState, memo, useCallback,\n} from '../../lib/teact/teact';\n\nimport { DEBUG } from '../../config';\nimport { blobToFile, blobToDataUri } from '../../util/files';\nimport useLang from '../../hooks/useLang';\n\nimport Button from './Button';\nimport Modal from './Modal';\nimport Loading from './Loading';\n\nimport './CropModal.scss';\n\n// Change to 'base64' to get base64-encoded string\nconst cropperResultOptions: Croppie.ResultOptions & { type: 'blob' } = {\n type: 'blob',\n quality: 1,\n format: 'jpeg',\n circle: false,\n size: { width: 1024, height: 1024 },\n};\n\ntype ICroppie = typeof import('croppie');\nlet Croppie: ICroppie;\nlet croppiePromise: Promise<{ default: ICroppie }>;\n\nasync function ensureCroppie() {\n if (!croppiePromise) {\n croppiePromise = import('../../lib/croppie') as unknown as Promise<{ default: ICroppie }>;\n Croppie = (await croppiePromise).default;\n }\n\n return croppiePromise;\n}\n\nlet cropper: Croppie;\n\nasync function initCropper(imgFile: File) {\n try {\n const cropContainer = document.getElementById('avatar-crop');\n if (!cropContainer) {\n return;\n }\n\n const { offsetWidth, offsetHeight } = cropContainer;\n\n cropper = new Croppie(cropContainer, {\n enableZoom: true,\n boundary: {\n width: offsetWidth,\n height: offsetHeight,\n },\n viewport: {\n width: offsetWidth - 16,\n height: offsetHeight - 16,\n type: 'circle',\n },\n });\n\n const dataUri = await blobToDataUri(imgFile);\n await cropper.bind({ url: dataUri });\n } catch (err) {\n if (DEBUG) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n }\n}\n\ntype OwnProps = {\n file?: File;\n onChange: (file: File) => void;\n onClose: () => void;\n};\n\nconst CropModal: FC<OwnProps> = ({ file, onChange, onClose }: OwnProps) => {\n const [isCroppieReady, setIsCroppieReady] = useState(false);\n\n useEffect(() => {\n if (!file) {\n return;\n }\n\n if (!isCroppieReady) {\n ensureCroppie().then(() => setIsCroppieReady(true));\n\n return;\n }\n\n initCropper(file);\n }, [file, isCroppieReady]);\n\n const lang = useLang();\n\n const handleCropClick = useCallback(async () => {\n if (!cropper) {\n return;\n }\n\n const result: Blob | string = await cropper.result(cropperResultOptions);\n const croppedImg = typeof result === 'string' ? result : blobToFile(result, 'avatar.jpg');\n\n onChange(croppedImg);\n }, [onChange]);\n\n return (\n <Modal\n isOpen={Boolean(file)}\n onClose={onClose}\n title=\"Drag to reposition\"\n className=\"CropModal\"\n hasCloseButton\n >\n {isCroppieReady ? (\n <div id=\"avatar-crop\" />\n ) : (\n <Loading />\n )}\n <Button\n className=\"confirm-button\"\n round\n color=\"primary\"\n onClick={handleCropClick}\n ariaLabel={lang('CropImage')}\n >\n <i className=\"icon-check\" />\n </Button>\n </Modal>\n );\n};\n\nexport default memo(CropModal);\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, {\n useState, useEffect, memo, useCallback,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport CropModal from './CropModal';\n\nimport './AvatarEditable.scss';\n\ninterface OwnProps {\n title?: string;\n disabled?: boolean;\n currentAvatarBlobUrl?: string;\n onChange: (file: File) => void;\n}\n\nconst AvatarEditable: FC<OwnProps> = ({\n title = 'Change your profile picture',\n disabled,\n currentAvatarBlobUrl,\n onChange,\n}) => {\n const [selectedFile, setSelectedFile] = useState<File | undefined>();\n const [croppedBlobUrl, setCroppedBlobUrl] = useState<string | undefined>(currentAvatarBlobUrl);\n\n useEffect(() => {\n setCroppedBlobUrl(currentAvatarBlobUrl);\n }, [currentAvatarBlobUrl]);\n\n function handleSelectFile(event: ChangeEvent<HTMLInputElement>) {\n const target = event.target as HTMLInputElement;\n\n if (!target || !target.files || !target.files[0]) {\n return;\n }\n\n setSelectedFile(target.files[0]);\n target.value = '';\n }\n\n const handleAvatarCrop = useCallback((croppedImg: File) => {\n setSelectedFile(undefined);\n onChange(croppedImg);\n\n if (croppedBlobUrl) {\n URL.revokeObjectURL(croppedBlobUrl);\n }\n setCroppedBlobUrl(URL.createObjectURL(croppedImg));\n }, [croppedBlobUrl, onChange]);\n\n const handleModalClose = useCallback(() => {\n setSelectedFile(undefined);\n }, []);\n\n const labelClassName = buildClassName(\n croppedBlobUrl && 'filled',\n disabled && 'disabled',\n );\n\n return (\n <div className=\"AvatarEditable\">\n <label\n className={labelClassName}\n role=\"button\"\n tabIndex={0}\n title={title}\n >\n <input\n type=\"file\"\n onChange={handleSelectFile}\n accept=\"image/png, image/jpeg\"\n />\n <i className=\"icon-camera-add\" />\n {croppedBlobUrl && <img src={croppedBlobUrl} alt=\"Avatar\" />}\n </label>\n <CropModal file={selectedFile} onClose={handleModalClose} onChange={handleAvatarCrop} />\n </div>\n );\n};\n\nexport default memo(AvatarEditable);\n"],"names":["createGhost","source","origin","ghost","document","createElement","classList","add","img","Image","draggable","oncontextmenu","stopEvent","src","HTMLVideoElement","poster","appendChild","MediaViewerOrigin","profileInfo","querySelector","cloneNode","isMessageImageFullyVisible","container","imageEl","messageListElement","imgOffsetTop","offsetTop","closest","id","includes","parentElement","scrollTop","offsetHeight","applyStyles","element","styles","Object","assign","style","getNodes","message","containerSelector","mediaSelector","getMessageHtmlId","mediaEls","querySelectorAll","mediaEl","length","applyShape","firstChild","objectFit","cache","Map","useBlurSync","dataUri","blurredRef","useRef","isChanged","useOnChange","current","undefined","width","canvas","imgToCanvas","fastBlur","getContext","height","toDataURL","blurredAsync","isDisabled","delay","get","timeoutRef","forceUpdate","useForceUpdate","clearTimeout","useEffect","onload","blurredDataUri","size","clear","set","window","setTimeout","useBlur","Boolean","memo","withGlobal","global","isDownloading","selectIsDownloading","isProtected","selectIsMessageProtected","mediaData","isVideo","fileName","isAvatar","canReport","onReport","onCloseMediaViewer","zoomLevelChange","setZoomLevelChange","onForward","downloadMessageMedia","cancelMessageMediaDownload","getActions","loadProgress","downloadProgress","useMediaWithLoadProgress","getMessageMediaHash","handleDownloadClick","useCallback","handleZoomOut","handleZoomIn","lang","useLang","MenuButton","useMemo","onTrigger","isOpen","Button","round","color","className","onClick","ariaLabel","IS_SINGLE_COLUMN_LAYOUT","DropdownMenu","trigger","positionX","MenuItem","icon","Math","href","download","ProgressSpinner","progress","noCross","renderDownloadButton","text","isHidden","isForVideo","isMultiline","setIsMultiline","useState","footerContent","checkIsMultiline","clientHeight","REM","handleResize","throttle","addEventListener","removeEventListener","classNames","buildClassName","e","stopPropagation","dir","prop","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","units","bytes","number","floor","log","toFixed","PLAYBACK_RATES","bufferedRanges","bufferedProgress","currentTime","duration","fileSize","isForceMobileVersion","isPlayed","isFullscreenSupported","isFullscreen","isVisible","isBuffered","volume","isMuted","playbackRate","onChangeFullscreen","onVolumeClick","onVolumeChange","onPlaybackRateChange","onPlayPause","setVisibility","onSeek","isPlaybackMenuOpen","openPlaybackMenu","closePlaybackMenu","useFlag","seekerRef","isSeekingRef","isSeeking","timeout","body","remove","handleSeek","left","getBoundingClientRect","clientX","MouseEvent","targetTouches","max","min","handleStartSeek","handleStopSeek","captureEvents","onCapture","onRelease","onDrag","volumeIcon","percentagePlayed","ref","map","start","end","renderSeekLine","ripple","IS_IOS","RangeSlider","bold","value","onChange","formatMediaDuration","renderTime","loadedPercent","totalSize","formatFileSize","Menu","positionY","autoClose","onClose","rate","disabled","url","isGif","posterData","posterSize","isMediaViewerOpen","noPlay","toggleControls","areControlsVisible","setMediaViewerVolume","setMediaViewerMuted","setMediaViewerPlaybackRate","videoRef","setIsPlayed","IS_TOUCH_ENV","setCurrentTime","setFullscreen","exitFullscreen","elRef","setIsFullscreen","useLayoutEffect","listener","listenerEnter","listenerExit","video","PLATFORM_ENV","requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","mozRequestFullScreen","mozCancelFullScreen","webkitCancelFullScreen","webkitExitFullscreen","useFullscreenStatus","bufferingHandlers","useBuffering","shouldRender","shouldRenderSpinner","transitionClassNames","spinnerClassNames","useShowTransition","shouldRenderPlayButton","playButtonClassNames","pause","safePlay","togglePlayState","useVideoCleanup","handleMouseMove","handleMouseOut","target","handleTimeUpdate","currentTarget","handleEnded","handleFullscreenChange","position","handleVolumeChange","newVolume","handleVolumeMuted","handlePlaybackRateChange","newPlaybackRate","togglePayingStateBySpace","key","preventDefault","wrapperStyle","videoStyle","onMouseMove","onMouseOut","autoPlay","playsInline","loop","muted","onPlay","onEnded","onDoubleClick","onTimeUpdate","join","square","ownProps","chatId","threadId","messageId","avatarOwnerId","profilePhotoIndex","mediaViewer","selectChatMessage","senderId","avatarOwner","selectUser","selectChat","selectScheduledMessage","props","isActive","animationLevel","isFooterHidden","onFooterClick","setIsFooterHidden","photo","getMessagePhoto","getMessageVideo","webPagePhoto","getMessageWebPagePhoto","webPageVideo","getMessageWebPageVideo","isDocumentPhoto","isMessageDocumentPhoto","isDocumentVideo","isMessageDocumentVideo","isPhoto","isFromSharedMedia","isFromSearch","isGhostAnimation","getMediaHash","isFull","photos","getChatAvatarHash","pictogramBlobUrl","useMedia","ApiMediaFormat","previewMediaHash","previewBlobUrl","fullMediaBlobUrl","getMessageMediaFormat","localBlobUrl","blobUrl","bestImageData","thumbDataUri","getMessageMediaThumbDataUri","videoSize","getMessageFileSize","dimensions","getMessageDocument","mediaSize","getPhotoFullDimensions","getVideoDimensions","AVATAR_FULL_DIMENSIONS","renderPhoto","calculateMediaViewerDimensions","textParts","renderMessageText","hasFooter","onContextMenu","imageSize","canDrag","Spinner","renderVideoPreview","alt","easeOutCubic","easeOutQuart","timingFunctions","SLIDES_GAP","ANIMATION_DURATION","cancelAnimation","cancelZoomAnimation","SwipeDirection","getMessageId","selectMessage","rest","containerRef","activeSlideRef","transformRef","x","y","scale","lastTransformRef","swipeDirectionRef","isActiveRef","activeMessageId","setActiveMessageId","prevZoomLevelChange","usePrevious","hasZoomChanged","isMouseDown","setIsMouseDown","windowHeight","windowWidth","isResizing","useWindowSize","setTransform","selectMessageDebounced","useDebouncedCallback","clearSwipeDirectionDebounced","setIsActiveDebounced","shouldCloseOnVideo","clickXThreshold","handleToggleFooterVisibility","isFooter","pageY","pageX","useTimeout","lastTransform","lastDragOffset","lastZoomCenter","panDelta","initialContentRect","content","lastGestureTime","Date","now","setLastGestureTime","debounce","changeSlide","direction","mId","offset","animateNumber","from","to","timing","onUpdate","changeSlideOnClick","handleKeyDown","calculateOffsetBoundaries","inBoundsX","inBoundsY","centerX","centerY","minOffsetX","maxOffsetX","right","isBetween","clamp","minOffsetY","top","maxOffsetY","bottom","cleanup","isNotPassive","withNativeDrag","excludedClosestSelector","minZoom","maxZoom","doubleTapZoom","checkIfControlTarget","type","arePropsShallowEqual","event","captureEvent","cancelDrag","dragOffsetX","dragOffsetY","touches","IOS_SCREEN_EDGE_THRESHOLD","absOffsetX","abs","absOffsetY","h","Vertical","Horizontal","limit","x1","y1","transform","onZoom","zoom","zoomFactor","initialCenterX","initialCenterY","currentCenterX","currentCenterY","MIN_ZOOM","MAX_ZOOM","scaleFactor","offsetX","offsetY","scaledCenterX","scaledCenterY","scaleOffsetX","scaleOffsetY","isInThreshold","hasNextSlide","checkIfInsideSelector","absX","absY","s1","k","Vx","Vy","dirX","prevValue","delta","wheelEvent","WheelEvent","deltaY","ctrlKey","dispatchEvent","nextMessageId","previousMessageId","getAnimationStyle","isRtl","selector","matches","sender","isUserId","selectSender","closeMediaViewer","focusMessage","toggleChatInfo","handleFocusMessage","forceSyncOnIOs","senderTitle","getSenderTitle","Avatar","user","chat","renderText","formatMediaDateTime","date","settings","byKey","chatMessages","collectionIds","isChatWithSelf","selectIsChatWithSelf","selectScheduledMessages","selectChatMessages","selectOutlyingIds","selectListedIds","currentSearch","selectCurrentMediaSearch","foundIds","resultsByType","media","openMediaViewer","openForwardMenu","singleMessageId","messageIds","getChatMediaMessageIds","selectedMediaMessageIndex","indexOf","animationKey","prevSenderId","headerAnimation","isReportModalOpen","openReportModal","closeReportModal","avatarPhoto","getMessageFileName","toggle","mql","matchMedia","MEDIA_VIEWER_MEDIA_QUERY","addListener","removeListener","prevMessage","prevOrigin","prevAvatarOwner","prevBestImageData","dispatchHeavyAnimationEvent","ANIMATION_END_DELAY","fromImage","windowSize","availableWidth","availableHeight","getMediaViewerAvailableDimensions","toWidth","toHeight","calculateDimensions","toLeft","toTop","topOffsetRem","getTopOffset","fromTop","fromLeft","fromWidth","fromHeight","uncovered","realWidth","realHeight","srcWidth","srcHeight","uncover","fromTranslateX","fromTranslateY","fromScaleX","fromScaleY","requestAnimationFrame","clearShape","contains","removeChild","animateOpening","toImage","getElementById","targetTop","isElementInViewport","shouldFadeOut","existingGhost","getElementsByClassName","transition","transformOrigin","opacity","animateClosing","close","handleFooterClick","handleForward","fromChatId","forceOnHeavyAnimation","captureEscKeyListener","stopCurrentAudio","fromId","index","useHistoryBack","onBack","ShowTransition","Transition","activeKey","name","ReportModal","subject","currentUserId","chatOrUserIds","filterRef","filter","filterPlaceholder","loadMore","onFilterChange","onSelectChatOrUser","onCloseAnimationEnd","viewportIds","getMore","useInfiniteScroll","resetFilter","useInputFocusOnOpen","handleFilterChange","useKeyboardListNavigation","modalHeader","InputText","onKeyDown","placeholder","viewportOffset","Modal","header","InfiniteScroll","items","onLoadMore","withAbsolutePositioning","maxHeight","CHAT_HEIGHT_PX","i","ListItem","PrivateChatInfo","status","userId","GroupChatInfo","Loading","chats","byId","chatsById","listIds","orderedPinnedIds","switchBotInline","activeListIds","active","archivedListIds","archived","pinnedIds","contactIds","contactList","userIds","setForwardChatId","exitForwardMode","openChatWithText","resetSwitchBotInline","setFilter","isShown","markIsShown","unmarkIsShown","chatAndContactIds","priorityIds","unique","chatIds","getCanPostInChat","MAIN_THREAD_ID","usersById","getGlobal","users","sortChatIds","filterChatsByName","filterUsersByName","handleSelectUser","botUsername","query","handleClose","renderingChatAndContactIds","useCurrentOrPrev","getErrorHeader","error","isSlowMode","hasErrorKey","pick","dialogs","dismissDialog","acceptInviteConfirmation","sendMessage","showNotification","isModalOpen","openModal","closeModal","dialog","contactRequest","invite","hash","title","about","participantsCount","isChannel","isRequestNeeded","participantsText","joinText","requestToJoinText","renderInviteHeader","isText","renderInvite","contact","getReadableErrorText","notifications","dismissNotification","localId","Notification","onDismiss","toggleSafeLinkModal","handleOpen","open","ensureProtocol","handleDismiss","renderingUrl","ConfirmDialog","confirmLabel","confirmHandler","MAX_SAFE_DATE","WEEKDAY_LETTERS","isDisabledDay","year","month","day","minDate","maxDate","selectedDay","fixedMinDate","getDayStart","fixedMaxDate","formatInputTime","String","padStart","formatDay","selectedAt","minAt","maxAt","isFutureMode","isPastMode","withTimePicker","submitButtonLabel","secondButtonLabel","onSubmit","onSecondButtonClick","passedSelectedDate","prevIsOpen","isTimeInputFocused","markTimeInputAsFocused","unmarkTimeInputAsFocused","selectedDate","setSelectedDate","currentMonthAndYear","setCurrentMonthAndYear","getFullYear","getMonth","selectedHours","setSelectedHours","getHours","selectedMinutes","setSelectedMinutes","getMinutes","getDate","currentYear","currentMonth","getTime","newSelectedDate","shouldDisableNextMonth","shouldDisablePrevMonth","prevMonthGrid","currentMonthGrid","nextMonthGrid","setDate","setMonth","setFullYear","firstDay","getDay","totalDaysInPrevMonth","push","gridDate","lastRowDaysCount","buildCalendarGrid","submitLabel","formatDateToString","code","formatTime","formatSubmitLabel","handleSubmit","handleChangeHours","replace","hours","Number","setHours","hoursStr","handleChangeMinutes","minutes","setMinutes","minutesStr","d","dateCopy","role","tabIndex","handleDateSelect","inputMode","onFocus","onBlur","historyCalendarSelectedAt","searchMessagesByDate","closeHistoryCalendar","handleJumpToDate","timestamp","valueOf","userStatus","selectUserStatus","serverTimeOffset","phoneCodeList","countryList","phoneCodes","isByPhoneNumber","updateContact","importContact","closeNewContactDialog","renderingUser","renderingIsByPhoneNumber","inputRef","firstName","setFirstName","lastName","setLastName","phone","setPhone","phoneNumber","shouldSharePhoneNumber","setShouldSharePhoneNumber","canBeSubmitted","focus","handleFirstNameChange","handlePhoneChange","formatPhoneNumberWithCode","handleLastNameChange","getUserStatus","label","Checkbox","checked","onCheck","webApp","bot","isInstalled","attachMenu","bots","selectCurrentChat","theme","selectTheme","closeWebApp","sendWebViewData","prolongWebView","toggleBotInAttachMenu","openTelegramLink","openChat","mainButton","setMainButton","buttonText","queryId","isSimple","handleEvent","eventType","linkUrl","eventData","path_full","data","themeParams","extractCurrentThemeParams","validateHexColor","button_color","textColor","text_color","is_visible","trim","is_active","isProgressVisible","is_progress_visible","reloadFrame","sendEvent","sendViewport","sendTheme","isSimpleView","onEvent","ignoreEventsRef","frame","once","contentWindow","postMessage","JSON","stringify","is_expanded","theme_params","sendCustomStyle","handleMessage","parse","scrollbarColor","getComputedStyle","getPropertyValue","err","useWebAppFrame","shouldShowMainButton","useInterval","peer","handleMainButtonClick","handleRefreshClick","handleToggleClick","botId","isEnabled","openBotChat","MoreMenuButton","isMenuOpen","isAttachMenuBot","destructive","prevMainButtonColor","prevMainButtonTextColor","prevMainButtonIsActive","prevMainButtonText","mainButtonCurrentColor","mainButtonCurrentTextColor","mainButtonCurrentIsActive","mainButtonCurrentText","shouldDecreaseWebFrameSize","setShouldDecreaseWebFrameSize","shouldHideButton","setShouldHideButton","buttonChangeTimeout","hasCloseButton","sandbox","allow","allowFullScreen","cancelBotTrustRequest","markBotTrusted","previousBot","previousType","currentBot","currentType","handleBotTrustAccept","getUserFullName","closeBotAttachRequestModal","confirmBotAttachRequest","isSchedule","selectCurrentMessageList","canDeleteForAll","selectAllowedMessageActions","contactName","getUserFirstOrLastName","getPrivateChatUserId","willDeleteForCurrentUserOnly","isChatBasicGroup","willDeleteForAll","isChatSuperGroup","album","deleteMessages","deleteScheduledMessages","handleDeleteMessageForAll","messages","shouldDeleteForAll","handleDeleteMessageForSelf","onEnter","isPrivateChat","isChatChannel","isGroup","isSuperGroup","canPinForAll","pinMessage","handlePinMessageForAll","isUnpin","handlePinMessage","isOneSide","isSilent","pinnedMessagesCount","onUnpin","selectedMessageIds","selectedMessages","selectCanDeleteSelectedMessages","exitMessageSelectMode","messageListType","canDelete","selectCanReportSelectedMessages","canDownload","selectCanDownloadSelectedMessages","hasProtectedMessage","selectHasProtectedMessage","selectedMessagesCount","selectSelectedMessagesCount","canDeleteMessages","canReportMessages","canDownloadMessages","canPost","openForwardMenuForSelectedMessages","downloadSelectedMessages","copySelectedMessages","isDeleteModalOpen","openDeleteModal","closeDeleteModal","useHotkeys","useCopySelectedMessages","captureKeyboardListeners","onBackspace","onDelete","onEsc","handleCopy","handleDownload","prevSelectedMessagesCount","formattedMessagesCount","renderButton","seenByModal","memberIds","seenByUserIds","closeSeenByModal","handleClick","renderingMemberIds","noStatusOrTyping","reactorModal","reactions","reactors","loadReactors","closeReactorListModal","isClosing","startClosing","stopClosing","chosenTab","setChosenTab","canShowFilters","count","results","chatIdRef","handleCloseAnimationEnd","handleLoadMore","allReactions","l","reaction","concat","nextOffset","LoadMoreDirection","formatIntegerCompact","find","ReactionStaticEmoji","fullName","activeEmojiInteraction","animatedEffect","selectAnimatedEmojiEffect","effectAnimationId","localEffectAnimation","keys","LOCAL_TGS_URLS","stopActiveEmojiInteraction","isHiding","startHiding","isPlaying","startPlaying","stop","handleCancelAnimation","dispatchHeavyAnimationStop","effectTgsUrl","startSize","tgsUrl","isReversed","AnimatedSticker","play","quality","IS_ANDROID","noLoop","onLoad","onSelect","buttonRef","activeElement","privateChatUserId","isPinned","selectIsChatPinned","selectIsChatMuted","selectNotifySettings","selectNotifyExceptions","canChangeFolder","chatFolders","orderedIds","withUsername","isChatFolderModalOpen","openChatFolderModal","closeChatFolderModal","contextActions","useChatContextActions","handleDelete","handleChatFolderChange","useSelectWithEnter","avatarSize","DeleteChatModal","runThrottled","cb","topUserIds","topPeers","recentlyFoundChatIds","globalSearch","onReset","loadTopUsers","addRecentlyFoundChatId","clearRecentlyFoundChats","topUsersRef","useHorizontalScroll","shouldReplaceHistory","lastSyncTime","privateChatUser","searchQuery","mediaThumbnail","mediaBlobUrl","isRoundVideo","getMessageRoundVideo","isSavedMessages","isSelf","getChatTitle","isVerified","VerifiedIcon","fakeType","FakeIcon","Link","formatPastTimeShort","renderMessageSummary","renderSummary","searchDate","suggestions","match","suggestion","currentDate","latestYear","getSuggestionsFromDate","localContactIds","fetchingStatus","globalResults","localResults","globalChatIds","globalUserIds","localChatIds","localUserIds","byChatId","globalMessagesByChatId","dateSearchQuery","onSearchDateSelect","searchMessagesGlobal","setGlobalSearchChatId","shouldShowMoreLocal","setShouldShowMoreLocal","shouldShowMoreGlobal","setShouldShowMoreGlobal","handleChatClick","handlePickerItemClick","startsWith","MEMO_EMPTY_ARRAY","contactIdsWithMe","foundContactIds","foundMessages","split","sort","a","b","handleClickShowMoreLocal","handleClickShowMoreGlobal","nothingFound","noScrollRestoreOnTop","noFastList","NothingFound","description","PickerSelectedItem","chatOrUserId","clickArg","createMapStateToProps","isVoice","activeDownloads","isLoading","searchChatId","isChatProtected","CURRENT_TYPE","observe","observeIntersectionForMedia","useIntersectionObserver","rootRef","throttleMs","handleSelectMedia","canRenderContents","useAsyncRendering","SLIDE_TRANSITION_DURATION","isMediaGrid","isMessageList","itemSelector","Media","idPrefix","observeIntersection","handleMessageFocus","shouldDrawDateDivider","toYearMonth","formatMonthAndYear","WebLink","getSenderName","onMessageClick","Document","withDate","datetime","smaller","onDateClick","openAudioPlayer","handlePlayAudio","Audio","AudioOrigin","TABS","GlobalSearchContent","CHAT_TABS","slice","TRANSITION_RENDER_COUNT","currentContent","setGlobalSearchContent","setGlobalSearchDate","activeTab","setActiveTab","parseDateString","handleSwitchTab","tab","handleSearchDateSelect","TabList","tabs","onSwitchTab","renderCount","INITIAL_STATE","currentPassword","password","hint","email","twoFaReducer","state","action","payload","currentScreen","editedFolderId","onSaveFilter","onScreenSelect","signOut","deleteChatFolder","isSignOutDialogOpen","setIsSignOutDialogOpen","isDeleteFolderDialogOpen","setIsDeleteFolderDialogOpen","openSignOutConfirmation","closeSignOutConfirmation","openDeleteFolderConfirmation","closeDeleteFolderConfirmation","handleSignOutMessage","handleDeleteFolderMessage","SettingsMenuButton","SettingsScreens","renderHeaderContent","confirmIsDestructive","sessionCount","activeSessions","orderedHashes","currentUser","loadProfilePhotos","loadAuthorizations","profileId","ProfileInfo","forceShowSelf","ChatExtra","langName","LINK_PREFIX","LINK_PREFIX_REGEX","USERNAME_REGEX","runDebouncedForCheckUsername","currentUsername","asLink","isUsernameAvailable","checkUsername","username","setUsername","langPrefix","usernameSuccess","usernameError","test","handleUsernameChange","newUsername","isValid","isUsernameValid","success","readOnly","ERROR_FIRST_NAME_MISSING","ERROR_BIO_TOO_LONG","profileEdit","currentFirstName","currentLastName","fullInfo","bio","currentBio","currentAvatarHash","loadCurrentUser","updateProfile","isUsernameTouched","setIsUsernameTouched","isProfileFieldsTouched","setIsProfileFieldsTouched","setError","setPhoto","setBio","currentAvatarBlobUrl","ProfileEditProgress","isUsernameError","isSaveButtonShown","handlePhotoChange","newPhoto","handleBioChange","handleProfileSave","trimmedFirstName","trimmedLastName","trimmedBio","AvatarEditable","UsernameInput","FloatingActionButton","canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb","setSettingOption","renderFileSizeCallback","AUTODOWNLOAD_FILESIZE_MB_LIMITS","handleFileSizeChange","handleCanAutoPlayGifsChange","handleCanAutoPlayVideosChange","renderAutoDownloadBlock","canAutoLoadFromContacts","canAutoLoadInPrivateChats","canAutoLoadInGroups","canAutoLoadInChannels","isChecked","renderValue","renderContentSizeSlider","runThrottledForLoadRecommended","orderedFolderIds","foldersById","recommended","recommendedChatFolders","onCreateFolder","onEditFolder","loadRecommendedChatFolders","addChatFolder","showDialog","handleCreateFolder","chatsCountByFolderId","useFolderManagerForChatsCount","userFolders","folder","subtitle","getFolderDescriptionText","handleCreateFolderFromRecommended","AnimatedIcon","STICKER_SIZE_FOLDER_SETTINGS","pill","fluid","narrow","multiline","itemName","itemPluralName","ERROR_NO_TITLE","ERROR_NO_CHATS","loadedActiveChatIds","loadedArchivedChatIds","dispatch","onAddIncludedChats","onAddExcludedChats","editChatFolder","isIncludedChatsListExpanded","setIsIncludedChatsListExpanded","isExcludedChatsListExpanded","setIsExcludedChatsListExpanded","selectedChatIds","includedChatIds","selectedChatTypes","includedChatTypes","selectChatFilters","excludedChatIds","excludedChatTypes","folderId","visibleIncludedChatIds","visibleExcludedChatIds","allLoadedChatsSet","Set","loadedIncludedChatIds","findIntersectionWithSet","loadedExcludedChatIds","handleChange","mode","folderUpdate","renderChats","visibleChatIds","isExpanded","leftChatsCount","clickHandler","chatType","INCLUDED_CHAT_TYPES","typeKey","EXCLUDED_CHAT_TYPES","inactive","renderChatType","isTouched","selectedIds","filterValue","onSelectedIdsChange","onSelectedChatTypesChange","chatTypes","shouldMinimize","hasMaxChats","handleItemClick","newSelectedIds","splice","handleChatTypeClick","newSelectedChatTypes","selectedType","isMinimized","canClose","isSelected","withChatType","chatFilter","folderAllOrderedIds","useFolderManagerForOrderedIds","ALL_FOLDER_ID","folderArchivedOrderedIds","ARCHIVED_FOLDER_ID","displayedIds","newFilter","handleSelectedIdsChange","ids","includeFilters","excludeFilters","handleSelectedChatTypesChange","newFilters","forEach","shownScreen","handleReset","handleEditFolder","handleAddIncludedChats","handleAddExcludedChats","STICKER_SIZE_PICKER_HEADER","stickerSet","isIntersecting","useIsIntersecting","mediaHash","lottieData","useMediaTransition","firstLetters","getFirstLetters","hasThumbnail","isVideos","IS_WEBM_SUPPORTED","stickers","firstSticker","isLottie","STICKER_SIZE_GENERAL_SETTINGS","StickerButton","sticker","noContextMenu","ANIMATION_LEVEL_OPTIONS","TIME_FORMAT_OPTIONS","shouldUseSystemTheme","stickerSetIds","added","setIds","stickerSetsById","setsById","defaultReaction","appConfig","messageTextSize","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","timeFormat","stickerSettingsRef","observeIntersectionForCovers","setSticker","APPEARANCE_THEME_OPTIONS","KEYBOARD_SEND_OPTIONS","subLabel","IS_MAC_OS","handleAnimationLevelChange","newLevel","_","handleMessageTextSizeChange","newSize","documentElement","setProperty","setAttribute","toString","handleAppearanceThemeChange","newTheme","getSystemTheme","switchTheme","ANIMATION_LEVEL_MAX","handleTimeFormatChange","newTimeFormat","wasTimeFormatSetManually","setTimeFormat","handleStickerSetClick","handleMessageSendComboChange","newCombo","handleSuggestStickersChange","newValue","handleShouldLoopStickersChange","stickerSets","installedDate","RadioGroup","options","selected","fromSticker","hex2rgb","param","parseInt","substring","rgb2hex","p0","p1","p2","rgb2hsb","r","g","s","v","hsb2rgb","f","p","q","t","getPatternColor","rgbColor","hue","saturation","wallpaper","slug","localMediaHash","thumbRef","useCanvasBlur","thumbnail","isLoadAllowed","setIsLoadAllowed","fullMedia","wasLoadDisabled","UPLOADING_WALLPAPER_SLUG","cacheKeyRef","handleSelect","blob","fetchBlob","cacheApi","save","CUSTOM_BG_CACHE_NAME","isAllowed","background","isBlurred","themes","loadedWallpapers","loadWallpapers","uploadWallpaper","setThemeSettings","themeRef","handleFileSelect","files","handleUploadWallpaper","openSystemFilesDialog","handleSetColor","handleResetToDefault","backgroundColor","patternColor","DARK_THEME_PATTERN_COLOR","DEFAULT_PATTERN_COLOR","handleWallPaperSelect","currentWallpaper","async","defaultRGB","rgb","context","image","preloadImage","naturalHeight","naturalWidth","offsetWidth","drawImage","getImageData","blockSize","getAverageColor","then","handleWallPaperBlurChange","isUploading","DEFAULT_HSB","PREDEFINED_COLORS","hsb2positions","hsb","rects","colorPosition","colorRect","huePosition","hueRect","positions2hsb","colorPickerRef","huePickerRef","isFirstRunRef","setHsb","getInitialHsb","hsbRef","isDragging","markIsDragging","unmarkIsDragging","rgbInput","setRgbInput","hexInput","setHexInput","rectsRef","colorCtxRef","offsetLeft","handleColorDrag","handleHueDrag","selectorToPreventScroll","withCursor","hex","hueHex","w","ctx","imgData","createImageData","pixels","col","perY","st","ed","perX","putImageData","drawColor","drawHue","handleRgbChange","rgbValue","channel","handleHexChange","hexValue","handlePredefinedColorClick","dataset","hasPrivateChatsNotifications","hasPrivateChatsMessagePreview","hasGroupNotifications","hasGroupMessagePreview","hasBroadcastNotifications","hasBroadcastMessagePreview","hasContactJoinedNotifications","hasWebNotifications","hasPushNotifications","notificationSoundVolume","loadNotificationSettings","updateContactSignUpNotification","updateNotificationSettings","updateWebNotificationSettings","runDebounced","useRunDebounced","handleSettingsChange","peerType","setting","currentIsSilent","currentShouldShowPreviews","shouldShowPreviews","handleWebNotificationsChange","handlePushNotificationsChange","handlePrivateChatsNotificationsChange","handlePrivateChatsPreviewChange","handleGroupsNotificationsChange","handleGroupsPreviewChange","handleChannelsNotificationsChange","handleChannelsPreviewChange","handleContactNotificationChange","playNotifySound","hasPassword","isSensitiveEnabled","canChangeSensitive","privacy","blocked","passcode","hasPasscode","blockedCount","totalCount","privacyPhoneNumber","privacyLastSeen","lastSeen","privacyProfilePhoto","profilePhoto","privacyForwarding","forwards","privacyGroupChats","chatInvite","privacyPhoneCall","phoneCall","privacyPhoneP2P","phoneP2P","loadPrivacySettings","loadBlockedContacts","loadContentSettings","updateContentSettings","getVisibilityValue","visibility","blockCount","blockChatIds","blockUserIds","allowCount","allowChatIds","allowUserIds","total","exceptionString","languages","language","loadLanguages","selectedLanguage","setSelectedLanguage","markIsLoading","unmarkIsLoading","langCode","setLanguage","currentLangCode","navigator","toLowerCase","shortLangCode","substr","nativeName","buildOptions","loadingOption","getPrivacyKey","screen","privacySettings","setPrivacyVisibility","visibilityOptions","exceptionLists","shouldShowDenied","shouldShowAllowed","privacyKey","headerText","descriptionText","allowedContactsScreen","deniedContactsScreen","allowedCount","reduce","result","membersCount","handleVisibilityChange","getSessionIcon","session","platform","device","deviceModel","systemVersion","byHash","changeSessionSettings","terminateAuthorization","renderingSession","handleSecretChatsStateChange","areSecretChatsEnabled","handleCallsStateChange","areCallsEnabled","handleTerminateSessionClick","formatDateTimeToString","dateActive","appName","appVersion","ip","region","country","getLocation","Switcher","ttlDays","terminateAllAuthorizations","changeSessionTtl","isConfirmTerminateAllDialogOpen","openConfirmTerminateAllDialog","closeConfirmTerminateAllDialog","openedSessionHash","setOpenedSessionHash","autoTerminateValue","AUTO_TERMINATE_OPTIONS","handleTerminateAllSessions","handleOpenSessionModal","handleCloseSessionModal","handleChangeSessionTtl","days","currentSession","currentSessionHash","isCurrent","otherSessionHashes","hasOtherSessions","sessionHashes","sessionHash","handler","blockedIds","userSearch","setUserSearchQuery","blockContact","filteredContactIds","availableContactIds","contactId","firstId","secondId","secondName","localeCompare","handleRemoveUser","accessHash","chatsByIds","usersByIds","unblockContact","isBlockUserModalOpen","openBlockUserModal","closeBlockUserModal","handleUnblockClick","isPrivate","renderContact","AnimatedIconWithPreview","previewUrl","lockPreviewUrl","shouldDisablePasswordManager","expectedPassword","clearError","validationError","setValidationError","shouldShowPassword","setShouldShowPassword","newPassword","handleClearError","PasswordMonkey","isBig","isPasswordVisible","PasswordForm","shouldResetValue","onChangePasswordVisibility","onStart","FOCUS_DELAY_TIMEOUT_MS","animatedEmoji","selectAnimatedEmoji","shouldConfirm","setValue","isConfirmShown","markIsConfirmShown","unmarkIsConfirmShown","handleInputChange","handleSkip","handleSkipConfirm","AnimatedIconFromSticker","STICKER_SIZE_TWO_FA","codeLength","twoFaSettings","waitingEmailCodeLength","updatePassword","checkPassword","clearTwoFaError","updateRecoveryEmail","provideTwoFaEmailCode","clearPassword","handleStartWizard","handleNewPassword","handleNewPasswordConfirm","handleNewPasswordHint","handleNewPasswordEmail","onSuccess","handleChangePasswordCurrent","handleChangePasswordNew","handleChangePasswordConfirm","handleChangePasswordHint","handleTurnOff","handleRecoveryEmailCurrentPassword","handleRecoveryEmail","handleEmailCode","getCurrentPrivacySettings","isAllowList","setPrivacySettings","selectedContactIds","setSearchQuery","isSubmitShown","setIsSubmitShown","newSelectedContactIds","setNewSelectedContactIds","handleSelectedContactIdsChange","contactsIds","Picker","itemIds","searchInputId","availableReactions","selectedReaction","setDefaultReaction","isInactive","STICKER_SIZE_PASSCODE","fullReset","onSetPasscode","setPasscode","clearPasscode","setPasscodeError","clearPasscodeError","currentPasscode","decryptSession","TWO_FA_SCREENS","PASSCODE_SCREENS","FOLDERS_SCREENS","PRIVACY_SCREENS","PRIVACY_PHONE_NUMBER_SCREENS","PRIVACY_LAST_SEEN_PHONE_SCREENS","PRIVACY_PROFILE_PHOTO_SCREENS","PRIVACY_PHONE_CALL_SCREENS","PRIVACY_PHONE_P2P_SCREENS","PRIVACY_FORWARDING_SCREENS","PRIVACY_GROUP_CHATS_SCREENS","foldersState","foldersDispatch","shouldSkipTransition","twoFaState","twoFaDispatch","useReducer","privacyPasscode","setPrivacyPasscode","forceReturnToChatList","handleSaveFilter","renderCurrentSection","isScreenActive","isFrom","currentKey","privacyAllowScreens","isTwoFaScreen","isPasscodeScreen","isFoldersScreen","isPrivacyScreen","values","SettingsGeneralBackgroundColor","renderCurrentSectionContent","LAYERS_ANIMATION_NAME","statusesById","userStatusesById","openNewContactDialog","filteredIds","sortUserIds","isSearching","selectedMemberIds","onSelectedMemberIdsChange","onNextStep","setGlobalSearchQuery","canBeInvitedToGroup","isUserBot","handleNextStep","creationProgress","creationError","chatCreation","createGroupChat","createChannel","setTitle","setAbout","chatTitleEmptyError","channelTitleEmptyError","chatTooManyUsersError","ChatCreationProgress","handleTitleChange","handleDescriptionChange","handleCreateGroup","handleCreateChannel","renderedError","RENDER_COUNT","LeftColumnContent","onContentChange","newChatMemberIds","setNewChatMemberIds","isStepActive","ChatList","folderType","folderOrderedIds","editChatFolders","initialSelectedFolderIds","pinnedChatIds","selectedFolderIds","setSelectedFolderIds","folders","idsToRemove","idsToAdd","CheckboxGroup","getCopyLabel","hasSelection","scrollLockEl","IGNORED_KEYS","Down","ArrowDown","Up","ArrowUp","Left","ArrowLeft","Right","ArrowRight","PageUp","PageDown","End","Home","Tab","getTouchY","changedTouches","clientY","scrollHeight","preventDefaultForScrollKeys","HTMLElement","tagName","getAttribute","isTextBox","disableScrolling","el","_excludedClosestSelector","passive","onkeydown","enableScrolling","REACTION_SIZE","IS_COMPACT_MENU","cn","createClassNameBuilder","previewIndex","onSendReaction","isReady","selectAnimation","isActivated","activate","deactivate","isAnimationLoaded","markAnimationLoaded","shouldRenderAnimated","animatedClassNames","shouldRenderStatic","staticClassNames","onMouseEnter","enabledReactions","itemsScrollRef","isHorizontalScrollEnabled","enableHorizontalScroll","handleWheel","onWheelCapture","onTouchMove","anchor","canSendNow","canReschedule","canReply","canEdit","canPin","canUnpin","canForward","canFaveSticker","canUnfaveSticker","canCopy","canCopyLink","canSelect","canSaveGif","canShowSeenBy","canShowReactionsCount","canRemoveReaction","canShowReactionList","seenByRecentUsers","onReply","onEdit","onPin","onFaveSticker","onUnfaveSticker","onSend","onReschedule","onCopyLink","onCopyNumber","onDownload","onSaveGif","onShowSeenBy","onShowReactors","onCopyMessages","menuRef","scrollableRef","noReactions","withReactions","markIsReady","unmarkIsReady","handleAfterCopy","copyOptions","afterEffect","getMessageText","getMessageContact","canImageBeCopied","hasMessageLocalBlobUrl","CLIPBOARD_ITEM_SUPPORTED","selection","getSelection","Promise","resolve","mediaLoader","copyImageToClipboard","anchorNode","parentNode","getMessageIdsForSelectedText","clipboardText","getMessageTextWithSpoilers","copyTextToClipboard","getMessageCopyOptions","getTriggerElement","getRootElement","getMenuElement","getLayout","extraHeightAudioPlayer","pinnedElement","extraHeightPinned","extraPaddingX","extraTopPadding","marginSides","extraMarginTop","handleRemoveReaction","transformOriginX","transformOriginY","menuStyle","withScroll","useContextMenuPosition","bubbleStyle","option","START_SIZE","selectActiveDownloadIds","seenByExpiresAt","seenByMaxChatMembers","noOptions","isScheduled","isLocal","isMessageLocal","isChatGroup","isOwnMessage","isAction","isActionMessage","areReactionsEmpty","canSeeList","some","isChosen","canCopyNumber","isForbidden","hasFullInfo","SERVICE_NOTIFICATIONS_USER_ID","chatUsername","setReplyingToId","setEditingId","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","loadSeenBy","openSeenByModal","sendReaction","openReactorListModal","loadFullChat","copyMessagesByIds","saveGif","setIsMenuOpen","setIsDeleteModalOpen","setIsReportModalOpen","isPinModalOpen","setIsPinModalOpen","isCalendarOpen","openCalendar","closeCalendar","recentReactions","msg","handleReport","closeMenu","closePinModal","handleCloseCalendar","handleReply","handleEdit","handlePin","handleUnpin","handleFaveSticker","handleUnfaveSticker","handleSelectMessage","params","childMessageIds","withShift","handleScheduledMessageSend","handleOpenCalendar","handleOpenSeenByModal","handleOpenReactorListModal","handleRescheduleMessage","scheduledAt","handleCopyMessages","handleCopyLink","handleCopyNumber","handleSaveGif","gif","handleSendReaction","reportMessageIds","scheduledMaxDate","getDayStartAt","stickerSetShortName","currentMessageList","sendOptions","getAllowedAttachmentOptions","canSendStickers","canScheduleUntilOnline","selectCanScheduleUntilOnline","shouldSchedule","selectShouldSchedule","selectStickerSet","stickerSetId","selectStickerSetByShortName","loadStickers","toggleStickerSet","requestCalendar","calendar","useSchedule","stickerSetAccessHash","isScheduleRequested","isPreloadedGlobally","handleButtonClick","STICKER_SIZE_MODAL","BOT_BUTTONS","help","isRestricted","canAddContact","getCanAddContact","canReportChat","chatBot","REPLIES_USER_ID","selectChatBot","canDeleteChat","getCanDeleteChat","hasLinkedChat","linkedChatId","botCommands","botInfo","commands","withExtraActions","canStartBot","canRestartBot","canSubscribe","canSearch","canCall","canMute","canViewStatistics","canLeave","canEnterVoiceChat","canCreateVoiceChat","onSubscribeChannel","onSearchClick","updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot","joinGroupCall","createGroupCall","openLinkedChat","openAddContactDialog","requestCall","toggleStatistics","handleStartBot","command","handleRestartBot","handleToggleMuteClick","handleEnterVoiceChatClick","handleLinkedChatClick","handleAddContactClick","handleSubscribe","handleVideoCall","handleCall","handleSearch","handleStatisticsClick","handleSelectMessages","botButtons","cmd","Portal","runDebouncedForSearch","selectCurrentTextSearch","isHistoryCalendarOpen","setLocalTextSearchQuery","searchTextMessagesLocal","closeLocalTextSearch","openHistoryCalendar","focusedIndex","setFocusedIndex","visualViewport","mainEl","pageTop","Array","input","div","contentEditable","blur","handleMessageSearchQueryChange","newQuery","handleUp","newFocusIndex","handleDown","SearchInput","findInViewport","selectorOrElements","margin","isDense","shouldContainBottom","isHorizontal","viewportY1","viewportY2","allElements","visibleIndexes","isFound","y2","setTooltipItemVisible","first","isFullyVisible","fastSmoothScroll","useKeyboardNavigation","shouldSaveSelectionOnUpdateItems","shouldRemoveSelectionOnReset","noArrowNavigation","shouldSelectOnTab","selectedItemIndex","setSelectedItemIndex","getSelectedIndex","newIndex","cycleRestrict","handleArrowKey","handleItemSelect","item","isSelectionOutOfRange","onUp","onDown","onLeft","onRight","onTab","onInsertUserName","filteredUsers","handleUserSelect","forceFocus","handleSelectMention","member","selectedMentionIndex","prevChatMembers","renderedChatMembers","attachments","caption","canShowCustomSendMenu","groupChatMembers","recentEmojis","baseEmojiKeywords","emojiKeywords","addRecentEmoji","onCaptionUpdate","onFileAppend","onClear","onSendSilent","onSendScheduled","captionRef","useStateRef","mainButtonRef","hideTimeoutRef","prevAttachments","renderingAttachments","isHovered","markHovered","unmarkHovered","isQuick","every","quick","isMentionTooltipOpen","closeMentionTooltip","insertMention","mentionFilteredUsers","useMentionTooltip","EDITABLE_INPUT_MODAL_ID","isEmojiTooltipOpen","closeEmojiTooltip","filteredEmojis","insertEmoji","useEmojiTooltip","isContextMenuOpen","isCustomSendMenuOpen","handleContextMenu","handleContextMenuClose","handleContextMenuHide","useContextMenuHandlers","sendAttachments","handleFilesDrop","dataTransfer","newFiles","file","CONTENT_TYPES_WITH_PREVIEW","areAllPhotos","SUPPORTED_IMAGE_CONTENT_TYPES","mimeType","areAllVideos","SUPPORTED_VIDEO_CONTENT_TYPES","areAllAudios","SUPPORTED_AUDIO_CONTENT_TYPES","isOpenToBottom","onSendSchedule","renderHeader","onDragEnter","onDrop","onDragOver","onDragLeave","relatedTarget","toTarget","fromTarget","attachment","File","filename","extension","getFileExtension","previewData","emojis","onEmojiSelect","MessageInput","isAttachmentModalInput","html","editableInputId","canAutoFocus","isQuiz","shouldBeAnonimous","questionInputRef","optionsListRef","solutionRef","question","setQuestion","setOptions","isAnonymous","setIsAnonymous","isMultipleAnswers","setIsMultipleAnswers","isQuizMode","setIsQuizMode","solution","setSolution","correctOption","setCorrectOption","hasErrors","setHasErrors","focusInput","solutionEl","innerHTML","addNewOption","newOptions","list","scrollTo","behavior","handleCreate","questionTrimmed","optionsTrimmed","o","summary","answers","correct","isPublic","multipleChoice","quiz","entities","parseMessageInput","correctAnswers","solutionEntities","updateOption","removeOption","handleCorrectOptionChange","handleIsAnonymousChange","handleMultipleAnswersChange","handleQuizModeChange","handleKeyPress","keyCode","handleQuestionChange","getQuestionError","getOptionsError","renderOptions","onKeyPress","renderQuizNoOptionError","hidden","emoji","native","isLoaded","LOADED_EMOJIS","onMouseDown","names","IS_EMOJI_SUPPORTED","loading","handleEmojiLoad","category","allEmojis","useOnIntersect","emojisPerRow","ceil","RECENT_SYMBOL_SET_ID","displayedEmoji","ICONS_BY_CATEGORY","recent","people","nature","foods","activity","places","objects","symbols","flags","categoryIntersections","emojiDataPromise","emojiRawData","emojiData","headerRef","categories","setCategories","setEmojis","activeCategoryIndex","setActiveCategoryIndex","entries","entry","intersectingWithIndexes","newLeft","HEADER_BUTTON_WIDTH","fastSmoothScrollHorizontal","allCategories","themeCategories","unshift","exec","default","uncompressEmoji","ensureEmojiData","selectCategory","categoryEl","handleEmojiSelect","MENU_TRANSITION_DURATION","containerClassName","faded","STICKER_MARGIN","loadAndPlay","favoriteStickers","onStickerSelect","onStickerUnfave","onStickerFave","onStickerRemoveRecent","clearRecentStickers","isConfirmModalOpen","openConfirmModal","closeConfirmModal","handleClearRecent","stickersPerRow","STICKER_SIZE_PICKER","favoriteStickerIdsSet","isRecent","noAnimate","onUnfaveClick","FAVORITE_SYMBOL_SET_ID","has","onFaveClick","onRemoveRecentClick","canViewSet","stickerSetIntersections","favorite","recentStickers","addedSetIds","shouldPlay","loadRecentStickers","addRecentSticker","removeRecentSticker","activeSetIndex","setActiveSetIndex","sendMessageAction","useSendMessageAction","areAddedLoaded","allSets","defaultSets","fullSet","CHAT_STICKER_SET_ID","pickTruthy","noPopulatedSets","stickerSetEl","handleStickerSelect","handleStickerUnfave","handleStickerFave","handleRemoveRecentSticker","fullClassName","buttonClassName","onUnsaveClick","videoData","shouldRenderVideo","isVideoReady","contextMenuPosition","handleBeforeContextMenu","handleUnsaveClick","handleContextDelete","handleSendQuiet","handleSendScheduled","handleMouseDown","preventMessageInputBlurWithBubbling","preload","savedGifs","gifs","saved","canSendGifs","onGifSelect","loadSavedGifs","debounceMs","shouldUnsave","SymbolMenuTabs","SYMBOL_MENU_TAB_TITLES","SYMBOL_MENU_TAB_ICONS","Emoji","Stickers","GIFs","onRemoveSymbol","onSearchOpen","renderTabButton","handleSearchOpen","isLeftColumnShown","setRecentEmojis","handleMouseEnter","handleMouseLeave","useMouseInside","fastRaf","recentEmojisRef","renderContent","onMouseLeave","noCloseOnBackdrop","noCompact","withAvatar","botCommand","handleSendCommand","selectedCommandIndex","prevCommands","renderedCommands","chatBotCommand","forEmoji","clearStickersForEmoji","prevStickers","displayedStickers","listEmojis","usePrevDuringAnimation","handleSelectEmoji","selectedIndex","setItemVisible","thumbUrl","thumbnailDataUrl","decoding","webThumbnail","isForGallery","inlineResult","_gif","STICKER_SIZE_INLINE_BOT_RESULT","isGallery","inlineBotResults","switchPm","onSelectResult","startBot","handleSendPm","startParam","prevInlineBotResults","renderedInlineBotResults","sensitiveArea","inlineBotResult","selectedSendAsId","sendAsIds","saveDefaultSendAs","markMouseInside","sendAsId","selectedSendAsIndex","messagesById","viewportResults","senderUser","senderChat","forwardInfo","isChannelPost","foundResult","isOnTop","preloadBackwards","teactOrderKey","LastMessageMeta","selectShouldLoopStickers","isSomeModalOpen","onModalToggle","isAdded","areStickersLoaded","coverStickerIds","covers","otherStickers","handleAddClick","canRenderStickers","STICKER_SIZE_SEARCH","selectCurrentStickerSearch","resultIds","featured","featuredIds","loadFeaturedStickers","setIsModalOpen","selectCurrentGifSearch","isChatWithBot","selectIsChatWithBot","canPostInChat","searchMoreGifs","setGifSearchQuery","handleGifClick","hasResults","CHANNEL_OVERVIEW","isPercentage","GROUP_OVERVIEW","MESSAGE_OVERVIEW","isPlain","isApproximate","isMessage","statistics","period","formatFullDate","row","cell","field","formatInteger","percentage","change","isChangeNegative","renderOverviewItemValue","toggleMessageStatistics","views","lovelyChartPromise","LovelyChart","CHANNEL_GRAPHS_TITLES","growthGraph","followersGraph","muteGraph","topHoursGraph","viewsBySourceGraph","newFollowersBySourceGraph","languagesGraph","interactionsGraph","CHANNEL_GRAPHS","GROUP_GRAPHS_TITLES","membersGraph","messagesGraph","actionsGraph","GROUP_GRAPHS","selectStatistics","dcId","statisticsDcId","setIsReady","loadedCharts","loadStatistics","loadStatisticsAsyncGraph","graphs","graphTitles","graph","token","ensureLovelyChart","zoomToken","create","children","callApi","zoomOutLabel","recentTopMessages","openChatByUsername","GRAPH_TITLES","viewsGraph","GRAPHS","currentMessage","currentMessageId","loadMessageStatistics","publicForwards","publicForwardsData","answer","voters","offsets","pollResults","answerVote","totalVoters","loadPollOptionResults","closePollResults","prevVotersCount","votersCount","setIsLoading","areVotersLoaded","shouldResetVoters","handleViewMoreClick","handleMemberClick","leftVotersCount","renderViewMoreButton","getMessagePoll","resultsByOption","buildCollectionByKey","management","deleteContact","closeManagement","isDeleteDialogOpen","openDeleteDialog","closeDeleteDialog","isNotificationsEnabled","setIsNotificationsEnabled","ManagementProgress","handleNotificationChange","handleDeleteContact","withFullInfo","GROUP_TITLE_EMPTY","hasLinkedChannel","isBasicGroup","invites","canChangeInfo","isCreator","getHasAdminRight","canBanUsers","canInvite","exportedInvites","availableReactionsCount","togglePreHistoryHidden","updateChat","deleteChat","leaveChannel","deleteChannel","loadExportedChatInvites","loadChatJoinRequests","currentTitle","currentAbout","imageHash","isPublicGroup","isRevoked","handleClickEditType","ManagementScreens","handleClickDiscussion","handleClickReactions","handleClickPermissions","handleClickAdministrators","handleClickInvites","handleClickRequests","handleSetPhoto","handleAboutChange","handleUpdateGroup","trimmedTitle","trimmedAbout","handleClickMembers","handleTogglePreHistory","isPreHistoryHidden","enabledReactionsCount","enabledPermissionsCount","defaultBannedRights","sendStickers","sendGifs","adminsCount","adminMembers","handleDeleteGroup","joinRequests","onChatMemberSelect","updateChatDefaultBannedRights","permissions","setPermissions","havePermissionChanged","setHavePermissionChanged","handleRemovedUsersClick","handleAddExceptionClick","handleExceptionMemberClick","promotedByUserId","handlePermissionChange","getUpdatedPermissionValue","handleSavePermissions","bannedRights","removedUsersCount","kickedMembers","exceptionMembers","members","getMemberExceptions","langKey","getLangKeyForBannedRightKey","translatedString","sendMessages","blocking","sendMedia","sendPolls","embedLinks","inviteUsers","pinMessages","changeInfo","loadMoreMembers","deleteChatMember","usersId","availableMemberIds","acc","isAdmin","isOwner","canDeleteMembers","updateChatMemberBannedRights","isRemoveUserModalOpen","openRemoveUserModal","closeRemoveUserModal","removedMembers","getRemovedBy","kickedByUserId","kickedByUser","getContextActions","CHANNEL_TITLE_EMPTY","isSignaturesShown","toggleSignatures","handleUpdateChannel","handleToggleSignatures","handleClickSubscribers","handleDeleteChannel","selectManagement","checkPublicLink","updatePublicLink","updatePrivateLink","toggleIsProtected","privateLink","inviteLink","privacyType","setPrivacyType","isRevokeConfirmDialogOpen","openRevokeConfirmDialog","closeRevokeConfirmDialog","canUpdate","handleOptionChange","handleForwardingOptionChange","handleSave","handleRevokePrivateLink","langPrefix1","langPrefix2","forwardingOptions","SafeLink","forDiscussionIds","linkedChat","loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup","linkedGroupId","setLinkedGroupId","isConfirmUnlinkGroupDialogOpen","openConfirmUnlinkGroupDialog","closeConfirmUnlinkGroupDialog","isConfirmLinkGroupDialogOpen","openConfirmLinkGroupDialog","closeConfirmLinkGroupDialog","handleUnlinkGroupSessions","channelId","handleLinkGroupSessions","STICKER_SIZE_DISCUSSION_GROUPS","teactFastList","linkedGroup","renderLinkGroupHeader","hasPrivateLink","renderLinkGroupConfirmText","isButtonsInOneRow","isPromotedByCurrentUser","isFormFullyDisabled","selectedChatMemberId","isBanConfirmationDialogOpen","openBanConfirmationDialog","closeBanConfirmationDialog","selectedChatMember","handleBanFromGroup","viewMessages","getControlIsDisabled","handleRecentActionsClick","handleAdminMemberClick","handleAddAdminClick","getMemberStatus","promotedByUser","defaultRights","adminRights","isNewAdmin","selectedUserId","updateChatAdmin","setIsTouched","isDismissConfirmationDialogOpen","openDismissConfirmationDialog","closeDismissConfirmationDialog","customTitle","setCustomTitle","selectedAdminMember","handleDismissAdmin","memberStatus","handleCustomTitleChange","postMessages","editMessages","banUsers","addAdmins","manageCall","anonymous","maxLength","noAdmins","adminIds","shouldUseSearchResults","listedIds","noScrollRestore","memberId","inviteComparator","i1","i2","isPermanent","i1IsPermanent","usage","i1Usage","i1Date","i2IsPermanent","i2Usage","i2Date","revokedInvites","revokedExportedInvites","setEditingExportedInvite","editExportedChatInvite","deleteExportedChatInvite","deleteRevokedExportedChatInvites","setOpenedInviteInfo","isDeleteRevokeAllDialogOpen","openDeleteRevokeAllDialog","closeDeleteRevokeAllDialog","isRevokeDialogOpen","openRevokeDialog","closeRevokeDialog","revokingInvite","setRevokingInvite","deletingInvite","setDeletingInvite","hasDetailedCountdown","expireDate","getServerTime","MILLISECONDS_IN_DAY","primaryInvite","primaryInviteLink","link","temporalInvites","revokeInvite","usageLimit","askToRevoke","handleRevoke","handleCreateNewClick","handlePrimaryRevoke","handleDeleteAllRevoked","showInviteInfo","deleteInvite","askToDelete","copyLink","handleCopyPrimaryClicked","prepareUsageText","requested","diff","formatCountdown","prepareContextActions","actions","editInvite","PrimaryLinkMenuButton","STICKER_SIZE_INVITES","secondaryIcon","DEFAULT_USAGE_LIMITS","DEFAULT_EXPIRE_DATE","hour","week","DEFAULT_CUSTOM_EXPIRE_DATE","editingInvite","exportChatInvite","isCalendarOpened","setIsRequestNeeded","customExpireDate","setCustomExpireDate","selectedExpireOption","setSelectedExpireOption","customUsageLimit","setCustomUsageLimit","selectedUsageOption","setSelectedUsageOption","isSubmitBlocked","setIsSubmitBlocked","oldEditingInvite","editingTitle","editingIsRequestNeeded","minSafeDate","handleIsRequestChange","handleCustomUsageLimitChange","handleExpireDateChange","handleSaveClick","n","setChatEnabledReactions","localEnabledReactions","setLocalEnabledReactions","handleSaveReactions","handleReactionChange","newEnabledReactions","inviteInfo","importers","requesters","loadChatInviteImporters","loadChatInviteRequesters","adminId","isExpired","handleCopyClicked","importer","renderImporters","requester","renderRequesters","hideChatJoinRequest","fixedDate","dateString","isToday","formatHumanDate","handleAcceptRequest","isApproved","handleRejectRequest","hideAllChatJoinRequests","isAcceptAllDialogOpen","openAcceptAllDialog","closeAcceptAllDialog","isRejectAllDialogOpen","openRejectAllDialog","closeRejectAllDialog","handleAcceptAllRequests","handleRejectAllRequests","STICKER_SIZE_JOIN_REQUESTS","managementType","selectCurrentManagementType","VISA","MASTERCARD1","MASTERCARD2","CardType","cards","Default","Visa","Mastercard","detectCardType","cardNumber","streetLine1","streetLine2","city","countryIso2","postCode","shipping","cardholder","expiry","cvv","billingCountry","billingZip","saveInfo","saveCredentials","formErrors","reducer","iso2","defaultName","useFocusAfterAnimation","animationDuration","hasArrow","labelText","htmlFor","needEmail","needPhone","needName","needAddress","phoneRef","selectCountryRef","handleAddress1Change","handleAddress2Change","handleCityChange","handleStateChange","handleCountryChange","handlePostCodeChange","handleFullNameChange","handleEmailChange","handleSaveInfoChange","shippingOptions","currency","handleShippingSelect","amount","formatCurrency","renderPaymentItem","main","renderCheckoutItem","invoiceContent","prices","shippingPrices","checkoutInfo","totalPrice","photoUrl","paymentMethod","paymentProvider","shippingAddress","shippingMethod","expiryInputRef","charAt","parts","formatCardExpiry","cardNumberRef","cardType","setCardType","newCardType","formatCardNumber","cardIcon","mastercardIconPath","visaIconPath","getCardIcon","canSaveCredentials","needCardholderName","needCountry","needZip","handleCardNumberChange","handleCardholderChange","toUpperCase","handleExpiryChange","handleCvvChange","handleBillingPostCodeChange","handleChangeSaveCredentials","SUPPORTED_PROVIDERS","step","savedInfo","invoice","nativeProvider","nativeParams","passwordMissing","confirmPaymentUrl","payment","isProviderError","nameRequested","phoneRequested","emailRequested","shippingAddressRequested","flexible","phoneToProvider","emailToProvider","general","validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError","paymentState","paymentDispatch","canRenderFooter","PaymentStep","shippingAddressRest","shippingCountry","handleErrorModalClose","shippingOption","getShippingPrices","totalPrices","cur","getTotalPrice","detectCardTypeText","findShippingOption","getCheckoutInfo","validateRequest","requestInfo","getRequestInfo","sendCredentials","credentials","expiryMonth","expiryYear","zip","getCredentials","sendForm","shippingOptionId","setStep","nextStep","currentStep","renderModalContent","renderError","optionId","receipt","info","totalAmount","credentialsTitle","fullAddress","SEGMENT_COVER_EYES","SEGMENT_UNCOVER_EYE","SEGMENT_COVER_EYE","STICKER_SIZE","STICKER_SIZE_AUTH_MOBILE","STICKER_SIZE_AUTH","isFirstMonkeyLoaded","markFirstMonkeyLoaded","isPeekShown","markPeekShown","handleFirstMonkeyLoad","playSegment","cropperResultOptions","format","circle","Croppie","croppiePromise","cropper","isCroppieReady","setIsCroppieReady","imgFile","cropContainer","enableZoom","boundary","viewport","blobToDataUri","bind","DEBUG","console","initCropper","ensureCroppie","handleCropClick","croppedImg","blobToFile","selectedFile","setSelectedFile","croppedBlobUrl","setCroppedBlobUrl","handleAvatarCrop","URL","revokeObjectURL","createObjectURL","handleModalClose","labelClassName","accept"],"sourceRoot":""} |