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,QAASg3G,EAAkBv3G,SAAUw6G","sources":["webpack://telegram-t/./src/components/mediaViewer/helpers/ghostAnimation.ts","webpack://telegram-t/./src/hooks/useBlur.ts","webpack://telegram-t/./src/components/mediaViewer/hooks/useMediaProps.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/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/main/UrlAuthModal.module.scss?b72e","webpack://telegram-t/./src/components/main/UrlAuthModal.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/main/DeleteFolderDialog.tsx","webpack://telegram-t/./src/components/main/premium/common/PremiumLimitsCompare.module.scss?00e6","webpack://telegram-t/./src/components/main/premium/common/PremiumLimitsCompare.tsx","webpack://telegram-t/./src/components/main/premium/common/PremiumLimitPreview.tsx","webpack://telegram-t/./src/components/main/premium/common/PremiumLimitPreview.module.scss?28b4","webpack://telegram-t/./src/components/main/premium/previews/PremiumFeaturePreviewVideo.module.scss?0228","webpack://telegram-t/./src/components/main/premium/previews/PremiumFeaturePreviewVideo.tsx","webpack://telegram-t/./src/components/main/premium/previews/PremiumFeaturePreviewReactions.module.scss?a2dc","webpack://telegram-t/./src/components/main/premium/previews/PremiumFeaturePreviewReactions.tsx","webpack://telegram-t/./src/components/common/SliderDots.module.scss?afdd","webpack://telegram-t/./src/components/common/SliderDots.tsx","webpack://telegram-t/./src/components/main/premium/previews/PremiumFeaturePreviewStickers.tsx","webpack://telegram-t/./src/components/main/premium/previews/PremiumFeaturePreviewStickers.module.scss?0900","webpack://telegram-t/./src/components/main/premium/PremiumFeatureModal.module.scss?b65b","webpack://telegram-t/./src/components/main/premium/PremiumFeatureModal.tsx","webpack://telegram-t/./src/components/main/premium/PremiumFeatureItem.module.scss?7431","webpack://telegram-t/./src/components/main/premium/PremiumFeatureItem.tsx","webpack://telegram-t/./src/components/main/premium/PremiumMainModal.module.scss?323f","webpack://telegram-t/./src/components/main/premium/PremiumMainModal.tsx","webpack://telegram-t/./src/components/main/premium/GiftOption.module.scss?a171","webpack://telegram-t/./src/components/main/premium/GiftOption.tsx","webpack://telegram-t/./src/components/main/premium/GiftPremiumModal.tsx","webpack://telegram-t/./src/components/main/premium/GiftPremiumModal.module.scss?1c3e","webpack://telegram-t/./src/components/main/premium/common/PremiumLimitReachedModal.tsx","webpack://telegram-t/./src/components/main/premium/common/PremiumLimitReachedModal.module.scss?434e","webpack://telegram-t/./src/components/common/AboutAdsModal.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/hooks/useMultiClick.ts","webpack://telegram-t/./src/components/left/settings/SettingsMain.tsx","webpack://telegram-t/./src/components/common/UsernameInput.tsx","webpack://telegram-t/./src/components/ui/TextArea.tsx","webpack://telegram-t/./src/components/left/settings/SettingsEditProfile.tsx","webpack://telegram-t/./src/components/left/settings/SettingsDataStorage.tsx","webpack://telegram-t/./src/components/ui/Draggable.tsx","webpack://telegram-t/./src/components/ui/Draggable.module.scss?804f","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/left/settings/SettingsGeneral.tsx","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/SettingsActiveWebsite.tsx","webpack://telegram-t/./src/components/left/settings/SettingsActiveWebsite.module.scss?99ae","webpack://telegram-t/./src/components/left/settings/SettingsActiveWebsites.module.scss?28f4","webpack://telegram-t/./src/components/left/settings/SettingsActiveWebsites.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/middle/composer/StickerSetCoverAnimated.tsx","webpack://telegram-t/./src/components/middle/composer/StickerSetCover.tsx","webpack://telegram-t/./src/components/common/StickerSetCard.tsx","webpack://telegram-t/./src/components/left/settings/SettingsStickers.tsx","webpack://telegram-t/./src/components/left/settings/SettingsCustomEmoji.tsx","webpack://telegram-t/./src/components/left/settings/SettingsExperimental.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/middle/message/SponsoredMessageContextMenuContainer.tsx","webpack://telegram-t/./src/components/common/StickerSetModal.tsx","webpack://telegram-t/./src/components/common/CustomEmojiSetsModal.module.scss?b138","webpack://telegram-t/./src/components/common/CustomEmojiSetsModal.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.module.scss?4e47","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 type {\n ApiMessage, ApiChat, ApiUser, ApiDimensions,\n} from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\nimport {\n getVideoAvatarMediaHash,\n getChatAvatarHash,\n getMessageMediaHash,\n getMessagePhoto,\n getMessageVideo,\n getMessageWebPagePhoto,\n getMessageWebPageVideo,\n isMessageDocumentPhoto,\n isMessageDocumentVideo,\n getMessageMediaFormat,\n getMessageMediaThumbDataUri,\n getMessageFileName,\n getMessageDocument,\n getPhotoFullDimensions,\n getVideoDimensions,\n getMessageFileSize,\n} from '../../../global/helpers';\nimport { useMemo } from '../../../lib/teact/teact';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress';\nimport useBlurSync from '../../../hooks/useBlurSync';\nimport { MediaViewerOrigin } from '../../../types';\nimport { VIDEO_AVATAR_FULL_DIMENSIONS, AVATAR_FULL_DIMENSIONS } from '../../common/helpers/mediaDimensions';\n\ntype UseMediaProps = {\n mediaId?: number;\n message?: ApiMessage;\n avatarOwner?: ApiChat | ApiUser;\n origin?: MediaViewerOrigin;\n lastSyncTime?: number;\n delay: number | false;\n};\n\nexport const useMediaProps = ({\n message,\n mediaId = 0,\n avatarOwner,\n origin,\n delay,\n}: UseMediaProps) => {\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 videoSize = message ? getMessageFileSize(message) : undefined;\n const avatarMedia = avatarOwner?.photos?.[mediaId];\n const isVideoAvatar = Boolean(avatarMedia?.isVideo);\n const isVideo = Boolean(video || webPageVideo || isDocumentVideo);\n const isPhoto = Boolean(!isVideo && (photo || webPagePhoto || isDocumentPhoto));\n const { isGif } = video || webPageVideo || {};\n const isFromSharedMedia = origin === MediaViewerOrigin.SharedMedia;\n const isFromSearch = origin === MediaViewerOrigin.SearchResult;\n\n const getMediaHash = useMemo(() => (isFull?: boolean) => {\n if (avatarOwner) {\n if (avatarMedia) {\n if (avatarMedia.isVideo && isFull) {\n return getVideoAvatarMediaHash(avatarMedia);\n } else if (mediaId === 0) {\n // Show preloaded avatar if this is the first media (when user clicks on profile info avatar)\n return getChatAvatarHash(avatarOwner, isFull ? 'big' : 'normal');\n } else {\n return `photo${avatarMedia.id}?size=c`;\n }\n } else {\n return getChatAvatarHash(avatarOwner, isFull ? 'big' : 'normal');\n }\n }\n return message && getMessageMediaHash(message, isFull ? 'viewerFull' : 'viewerPreview');\n }, [avatarOwner, message, avatarMedia, mediaId]);\n\n const pictogramBlobUrl = useMedia(\n message && (isFromSharedMedia || isFromSearch) && getMessageMediaHash(message, 'pictogram'),\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n delay,\n );\n const previewMediaHash = getMediaHash();\n const previewBlobUrl = useMedia(\n previewMediaHash,\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n delay,\n );\n const {\n mediaData: fullMediaBlobUrl,\n loadProgress,\n } = useMediaWithLoadProgress(\n getMediaHash(true),\n undefined,\n message && getMessageMediaFormat(message, 'viewerFull'),\n undefined,\n delay,\n );\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 if (isVideoAvatar && previewBlobUrl) {\n bestImageData = previewBlobUrl;\n }\n\n const fileName = message\n ? getMessageFileName(message)\n : avatarOwner\n ? `avatar${avatarOwner!.id}.${avatarOwner?.hasVideoAvatar ? 'mp4' : '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 = isVideoAvatar ? VIDEO_AVATAR_FULL_DIMENSIONS : AVATAR_FULL_DIMENSIONS;\n }\n\n return {\n getMediaHash,\n photo,\n video,\n webPagePhoto,\n webPageVideo,\n isVideo,\n isPhoto,\n isGif,\n isDocumentPhoto,\n isDocumentVideo,\n fileName,\n bestImageData,\n dimensions,\n isFromSharedMedia,\n avatarPhoto: avatarMedia,\n isVideoAvatar,\n localBlobUrl,\n fullMediaBlobUrl,\n previewBlobUrl,\n pictogramBlobUrl,\n loadProgress,\n videoSize,\n };\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 { getMessageMediaFormat, 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 message && getMessageMediaFormat(message, 'download'),\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 isProtected?: boolean;\n};\n\nconst MediaViewerFooter: FC<OwnProps> = ({\n text = '', isHidden, isForVideo, onClick, isProtected,\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 isProtected && 'is-protected',\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","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, IS_TOUCH_ENV } from '../../util/environment';\nimport { formatMediaDuration } from '../../util/dateFormat';\nimport { formatFileSize } from '../../util/textFormat';\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 = 3000;\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 if (!IS_TOUCH_ENV) return undefined;\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 && (\n <div className=\"player-file-size\">\n {`${formatFileSize(lang, fileSize * bufferedProgress)} / ${formatFileSize(lang, fileSize)}`}\n </div>\n )}\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={buildClassName('playback-rate-menu', !isFullscreenSupported && 'no-fullscreen')}\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 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';\nimport stopEvent from '../../util/stopEvent';\n\nimport Button from '../ui/Button';\nimport ProgressSpinner from '../ui/ProgressSpinner';\nimport VideoPlayerControls from './VideoPlayerControls';\n\nimport './VideoPlayer.scss';\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 volume: number;\n isMuted: boolean;\n playbackRate: number;\n isProtected?: boolean;\n areControlsVisible: boolean;\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 isProtected,\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 const [isFullscreen, setFullscreen, exitFullscreen] = useFullscreenStatus(videoRef, setIsPlayed);\n\n const handleVideoMove = useCallback(() => {\n toggleControls(true);\n }, [toggleControls]);\n\n const handleVideoLeave = useCallback((e) => {\n const bounds = videoRef.current?.getBoundingClientRect();\n if (!bounds) return;\n if (e.clientX < bounds.left || e.clientX > bounds.right || e.clientY < bounds.top || e.clientY > bounds.bottom) {\n toggleControls(false);\n }\n }, [toggleControls]);\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 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={!IS_TOUCH_ENV ? handleVideoMove : undefined}\n onMouseOut={!IS_TOUCH_ENV ? handleVideoLeave : undefined}\n >\n <div\n style={wrapperStyle}\n >\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n {isProtected && (\n <div\n onContextMenu={stopEvent}\n onDoubleClick={!IS_TOUCH_ENV ? handleFullscreenChange : undefined}\n onClick={!IS_SINGLE_COLUMN_LAYOUT ? togglePlayState : undefined}\n className=\"protector\"\n />\n )}\n <video\n ref={videoRef}\n autoPlay={IS_TOUCH_ENV}\n controlsList={isProtected ? 'nodownload' : undefined}\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 { MediaViewerOrigin } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport {\n selectChat, selectChatMessage, selectIsMessageProtected, selectScheduledMessage, selectUser,\n} from '../../global/selectors';\nimport { calculateMediaViewerDimensions } from '../common/helpers/mediaDimensions';\nimport { renderMessageText } from '../common/helpers/renderMessageText';\nimport stopEvent from '../../util/stopEvent';\nimport buildClassName from '../../util/buildClassName';\nimport { useMediaProps } from './hooks/useMediaProps';\n\nimport Spinner from '../ui/Spinner';\nimport MediaViewerFooter from './MediaViewerFooter';\nimport VideoPlayer from './VideoPlayer';\n\nimport './MediaViewerContent.scss';\n\ntype OwnProps = {\n mediaId?: number;\n chatId?: string;\n threadId?: number;\n avatarOwnerId?: string;\n origin?: MediaViewerOrigin;\n isActive?: boolean;\n animationLevel: 0 | 1 | 2;\n onClose: () => void;\n onFooterClick: () => void;\n setControlsVisible?: (isVisible: boolean) => void;\n areControlsVisible: boolean;\n};\n\ntype StateProps = {\n chatId?: string;\n mediaId?: number;\n senderId?: string;\n threadId?: number;\n avatarOwner?: ApiChat | ApiUser;\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 mediaId,\n isActive,\n avatarOwner,\n chatId,\n message,\n origin,\n animationLevel,\n areControlsVisible,\n isProtected,\n volume,\n playbackRate,\n isMuted,\n onClose,\n onFooterClick,\n setControlsVisible,\n } = props;\n\n const isGhostAnimation = animationLevel === 2;\n\n const {\n isVideo,\n isPhoto,\n bestImageData,\n dimensions,\n isGif,\n isVideoAvatar,\n localBlobUrl,\n fullMediaBlobUrl,\n previewBlobUrl,\n pictogramBlobUrl,\n videoSize,\n loadProgress,\n } = useMediaProps({\n message, avatarOwner, mediaId, origin, delay: isGhostAnimation && ANIMATION_DURATION,\n });\n\n const isOpen = Boolean(avatarOwner || mediaId);\n\n const toggleControls = useCallback((isVisible) => {\n setControlsVisible?.(isVisible);\n }, [setControlsVisible]);\n\n if (avatarOwner) {\n if (!isVideoAvatar) {\n return (\n <div key={chatId} className=\"MediaViewerContent\">\n {renderPhoto(\n fullMediaBlobUrl || previewBlobUrl,\n calculateMediaViewerDimensions(dimensions, false),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n isProtected,\n )}\n </div>\n );\n } else {\n return (\n <div key={chatId} className=\"MediaViewerContent\">\n <VideoPlayer\n key={mediaId}\n url={localBlobUrl || fullMediaBlobUrl}\n isGif\n posterData={bestImageData}\n posterSize={calculateMediaViewerDimensions(dimensions!, false, true)}\n loadProgress={loadProgress}\n fileSize={videoSize!}\n isMediaViewerOpen={isOpen && isActive}\n areControlsVisible={areControlsVisible}\n toggleControls={toggleControls}\n isProtected={isProtected}\n noPlay={!isActive}\n onClose={onClose}\n isMuted\n volume={0}\n playbackRate={1}\n />\n </div>\n );\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={buildClassName('MediaViewerContent', hasFooter && 'has-footer')}\n >\n {isPhoto && renderPhoto(\n localBlobUrl || fullMediaBlobUrl || previewBlobUrl || pictogramBlobUrl,\n message && calculateMediaViewerDimensions(dimensions!, hasFooter),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n isProtected,\n )}\n {isVideo && (!isActive ? renderVideoPreview(\n bestImageData,\n message && calculateMediaViewerDimensions(dimensions!, hasFooter, true),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n isProtected,\n ) : (\n <VideoPlayer\n key={mediaId}\n url={localBlobUrl || fullMediaBlobUrl}\n isGif={isGif}\n posterData={bestImageData}\n posterSize={message && calculateMediaViewerDimensions(dimensions!, hasFooter, true)}\n loadProgress={loadProgress}\n fileSize={videoSize!}\n areControlsVisible={areControlsVisible}\n isMediaViewerOpen={isOpen && isActive}\n toggleControls={toggleControls}\n noPlay={!isActive}\n onClose={onClose}\n isMuted={isMuted}\n isProtected={isProtected}\n volume={volume}\n playbackRate={playbackRate}\n />\n ))}\n {textParts && (\n <MediaViewerFooter\n text={textParts}\n onClick={onFooterClick}\n isProtected={isProtected}\n isHidden={IS_TOUCH_ENV ? !areControlsVisible : false}\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 mediaId,\n avatarOwnerId,\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 && mediaId)) {\n return { volume, isMuted, playbackRate };\n }\n\n const message = selectChatMessage(global, chatId, mediaId);\n if (!message) {\n return { volume, isMuted, playbackRate };\n }\n\n return {\n chatId,\n mediaId,\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 mediaId,\n senderId: avatarOwnerId,\n avatarOwner: sender,\n origin,\n volume,\n isMuted,\n playbackRate,\n };\n }\n\n if (!(chatId && threadId && mediaId)) {\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, mediaId);\n } else {\n message = selectChatMessage(global, chatId, mediaId);\n }\n\n if (!message) {\n return { volume, isMuted, playbackRate };\n }\n\n return {\n chatId,\n threadId,\n mediaId,\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, isProtected?: boolean) {\n return blobUrl\n ? (\n <div style=\"position: relative;\">\n {isProtected && <div onContextMenu={stopEvent} className=\"protector\" />}\n <img\n src={blobUrl}\n alt=\"\"\n className={buildClassName(isProtected && 'is-protected')}\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n draggable={Boolean(canDrag)}\n />\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\nfunction renderVideoPreview(blobUrl?: string, imageSize?: ApiDimensions, canDrag?: boolean, isProtected?: 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 {isProtected && <div onContextMenu={stopEvent} className=\"protector\" />}\n <div\n style={wrapperStyle}\n >\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <video\n style={videoStyle}\n className={buildClassName(isProtected && 'is-protected')}\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 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 mediaId?: number;\n getMediaId: (fromId?: number, direction?: number) => number | undefined;\n isVideo?: boolean;\n isGif?: boolean;\n isPhoto?: boolean;\n isOpen?: boolean;\n selectMedia: (id?: number) => void;\n chatId?: string;\n threadId?: number;\n avatarOwnerId?: string;\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 mediaId,\n getMediaId,\n selectMedia,\n isVideo,\n isGif,\n isPhoto,\n isOpen,\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 isReleasedRef = useRef(false);\n const [activeMediaId, setActiveMediaId] = useState<number | undefined>(mediaId);\n const prevZoomLevelChange = usePrevious(zoomLevelChange);\n const hasZoomChanged = prevZoomLevelChange !== undefined && prevZoomLevelChange !== zoomLevelChange;\n const forceUpdate = useForceUpdate();\n const [areControlsVisible, setControlsVisible] = useState(false);\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 selectMediaDebounced = useDebouncedCallback(selectMedia, [], 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 handleControlsVisibility = 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 setControlsVisible(!areControlsVisible);\n }, [clickXThreshold, areControlsVisible, windowHeight, windowWidth]);\n\n useTimeout(() => setControlsVisible(true), ANIMATION_DURATION + 100);\n\n useEffect(() => {\n if (!containerRef.current || activeMediaId === undefined) {\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 = getMediaId(activeMediaId, direction);\n if (mId !== undefined) {\n const offset = (windowWidth + SLIDES_GAP) * direction;\n transformRef.current.x += offset;\n isActiveRef.current = false;\n setActiveMediaId(mId);\n selectMediaDebounced(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 if ((e.target as HTMLElement).closest('div.VideoPlayerControls')) {\n return [false, false];\n }\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 onRelease = (e: MouseEvent | RealTouchEvent | WheelEvent) => {\n // This allows to prevent onRelease triggered by debounced wheel event\n // after onRelease was triggered manually in onDrag\n if (isReleasedRef.current) {\n isReleasedRef.current = false;\n return;\n }\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;\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;\n }\n lastTransform = {\n x,\n y,\n scale,\n };\n if (absY >= SWIPE_Y_THRESHOLD) {\n onClose();\n return;\n }\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;\n }\n // Get horizontal swipe direction\n const direction = x < 0 ? 1 : -1;\n const mId = getMediaId(activeMediaId, 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 !== undefined && 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 setActiveMediaId(mId);\n selectMediaDebounced(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 };\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 const { x, y, scale } = transformRef.current;\n if (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 (isReleasedRef.current || 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 threshold = 10;\n const tolerance = 1.5;\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 (event.type === 'mousemove') 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) > threshold || absOffsetX / absOffsetY > tolerance) {\n swipeDirectionRef.current = SwipeDirection.Horizontal;\n isActiveRef.current = false;\n const limit = windowWidth + SLIDES_GAP;\n const x1 = clamp(dragOffsetX, -limit, limit);\n setTransform({\n x: x1,\n y: 0,\n scale,\n });\n // We know that at this point onRelease will trigger slide change,\n // We can trigger onRelease directly instead of waiting for the debounced callback\n // to avoid a delay\n if (event.type === 'wheel' && Math.abs(x1) > SWIPE_X_THRESHOLD * 2) {\n onRelease(event);\n isReleasedRef.current = true;\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) > threshold || absOffsetY / absOffsetX > tolerance) {\n swipeDirectionRef.current = SwipeDirection.Vertical;\n const limit = windowHeight;\n const y1 = clamp(dragOffsetY, -limit, limit);\n setTransform({\n x: 0,\n y: y1,\n scale,\n });\n if (event.type === 'wheel' && Math.abs(y1) > SWIPE_Y_THRESHOLD * 2) {\n onRelease(event);\n isReleasedRef.current = true;\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 const { x, y, scale } = transformRef.current;\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 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,\n });\n document.addEventListener('keydown', handleKeyDown, false);\n return () => {\n cleanup();\n document.removeEventListener('keydown', handleKeyDown, false);\n };\n }, [\n onClose,\n setTransform,\n getMediaId,\n activeMediaId,\n windowWidth,\n windowHeight,\n clickXThreshold,\n shouldCloseOnVideo,\n selectMediaDebounced,\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.6;\n const maxZoom = MAX_ZOOM * 3;\n let steps = 100;\n let prevValue = 0;\n if (scale <= minZoom && dir > 0) return;\n if (scale >= maxZoom && dir < 0) return;\n if (scale === 1 && dir > 0) steps = 20;\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 (activeMediaId === undefined) return undefined;\n\n const nextMediaId = getMediaId(activeMediaId, 1);\n const prevMediaId = getMediaId(activeMediaId, -1);\n const hasPrev = prevMediaId !== undefined;\n const hasNext = nextMediaId !== undefined;\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 {hasPrev && 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 areControlsVisible={areControlsVisible}\n mediaId={prevMediaId}\n />\n </div>\n )}\n <div\n className={buildClassName(\n 'MediaViewerSlide',\n 'MediaViewerSlide--active',\n isMouseDown && scale > 1 && 'MediaViewerSlide--moving',\n )}\n onClick={handleControlsVisibility}\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 mediaId={activeMediaId}\n animationLevel={animationLevel}\n isActive={isActiveRef.current}\n setControlsVisible={setControlsVisible}\n areControlsVisible={areControlsVisible && scale === 1}\n />\n </div>\n {hasNext && 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 areControlsVisible={areControlsVisible}\n mediaId={nextMediaId}\n />\n </div>\n )}\n {hasPrev && 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 {hasNext && 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, ApiMessage, ApiUser,\n} from '../../api/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { getActions, withGlobal } from '../../global';\nimport {\n getChatMediaMessageIds,\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 { 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 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 usePrevious from '../../hooks/usePrevious';\nimport { useMediaProps } from './hooks/useMediaProps';\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 mediaId?: number;\n senderId?: string;\n isChatWithSelf?: boolean;\n origin?: MediaViewerOrigin;\n avatarOwner?: ApiChat | ApiUser;\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 mediaId,\n senderId,\n isChatWithSelf,\n origin,\n avatarOwner,\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 || mediaId);\n\n /* Animation */\n const animationKey = useRef<number>();\n const prevSenderId = usePrevious<string | undefined>(senderId);\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 const {\n webPagePhoto,\n webPageVideo,\n isVideo,\n isPhoto,\n bestImageData,\n dimensions,\n isGif,\n isFromSharedMedia,\n avatarPhoto,\n fileName,\n fullMediaBlobUrl,\n previewBlobUrl,\n } = useMediaProps({\n message, avatarOwner, mediaId, delay: isGhostAnimation && ANIMATION_DURATION,\n });\n\n const canReport = !!avatarPhoto && !isChatWithSelf;\n\n /* Navigation */\n const singleMediaId = webPagePhoto || webPageVideo ? mediaId : undefined;\n\n const mediaIds = useMemo(() => {\n if (singleMediaId) {\n return [singleMediaId];\n } else if (avatarOwner) {\n return avatarOwner.photos?.map((p, i) => i) || [];\n } else {\n return getChatMediaMessageIds(chatMessages || {}, collectionIds || [], isFromSharedMedia);\n }\n }, [singleMediaId, avatarOwner, chatMessages, collectionIds, isFromSharedMedia]);\n\n const selectedMediaIndex = mediaId ? mediaIds.indexOf(mediaId) : -1;\n\n if (isOpen && (!prevSenderId || prevSenderId !== senderId || !animationKey.current)) {\n animationKey.current = selectedMediaIndex;\n }\n\n useEffect(() => {\n if (!IS_SINGLE_COLUMN_LAYOUT) return;\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, mediaId });\n }, ANIMATION_DURATION);\n } else {\n focusMessage({ chatId, threadId, mediaId });\n }\n }, [close, chatId, threadId, focusMessage, toggleChatInfo, mediaId]);\n\n const handleForward = useCallback(() => {\n openForwardMenu({\n fromChatId: chatId!,\n messageIds: [mediaId!],\n });\n }, [openForwardMenu, chatId, mediaId]);\n\n const selectMedia = useCallback((id?: number) => {\n openMediaViewer({\n chatId,\n threadId,\n mediaId: id,\n avatarOwnerId: avatarOwner?.id,\n origin,\n }, {\n forceOnHeavyAnimation: true,\n });\n }, [avatarOwner?.id, 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 getMediaId = useCallback((fromId?: number, direction?: number): number | undefined => {\n if (fromId === undefined) return undefined;\n const index = mediaIds.indexOf(fromId);\n if ((direction === -1 && index > 0) || (direction === 1 && index < mediaIds.length - 1)) {\n return mediaIds[index + direction];\n }\n return undefined;\n }, [mediaIds]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive: isOpen,\n onBack: closeMediaViewer,\n });\n\n function renderSenderInfo() {\n return avatarOwner ? (\n <SenderInfo\n key={avatarOwner.id}\n chatId={avatarOwner.id}\n isAvatar\n />\n ) : (\n <SenderInfo\n key={mediaId}\n chatId={chatId}\n messageId={mediaId}\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={Boolean(avatarOwner)}\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 mediaId={mediaId}\n getMediaId={getMediaId}\n chatId={chatId}\n isPhoto={isPhoto}\n isGif={isGif}\n threadId={threadId}\n avatarOwnerId={avatarOwner?.id}\n origin={origin}\n isOpen={isOpen}\n hasFooter={hasFooter}\n zoomLevelChange={zoomLevelChange}\n isVideo={isVideo}\n animationLevel={animationLevel}\n onClose={close}\n selectMedia={selectMedia}\n onFooterClick={handleFooterClick}\n />\n </ShowTransition>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n chatId,\n threadId,\n mediaId,\n avatarOwnerId,\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 && mediaId)) {\n return { animationLevel };\n }\n\n const message = selectChatMessage(global, chatId, mediaId);\n if (!message) {\n return { animationLevel };\n }\n\n return {\n chatId,\n mediaId,\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 mediaId,\n senderId: avatarOwnerId,\n avatarOwner: sender,\n isChatWithSelf,\n animationLevel,\n origin,\n };\n }\n\n if (!(chatId && threadId && mediaId)) {\n return { animationLevel };\n }\n\n let message: ApiMessage | undefined;\n if (origin && [MediaViewerOrigin.ScheduledAlbum, MediaViewerOrigin.ScheduledInline].includes(origin)) {\n message = selectScheduledMessage(global, chatId, mediaId);\n } else {\n message = selectChatMessage(global, chatId, mediaId);\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 mediaId,\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 ...((filter && 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 if (isRequestNeeded) {\n showNotification({\n message: isChannel ? lang('RequestToJoinChannelSentDescription') : lang('RequestToJoinGroupSentDescription'),\n });\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)\n : renderText(error.message!, ['simple_markdown', '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(({\n message, className, localId, action, actionText, title,\n }) => (\n <Notification\n title={title ? renderText(title, ['simple_markdown', 'emoji', 'br', 'links']) : undefined}\n action={action}\n actionText={actionText}\n className={className}\n message={renderText(message, ['simple_markdown', 'emoji', 'br', 'links'])}\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), '_blank', 'noopener');\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","// extracted by mini-css-extract-plugin\nexport default {\"checkbox\":\"XxZ7KIBUQzsSYf8KZiIc\"};","import React, {\n memo, useCallback, useEffect, useState,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { ApiUser } from '../../api/types';\nimport type { GlobalState } from '../../global/types';\n\nimport { ensureProtocol } from '../../util/ensureProtocol';\nimport renderText from '../common/helpers/renderText';\nimport { getUserFullName } from '../../global/helpers';\n\nimport useLang from '../../hooks/useLang';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\nimport Checkbox from '../ui/Checkbox';\n\nimport styles from './UrlAuthModal.module.scss';\n\nexport type OwnProps = {\n urlAuth?: GlobalState['urlAuth'];\n currentUser?: ApiUser;\n};\n\nconst UrlAuthModal: FC<OwnProps> = ({\n urlAuth, currentUser,\n}) => {\n const { closeUrlAuthModal, acceptBotUrlAuth, acceptLinkUrlAuth } = getActions();\n const [isLoginChecked, setLoginChecked] = useState(true);\n const [isWriteAccessChecked, setWriteAccessChecked] = useState(true);\n const currentAuth = useCurrentOrPrev(urlAuth, false);\n const { domain, botId, shouldRequestWriteAccess } = currentAuth?.request || {};\n const bot = botId ? getGlobal().users.byId[botId] : undefined;\n\n const lang = useLang();\n\n const handleOpen = useCallback(() => {\n if (urlAuth?.url && isLoginChecked) {\n const acceptAction = urlAuth.button ? acceptBotUrlAuth : acceptLinkUrlAuth;\n acceptAction({\n isWriteAllowed: isWriteAccessChecked,\n });\n } else {\n window.open(ensureProtocol(currentAuth?.url), '_blank', 'noopener');\n }\n closeUrlAuthModal();\n }, [\n urlAuth, isLoginChecked, closeUrlAuthModal, acceptBotUrlAuth, acceptLinkUrlAuth, isWriteAccessChecked, currentAuth,\n ]);\n\n const handleDismiss = useCallback(() => {\n closeUrlAuthModal();\n }, [closeUrlAuthModal]);\n\n const handleLoginChecked = useCallback((value: boolean) => {\n setLoginChecked(value);\n setWriteAccessChecked(value);\n }, [setLoginChecked]);\n\n // Reset on re-open\n useEffect(() => {\n if (domain) {\n setLoginChecked(true);\n setWriteAccessChecked(Boolean(shouldRequestWriteAccess));\n }\n }, [shouldRequestWriteAccess, domain]);\n\n return (\n <ConfirmDialog\n isOpen={Boolean(urlAuth?.url)}\n onClose={handleDismiss}\n title={lang('OpenUrlTitle')}\n confirmLabel={lang('OpenUrlTitle')}\n confirmHandler={handleOpen}\n >\n {renderText(lang('OpenUrlAlert2', currentAuth?.url), ['links'])}\n {domain && (\n <Checkbox\n checked={isLoginChecked}\n label={(\n <>\n {renderText(\n lang('Conversation.OpenBotLinkLogin', [domain, getUserFullName(currentUser)]),\n ['simple_markdown'],\n )}\n </>\n )}\n onCheck={handleLoginChecked}\n className={styles.checkbox}\n />\n )}\n {shouldRequestWriteAccess && (\n <Checkbox\n checked={isWriteAccessChecked}\n label={(\n <>\n {renderText(\n lang('Conversation.OpenBotLinkAllowMessages', getUserFullName(bot)),\n ['simple_markdown'],\n )}\n </>\n )}\n onCheck={setWriteAccessChecked}\n disabled={!isLoginChecked}\n className={styles.checkbox}\n />\n )}\n </ConfirmDialog>\n );\n};\n\nexport default memo(UrlAuthModal);\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 PopupOptions = {\n title: string;\n message: string;\n buttons: {\n id: string;\n type: 'default' | 'ok' | 'close' | 'cancel' | 'destructive';\n text: string;\n }[];\n};\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_setup_back_button';\n eventData: {\n is_visible: boolean;\n };\n} | {\n eventType: 'web_app_open_link';\n eventData: {\n url: string;\n };\n} | {\n eventType: 'web_app_open_tg_link';\n eventData: {\n path_full: string;\n };\n} | {\n eventType: 'web_app_open_invoice';\n eventData: {\n slug: string;\n };\n} | {\n eventType: 'web_app_trigger_haptic_feedback';\n eventData: {\n type: 'impact' | 'notification' | 'selection_change';\n impact_style?: 'light' | 'medium' | 'heavy';\n notification_type?: 'error' | 'success' | 'warning';\n };\n} | {\n eventType: 'web_app_set_background_color';\n eventData: {\n color: string;\n };\n} | {\n eventType: 'web_app_set_header_color';\n eventData: {\n color_key: 'bg_color' | 'secondary_bg_color';\n };\n} | {\n eventType: 'web_app_open_popup';\n eventData: PopupOptions;\n} | {\n eventType: 'web_app_setup_closing_behavior';\n eventData: {\n need_confirmation: boolean;\n };\n} | {\n eventType: 'web_app_request_viewport' | 'web_app_request_theme' | 'web_app_ready' | 'web_app_expand'\n | 'web_app_request_phone' | 'web_app_close' | 'iframe_ready';\n eventData: null;\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 secondary_bg_color: string;\n };\n };\n} | {\n eventType: 'set_custom_style';\n eventData: string;\n} | {\n eventType: 'invoice_closed';\n eventData: {\n slug: string;\n status: 'paid' | 'cancelled' | 'pending' | 'failed';\n };\n} | {\n eventType: 'phone_requested';\n eventData: {\n phone_number: string;\n };\n} | {\n eventType: 'popup_closed';\n eventData: {\n button_id?: string;\n };\n} | {\n eventType: 'main_button_pressed' | 'back_button_pressed' | 'settings_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 React, {\n memo, useCallback, useEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { ApiAttachMenuBot, ApiChat, ApiUser } from '../../api/types';\nimport type { GlobalState } from '../../global/types';\nimport type { ThemeKey } from '../../types';\nimport type { PopupOptions, WebAppInboundEvent } from './hooks/useWebAppFrame';\n\nimport windowSize from '../../util/windowSize';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { TME_LINK_PREFIX } from '../../config';\nimport { selectCurrentChat, selectTheme, selectUser } 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 useWebAppFrame from './hooks/useWebAppFrame';\nimport usePrevious from '../../hooks/usePrevious';\nimport useFlag from '../../hooks/useFlag';\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';\nimport ConfirmDialog from '../ui/ConfirmDialog';\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 chat?: ApiChat;\n bot?: ApiUser;\n attachMenuBot?: ApiAttachMenuBot;\n theme?: ThemeKey;\n isPaymentModalOpen?: boolean;\n paymentStatus?: GlobalState['payment']['status'];\n};\n\nconst NBSP = '\\u00A0';\n\nconst MAIN_BUTTON_ANIMATION_TIME = 250;\nconst PROLONG_INTERVAL = 45000; // 45s\nconst ANIMATION_WAIT = 400;\nconst SANDBOX_ATTRIBUTES = [\n 'allow-scripts',\n 'allow-same-origin',\n 'allow-popups',\n 'allow-forms',\n 'allow-modals',\n 'allow-storage-access-by-user-activation',\n].join(' ');\n\nconst DEFAULT_BUTTON_TEXT: Record<string, string> = {\n ok: 'OK',\n cancel: 'Cancel',\n close: 'Close',\n};\n\nconst WebAppModal: FC<OwnProps & StateProps> = ({\n webApp,\n chat,\n bot,\n attachMenuBot,\n theme,\n isPaymentModalOpen,\n paymentStatus,\n}) => {\n const {\n closeWebApp,\n sendWebViewData,\n prolongWebView,\n toggleBotInAttachMenu,\n openTelegramLink,\n openChat,\n openInvoice,\n setWebAppPaymentSlug,\n } = getActions();\n const [mainButton, setMainButton] = useState<WebAppButton | undefined>();\n const [isBackButtonVisible, setIsBackButtonVisible] = useState(false);\n const [backgroundColor, setBackgroundColor] = useState(extractCurrentThemeParams().bg_color);\n const [headerColor, setHeaderColor] = useState(extractCurrentThemeParams().bg_color);\n const [confirmClose, setConfirmClose] = useState(false);\n const [isCloseModalOpen, openCloseModal, closeCloseModal] = useFlag(false);\n const [popupParams, setPopupParams] = useState<PopupOptions | undefined>();\n const prevPopupParams = usePrevious(popupParams);\n const renderingPopupParams = popupParams || prevPopupParams;\n\n const lang = useLang();\n const {\n url, buttonText, queryId,\n } = webApp || {};\n const isOpen = Boolean(url);\n const isSimple = !queryId;\n\n const handleEvent = useCallback((event: WebAppInboundEvent) => {\n const { eventType, eventData } = event;\n if (eventType === 'web_app_close') {\n closeWebApp();\n }\n\n if (eventType === 'web_app_open_invoice') {\n setWebAppPaymentSlug({\n slug: eventData.slug,\n });\n openInvoice({\n slug: eventData.slug,\n });\n }\n\n if (eventType === 'web_app_open_tg_link' && !isPaymentModalOpen) {\n const linkUrl = TME_LINK_PREFIX + eventData.path_full;\n openTelegramLink({ url: linkUrl });\n closeWebApp();\n }\n\n if (eventType === 'web_app_open_link') {\n const linkUrl = eventData.url;\n window.open(linkUrl, '_blank', 'noreferrer');\n }\n\n if (eventType === 'web_app_setup_back_button') {\n setIsBackButtonVisible(eventData.is_visible);\n }\n\n if (eventType === 'web_app_set_background_color') {\n const themeParams = extractCurrentThemeParams();\n const color = validateHexColor(eventData.color) ? eventData.color : themeParams.bg_color;\n setBackgroundColor(color);\n }\n\n if (eventType === 'web_app_set_header_color') {\n const themeParams = extractCurrentThemeParams();\n const key = eventData.color_key;\n const newColor = themeParams[key];\n const color = validateHexColor(newColor) ? newColor : themeParams.bg_color;\n setHeaderColor(color);\n }\n\n if (eventType === 'web_app_data_send') {\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 themeParams = extractCurrentThemeParams();\n const color = validateHexColor(eventData.color) ? eventData.color : themeParams.button_color;\n const textColor = validateHexColor(eventData.text_color) ? eventData.text_color : 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\n if (eventType === 'web_app_setup_closing_behavior') {\n setConfirmClose(eventData.need_confirmation);\n }\n\n if (eventType === 'web_app_open_popup') {\n if (!eventData.message.trim().length || !eventData.buttons?.length || eventData.buttons.length > 3) return;\n setPopupParams(eventData);\n }\n }, [\n bot, buttonText, closeWebApp, openInvoice, openTelegramLink, sendWebViewData, setWebAppPaymentSlug,\n isPaymentModalOpen,\n ]);\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 botId: bot!.id,\n queryId: queryId!,\n peerId: chat!.id,\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 handleSettingsButtonClick = useCallback(() => {\n sendEvent({\n eventType: 'settings_button_pressed',\n });\n }, [sendEvent]);\n\n const handleRefreshClick = useCallback(() => {\n reloadFrame(webApp!.url);\n }, [reloadFrame, webApp]);\n\n const handleClose = useCallback(() => {\n if (confirmClose) {\n openCloseModal();\n } else {\n closeWebApp();\n }\n }, [confirmClose, openCloseModal, closeWebApp]);\n\n const handlePopupClose = useCallback((buttonId?: string) => {\n setPopupParams(undefined);\n sendEvent({\n eventType: 'popup_closed',\n eventData: {\n button_id: buttonId,\n },\n });\n }, [sendEvent]);\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 useOnChange(([prevIsPaymentModalOpen]) => {\n if (isPaymentModalOpen === prevIsPaymentModalOpen) return;\n if (webApp?.slug && !isPaymentModalOpen && paymentStatus) {\n sendEvent({\n eventType: 'invoice_closed',\n eventData: {\n slug: webApp.slug,\n status: paymentStatus,\n },\n });\n setWebAppPaymentSlug({\n slug: undefined,\n });\n }\n }, [isPaymentModalOpen, paymentStatus, sendEvent, setWebAppPaymentSlug, webApp] as const);\n\n const handleToggleClick = useCallback(() => {\n toggleBotInAttachMenu({\n botId: bot!.id,\n isEnabled: !attachMenuBot,\n });\n }, [bot, attachMenuBot, toggleBotInAttachMenu]);\n\n const handleBackClick = useCallback(() => {\n if (isBackButtonVisible) {\n sendEvent({\n eventType: 'back_button_pressed',\n });\n } else {\n handleClose();\n }\n }, [handleClose, isBackButtonVisible, sendEvent]);\n\n const openBotChat = useCallback(() => {\n openChat({\n id: bot!.id,\n });\n closeWebApp();\n }, [bot, closeWebApp, openChat]);\n\n useEffect(() => {\n if (!isOpen) {\n setConfirmClose(false);\n closeCloseModal();\n setPopupParams(undefined);\n }\n }, [closeCloseModal, isOpen]);\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 backButtonClassName = buildClassName(\n 'animated-close-icon',\n isBackButtonVisible && 'state-back',\n );\n\n const header = useMemo(() => {\n return (\n <div className=\"modal-header\" style={`background-color: ${headerColor}`}>\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang(isBackButtonVisible ? 'Back' : 'Close')}\n onClick={handleBackClick}\n >\n <div className={backButtonClassName} />\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\n icon={attachMenuBot ? 'stop' : 'install'}\n onClick={handleToggleClick}\n destructive={Boolean(attachMenuBot)}\n >\n {lang(attachMenuBot ? 'WebApp.RemoveBot' : 'WebApp.AddToAttachmentAdd')}\n </MenuItem>\n )}\n {attachMenuBot?.hasSettings && (\n <MenuItem icon=\"settings\" onClick={handleSettingsButtonClick}>\n {lang('Settings')}\n </MenuItem>\n )}\n </DropdownMenu>\n </div>\n );\n }, [\n lang, handleBackClick, bot, MoreMenuButton, chat, openBotChat, handleRefreshClick, attachMenuBot,\n handleToggleClick, handleSettingsButtonClick, isBackButtonVisible, headerColor, backButtonClassName,\n ]);\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) {\n const themeParams = extractCurrentThemeParams();\n setMainButton(undefined);\n setIsBackButtonVisible(false);\n setBackgroundColor(themeParams.bg_color);\n setHeaderColor(themeParams.bg_color);\n }\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={handleClose}\n header={header}\n hasCloseButton\n style={`background-color: ${backgroundColor}`}\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={SANDBOX_ATTRIBUTES}\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 {confirmClose && (\n <ConfirmDialog\n isOpen={isCloseModalOpen}\n onClose={closeCloseModal}\n title={lang('lng_bot_close_warning_title')}\n text={lang('lng_bot_close_warning')}\n confirmHandler={closeWebApp}\n confirmIsDestructive\n confirmLabel={lang('lng_bot_close_warning_sure')}\n />\n )}\n {renderingPopupParams && (\n <Modal\n isOpen={Boolean(popupParams)}\n title={renderingPopupParams.title || NBSP}\n onClose={handlePopupClose}\n hasCloseButton\n className={buildClassName('web-app-popup', !renderingPopupParams.title?.trim().length && 'without-title')}\n >\n {renderingPopupParams.message}\n <div className=\"dialog-buttons mt-2\">\n {renderingPopupParams.buttons.map((button) => (\n <Button\n key={button.id || button.text || button.type}\n color={button.type === 'destructive' ? 'danger' : 'primary'}\n isText\n fluid\n size=\"smaller\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handlePopupClose(button.id)}\n >\n {button.text || lang(DEFAULT_BUTTON_TEXT[button.type])}\n </Button>\n ))}\n </div>\n </Modal>\n )}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { webApp }): StateProps => {\n const { botId } = webApp || {};\n const attachMenuBot = botId ? global.attachMenu.bots[botId] : undefined;\n const bot = botId ? selectUser(global, botId) : undefined;\n const chat = selectCurrentChat(global);\n const theme = selectTheme(global);\n const { isPaymentModalOpen, status } = global.payment;\n\n return {\n attachMenuBot,\n bot,\n chat,\n theme,\n isPaymentModalOpen,\n paymentStatus: status,\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', 'emoji'])}\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, { memo, useCallback } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport useLang from '../../hooks/useLang';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nexport type OwnProps = {\n deleteFolderDialogId?: number;\n};\n\nconst DeleteFolderDialog: FC<OwnProps> = ({\n deleteFolderDialogId,\n}) => {\n const { closeDeleteChatFolderModal, deleteChatFolder } = getActions();\n const lang = useLang();\n\n const handleDeleteFolderMessage = useCallback(() => {\n closeDeleteChatFolderModal();\n deleteChatFolder({ id: deleteFolderDialogId });\n }, [closeDeleteChatFolderModal, deleteChatFolder, deleteFolderDialogId]);\n\n return (\n <ConfirmDialog\n isOpen={deleteFolderDialogId !== undefined}\n onClose={closeDeleteChatFolderModal}\n text={lang('FilterDeleteAlert')}\n confirmLabel={lang('Delete')}\n confirmHandler={handleDeleteFolderMessage}\n confirmIsDestructive\n />\n );\n};\n\nexport default memo(DeleteFolderDialog);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"qiAkShre9E6R3S_XXL9S\",\"floating-badge\":\"gIcOQgrfw3soP3cK9s5Q\",\"floatingBadge\":\"gIcOQgrfw3soP3cK9s5Q\",\"floating-badge-triangle\":\"Ip5PkcvyMOnN0RLpXLXO\",\"floatingBadgeTriangle\":\"Ip5PkcvyMOnN0RLpXLXO\",\"floating-badge-icon\":\"y7T3FpaFXDsnPGk6dPmg\",\"floatingBadgeIcon\":\"y7T3FpaFXDsnPGk6dPmg\",\"text\":\"X0zFAEpRoPWj1yE904xR\",\"floating-badge-value\":\"rQ6ZdKdWi4HVydX6qhWS\",\"floatingBadgeValue\":\"rQ6ZdKdWi4HVydX6qhWS\",\"left-text\":\"kuq7sjJF6mvCc4Y5CXpv X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR\",\"leftText\":\"kuq7sjJF6mvCc4Y5CXpv X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR\",\"right-text\":\"QWqqObtxZyakBzakEoyh X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR\",\"rightText\":\"QWqqObtxZyakBzakEoyh X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR\",\"right-value\":\"TCdcdr_TxlgpCSBV0ePq X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR\",\"rightValue\":\"TCdcdr_TxlgpCSBV0ePq X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR\",\"left-value\":\"FaVxkFCcMpBfLY74WJZv X0zFAEpRoPWj1yE904xR\",\"leftValue\":\"FaVxkFCcMpBfLY74WJZv X0zFAEpRoPWj1yE904xR\",\"line\":\"slESyAvUqizX4_EIX_yg\",\"left\":\"lQi3xqxjvl2Owb4ES2SM\",\"right\":\"Dcv5uphsn2Sxpg3ROS_u\"};","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport buildClassName from '../../../../util/buildClassName';\nimport useLang from '../../../../hooks/useLang';\n\nimport styles from './PremiumLimitsCompare.module.scss';\n\n// eslint-disable-next-line max-len\nconst TRIANGLE_SVG = '<svg width=\"26\" height=\"9\" viewBox=\"0 0 26 9\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M0 0H26H24.4853C22.894 0 21.3679 0.632141 20.2426 1.75736L14.4142 7.58579C13.6332 8.36684 12.3668 8.36683 11.5858 7.58579L5.75736 1.75736C4.63214 0.632139 3.10602 0 1.51472 0H0Z\" fill=\"#7E85FF\"/></svg>';\n\ntype OwnProps = {\n floatingBadgeIcon?: string;\n leftValue?: string;\n rightValue?: string;\n className?: string;\n rightStyle?: string;\n};\n\nconst PremiumLimitsCompare: FC<OwnProps> = ({\n leftValue,\n rightValue,\n className,\n floatingBadgeIcon,\n rightStyle,\n}) => {\n const lang = useLang();\n\n return (\n <div className={buildClassName(styles.root, className)}>\n {floatingBadgeIcon && (\n <div className={styles.floatingBadge}>\n <i className={buildClassName(styles.floatingBadgeIcon, floatingBadgeIcon)} />\n <div className={styles.floatingBadgeValue} dir={lang.isRtl ? 'rtl' : undefined}>{leftValue}</div>\n <div className={styles.floatingBadgeTriangle} dangerouslySetInnerHTML={{ __html: TRIANGLE_SVG }} />\n </div>\n )}\n <div className={buildClassName(styles.line, styles.left)}>\n <div className={styles.leftText} dir={lang.isRtl ? 'rtl' : undefined}>{lang('LimitFree')}</div>\n {!floatingBadgeIcon && <div className={styles.leftValue}>{leftValue}</div>}\n </div>\n <div className={buildClassName(styles.line, styles.right)} style={rightStyle}>\n <div className={styles.rightText} dir={lang.isRtl ? 'rtl' : undefined}>{lang('LimitPremium')}</div>\n <div className={styles.rightValue}>{rightValue}</div>\n </div>\n </div>\n );\n};\n\nexport default memo(PremiumLimitsCompare);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useMemo } from '../../../../lib/teact/teact';\n\nimport { lerp } from '../../../../util/math';\n\nimport PremiumLimitsCompare from './PremiumLimitsCompare';\n\nimport styles from './PremiumLimitPreview.module.scss';\n\ntype OwnProps = {\n title: string;\n description: string;\n leftValue?: string;\n rightValue?: string;\n colorStepProgress: number;\n};\n\nconst COLOR_START = [91, 160, 255];\nconst COLOR_END = [197, 100, 243];\n\nconst PremiumLimitPreview: FC<OwnProps> = ({\n title,\n description,\n leftValue,\n rightValue,\n colorStepProgress,\n}) => {\n const color = useMemo(() => {\n return COLOR_START.map((start, i) => lerp(start, COLOR_END[i], colorStepProgress));\n }, [colorStepProgress]);\n\n return (\n <div className={styles.root}>\n <div className={styles.title}>{title}</div>\n <div className={styles.description}>{description}</div>\n <PremiumLimitsCompare\n leftValue={leftValue}\n rightValue={rightValue}\n rightStyle={`background: rgb(${color.join(',')})`}\n />\n </div>\n );\n};\n\nexport default memo(PremiumLimitPreview);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"jeeOV_UYyl50GFLOzjGC\",\"title\":\"SVqE3gr2ekQUWfFT_Mvg\",\"description\":\"mCBNPstzrSlOQsz6rOtE\"};","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"WHiQiGCtWfjSlEysEelB\",\"wrapper\":\"WUpKHfqLbeZmhfYqqiko\",\"down\":\"MiGmL4xqBPkxmLim4Ai0\",\"frame\":\"xuhT9JHpFkVsTcUWeh4L\",\"video\":\"sLLJqCkdSug4bzEQrACs\"};","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useEffect, useRef } from '../../../../lib/teact/teact';\n\nimport type { ApiThumbnail } from '../../../../api/types';\n\nimport useMedia from '../../../../hooks/useMedia';\nimport buildClassName from '../../../../util/buildClassName';\nimport useCanvasBlur from '../../../../hooks/useCanvasBlur';\nimport useMediaTransition from '../../../../hooks/useMediaTransition';\nimport safePlay from '../../../../util/safePlay';\n\nimport DeviceFrame from '../../../../assets/premium/DeviceFrame.svg';\n\nimport styles from './PremiumFeaturePreviewVideo.module.scss';\n\ntype OwnProps = {\n videoId: string;\n isReverseAnimation: boolean;\n isDown: boolean;\n videoThumbnail: ApiThumbnail;\n index: number;\n isActive: boolean;\n};\n\nconst PremiumFeaturePreviewVideo: FC<OwnProps> = ({\n videoId,\n isReverseAnimation,\n isDown,\n videoThumbnail,\n index,\n isActive,\n}) => {\n const mediaData = useMedia(`document${videoId}`);\n const thumbnailRef = useCanvasBlur(videoThumbnail.dataUri);\n const transitionClassNames = useMediaTransition(mediaData);\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef<HTMLVideoElement>(null);\n\n useEffect(() => {\n const video = videoRef.current;\n if (!video) return;\n\n if (isActive) {\n safePlay(video);\n } else {\n video.pause();\n }\n }, [isActive]);\n\n return (\n <div className={styles.root}>\n <div\n className={buildClassName(\n styles.wrapper,\n isReverseAnimation && styles.reverse,\n isDown && styles.down,\n )}\n id={`premium_feature_preview_video_${index}`}\n >\n <img src={DeviceFrame} alt=\"\" className={styles.frame} />\n <canvas ref={thumbnailRef} className={styles.video} />\n <video\n ref={videoRef}\n className={buildClassName(\n styles.video,\n transitionClassNames,\n )}\n src={mediaData}\n autoPlay={isActive}\n disablePictureInPicture\n playsInline\n muted\n loop\n />\n </div>\n </div>\n );\n};\n\nexport default memo(PremiumFeaturePreviewVideo);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"lSI7Gb2It7nFGpBE4IFs\",\"sticker\":\"sbJjdz4IEwYhlti5MyPA\",\"effect-sticker\":\"bIR5UZpxiCoHBe0ZmtIn sbJjdz4IEwYhlti5MyPA\",\"effectSticker\":\"bIR5UZpxiCoHBe0ZmtIn sbJjdz4IEwYhlti5MyPA\"};","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 { GlobalState } from '../../../../global/types';\nimport type { ApiAvailableReaction } from '../../../../api/types';\n\nimport cycleRestrict from '../../../../util/cycleRestrict';\nimport useMedia from '../../../../hooks/useMedia';\nimport useInterval from '../../../../hooks/useInterval';\nimport useFlag from '../../../../hooks/useFlag';\n\nimport AnimatedSticker from '../../../common/AnimatedSticker';\n\nimport styles from './PremiumFeaturePreviewReactions.module.scss';\n\ntype OwnProps = {\n isActive: boolean;\n};\n\ntype StateProps = {\n availableReactions: GlobalState['availableReactions'];\n};\n\nconst EMOJI_SIZE_MULTIPLIER = 0.2;\nconst EFFECT_SIZE_MULTIPLIER = 0.6;\nconst ROTATE_INTERVAL = 3000;\nconst CLICK_DELAY = 4000;\nconst MAX_EMOJIS = 15;\n\nconst AnimatedCircleReaction: FC<{\n size: number;\n realIndex: number;\n reaction: ApiAvailableReaction;\n index: number;\n maxLength: number;\n handleClick: (index: number) => void;\n isActivated: boolean;\n canPlay: boolean;\n}> = ({\n size, realIndex, isActivated, canPlay,\n reaction, index, maxLength, handleClick,\n}) => {\n const mediaData = useMedia(`document${reaction.activateAnimation?.id}`);\n const mediaDataAround = useMedia(`document${reaction.aroundAnimation?.id}`);\n const [isAnimated, animate, inanimate] = useFlag(isActivated);\n const [isEffectEnded, markEffectEnded, unmarkEffectEnded] = useFlag(false);\n\n const circleSize = (size - size * EMOJI_SIZE_MULTIPLIER) / 2;\n\n const t = index / maxLength;\n const angle = t * (Math.PI * 2);\n const totalAngle = angle - (Math.PI / 6) * Math.cos(angle);\n const scaleNotFull = 0.2 + (0.7 * (Math.sin(totalAngle) + 1)) / 2;\n const scale = scaleNotFull > 0.85 ? 1 : scaleNotFull;\n\n const x = Math.cos(totalAngle) * circleSize;\n const y = Math.sin(totalAngle) * circleSize * 0.6;\n\n const handleClickEmoji = useCallback(() => {\n handleClick(realIndex);\n }, [handleClick, realIndex]);\n\n useEffect(() => {\n if (isActivated) {\n animate();\n unmarkEffectEnded();\n }\n }, [isActivated, animate, unmarkEffectEnded]);\n\n return (\n <>\n {isActivated && !isEffectEnded && (\n <AnimatedSticker\n className={styles.effectSticker}\n tgsUrl={mediaDataAround}\n play={canPlay}\n isLowPriority\n noLoop\n size={EFFECT_SIZE_MULTIPLIER * size}\n style={`--x: ${x}px; --y: ${y}px; --scale: ${scale};`}\n onEnded={markEffectEnded}\n />\n )}\n <AnimatedSticker\n className={styles.sticker}\n tgsUrl={mediaData}\n onClick={handleClickEmoji}\n play={isAnimated && canPlay}\n noLoop\n size={EMOJI_SIZE_MULTIPLIER * size}\n style={`--x: ${x}px; --y: ${y}px; --scale: ${scale};`}\n onEnded={inanimate}\n />\n </>\n );\n};\nconst PremiumFeaturePreviewReactions: FC<OwnProps & StateProps> = ({\n availableReactions, isActive,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const [isIntervalPaused, pauseInterval, unpauseInterval] = useFlag();\n const lastUnpauseTimeout = useRef<NodeJS.Timeout>();\n const [offset, setOffset] = useState(0);\n const [size, setSize] = useState(0);\n\n const renderedReactions = availableReactions?.filter((l) => l.isPremium)?.slice(0, MAX_EMOJIS) || [];\n\n useInterval(() => {\n setOffset((current) => cycleRestrict(renderedReactions.length, current + 1));\n }, isIntervalPaused || !isActive ? undefined : ROTATE_INTERVAL);\n\n const handleClickEmoji = useCallback((i: number) => {\n setOffset(i);\n pauseInterval();\n if (lastUnpauseTimeout.current) clearTimeout(lastUnpauseTimeout.current);\n lastUnpauseTimeout.current = setTimeout(() => {\n unpauseInterval();\n }, CLICK_DELAY);\n }, [pauseInterval, unpauseInterval]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n setSize(container.closest('.modal-dialog')!.clientWidth);\n }, []);\n\n return (\n <div\n className={styles.root}\n ref={containerRef}\n >\n {renderedReactions.map((l, i) => {\n return (\n <AnimatedCircleReaction\n size={size}\n reaction={l}\n realIndex={i}\n index={(i - offset + renderedReactions.length / 4) % renderedReactions.length}\n maxLength={renderedReactions.length}\n handleClick={handleClickEmoji}\n isActivated={offset === i}\n canPlay={isActive}\n />\n );\n })}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n availableReactions: global.availableReactions,\n };\n },\n)(PremiumFeaturePreviewReactions));\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"NtJc4bt94t9fklIWC6wF\",\"arrow\":\"_rzXza87NHdAMH2TDKul\",\"right\":\"J4UYbae0Frt01jIavpB0\",\"arrow-hidden\":\"qd3rvhZma3JJmhdt07Ig\",\"arrowHidden\":\"qd3rvhZma3JJmhdt07Ig\",\"dot\":\"eCgEFkp07vgaUGwymYAQ\",\"medium\":\"AIpVWjJc47egZ8ATaC3n\",\"small\":\"MnRKztu0OZTyIywGLMc6\",\"invisible\":\"boSFbatyzatdw70J7mpu\",\"active\":\"nlCmVncFkKVtsawWqcfw\"};","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport styles from './SliderDots.module.scss';\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport Button from '../ui/Button';\n\ntype OwnProps = {\n length: number;\n active: number;\n onSelectSlide: (index: number) => void;\n};\n\nconst SliderDots: FC<OwnProps> = ({\n length,\n active,\n onSelectSlide,\n}) => {\n const startFrom = Math.max(0, Math.min(length - 8, active - 4));\n const isPreLastBatch = startFrom === length - 8 - 1;\n const isLastBatch = startFrom === length - 8;\n const isFirstBatch = startFrom === 0;\n const isPreFirstBatch = startFrom === 1;\n const shownDotsCount = Math.min(length, 8);\n\n const handleGoForward = useCallback(() => {\n onSelectSlide(active + 1);\n }, [active, onSelectSlide]);\n\n const handleGoBack = useCallback(() => {\n onSelectSlide(active - 1);\n }, [active, onSelectSlide]);\n\n const count = Math.min(8, length);\n\n return (\n <div>\n {!IS_TOUCH_ENV && (\n <Button\n className={buildClassName(styles.arrow, active === 0 && styles.arrowHidden)}\n color=\"translucent\"\n disabled={active === 0}\n round\n onClick={handleGoBack}\n >\n <i className=\"icon-previous\" />\n </Button>\n )}\n <div className={styles.root} style={`--start-from: ${startFrom}; --length: ${length}; --count: ${count};`}>\n {Array(length).fill(undefined).map((_, i) => {\n const index = i;\n const isLast = (i === startFrom + shownDotsCount - 1 && !isLastBatch && !isPreLastBatch);\n const isPreLast = (i === startFrom + shownDotsCount - 2 && !isPreLastBatch && !isLastBatch)\n || (i === startFrom + shownDotsCount - 1 && isPreLastBatch);\n const isFirst = (i === startFrom) && !isFirstBatch && !isPreFirstBatch;\n const isPreFirst = ((i === startFrom + 1) && !isFirstBatch && !isPreFirstBatch)\n || (i === startFrom && isPreFirstBatch);\n const isInvisible = i < startFrom || i >= startFrom + shownDotsCount;\n return (\n <div\n onClick={() => onSelectSlide(i)}\n className={buildClassName(\n styles.dot,\n index === active && styles.active,\n (isPreLast || isPreFirst) && styles.medium,\n (isLast || isFirst) && styles.small,\n isInvisible && styles.invisible,\n )}\n />\n );\n })}\n </div>\n {!IS_TOUCH_ENV && (\n <Button\n className={buildClassName(styles.arrow, active === length - 1 && styles.arrowHidden, styles.right)}\n color=\"translucent\"\n round\n disabled={active === length - 1}\n onClick={handleGoForward}\n >\n <i className=\"icon-next\" />\n </Button>\n )}\n </div>\n );\n};\n\nexport default memo(SliderDots);\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 { GlobalState } from '../../../../global/types';\nimport type { ApiSticker } from '../../../../api/types';\n\nimport cycleRestrict from '../../../../util/cycleRestrict';\nimport useMedia from '../../../../hooks/useMedia';\nimport useFlag from '../../../../hooks/useFlag';\n\nimport AnimatedSticker from '../../../common/AnimatedSticker';\n\nimport styles from './PremiumFeaturePreviewStickers.module.scss';\n\ntype OwnProps = {\n isActive: boolean;\n};\n\ntype StateProps = {\n stickers: GlobalState['stickers']['premium']['stickers'];\n};\n\nconst EMOJI_SIZE_MULTIPLIER = 0.6;\nconst EFFECT_SIZE_MULTIPLIER = 0.8;\nconst MAX_EMOJIS = 15;\nconst ENDED_DELAY = 150;\n\nconst AnimatedCircleSticker: FC<{\n size: number;\n realIndex: number;\n sticker: ApiSticker;\n index: number;\n maxLength: number;\n onClick: (index: number) => void;\n onEnded: NoneToVoidFunction;\n canPlay: boolean;\n}> = ({\n size, realIndex, canPlay,\n sticker, index, maxLength, onClick, onEnded,\n}) => {\n const mediaData = useMedia(`sticker${sticker.id}`);\n const mediaDataAround = useMedia(`sticker${sticker.id}?size=f`);\n\n const isActivated = index === 0;\n const [isAnimated, animate, inanimate] = useFlag(isActivated);\n\n const circleSize = size - size * EMOJI_SIZE_MULTIPLIER;\n const width = circleSize * 3;\n const height = circleSize * 3.2;\n\n const a = index / maxLength;\n\n const angle = a * (Math.PI * 2);\n const scale = isActivated ? 1 : 0.66;\n\n const x = Math.cos(angle) * width - circleSize * 2.8;\n const y = Math.sin(angle) * height;\n\n const handleClick = useCallback(() => {\n onClick(realIndex);\n }, [onClick, realIndex]);\n\n const handleEnded = useCallback(() => {\n inanimate();\n onEnded();\n }, [inanimate, onEnded]);\n\n useEffect(() => {\n if (isActivated) {\n animate();\n }\n }, [isActivated, animate]);\n\n return (\n <>\n {isActivated && (\n <AnimatedSticker\n className={styles.effectSticker}\n tgsUrl={mediaDataAround}\n play={canPlay}\n isLowPriority\n noLoop\n size={EFFECT_SIZE_MULTIPLIER * size}\n style={`--x: calc(${x}px - 10%); --y: ${y}px;`}\n />\n )}\n <AnimatedSticker\n className={styles.sticker}\n tgsUrl={mediaData}\n play={canPlay && isAnimated}\n noLoop\n size={EMOJI_SIZE_MULTIPLIER * size}\n style={`--x: ${x}px; --y: ${y}px; --opacity: ${scale}`}\n onClick={handleClick}\n onEnded={handleEnded}\n />\n </>\n );\n};\nconst PremiumFeaturePreviewStickers: FC<OwnProps & StateProps> = ({\n stickers, isActive,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const [offset, setOffset] = useState(0);\n const [size, setSize] = useState(0);\n\n const renderedStickers = stickers?.slice(0, MAX_EMOJIS);\n\n const handleClick = useCallback((i: number) => {\n setOffset(-i);\n }, []);\n\n const handleEnded = useCallback(() => {\n setTimeout(() => {\n setOffset((current) => cycleRestrict(renderedStickers.length, current + 1));\n }, ENDED_DELAY);\n }, [renderedStickers.length]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n setSize(container.closest('.modal-dialog')!.clientWidth);\n }, []);\n\n return (\n <div\n className={styles.root}\n ref={containerRef}\n >\n {renderedStickers?.map((l, i) => {\n return (\n <AnimatedCircleSticker\n size={size}\n sticker={l}\n realIndex={i}\n index={(i + offset + renderedStickers.length) % renderedStickers.length}\n maxLength={renderedStickers.length}\n onClick={handleClick}\n onEnded={handleEnded}\n canPlay={isActive}\n />\n );\n })}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n stickers: global.stickers.premium.stickers,\n };\n },\n)(PremiumFeaturePreviewStickers));\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"dVn5gk50tXn1EiI4kJFJ\",\"sticker\":\"PIYKt4xxOUBpRjRu0b4q\",\"effect-sticker\":\"JLzWnq8to4W24wBGmbyt PIYKt4xxOUBpRjRu0b4q\",\"effectSticker\":\"JLzWnq8to4W24wBGmbyt PIYKt4xxOUBpRjRu0b4q\"};","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"QfngIllOc1THaTQiJf7h\",\"button\":\"n8tTb600de2uZKGkyw67\",\"button-content\":\"eZLuJy6dL4ekVllaRcCm\",\"buttonContent\":\"eZLuJy6dL4ekVllaRcCm\",\"back-button\":\"ZTIpWD6Zrj1U7rnGvrlD\",\"backButton\":\"ZTIpWD6Zrj1U7rnGvrlD\",\"white-back-button\":\"E42Dy7DFLAxvj8HE4GAD\",\"whiteBackButton\":\"E42Dy7DFLAxvj8HE4GAD\",\"content\":\"JMdhJYW94Mas4JDye486\",\"frame\":\"fEQZ2fyO9g6L1v8QJUCJ\",\"slide\":\"xkC9BFxv7RkSwbPe4RMb\",\"limits\":\"zngeFAwxdlVJZY876fHc\",\"limits-content\":\"le7Qv9QkHlO3qdK0Hs_g\",\"limitsContent\":\"le7Qv9QkHlO3qdK0Hs_g\",\"header\":\"Mw81cOCIGy8KGn9VokFA\",\"no-header-border\":\"tRvcw256KSHRqgSj5uGX\",\"noHeaderBorder\":\"tRvcw256KSHRqgSj5uGX\",\"preview\":\"EXGFQjwHmQxjvMLbYtS9\",\"title\":\"eEYA2lXPy_DUKe8JKHiP\",\"description\":\"TVO7LjkV_yHUGIu5PXCA\",\"footer\":\"EKr_FVmiDSwhUxouhaqB\",\"no-footer-border\":\"H8z5Q6gsuqeCy82HFlyX\",\"noFooterBorder\":\"H8z5Q6gsuqeCy82HFlyX\"};","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport type { ApiPremiumPromo } from '../../../api/types';\nimport type { ApiLimitType, GlobalState } from '../../../global/types';\n\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\nimport fastSmoothScrollHorizontal from '../../../util/fastSmoothScrollHorizontal';\nimport useFlag from '../../../hooks/useFlag';\nimport renderText from '../../common/helpers/renderText';\nimport usePrevious from '../../../hooks/usePrevious';\nimport { formatCurrency } from '../../../util/formatCurrency';\n\nimport Button from '../../ui/Button';\nimport PremiumLimitPreview from './common/PremiumLimitPreview';\nimport PremiumFeaturePreviewVideo from './previews/PremiumFeaturePreviewVideo';\nimport PremiumFeaturePreviewReactions from './previews/PremiumFeaturePreviewReactions';\nimport SliderDots from '../../common/SliderDots';\nimport PremiumFeaturePreviewStickers from './previews/PremiumFeaturePreviewStickers';\n\nimport styles from './PremiumFeatureModal.module.scss';\n\nexport const PREMIUM_FEATURE_TITLES: Record<string, string> = {\n double_limits: 'PremiumPreviewLimits',\n unique_reactions: 'PremiumPreviewReactions',\n premium_stickers: 'PremiumPreviewStickers',\n animated_emoji: 'PremiumPreviewEmoji',\n no_ads: 'PremiumPreviewNoAds',\n voice_to_text: 'PremiumPreviewVoiceToText',\n profile_badge: 'PremiumPreviewProfileBadge',\n faster_download: 'PremiumPreviewDownloadSpeed',\n more_upload: 'PremiumPreviewUploads',\n advanced_chat_management: 'PremiumPreviewAdvancedChatManagement',\n animated_userpics: 'PremiumPreviewAnimatedProfiles',\n};\n\nexport const PREMIUM_FEATURE_DESCRIPTIONS: Record<string, string> = {\n double_limits: 'PremiumPreviewLimitsDescription',\n unique_reactions: 'PremiumPreviewReactionsDescription',\n premium_stickers: 'PremiumPreviewStickersDescription',\n no_ads: 'PremiumPreviewNoAdsDescription',\n animated_emoji: 'PremiumPreviewEmojiDescription',\n voice_to_text: 'PremiumPreviewVoiceToTextDescription',\n profile_badge: 'PremiumPreviewProfileBadgeDescription',\n faster_download: 'PremiumPreviewDownloadSpeedDescription',\n more_upload: 'PremiumPreviewUploadsDescription',\n advanced_chat_management: 'PremiumPreviewAdvancedChatManagementDescription',\n animated_userpics: 'PremiumPreviewAnimatedProfilesDescription',\n};\n\nexport const PREMIUM_FEATURE_SECTIONS = [\n 'double_limits',\n 'more_upload',\n 'faster_download',\n 'voice_to_text',\n 'no_ads',\n 'unique_reactions',\n 'premium_stickers',\n 'animated_emoji',\n 'advanced_chat_management',\n 'profile_badge',\n 'animated_userpics',\n];\n\nconst PREMIUM_BOTTOM_VIDEOS: string[] = [\n 'faster_download',\n 'voice_to_text',\n 'advanced_chat_management',\n 'profile_badge',\n 'animated_userpics',\n];\n\ntype ApiLimitTypeWithoutUpload = Exclude<ApiLimitType, 'uploadMaxFileparts'>;\n\nconst LIMITS_ORDER: ApiLimitTypeWithoutUpload[] = [\n 'channels',\n 'dialogFolderPinned',\n 'channelsPublic',\n 'savedGifs',\n 'stickersFaved',\n 'aboutLength',\n 'captionLength',\n 'dialogFilters',\n 'dialogFiltersChats',\n];\n\nconst LIMITS_TITLES: Record<ApiLimitTypeWithoutUpload, string> = {\n channels: 'GroupsAndChannelsLimitTitle',\n dialogFolderPinned: 'PinChatsLimitTitle',\n channelsPublic: 'PublicLinksLimitTitle',\n savedGifs: 'SavedGifsLimitTitle',\n stickersFaved: 'FavoriteStickersLimitTitle',\n aboutLength: 'BioLimitTitle',\n captionLength: 'CaptionsLimitTitle',\n dialogFilters: 'FoldersLimitTitle',\n dialogFiltersChats: 'ChatPerFolderLimitTitle',\n};\n\nconst LIMITS_DESCRIPTIONS: Record<ApiLimitTypeWithoutUpload, string> = {\n channels: 'GroupsAndChannelsLimitSubtitle',\n dialogFolderPinned: 'PinChatsLimitSubtitle',\n channelsPublic: 'PublicLinksLimitSubtitle',\n savedGifs: 'SavedGifsLimitSubtitle',\n stickersFaved: 'FavoriteStickersLimitSubtitle',\n aboutLength: 'BioLimitSubtitle',\n captionLength: 'CaptionsLimitSubtitle',\n dialogFilters: 'FoldersLimitSubtitle',\n dialogFiltersChats: 'ChatPerFolderLimitSubtitle',\n};\n\nconst BORDER_THRESHOLD = 20;\n\ntype OwnProps = {\n onBack: VoidFunction;\n initialSection: string;\n promo: ApiPremiumPromo;\n onClickSubscribe: (startParam?: string) => void;\n isPremium?: boolean;\n limits?: NonNullable<GlobalState['appConfig']>['limits'];\n};\n\nconst PremiumFeatureModal: FC<OwnProps> = ({\n promo,\n initialSection,\n onBack,\n onClickSubscribe,\n isPremium,\n limits,\n}) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const [currentSlideIndex, setCurrentSlideIndex] = useState(PREMIUM_FEATURE_SECTIONS.indexOf(initialSection));\n const [reverseAnimationSlideIndex, setReverseAnimationSlideIndex] = useState(0);\n const [isScrolling, startScrolling, stopScrolling] = useFlag();\n\n const [isScrolledToTop, setIsScrolledToTop] = useState(true);\n const [isScrolledToBottom, setIsScrolledToBottom] = useState(false);\n\n const prevInitialSection = usePrevious(initialSection);\n\n function handleClick() {\n onClickSubscribe(initialSection);\n }\n\n function handleScroll(e: React.UIEvent<HTMLDivElement>) {\n const { clientWidth, scrollLeft: scrollLeftOriginal } = e.currentTarget;\n\n const scrollLeft = Math.round(scrollLeftOriginal);\n\n const left = scrollLeft % (clientWidth);\n const progress = left / (clientWidth);\n e.currentTarget.style.setProperty('--scroll-progress', progress.toString());\n e.currentTarget.style.setProperty('--abs-scroll-progress', Math.abs(progress).toString());\n const reverseIndex = Math.ceil((scrollLeft + 1) / clientWidth);\n\n setReverseAnimationSlideIndex(reverseIndex);\n\n const prevElement = e.currentTarget.querySelector(`#premium_feature_preview_video_${reverseIndex - 1}`);\n const reverseElement = e.currentTarget.querySelector(`#premium_feature_preview_video_${reverseIndex}`);\n prevElement?.classList.toggle('reverse', false);\n reverseElement?.classList.toggle('reverse', true);\n\n if (isScrolling) return;\n const slide = Math.round(scrollLeft / clientWidth);\n setCurrentSlideIndex(slide);\n }\n\n function handleLimitsScroll(e: React.UIEvent<HTMLDivElement>) {\n const { scrollTop, clientHeight, scrollHeight } = e.currentTarget;\n setIsScrolledToTop(scrollTop <= BORDER_THRESHOLD);\n setIsScrolledToBottom(scrollTop >= scrollHeight - clientHeight - BORDER_THRESHOLD);\n }\n\n useEffect(() => {\n const scrollContainer = scrollContainerRef.current;\n if (!scrollContainer || (prevInitialSection === initialSection)) return;\n\n const index = PREMIUM_FEATURE_SECTIONS.indexOf(initialSection);\n setCurrentSlideIndex(index);\n startScrolling();\n fastSmoothScrollHorizontal(scrollContainer, scrollContainer.clientWidth * index, 0)\n .then(stopScrolling);\n }, [currentSlideIndex, initialSection, prevInitialSection, startScrolling, stopScrolling]);\n\n const handleSelectSlide = useCallback(async (index: number) => {\n const scrollContainer = scrollContainerRef.current;\n if (!scrollContainer) return;\n\n setCurrentSlideIndex(index);\n\n startScrolling();\n await fastSmoothScrollHorizontal(scrollContainer, scrollContainer.clientWidth * index, 800);\n stopScrolling();\n }, [startScrolling, stopScrolling]);\n\n return (\n <div className={styles.root}>\n <Button\n round\n size=\"smaller\"\n className={buildClassName(styles.backButton, currentSlideIndex !== 0 && styles.whiteBackButton)}\n color={currentSlideIndex === 0 ? 'translucent' : 'translucent-white'}\n onClick={onBack}\n ariaLabel={lang('Back')}\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n\n <div className={styles.preview} />\n\n <div className={buildClassName(styles.content, 'no-scrollbar')} onScroll={handleScroll} ref={scrollContainerRef}>\n\n {PREMIUM_FEATURE_SECTIONS.map((section, index) => {\n if (section === 'double_limits') {\n return (\n <div className={buildClassName(styles.slide, styles.limits)}>\n <h2 className={buildClassName(styles.header, isScrolledToTop && styles.noHeaderBorder)}>\n {lang(PREMIUM_FEATURE_TITLES.double_limits)}\n </h2>\n <div className={buildClassName(styles.limitsContent, 'custom-scroll')} onScroll={handleLimitsScroll}>\n {LIMITS_ORDER.map((limit, i) => {\n const defaultLimit = limits?.[limit][0].toString();\n const premiumLimit = limits?.[limit][1].toString();\n return (\n <PremiumLimitPreview\n title={lang(LIMITS_TITLES[limit])}\n description={lang(LIMITS_DESCRIPTIONS[limit], premiumLimit)}\n leftValue={defaultLimit}\n rightValue={premiumLimit}\n colorStepProgress={i / (LIMITS_ORDER.length - 1)}\n />\n );\n })}\n </div>\n </div>\n );\n }\n if (section === 'unique_reactions') {\n return (\n <div className={styles.slide}>\n <div className={styles.frame}>\n <PremiumFeaturePreviewReactions isActive={currentSlideIndex === index} />\n </div>\n <h1 className={styles.title}>\n {lang(PREMIUM_FEATURE_TITLES.unique_reactions)}\n </h1>\n <div className={styles.description}>\n {renderText(lang(PREMIUM_FEATURE_DESCRIPTIONS.unique_reactions), ['br'])}\n </div>\n </div>\n );\n }\n\n if (section === 'premium_stickers') {\n return (\n <div className={styles.slide}>\n <div className={styles.frame}>\n <PremiumFeaturePreviewStickers isActive={currentSlideIndex === index} />\n </div>\n <h1 className={styles.title}>\n {lang(PREMIUM_FEATURE_TITLES.premium_stickers)}\n </h1>\n <div className={styles.description}>\n {renderText(lang(PREMIUM_FEATURE_DESCRIPTIONS.premium_stickers), ['br'])}\n </div>\n </div>\n );\n }\n\n const i = promo.videoSections.indexOf(section);\n if (i === -1) return undefined;\n return (\n <div className={styles.slide}>\n <div className={styles.frame}>\n <PremiumFeaturePreviewVideo\n isActive={currentSlideIndex === index}\n videoId={promo.videos[i].id!}\n videoThumbnail={promo.videos[i].thumbnail!}\n isDown={PREMIUM_BOTTOM_VIDEOS.includes(section)}\n index={index}\n isReverseAnimation={index === reverseAnimationSlideIndex}\n />\n </div>\n <h1 className={styles.title}>\n {lang(PREMIUM_FEATURE_TITLES[promo.videoSections[i]!])}\n </h1>\n <div className={styles.description}>\n {renderText(lang(PREMIUM_FEATURE_DESCRIPTIONS[promo.videoSections[i]!]), ['br'])}\n </div>\n </div>\n );\n })}\n\n </div>\n\n <div\n className={buildClassName(\n styles.footer,\n (isScrolledToBottom || currentSlideIndex !== 0) && styles.noFooterBorder,\n )}\n >\n <SliderDots\n length={PREMIUM_FEATURE_SECTIONS.length}\n active={currentSlideIndex}\n onSelectSlide={handleSelectSlide}\n />\n <Button\n className={buildClassName(styles.button)}\n isShiny={!isPremium}\n withPremiumGradient={!isPremium}\n onClick={isPremium ? onBack : handleClick}\n >\n {isPremium\n ? lang('OK')\n : lang('SubscribeToPremium', formatCurrency(Number(promo.monthlyAmount), promo.currency, lang.code))}\n </Button>\n </div>\n </div>\n );\n};\n\nexport default memo(PremiumFeatureModal);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"PEnE7xWTMwTPGmhubmj6\",\"text\":\"U4UYSH7uHW3k4FlqBefm\",\"header\":\"Jdlm3dtJ8gOIY0x0u2d4\",\"description\":\"cE44My72bdvMJna9mgoc\",\"icon\":\"mxF3NdPgAi_H0ZFgNEtw\"};","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport renderText from '../../common/helpers/renderText';\n\nimport ListItem from '../../ui/ListItem';\n\nimport styles from './PremiumFeatureItem.module.scss';\n\ntype OwnProps = {\n icon: string;\n title: string;\n text: string;\n onClick: VoidFunction;\n index: number;\n};\n\nconst COLORS = [\n '#F2862D', '#EB7B4D', '#E46D72', '#DD6091', '#CC5FBA', '#B464E7',\n '#9873FF', '#768DFF', '#55A5FC', '#52B0C9', '#4FBC93', '#4CC663',\n];\n\nconst PremiumFeatureItem: FC<OwnProps> = ({\n icon,\n title,\n text,\n index,\n onClick,\n}) => {\n return (\n <ListItem buttonClassName={styles.root} onClick={onClick}>\n <img src={icon} className={styles.icon} alt=\"\" style={`--item-color: ${COLORS[index]}`} />\n <div className={styles.text}>\n <div className={styles.title}>{renderText(title, ['br'])}</div>\n <div className={styles.description}>{text}</div>\n </div>\n </ListItem>\n );\n};\n\nexport default memo(PremiumFeatureItem);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"JJNHc_FZuydBNBIHK9xC\",\"transition\":\"Q05gUm0HCMtSoeX2HVGw\",\"button\":\"Fb3VVHNrypZ3lhYfSVI_\",\"main\":\"E9_LJ9RqAHTj8h84EROt\",\"logo\":\"Vaf41aTAoSwl_e_cZhah\",\"header-text\":\"J2z1gqvfQu5kqV_UP8US\",\"headerText\":\"J2z1gqvfQu5kqV_UP8US\",\"description\":\"PXg8sU2cfdeysJXctlpB\",\"list\":\"LlPAfJpL066su4P2NFmh\",\"no-button\":\"wpPtJKCqTdOGkKoh7KTo\",\"noButton\":\"wpPtJKCqTdOGkKoh7KTo\",\"header\":\"Rwuf1efaEfZ13AD5XbCB\",\"hidden-header\":\"NV7fN3j69oFZEJu7ejG8\",\"hiddenHeader\":\"NV7fN3j69oFZEJu7ejG8\",\"close-button\":\"TyuYAZecpI2K_1i3B5XO\",\"closeButton\":\"TyuYAZecpI2K_1i3B5XO\",\"premium-header-text\":\"jA_DV7G5VJo8xGOe0otF\",\"premiumHeaderText\":\"jA_DV7G5VJo8xGOe0otF\",\"footer-text\":\"yVkdTScCEhH3EQMQiA42\",\"footerText\":\"yVkdTScCEhH3EQMQiA42\",\"primary-footer-text\":\"MQbFSG2o_R8rjKDsqs8R\",\"primaryFooterText\":\"MQbFSG2o_R8rjKDsqs8R\",\"footer\":\"FApXoTPpasib6Np5Uxpt\"};","import React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiPremiumPromo, ApiUser } from '../../../api/types';\nimport type { GlobalState } from '../../../global/types';\n\nimport PremiumFeatureModal, {\n PREMIUM_FEATURE_DESCRIPTIONS,\n PREMIUM_FEATURE_SECTIONS,\n PREMIUM_FEATURE_TITLES,\n} from './PremiumFeatureModal';\nimport { TME_LINK_PREFIX } from '../../../config';\nimport { formatCurrency } from '../../../util/formatCurrency';\nimport buildClassName from '../../../util/buildClassName';\nimport { selectIsCurrentUserPremium, selectUser } from '../../../global/selectors';\nimport { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities';\nimport { selectPremiumLimit } from '../../../global/selectors/limits';\nimport renderText from '../../common/helpers/renderText';\nimport { getUserFullName } from '../../../global/helpers';\n\nimport useLang from '../../../hooks/useLang';\nimport useOnChange from '../../../hooks/useOnChange';\n\nimport Modal from '../../ui/Modal';\nimport Button from '../../ui/Button';\nimport PremiumFeatureItem from './PremiumFeatureItem';\nimport Transition from '../../ui/Transition';\n\nimport PremiumLogo from '../../../assets/premium/PremiumLogo.svg';\nimport PremiumLimits from '../../../assets/premium/PremiumLimits.svg';\nimport PremiumFile from '../../../assets/premium/PremiumFile.svg';\nimport PremiumSpeed from '../../../assets/premium/PremiumSpeed.svg';\nimport PremiumVoice from '../../../assets/premium/PremiumVoice.svg';\nimport PremiumAds from '../../../assets/premium/PremiumAds.svg';\nimport PremiumReactions from '../../../assets/premium/PremiumReactions.svg';\nimport PremiumStickers from '../../../assets/premium/PremiumStickers.svg';\nimport PremiumChats from '../../../assets/premium/PremiumChats.svg';\nimport PremiumBadge from '../../../assets/premium/PremiumBadge.svg';\nimport PremiumVideo from '../../../assets/premium/PremiumVideo.svg';\nimport PremiumEmoji from '../../../assets/premium/PremiumEmoji.svg';\n\nimport styles from './PremiumMainModal.module.scss';\n\nconst LIMIT_ACCOUNTS = 4;\n\nconst PREMIUM_FEATURE_COLOR_ICONS: Record<string, string> = {\n double_limits: PremiumLimits,\n unique_reactions: PremiumReactions,\n premium_stickers: PremiumStickers,\n animated_emoji: PremiumEmoji,\n no_ads: PremiumAds,\n voice_to_text: PremiumVoice,\n profile_badge: PremiumBadge,\n faster_download: PremiumSpeed,\n more_upload: PremiumFile,\n advanced_chat_management: PremiumChats,\n animated_userpics: PremiumVideo,\n};\n\nexport type OwnProps = {\n isOpen?: boolean;\n};\n\ntype StateProps = {\n currentUserId?: string;\n promo?: ApiPremiumPromo;\n isClosing?: boolean;\n fromUser?: ApiUser;\n toUser?: ApiUser;\n initialSection?: string;\n isPremium?: boolean;\n isSuccess?: boolean;\n isGift?: boolean;\n monthsAmount?: number;\n limitChannels: number;\n limitPins: number;\n limitLinks: number;\n limitFolders: number;\n limits?: NonNullable<GlobalState['appConfig']>['limits'];\n premiumSlug?: string;\n premiumBotUsername?: string;\n premiumPromoOrder?: string[];\n};\n\nconst PremiumMainModal: FC<OwnProps & StateProps> = ({\n isOpen,\n currentUserId,\n fromUser,\n promo,\n initialSection,\n isPremium,\n limitChannels,\n limitLinks,\n limitFolders,\n limitPins,\n limits,\n premiumSlug,\n premiumBotUsername,\n isClosing,\n isSuccess,\n isGift,\n toUser,\n monthsAmount,\n premiumPromoOrder,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const dialogRef = useRef<HTMLDivElement>(null);\n const {\n closePremiumModal, openInvoice, requestConfetti, openTelegramLink,\n } = getActions();\n\n const lang = useLang();\n const [isHeaderHidden, setHeaderHidden] = useState(true);\n const [currentSection, setCurrentSection] = useState<string | undefined>(initialSection);\n\n const handleOpen = useCallback((section: string | undefined) => {\n return () => {\n setCurrentSection(section);\n };\n }, []);\n\n function handleScroll(e: React.UIEvent<HTMLDivElement>) {\n const { scrollTop } = e.currentTarget;\n\n setHeaderHidden(scrollTop <= 150);\n }\n\n function handleClickWithStartParam(startParam?: string) {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (premiumSlug) {\n openInvoice({\n slug: premiumSlug,\n });\n } else if (premiumBotUsername) {\n openTelegramLink({\n url: `${TME_LINK_PREFIX}${premiumBotUsername}?start=${startParam || 'promo'}`,\n });\n closePremiumModal();\n }\n }\n\n function handleClick() {\n handleClickWithStartParam();\n }\n\n const showConfetti = useCallback(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n if (isOpen) {\n const {\n top, left, width, height,\n } = dialog.querySelector('.modal-content')!.getBoundingClientRect();\n requestConfetti({\n top,\n left,\n width,\n height,\n });\n }\n }, [isOpen, requestConfetti]);\n\n useEffect(() => {\n if (isSuccess) {\n showConfetti();\n }\n }, [isSuccess, showConfetti]);\n\n useOnChange(([prevIsPremium]) => {\n if (prevIsPremium === isPremium) return;\n\n showConfetti();\n }, [isPremium]);\n\n if (!promo) return undefined;\n\n function getHeaderText() {\n if (isGift) {\n return fromUser?.id === currentUserId\n ? lang('TelegramPremiumUserGiftedPremiumOutboundDialogTitle', [getUserFullName(toUser), monthsAmount])\n : lang('TelegramPremiumUserGiftedPremiumDialogTitle', [getUserFullName(fromUser), monthsAmount]);\n }\n\n return fromUser\n ? lang('TelegramPremiumUserDialogTitle', getUserFullName(fromUser))\n : lang(isPremium ? 'TelegramPremiumSubscribedTitle' : 'TelegramPremium');\n }\n\n function getHeaderDescription() {\n if (isGift) {\n return fromUser?.id === currentUserId\n ? lang('TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle', getUserFullName(toUser))\n : lang('TelegramPremiumUserGiftedPremiumDialogSubtitle');\n }\n\n return fromUser\n ? lang('TelegramPremiumUserDialogSubtitle')\n : lang(isPremium ? 'TelegramPremiumSubscribedSubtitle' : 'TelegramPremiumSubtitle');\n }\n\n function renderFooterText() {\n if (!promo || (isGift && fromUser?.id === currentUserId)) {\n return undefined;\n }\n\n return (\n <div className={styles.footerText} dir={lang.isRtl ? 'rtl' : undefined}>\n {renderTextWithEntities(promo.statusText, promo.statusEntities)}\n </div>\n );\n }\n\n return (\n <Modal\n className={styles.root}\n // eslint-disable-next-line react/jsx-no-bind\n onCloseAnimationEnd={() => closePremiumModal({ isClosed: true })}\n onClose={closePremiumModal}\n isOpen={isOpen && !isClosing}\n dialogRef={dialogRef}\n >\n <Transition name=\"slide\" activeKey={currentSection ? 1 : 0} className={styles.transition}>\n {!currentSection ? (\n <div className={buildClassName(styles.main, 'custom-scroll')} onScroll={handleScroll}>\n <Button\n round\n size=\"smaller\"\n className={styles.closeButton}\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => closePremiumModal()}\n ariaLabel={lang('Close')}\n >\n <i className=\"icon-close\" />\n </Button>\n <img className={styles.logo} src={PremiumLogo} alt=\"\" />\n <h2 className={styles.headerText}>\n {renderText(getHeaderText(), ['simple_markdown', 'emoji'])}\n </h2>\n <div className={styles.description}>\n {renderText(getHeaderDescription(), ['simple_markdown', 'emoji'])}\n </div>\n <div className={buildClassName(styles.header, isHeaderHidden && styles.hiddenHeader)}>\n <h2 className={styles.premiumHeaderText}>\n {lang('TelegramPremium')}\n </h2>\n </div>\n\n <div className={buildClassName(styles.list, isPremium && styles.noButton)}>\n {(premiumPromoOrder || PREMIUM_FEATURE_SECTIONS).map((section, index) => {\n if (!PREMIUM_FEATURE_SECTIONS.includes(section)) return undefined;\n return (\n <PremiumFeatureItem\n key={section}\n title={lang(PREMIUM_FEATURE_TITLES[section])}\n text={section === 'double_limits'\n ? lang(PREMIUM_FEATURE_DESCRIPTIONS[section],\n [limitChannels, limitFolders, limitPins, limitLinks, LIMIT_ACCOUNTS])\n : lang(PREMIUM_FEATURE_DESCRIPTIONS[section])}\n icon={PREMIUM_FEATURE_COLOR_ICONS[section]}\n index={index}\n onClick={handleOpen(section)}\n />\n );\n })}\n <div\n className={buildClassName(styles.footerText, styles.primaryFooterText)}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n <p>\n {renderText(lang('AboutPremiumDescription'), ['simple_markdown'])}\n </p>\n <p>\n {renderText(lang('AboutPremiumDescription2'), ['simple_markdown'])}\n </p>\n </div>\n {renderFooterText()}\n </div>\n {!isPremium && (\n <div className={styles.footer}>\n {/* eslint-disable-next-line react/jsx-no-bind */}\n <Button className={styles.button} isShiny withPremiumGradient onClick={handleClick}>\n {lang('SubscribeToPremium', formatCurrency(Number(promo.monthlyAmount), promo.currency, lang.code))}\n </Button>\n </div>\n )}\n </div>\n ) : (\n <PremiumFeatureModal\n initialSection={currentSection}\n onBack={handleOpen(undefined)}\n promo={promo}\n // eslint-disable-next-line react/jsx-no-bind\n onClickSubscribe={handleClickWithStartParam}\n isPremium={isPremium}\n limits={limits}\n />\n )}\n </Transition>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global): StateProps => {\n return {\n currentUserId: global.currentUserId,\n promo: global.premiumModal?.promo,\n isClosing: global.premiumModal?.isClosing,\n isSuccess: global.premiumModal?.isSuccess,\n isGift: global.premiumModal?.isGift,\n monthsAmount: global.premiumModal?.monthsAmount,\n fromUser: global.premiumModal?.fromUserId ? selectUser(global, global.premiumModal.fromUserId) : undefined,\n toUser: global.premiumModal?.toUserId ? selectUser(global, global.premiumModal.toUserId) : undefined,\n initialSection: global.premiumModal?.initialSection,\n isPremium: selectIsCurrentUserPremium(global),\n limitChannels: selectPremiumLimit(global, 'channels'),\n limitFolders: selectPremiumLimit(global, 'dialogFilters'),\n limitPins: selectPremiumLimit(global, 'dialogFolderPinned'),\n limitLinks: selectPremiumLimit(global, 'channelsPublic'),\n limits: global.appConfig?.limits,\n premiumSlug: global.appConfig?.premiumInvoiceSlug,\n premiumBotUsername: global.appConfig?.premiumBotUsername,\n premiumPromoOrder: global.appConfig?.premiumPromoOrder,\n };\n})(PremiumMainModal));\n","// extracted by mini-css-extract-plugin\nexport default {\"wrapper\":\"c43s0Q6_xgGlM8sZxQ7Q\",\"active\":\"PjYaF42Oe55WgPpTP6Od\",\"input\":\"r03M3Tzd52_D2GCAdabK\",\"content\":\"oL_26LDnHDwJRxqKF1Kn\",\"month\":\"JmEuBQ4mFzu1MiFV5qSB\",\"perMonth\":\"hssGd7AUhDhhG2_aXqe9\",\"amount\":\"mhc9AgOUiNT2QMcErpQe\",\"discount\":\"WCXGWHYNQh8lg2rIWehC\"};","import type { ChangeEvent } from 'react';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiPremiumGiftOption } from '../../../api/types';\n\nimport { formatCurrency } from '../../../util/formatCurrency';\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\n\nimport styles from './GiftOption.module.scss';\n\ntype OwnProps = {\n option: ApiPremiumGiftOption;\n checked?: boolean;\n fullMonthlyAmount?: number;\n onChange: (month: number) => void;\n};\n\nconst GiftOption: FC<OwnProps> = ({\n option, checked, fullMonthlyAmount, onChange,\n}) => {\n const lang = useLang();\n\n const { months, amount, currency } = option;\n const perMonth = Math.floor(amount / months);\n\n const discount = useMemo(() => {\n return fullMonthlyAmount && fullMonthlyAmount > perMonth\n ? Math.ceil(100 - perMonth / (fullMonthlyAmount / 100))\n : undefined;\n }, [fullMonthlyAmount, perMonth]);\n\n const handleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.checked) {\n onChange(months);\n }\n }, [months, onChange]);\n\n return (\n <label className={buildClassName(styles.wrapper, checked && styles.active)} dir={lang.isRtl ? 'rtl' : undefined}>\n <input\n className={styles.input}\n type=\"radio\"\n name=\"gift_option\"\n value={months}\n checked={checked}\n onChange={handleChange}\n />\n <div className={styles.content}>\n <div className={styles.month}>{lang('Months', months)}</div>\n <div className={styles.perMonth}>\n {lang('PricePerMonth', formatCurrency(perMonth, currency, lang.code))}\n {discount && (\n <span className={styles.discount} title={lang('GiftDiscount')}> &minus;{discount}% </span>\n )}\n </div>\n <div className={styles.amount}>{formatCurrency(amount, currency, lang.code)}</div>\n </div>\n </label>\n );\n};\n\nexport default memo(GiftOption);\n","import React, {\n memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiPremiumGiftOption, ApiUser } from '../../../api/types';\n\nimport { formatCurrency } from '../../../util/formatCurrency';\nimport renderText from '../../common/helpers/renderText';\nimport { getUserFirstOrLastName } from '../../../global/helpers';\nimport { selectUser } from '../../../global/selectors';\n\nimport useCurrentOrPrev from '../../../hooks/useCurrentOrPrev';\nimport useLang from '../../../hooks/useLang';\n\nimport Modal from '../../ui/Modal';\nimport Button from '../../ui/Button';\nimport Link from '../../ui/Link';\nimport Avatar from '../../common/Avatar';\nimport GiftOption from './GiftOption';\n\nimport styles from './GiftPremiumModal.module.scss';\n\nexport type OwnProps = {\n isOpen?: boolean;\n};\n\ntype StateProps = {\n user?: ApiUser;\n gifts?: ApiPremiumGiftOption[];\n monthlyCurrency?: string;\n monthlyAmount?: number;\n};\n\nconst GiftPremiumModal: FC<OwnProps & StateProps> = ({\n isOpen, user, gifts, monthlyCurrency, monthlyAmount,\n}) => {\n const { openPremiumModal, closeGiftPremiumModal, openUrl } = getActions();\n\n const lang = useLang();\n const renderedUser = useCurrentOrPrev(user, true);\n const renderedGifts = useCurrentOrPrev(gifts, true);\n const [selectedOption, setSelectedOption] = useState<number | undefined>();\n const firstGift = renderedGifts?.[0];\n const fullMonthlyAmount = useMemo(() => {\n if (!renderedGifts || renderedGifts.length === 0 || !firstGift) {\n return undefined;\n }\n\n const cheaperGift = renderedGifts.reduce((acc, gift) => {\n return gift.amount < firstGift?.amount ? gift : firstGift;\n }, firstGift);\n\n return cheaperGift.currency === monthlyCurrency && monthlyAmount\n ? monthlyAmount\n : Math.floor(cheaperGift.amount / cheaperGift.months);\n }, [firstGift, renderedGifts, monthlyAmount, monthlyCurrency]);\n\n useEffect(() => {\n if (isOpen) {\n setSelectedOption(firstGift?.months);\n }\n }, [firstGift?.months, isOpen]);\n\n const selectedGift = useMemo(() => {\n return renderedGifts?.find((gift) => gift.months === selectedOption);\n }, [renderedGifts, selectedOption]);\n\n const handleSubmit = useCallback(() => {\n if (!selectedGift) {\n return;\n }\n\n closeGiftPremiumModal();\n openUrl({ url: selectedGift.botUrl });\n }, [closeGiftPremiumModal, openUrl, selectedGift]);\n\n const handlePremiumClick = useCallback(() => {\n openPremiumModal();\n }, [openPremiumModal]);\n\n function renderPremiumFeaturesLink() {\n const info = lang('GiftPremiumListFeaturesAndTerms');\n // Translation hack for rendering component inside string\n const parts = info.match(/([^*]*)\\*([^*]+)\\*(.*)/);\n\n if (!parts || parts.length < 4) {\n return undefined;\n }\n\n return (\n <p className={styles.premiumFeatures}>\n {parts[1]}\n <Link isPrimary onClick={handlePremiumClick}>{parts[2]}</Link>\n {parts[3]}\n </p>\n );\n }\n\n return (\n <Modal\n onClose={closeGiftPremiumModal}\n isOpen={isOpen}\n className={styles.modalDialog}\n >\n <div className=\"custom-scroll\">\n <Button\n round\n size=\"smaller\"\n className={styles.closeButton}\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => closeGiftPremiumModal()}\n ariaLabel={lang('Close')}\n >\n <i className=\"icon-close\" />\n </Button>\n <Avatar user={renderedUser} size=\"jumbo\" className={styles.avatar} />\n <h2 className={styles.headerText}>\n {lang('GiftTelegramPremiumTitle')}\n </h2>\n <p className={styles.description}>\n {renderText(\n lang('GiftTelegramPremiumDescription', getUserFirstOrLastName(renderedUser)),\n ['emoji', 'simple_markdown'],\n )}\n </p>\n\n <div className={styles.options}>\n {renderedGifts?.map((gift) => (\n <GiftOption\n key={gift.amount}\n option={gift}\n fullMonthlyAmount={fullMonthlyAmount}\n checked={gift.months === selectedOption}\n onChange={setSelectedOption}\n />\n ))}\n </div>\n\n {renderPremiumFeaturesLink()}\n </div>\n\n <Button className={styles.button} isShiny disabled={!selectedOption} onClick={handleSubmit}>\n {lang(\n 'GiftSubscriptionFor',\n selectedGift && formatCurrency(Number(selectedGift.amount), selectedGift.currency, lang.code),\n )}\n </Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global): StateProps => {\n const { forUserId, monthlyCurrency, monthlyAmount } = global.giftPremiumModal || {};\n const user = forUserId ? selectUser(global, forUserId) : undefined;\n const gifts = user ? user.fullInfo?.premiumGifts : undefined;\n\n return {\n user,\n gifts,\n monthlyCurrency,\n monthlyAmount: monthlyAmount ? Number(monthlyAmount) : undefined,\n };\n})(GiftPremiumModal));\n","// extracted by mini-css-extract-plugin\nexport default {\"modalDialog\":\"K80So3B9potKGNvwdtYE\",\"closeButton\":\"dxx424IZDNuP1OLbUIve\",\"avatar\":\"qJgJ7R5NJVmAxBjT5LxT\",\"headerText\":\"eqCNa8zBoMroKcepfXyE\",\"description\":\"MtYhgDChavNfKIUAJPzt\",\"premiumFeatures\":\"J0hST5xsC45ZolfGpbDc\",\"options\":\"HyfHjS1vAds31eFcSpDg\",\"button\":\"sSXm9RjIQSsVFi0D1nEd\"};","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../../lib/teact/teact';\n\nimport type { ApiLimitTypeWithModal } from '../../../../global/types';\nimport type { LangFn } from '../../../../hooks/useLang';\n\nimport renderText from '../../../common/helpers/renderText';\nimport buildClassName from '../../../../util/buildClassName';\nimport { formatFileSize } from '../../../../util/textFormat';\nimport { getActions, withGlobal } from '../../../../global';\nimport { selectIsCurrentUserPremium, selectIsPremiumPurchaseBlocked } from '../../../../global/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport { MAX_UPLOAD_FILEPART_SIZE } from '../../../../config';\nimport useFlag from '../../../../hooks/useFlag';\n\nimport Modal from '../../../ui/Modal';\nimport Button from '../../../ui/Button';\nimport PremiumLimitsCompare from './PremiumLimitsCompare';\n\nimport styles from './PremiumLimitReachedModal.module.scss';\n\nconst LIMIT_DESCRIPTION: Record<ApiLimitTypeWithModal, string> = {\n dialogFiltersChats: 'LimitReachedChatInFolders',\n uploadMaxFileparts: 'LimitReachedFileSize',\n dialogFilters: 'LimitReachedFolders',\n dialogFolderPinned: 'LimitReachedPinDialogs',\n channelsPublic: 'LimitReachedPublicLinks',\n channels: 'LimitReachedCommunities',\n};\n\nconst LIMIT_DESCRIPTION_BLOCKED: Record<ApiLimitTypeWithModal, string> = {\n dialogFiltersChats: 'LimitReachedChatInFoldersLocked',\n uploadMaxFileparts: 'LimitReachedFileSizeLocked',\n dialogFilters: 'LimitReachedFoldersLocked',\n dialogFolderPinned: 'LimitReachedPinDialogsLocked',\n channelsPublic: 'LimitReachedPublicLinksLocked',\n channels: 'LimitReachedCommunitiesLocked',\n};\n\nconst LIMIT_DESCRIPTION_PREMIUM: Record<ApiLimitTypeWithModal, string> = {\n dialogFiltersChats: 'LimitReachedChatInFoldersPremium',\n uploadMaxFileparts: 'LimitReachedFileSizePremium',\n dialogFilters: 'LimitReachedFoldersPremium',\n dialogFolderPinned: 'LimitReachedPinDialogsPremium',\n channelsPublic: 'LimitReachedPublicLinksPremium',\n channels: 'LimitReachedCommunitiesPremium',\n};\n\nconst LIMIT_ICON: Record<ApiLimitTypeWithModal, string> = {\n dialogFiltersChats: 'icon-chat-badge',\n uploadMaxFileparts: 'icon-file-badge',\n dialogFilters: 'icon-folder-badge',\n dialogFolderPinned: 'icon-pin-badge',\n channelsPublic: 'icon-link-badge',\n channels: 'icon-chats-badge',\n};\n\nconst LIMIT_VALUE_FORMATTER: Partial<Record<ApiLimitTypeWithModal, (...args: any[]) => string>> = {\n uploadMaxFileparts: (lang: LangFn, value: number) => {\n // The real size is not exactly 4gb, so we need to round it\n if (value === 8000) return lang('FileSize.GB', '4');\n if (value === 4000) return lang('FileSize.GB', '2');\n return formatFileSize(lang, value * MAX_UPLOAD_FILEPART_SIZE);\n },\n};\n\nfunction getLimiterDescription({\n lang,\n limitType,\n isPremium,\n canBuyPremium,\n defaultValue,\n premiumValue,\n valueFormatter,\n}: {\n lang: LangFn;\n limitType?: ApiLimitTypeWithModal;\n isPremium?: boolean;\n canBuyPremium?: boolean;\n defaultValue?: number;\n premiumValue?: number;\n valueFormatter?: (...args: any[]) => string;\n}) {\n if (!limitType) {\n return undefined;\n }\n\n const defaultValueFormatted = valueFormatter ? valueFormatter(lang, defaultValue) : defaultValue;\n const premiumValueFormatted = valueFormatter ? valueFormatter(lang, premiumValue) : premiumValue;\n\n if (isPremium) {\n return lang(LIMIT_DESCRIPTION_PREMIUM[limitType], premiumValueFormatted);\n }\n\n return canBuyPremium\n ? lang(LIMIT_DESCRIPTION[limitType],\n limitType === 'channelsPublic' ? premiumValueFormatted : [defaultValueFormatted, premiumValueFormatted])\n : lang(LIMIT_DESCRIPTION_BLOCKED[limitType], defaultValueFormatted);\n}\n\nexport type OwnProps = {\n limit?: ApiLimitTypeWithModal;\n};\n\ntype StateProps = {\n defaultValue?: number;\n premiumValue?: number;\n isPremium?: boolean;\n canBuyPremium?: boolean;\n};\n\nconst PremiumLimitReachedModal: FC<OwnProps & StateProps> = ({\n defaultValue,\n premiumValue,\n limit,\n isPremium,\n canBuyPremium,\n}) => {\n const { closeLimitReachedModal, openPremiumModal } = getActions();\n const lang = useLang();\n\n const [isClosing, startClosing, stopClosing] = useFlag();\n\n const handleClick = useCallback(() => {\n openPremiumModal();\n startClosing();\n }, [openPremiumModal, startClosing]);\n\n useEffect(() => {\n if (!limit && isClosing) stopClosing();\n }, [isClosing, limit, stopClosing]);\n\n const title = lang('LimitReached');\n const valueFormatter = limit && LIMIT_VALUE_FORMATTER[limit];\n const description = getLimiterDescription({\n lang,\n limitType: limit,\n isPremium,\n canBuyPremium,\n defaultValue,\n premiumValue,\n valueFormatter,\n });\n const icon = limit && LIMIT_ICON[limit];\n const canUpgrade = canBuyPremium && !isPremium;\n\n return (\n <Modal\n onClose={startClosing}\n onCloseAnimationEnd={closeLimitReachedModal}\n isOpen={Boolean(limit) && !isClosing}\n title={title}\n className={styles.root}\n >\n {!canUpgrade && (\n <div className={styles.limitBadge}>\n <i className={buildClassName(styles.limitIcon, icon)} />\n <div className={styles.limitValue}>{valueFormatter?.(\n lang, isPremium ? premiumValue : defaultValue,\n ) || (isPremium ? premiumValue : defaultValue)}\n </div>\n </div>\n )}\n\n {canUpgrade && (\n <PremiumLimitsCompare\n className={styles.limitCompare}\n leftValue={valueFormatter?.(lang, defaultValue) || defaultValue?.toString()}\n rightValue={valueFormatter?.(lang, premiumValue) || premiumValue?.toString()}\n floatingBadgeIcon={icon}\n />\n )}\n\n <div>\n {renderText(description, ['simple_markdown', 'br'])}\n </div>\n\n <div className={styles.dialogButtons}>\n <Button\n className=\"confirm-dialog-button\"\n isText\n onClick={startClosing}\n color=\"primary\"\n >\n {lang(canUpgrade ? 'Cancel' : 'OK')}\n </Button>\n {canUpgrade\n && (\n <Button\n className={buildClassName('confirm-dialog-button', styles.subscribeButton)}\n isShiny\n onClick={handleClick}\n color=\"primary\"\n >\n {lang('IncreaseLimit')}\n <i className={buildClassName(styles.buttonIcon, 'icon-double-badge')} />\n </Button>\n )}\n </div>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { limit }): StateProps => {\n const { limits } = global.appConfig || {};\n const isPremium = selectIsCurrentUserPremium(global);\n\n return {\n defaultValue: limit ? limits?.[limit][0] : undefined,\n premiumValue: limit ? limits?.[limit][1] : undefined,\n canBuyPremium: !selectIsPremiumPurchaseBlocked(global),\n isPremium,\n };\n },\n)(PremiumLimitReachedModal));\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"iz5RJvcQyNNDQzKfXQbN\",\"limit-compare\":\"az3lXhmlMfZfIQ_81jog\",\"limitCompare\":\"az3lXhmlMfZfIQ_81jog\",\"limit-badge\":\"womlEQglVV1w8ltVa6PQ\",\"limitBadge\":\"womlEQglVV1w8ltVa6PQ\",\"limit-value\":\"QC8Xe4ShGc_q82s4Tjmg\",\"limitValue\":\"QC8Xe4ShGc_q82s4Tjmg\",\"limit-icon\":\"q8SgjqQqlOVMSofzhdwh\",\"limitIcon\":\"q8SgjqQqlOVMSofzhdwh\",\"dialog-buttons\":\"DgRFl7StCs4fhROb7CKH\",\"dialogButtons\":\"DgRFl7StCs4fhROb7CKH\",\"subscribe-button\":\"Twnx_5clE9fKNOMo7lXf\",\"subscribeButton\":\"Twnx_5clE9fKNOMo7lXf\",\"button-icon\":\"BW05mF5k9uq5qBi_BYzg\",\"buttonIcon\":\"BW05mF5k9uq5qBi_BYzg\"};","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport SafeLink from './SafeLink';\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n};\n\nconst AboutAdsModal: FC<OwnProps> = ({\n isOpen,\n onClose,\n}) => {\n const lang = useLang();\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n hasCloseButton\n title={lang('SponsoredMessageInfo')}\n >\n <p>{renderText(lang('SponsoredMessageInfoDescription1'), ['br'])}</p>\n <p>{renderText(lang('SponsoredMessageInfoDescription2'), ['br'])}</p>\n <p>{renderText(lang('SponsoredMessageInfoDescription3'), ['br'])}</p>\n <p>\n <SafeLink\n url={lang('SponsoredMessageAlertLearnMoreUrl')}\n text={lang('SponsoredMessageAlertLearnMoreUrl')}\n />\n </p>\n <p>{renderText(lang('SponsoredMessageInfoDescription4'), ['br'])}</p>\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Close')}</Button>\n </Modal>\n );\n};\n\nexport default memo(AboutAdsModal);\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({ 'Mod+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 isForwardModalOpen?: 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 isForwardModalOpen,\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 && !isForwardModalOpen\n ? captureKeyboardListeners({\n onBackspace: canDeleteMessages ? openDeleteModal : undefined,\n onDelete: canDeleteMessages ? openDeleteModal : undefined,\n onEsc: exitMessageSelectMode,\n })\n : undefined;\n }, [\n isActive, isDeleteModalOpen, isReportModalOpen, openDeleteModal, exitMessageSelectMode, isForwardModalOpen,\n canDeleteMessages,\n ]);\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 isSchedule = messageListType === 'scheduled';\n const { canDelete } = selectCanDeleteSelectedMessages(global);\n const canReport = Boolean(!isSchedule && selectCanReportSelectedMessages(global));\n const canDownload = selectCanDownloadSelectedMessages(global);\n const { messageIds: selectedMessageIds } = global.selectedMessages || {};\n const hasProtectedMessage = chatId ? selectHasProtectedMessage(global, chatId, selectedMessageIds) : false;\n const isForwardModalOpen = global.forwardMessages.isModalShown;\n\n return {\n isSchedule,\n selectedMessagesCount: selectSelectedMessagesCount(global),\n canDeleteMessages: canDelete,\n canReportMessages: canReport,\n canDownloadMessages: canDownload,\n selectedMessageIds,\n hasProtectedMessage,\n isForwardModalOpen,\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';\nimport PremiumIcon from '../common/PremiumIcon';\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=\"small\" />\n <div className=\"title\">\n <h3 dir=\"auto\">{fullName && renderText(fullName)}</h3>\n {user.isPremium && <PremiumIcon />}\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 = 309;\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\" withVideoAvatar />\n ) : (\n <GroupChatInfo chatId={chatId} withUsername={withUsername} avatarSize=\"large\" withVideoAvatar />\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 getMessageSticker,\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';\nimport PremiumIcon from '../../common/PremiumIcon';\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 = !getMessageSticker(message) ? getMessageMediaThumbDataUri(message) : undefined;\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 {privateChatUser?.isPremium && <PremiumIcon />}\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, useRef, 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';\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\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 // eslint-disable-next-line no-null/no-null\n const chatSelectionRef = useRef<HTMLDivElement>(null);\n\n useHorizontalScroll(chatSelectionRef.current, undefined, true);\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\n className=\"chat-selection no-selection no-scrollbar\"\n dir={lang.isRtl ? 'rtl' : undefined}\n ref={chatSelectionRef}\n >\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 className=\"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 className=\"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((id: number, chatId: string) => {\n openMediaViewer({\n chatId,\n mediaId: id,\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 canDownload={!chatsById[message.chatId]?.isProtected && !message.isProtected}\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';\nimport useMultiClick from '../../../hooks/useMultiClick';\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 openDeleteChatFolderModal,\n } = getActions();\n\n const [isSignOutDialogOpen, setIsSignOutDialogOpen] = useState(false);\n\n const handleMultiClick = useMultiClick(5, () => {\n onScreenSelect(SettingsScreens.Experimental);\n });\n\n const openSignOutConfirmation = useCallback(() => {\n setIsSignOutDialogOpen(true);\n }, []);\n\n const closeSignOutConfirmation = useCallback(() => {\n setIsSignOutDialogOpen(false);\n }, []);\n\n const openDeleteFolderConfirmation = useCallback(() => {\n if (!editedFolderId) return;\n\n openDeleteChatFolderModal({ folderId: editedFolderId });\n }, [editedFolderId, openDeleteChatFolderModal]);\n\n const handleSignOutMessage = useCallback(() => {\n closeSignOutConfirmation();\n signOut();\n }, [closeSignOutConfirmation, signOut]);\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.CustomEmoji:\n return <h3>{lang('Emoji')}</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 case SettingsScreens.Stickers:\n return <h3>{lang('StickersName')}</h3>;\n case SettingsScreens.Experimental:\n return <h3>{lang('lng_settings_experimental')}</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.PrivacyVoiceMessages:\n return <h3>{lang('PrivacyVoiceMessages')}</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.PrivacyVoiceMessagesAllowedContacts:\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.PrivacyVoiceMessagesDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return <h3>{lang('NeverShareWith')}</h3>;\n\n case SettingsScreens.ActiveSessions:\n return <h3>{lang('SessionsTitle')}</h3>;\n case SettingsScreens.ActiveWebsites:\n return <h3>{lang('OtherWebSessions')}</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 {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <h3 onClick={handleMultiClick}>\n {lang('SETTINGS')}\n </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 </div>\n );\n};\n\nexport default memo(SettingsHeader);\n","import { useCallback, useRef } from '../lib/teact/teact';\n\nconst CLICK_TIMEOUT = 300;\n\nexport default function useMultiClick(amount: number, callback: NoneToVoidFunction) {\n const currentAmountRef = useRef(0);\n const timeoutRef = useRef<ReturnType<typeof setTimeout>>();\n const handleClick = useCallback(() => {\n currentAmountRef.current++;\n if (currentAmountRef.current === amount) {\n currentAmountRef.current = 0;\n callback();\n return;\n }\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = setTimeout(() => {\n currentAmountRef.current = 0;\n }, CLICK_TIMEOUT);\n }, [amount, callback]);\n\n return handleClick;\n}\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 { selectIsPremiumPurchaseBlocked, 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';\nimport PremiumIcon from '../../common/PremiumIcon';\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 canBuyPremium?: boolean;\n};\n\nconst SettingsMain: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n currentUser,\n sessionCount,\n lastSyncTime,\n canBuyPremium,\n}) => {\n const {\n loadProfilePhotos,\n loadAuthorizations,\n openPremiumModal,\n } = 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 <ListItem\n icon=\"stickers\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Stickers)}\n >\n {lang('StickersName')}\n </ListItem>\n {canBuyPremium && (\n <ListItem\n leftElement={<PremiumIcon withGradient big />}\n className=\"settings-main-menu-premium\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openPremiumModal()}\n >\n {lang('TelegramPremium')}\n </ListItem>\n )}\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 canBuyPremium: !selectIsPremiumPurchaseBlocked(global),\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 { TME_LINK_PREFIX } from '../../config';\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_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 ? TME_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 ? TME_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, FormEvent, RefObject } from 'react';\nimport useLang from '../../hooks/useLang';\nimport buildClassName from '../../util/buildClassName';\nimport type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../lib/teact/teact';\n\ntype OwnProps = {\n ref?: RefObject<HTMLTextAreaElement>;\n id?: string;\n className?: string;\n value?: string;\n label?: string;\n error?: string;\n success?: string;\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n autoComplete?: string;\n maxLength?: number;\n maxLengthIndicator?: string;\n tabIndex?: number;\n inputMode?: 'text' | 'none' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n onChange?: (e: ChangeEvent<HTMLTextAreaElement>) => void;\n onInput?: (e: FormEvent<HTMLTextAreaElement>) => void;\n onKeyPress?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n onBlur?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;\n onPaste?: (e: React.ClipboardEvent<HTMLTextAreaElement>) => void;\n};\n\nconst TextArea: FC<OwnProps> = ({\n ref,\n id,\n className,\n value,\n label,\n error,\n success,\n disabled,\n readOnly,\n placeholder,\n autoComplete,\n inputMode,\n maxLength,\n maxLengthIndicator,\n tabIndex,\n onChange,\n onInput,\n onKeyPress,\n onKeyDown,\n onBlur,\n onPaste,\n}) => {\n // eslint-disable-next-line no-null/no-null\n let textareaRef = useRef<HTMLTextAreaElement>(null);\n if (ref) {\n textareaRef = ref;\n }\n\n const lang = useLang();\n const labelText = error || success || label;\n const fullClassName = buildClassName(\n 'input-group',\n value && 'touched',\n error ? 'error' : success && 'success',\n disabled && 'disabled',\n readOnly && 'disabled',\n labelText && 'with-label',\n className,\n );\n\n useEffect(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n textarea.style.height = '0';\n textarea.style.height = `${textarea.scrollHeight}px`;\n }, []);\n\n const handleChange = useCallback((e: ChangeEvent<HTMLTextAreaElement>) => {\n e.currentTarget.value = e.currentTarget.value.replace(/\\n/, '');\n e.currentTarget.style.height = '0';\n e.currentTarget.style.height = `${e.currentTarget.scrollHeight}px`;\n onChange?.(e);\n }, [onChange]);\n\n return (\n <div className={fullClassName} dir={lang.isRtl ? 'rtl' : undefined}>\n <textarea\n ref={textareaRef}\n className=\"form-control\"\n id={id}\n dir=\"auto\"\n value={value || ''}\n tabIndex={tabIndex}\n placeholder={placeholder}\n maxLength={maxLength}\n autoComplete={autoComplete}\n inputMode={inputMode}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleChange}\n onInput={onInput}\n onKeyPress={onKeyPress}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n onPaste={onPaste}\n aria-label={labelText}\n />\n {labelText && (\n <label htmlFor={id}>{labelText}</label>\n )}\n {maxLengthIndicator && (\n <div className=\"max-length-indicator\">{maxLengthIndicator}</div>\n )}\n </div>\n );\n};\n\nexport default memo(TextArea);\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 { TME_LINK_PREFIX } from '../../../config';\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';\nimport { selectCurrentLimit } from '../../../global/selectors/limits';\nimport renderText from '../../common/helpers/renderText';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport InputText from '../../ui/InputText';\nimport UsernameInput from '../../common/UsernameInput';\nimport TextArea from '../../ui/TextArea';\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 maxBioLength: number;\n};\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst ERROR_FIRST_NAME_MISSING = 'Please provide your first name';\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 maxBioLength,\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<HTMLTextAreaElement>) => {\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 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 <TextArea\n value={bio}\n onChange={handleBioChange}\n label={lang('UserBio')}\n disabled={isLoading}\n maxLength={maxBioLength}\n maxLengthIndicator={maxBioLength ? (maxBioLength - bio.length).toString() : 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\">{TME_LINK_PREFIX}{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 const maxBioLength = selectCurrentLimit(global, 'aboutLength');\n\n if (!currentUser) {\n return {\n progress,\n isUsernameAvailable,\n maxBioLength,\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 maxBioLength,\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 React, {\n memo, useCallback, useEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport type { FC } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport styles from './Draggable.module.scss';\nimport useLang from '../../hooks/useLang';\nimport buildStyle from '../../util/buildStyle';\n\ntype TPoint = {\n x: number;\n y: number;\n};\n\ntype DraggableState = {\n isDragging: boolean;\n origin: TPoint;\n translation: TPoint;\n width?: number;\n height?: number;\n};\n\ntype OwnProps = {\n children: React.ReactNode;\n onDrag: (translation: TPoint, id: number) => void;\n onDragEnd: NoneToVoidFunction;\n id: number;\n style?: string;\n knobStyle?: string;\n isDisabled?: boolean;\n};\n\nconst ZERO_POINT: TPoint = { x: 0, y: 0 };\n\nconst Draggable: FC<OwnProps> = ({\n children,\n id,\n onDrag,\n onDragEnd,\n style: externalStyle,\n knobStyle,\n isDisabled,\n}) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const [state, setState] = useState<DraggableState>({\n isDragging: false,\n origin: ZERO_POINT,\n translation: ZERO_POINT,\n });\n\n const handleMouseDown = (e: React.MouseEvent | React.TouchEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const { x, y } = getClientCoordinate(e);\n\n setState({\n ...state,\n isDragging: true,\n origin: { x, y },\n width: ref.current?.offsetWidth,\n height: ref.current?.offsetHeight,\n });\n };\n\n const handleMouseMove = useCallback((e: MouseEvent | TouchEvent) => {\n const { x, y } = getClientCoordinate(e);\n\n const translation = {\n x: x - state.origin.x,\n y: y - state.origin.y,\n };\n\n setState((current) => ({\n ...current,\n translation,\n }));\n\n onDrag(translation, id);\n }, [id, onDrag, state.origin.x, state.origin.y]);\n\n const handleMouseUp = useCallback(() => {\n requestAnimationFrame(() => {\n setState((current) => ({\n ...current,\n isDragging: false,\n width: undefined,\n height: undefined,\n }));\n\n onDragEnd();\n });\n }, [onDragEnd]);\n\n useEffect(() => {\n if (state.isDragging && isDisabled) {\n setState((current) => ({\n ...current,\n isDragging: false,\n width: undefined,\n height: undefined,\n }));\n }\n }, [isDisabled, state.isDragging]);\n\n useEffect(() => {\n if (state.isDragging) {\n window.addEventListener('touchmove', handleMouseMove);\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('touchend', handleMouseUp);\n window.addEventListener('touchcancel', handleMouseUp);\n window.addEventListener('mouseup', handleMouseUp);\n } else {\n window.removeEventListener('touchmove', handleMouseMove);\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('touchend', handleMouseUp);\n window.removeEventListener('touchcancel', handleMouseUp);\n window.removeEventListener('mouseup', handleMouseUp);\n\n setState((current) => ({\n ...current,\n translation: ZERO_POINT,\n }));\n }\n\n return () => {\n if (state.isDragging) {\n window.removeEventListener('touchmove', handleMouseMove);\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('touchend', handleMouseUp);\n window.removeEventListener('touchcancel', handleMouseUp);\n window.removeEventListener('mouseup', handleMouseUp);\n }\n };\n }, [handleMouseMove, handleMouseUp, state.isDragging]);\n\n const fullClassName = buildClassName(styles.container, state.isDragging && styles.isDragging);\n\n const cssStyles = useMemo(() => {\n return buildStyle(\n `transform: translate(${state.translation.x}px, ${state.translation.y}px)`,\n state.width ? `width: ${state.width}px` : undefined,\n state.height ? `height: ${state.height}px` : undefined,\n externalStyle,\n );\n }, [externalStyle, state.height, state.translation.x, state.translation.y, state.width]);\n\n return (\n <div style={cssStyles} className={fullClassName} ref={ref}>\n {children}\n\n {!isDisabled && (\n <div\n aria-label={lang('i18n_dragToSort')}\n tabIndex={0}\n role=\"button\"\n className={buildClassName(styles.knob, 'draggable-knob')}\n onMouseDown={handleMouseDown}\n onTouchStart={handleMouseDown}\n style={knobStyle}\n >\n <i className=\"icon-sort\" aria-hidden />\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(Draggable);\n\nfunction getClientCoordinate(e: MouseEvent | TouchEvent | React.MouseEvent | React.TouchEvent) {\n let x;\n let y;\n\n if ('touches' in e) {\n x = e.touches[0].clientX;\n y = e.touches[0].clientY;\n } else {\n x = e.clientX;\n y = e.clientY;\n }\n\n return { x, y };\n}\n","// extracted by mini-css-extract-plugin\nexport default {\"container\":\"C9QYXaRLeCEFngOBl4S3\",\"isDragging\":\"vhGsRt79lQzzuXny9KG8\",\"knob\":\"oGgH1RraeCPayQnxA8C_\"};","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n memo, useMemo, useCallback, useEffect, useState,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport type { ApiChatFolder } from '../../../../api/types';\n\nimport { ALL_FOLDER_ID, STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport { MEMO_EMPTY_ARRAY } from '../../../../util/memo';\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';\nimport { selectCurrentLimit } from '../../../../global/selectors/limits';\nimport { selectIsCurrentUserPremium } from '../../../../global/selectors';\nimport renderText from '../../../common/helpers/renderText';\n\nimport ListItem from '../../../ui/ListItem';\nimport Button from '../../../ui/Button';\nimport Loading from '../../../ui/Loading';\nimport AnimatedIcon from '../../../common/AnimatedIcon';\nimport Draggable from '../../../ui/Draggable';\n\ntype OwnProps = {\n isActive?: boolean;\n onCreateFolder: () => void;\n onEditFolder: (folder: ApiChatFolder) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n folderIds?: number[];\n foldersById: Record<number, ApiChatFolder>;\n recommendedChatFolders?: ApiChatFolder[];\n maxFolders: number;\n isPremium?: boolean;\n};\n\ntype SortState = {\n orderedFolderIds?: number[];\n dragOrderIds?: number[];\n draggedIndex?: number;\n};\n\nconst FOLDER_HEIGHT_PX = 68;\nconst runThrottledForLoadRecommended = throttle((cb) => cb(), 60000, true);\n\nconst SettingsFoldersMain: FC<OwnProps & StateProps> = ({\n isActive,\n onCreateFolder,\n onEditFolder,\n onReset,\n folderIds,\n foldersById,\n isPremium,\n recommendedChatFolders,\n maxFolders,\n}) => {\n const {\n loadRecommendedChatFolders,\n addChatFolder,\n openLimitReachedModal,\n openDeleteChatFolderModal,\n sortChatFolders,\n } = getActions();\n\n const [state, setState] = useState<SortState>({\n orderedFolderIds: folderIds,\n dragOrderIds: folderIds,\n draggedIndex: undefined,\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 runThrottledForLoadRecommended(() => {\n loadRecommendedChatFolders();\n });\n }, [loadRecommendedChatFolders]);\n\n const handleCreateFolder = useCallback(() => {\n if (Object.keys(foldersById).length >= maxFolders - 1) {\n openLimitReachedModal({\n limit: 'dialogFilters',\n });\n\n return;\n }\n\n onCreateFolder();\n }, [foldersById, maxFolders, onCreateFolder, openLimitReachedModal]);\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 (!state.orderedFolderIds) {\n return undefined;\n }\n\n if (state.orderedFolderIds.length <= 1) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return state.orderedFolderIds.map((id) => {\n const folder = foldersById[id];\n\n if (id === ALL_FOLDER_ID) {\n return {\n id,\n title: lang('FilterAllChats'),\n };\n }\n\n return {\n id: folder.id,\n title: folder.title,\n subtitle: getFolderDescriptionText(lang, folder, chatsCountByFolderId[folder.id]),\n };\n });\n }, [state.orderedFolderIds, foldersById, lang, chatsCountByFolderId]);\n\n const handleCreateFolderFromRecommended = useCallback((folder: ApiChatFolder) => {\n if (Object.keys(foldersById).length >= maxFolders - 1) {\n openLimitReachedModal({\n limit: 'dialogFilters',\n });\n\n return;\n }\n\n addChatFolder({ folder });\n }, [foldersById, maxFolders, addChatFolder, openLimitReachedModal]);\n\n const handleDrag = useCallback((translation: { x: number; y: number }, id: number) => {\n const delta = Math.round(translation.y / FOLDER_HEIGHT_PX);\n const index = state.orderedFolderIds?.indexOf(id) || 0;\n const dragOrderIds = state.orderedFolderIds?.filter((folderId) => folderId !== id);\n\n if (!dragOrderIds || !inRange(index + delta, 0, folderIds?.length || 0)) {\n return;\n }\n\n dragOrderIds.splice(index + delta + (isPremium ? 0 : 1), 0, id);\n setState((current) => ({\n ...current,\n draggedIndex: index,\n dragOrderIds,\n }));\n }, [folderIds?.length, isPremium, state.orderedFolderIds]);\n\n const handleDragEnd = useCallback(() => {\n setState((current) => {\n sortChatFolders({ folderIds: current.dragOrderIds! });\n\n return {\n ...current,\n orderedFolderIds: current.dragOrderIds,\n draggedIndex: undefined,\n };\n });\n }, [sortChatFolders]);\n\n const canCreateNewFolder = useMemo(() => {\n return !isPremium || Object.keys(foldersById).length < maxFolders - 1;\n }, [foldersById, isPremium, maxFolders]);\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 {canCreateNewFolder && (\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 )}\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 <div className=\"settings-sortable-container\" style={`height: ${(folderIds?.length || 0) * FOLDER_HEIGHT_PX}px`}>\n {userFolders?.length ? userFolders.map((folder, i) => {\n const isBlocked = i > maxFolders - 1;\n const isDragged = state.draggedIndex === i;\n const draggedTop = (state.orderedFolderIds?.indexOf(folder.id) ?? 0) * FOLDER_HEIGHT_PX;\n const top = (state.dragOrderIds?.indexOf(folder.id) ?? 0) * FOLDER_HEIGHT_PX;\n\n if (folder.id === ALL_FOLDER_ID) {\n return (\n <Draggable\n key={folder.id}\n id={folder.id}\n onDrag={handleDrag}\n onDragEnd={handleDragEnd}\n style={`top: ${isDragged ? draggedTop : top}px;`}\n knobStyle={`${lang.isRtl ? 'left' : 'right'}: 0.375rem;`}\n isDisabled={!isPremium || !isActive}\n >\n <ListItem\n key={folder.id}\n className=\"mb-2 no-icon settings-sortable-item\"\n narrow\n inactive\n multiline\n isStatic\n >\n <span className=\"title\">\n {folder.title}\n </span>\n <span className=\"subtitle\">{lang('FoldersAllChatsDesc')}</span>\n </ListItem>\n </Draggable>\n );\n }\n\n return (\n <Draggable\n key={folder.id}\n id={folder.id}\n onDrag={handleDrag}\n onDragEnd={handleDragEnd}\n style={`top: ${isDragged ? draggedTop : top}px;`}\n knobStyle={`${lang.isRtl ? 'left' : 'right'}: 3rem;`}\n isDisabled={isBlocked || !isActive}\n >\n <ListItem\n className=\"mb-2 no-icon settings-sortable-item\"\n narrow\n secondaryIcon=\"more\"\n multiline\n contextActions={[\n {\n handler: () => {\n openDeleteChatFolderModal({ folderId: folder.id });\n },\n destructive: true,\n title: lang('Delete'),\n icon: 'delete',\n },\n ]}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => {\n if (isBlocked) {\n openLimitReachedModal({\n limit: 'dialogFilters',\n });\n } else {\n onEditFolder(foldersById[folder.id]);\n }\n }}\n >\n <span className=\"title\">\n {renderText(folder.title, ['emoji'])}\n {isBlocked && <i className=\"icon-lock-badge settings-folders-blocked-icon\" />}\n </span>\n <span className=\"subtitle\">{folder.subtitle}</span>\n </ListItem>\n </Draggable>\n );\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 </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\">{renderText(folder.title, ['emoji'])}</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: folderIds,\n byId: foldersById,\n recommended: recommendedChatFolders,\n } = global.chatFolders;\n\n return {\n folderIds,\n foldersById,\n isPremium: selectIsCurrentUserPremium(global),\n recommendedChatFolders,\n maxFolders: selectCurrentLimit(global, 'dialogFilters'),\n };\n },\n)(SettingsFoldersMain));\n\nfunction inRange(x: number, min: number, max: number) {\n return x >= min && x <= max;\n}\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 isRemoved?: boolean;\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 isRemoved,\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 useEffect(() => {\n if (isRemoved) {\n onReset();\n }\n }, [isRemoved, onReset]);\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, { state }): StateProps => {\n const { listIds } = global.chats;\n const { byId } = global.chatFolders;\n\n return {\n loadedActiveChatIds: listIds.active,\n loadedArchivedChatIds: listIds.archived,\n isRemoved: state.folderId !== undefined && !byId[state.folderId],\n };\n },\n)(SettingsFoldersEdit));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n useCallback, useRef, useEffect, memo,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\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';\nimport { selectCurrentLimit } from '../../../../global/selectors/limits';\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_FULL_ITEMS = 10;\nconst ALWAYS_FULL_ITEMS_COUNT = 5;\n\ntype StateProps = {\n maxChats: number;\n};\n\nconst SettingsFoldersChatsPicker: FC<OwnProps & StateProps> = ({\n mode,\n chatIds,\n selectedIds,\n selectedChatTypes,\n filterValue,\n onSelectedIdsChange,\n onSelectedChatTypesChange,\n onFilterChange,\n maxChats,\n}) => {\n const { openLimitReachedModal } = getActions();\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\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 if (selectedIds.length >= maxChats && mode === 'included') {\n openLimitReachedModal({\n limit: 'dialogFiltersChats',\n });\n return;\n }\n newSelectedIds.push(id);\n }\n onSelectedIdsChange(newSelectedIds);\n }, [selectedIds, onSelectedIdsChange, maxChats, mode, openLimitReachedModal]);\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 >\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 <InputText\n ref={inputRef}\n value={filterValue}\n onChange={handleFilterChange}\n placeholder={lang('Search')}\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(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n maxChats: selectCurrentLimit(global, 'dialogFiltersChats'),\n };\n },\n)(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, {\n useCallback, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ISettings, TimeFormat } from '../../../types';\nimport { SettingsScreens } from '../../../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 useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport RangeSlider from '../../ui/RangeSlider';\nimport type { IRadioOption } from '../../ui/RadioGroup';\nimport RadioGroup from '../../ui/RadioGroup';\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 'timeFormat'\n )> & {\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 messageTextSize,\n animationLevel,\n messageSendKeyCombo,\n timeFormat,\n theme,\n shouldUseSystemTheme,\n}) => {\n const {\n setSettingOption,\n } = getActions();\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 handleMessageSendComboChange = useCallback((newCombo: string) => {\n setSettingOption({ messageSendKeyCombo: newCombo });\n }, [setSettingOption]);\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 </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 'isSensitiveEnabled',\n 'canChangeSensitive',\n 'timeFormat',\n ]),\n theme,\n shouldUseSystemTheme,\n };\n },\n)(SettingsGeneral));\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, useCallback, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiPrivacySettings } from '../../../types';\nimport { SettingsScreens } from '../../../types';\n\nimport { selectIsCurrentUserPremium } from '../../../global/selectors';\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 isCurrentUserPremium?: boolean;\n hasPassword?: boolean;\n hasPasscode?: boolean;\n blockedCount: number;\n webAuthCount: number;\n isSensitiveEnabled?: boolean;\n canChangeSensitive?: boolean;\n shouldArchiveAndMuteNewNonContact?: boolean;\n privacyPhoneNumber?: ApiPrivacySettings;\n privacyLastSeen?: ApiPrivacySettings;\n privacyProfilePhoto?: ApiPrivacySettings;\n privacyForwarding?: ApiPrivacySettings;\n privacyVoiceMessages?: ApiPrivacySettings;\n privacyGroupChats?: ApiPrivacySettings;\n privacyPhoneCall?: ApiPrivacySettings;\n privacyPhoneP2P?: ApiPrivacySettings;\n};\n\nconst SettingsPrivacy: FC<OwnProps & StateProps> = ({\n isActive,\n isCurrentUserPremium,\n hasPassword,\n hasPasscode,\n blockedCount,\n webAuthCount,\n isSensitiveEnabled,\n canChangeSensitive,\n shouldArchiveAndMuteNewNonContact,\n privacyPhoneNumber,\n privacyLastSeen,\n privacyProfilePhoto,\n privacyForwarding,\n privacyVoiceMessages,\n privacyGroupChats,\n privacyPhoneCall,\n privacyPhoneP2P,\n onScreenSelect,\n onReset,\n}) => {\n const {\n loadPrivacySettings,\n loadBlockedContacts,\n loadAuthorizations,\n loadContentSettings,\n updateContentSettings,\n loadGlobalPrivacySettings,\n updateGlobalPrivacySettings,\n loadWebAuthorizations,\n showNotification,\n } = getActions();\n\n useEffect(() => {\n loadBlockedContacts();\n loadAuthorizations();\n loadPrivacySettings();\n loadContentSettings();\n loadWebAuthorizations();\n }, [loadBlockedContacts, loadAuthorizations, loadPrivacySettings, loadContentSettings, loadWebAuthorizations]);\n\n useEffect(() => {\n if (isActive) {\n loadGlobalPrivacySettings();\n }\n }, [isActive, loadGlobalPrivacySettings]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const handleArchiveAndMuteChange = useCallback((isEnabled: boolean) => {\n updateGlobalPrivacySettings({\n shouldArchiveAndMuteNewNonContact: isEnabled,\n });\n }, [updateGlobalPrivacySettings]);\n\n const handleVoiceMessagesClick = useCallback(() => {\n if (isCurrentUserPremium) {\n onScreenSelect(SettingsScreens.PrivacyVoiceMessages);\n } else {\n showNotification({\n message: lang('PrivacyVoiceMessagesPremiumOnly'),\n });\n }\n }, [isCurrentUserPremium, lang, onScreenSelect, showNotification]);\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 {webAuthCount > 0 && (\n <ListItem\n icon=\"web\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.ActiveWebsites)}\n >\n {lang('PrivacySettings.WebSessions')}\n <span className=\"settings-item__current-value\">{webAuthCount}</span>\n </ListItem>\n )}\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 disabled={!isCurrentUserPremium}\n allowDisabledClick\n rightElement={!isCurrentUserPremium && <i className=\"icon-lock-badge settings-icon-locked\" />}\n className=\"no-icon\"\n onClick={handleVoiceMessagesClick}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyVoiceMessages')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyVoiceMessages)}\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 <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('NewChatsFromNonContacts')}\n </h4>\n <Checkbox\n label={lang('ArchiveAndMute')}\n subLabel={lang('ArchiveAndMuteInfo')}\n checked={Boolean(shouldArchiveAndMuteNewNonContact)}\n onCheck={handleArchiveAndMuteChange}\n />\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, shouldArchiveAndMuteNewNonContact,\n },\n privacy,\n },\n blocked,\n passcode: {\n hasPasscode,\n },\n } = global;\n\n return {\n isCurrentUserPremium: selectIsCurrentUserPremium(global),\n hasPassword,\n hasPasscode: Boolean(hasPasscode),\n blockedCount: blocked.totalCount,\n webAuthCount: global.activeWebSessions.orderedHashes.length,\n isSensitiveEnabled,\n shouldArchiveAndMuteNewNonContact,\n canChangeSensitive,\n privacyPhoneNumber: privacy.phoneNumber,\n privacyLastSeen: privacy.lastSeen,\n privacyProfilePhoto: privacy.profilePhoto,\n privacyForwarding: privacy.forwards,\n privacyVoiceMessages: privacy.voiceMessages,\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.PrivacyVoiceMessages:\n case SettingsScreens.PrivacyVoiceMessagesAllowedContacts:\n case SettingsScreens.PrivacyVoiceMessagesDeniedContacts:\n return 'voiceMessages';\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.PrivacyVoiceMessages:\n return lang('PrivacyVoiceMessagesTitle');\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 case SettingsScreens.PrivacyVoiceMessages:\n return SettingsScreens.PrivacyVoiceMessagesAllowedContacts;\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 case SettingsScreens.PrivacyVoiceMessages:\n return SettingsScreens.PrivacyVoiceMessagesDeniedContacts;\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\">&minus;{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.PrivacyVoiceMessages:\n privacySettings = privacy.voiceMessages;\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\":\"P9I8aybVU7NyFiMWiyU2\",\"settingsActiveSession\":\"P9I8aybVU7NyFiMWiyU2\",\"iconDevice\":\"a633Zas_0v2MAAY277vj\",\"iconDevice__android\":\"GUI0ogXbRdxQ2RGy8fGv\",\"iconDeviceAndroid\":\"GUI0ogXbRdxQ2RGy8fGv\",\"iconDevice__apple\":\"emCcCPeQ7_9DHBonyO02\",\"iconDeviceApple\":\"emCcCPeQ7_9DHBonyO02\",\"iconDevice__brave\":\"OMEQQMEIcjln7GIyfO3Q\",\"iconDeviceBrave\":\"OMEQQMEIcjln7GIyfO3Q\",\"iconDevice__chrome\":\"XEQtza6nFt8ptPkvbi2w\",\"iconDeviceChrome\":\"XEQtza6nFt8ptPkvbi2w\",\"iconDevice__edge\":\"iHueuVDDSF_BaK2Wa06i\",\"iconDeviceEdge\":\"iHueuVDDSF_BaK2Wa06i\",\"iconDevice__firefox\":\"KM9rrbhNSrNOW8roXGo_\",\"iconDeviceFirefox\":\"KM9rrbhNSrNOW8roXGo_\",\"iconDevice__linux\":\"JzdHedSfMsVcaa8u4X6O\",\"iconDeviceLinux\":\"JzdHedSfMsVcaa8u4X6O\",\"iconDevice__opera\":\"McukeiFuIkeZbxMNzQKK\",\"iconDeviceOpera\":\"McukeiFuIkeZbxMNzQKK\",\"iconDevice__safari\":\"XGWuju_22haQw0Qraor7\",\"iconDeviceSafari\":\"XGWuju_22haQw0Qraor7\",\"iconDevice__samsung\":\"ZZGcTr3P3RJrOwOwFX6r\",\"iconDeviceSamsung\":\"ZZGcTr3P3RJrOwOwFX6r\",\"iconDevice__ubuntu\":\"OPtbMfpfiWN3dxilMOPX\",\"iconDeviceUbuntu\":\"OPtbMfpfiWN3dxilMOPX\",\"iconDevice__unknown\":\"xoc1kuf1XAKh_dhO758U\",\"iconDeviceUnknown\":\"xoc1kuf1XAKh_dhO758U\",\"iconDevice__vivaldi\":\"Y25gBvz9xzZicoJgQf8Y\",\"iconDeviceVivaldi\":\"Y25gBvz9xzZicoJgQf8Y\",\"iconDevice__windows\":\"dKbtoO2xjdhL8W2mqyxr\",\"iconDeviceWindows\":\"dKbtoO2xjdhL8W2mqyxr\",\"iconDevice__xbox\":\"FhLv8AIUHzsoTX8b0zdA\",\"iconDeviceXbox\":\"FhLv8AIUHzsoTX8b0zdA\",\"title\":\"b9iUjEhCpOrQ4dPhn2KU\",\"note\":\"hTTCWbngkwJoEwtGFD9o\",\"date\":\"pUv5oVVNDZ5lBRzNzx3X\",\"box\":\"e32uLjclYAYuxxW1CAex\",\"actionHeader\":\"xwSMwr4aHsrRVIVInLEo\",\"actionName\":\"tSrCe7E_Iom1nGuh2Gs3\",\"headerButton\":\"N0buK669iHOZ1hN_H7Ik\"};","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 RadioGroup from '../../ui/RadioGroup';\nimport SettingsActiveSession from './SettingsActiveSession';\n\nimport './SettingsActiveSessions.scss';\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 // eslint-disable-next-line max-len\n // https://github.com/DrKLO/Telegram/blob/96dce2c9aabc33b87db61d830aa087b6b03fe397/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java#L195\n if (ttlDays === undefined) {\n return undefined;\n }\n\n if (ttlDays <= 7) {\n return '7';\n }\n\n if (ttlDays <= 30) {\n return '30';\n }\n\n if (ttlDays <= 93) {\n return '90';\n }\n\n if (ttlDays <= 183) {\n return '183';\n }\n\n if (ttlDays > 183) {\n return '365';\n }\n\n return undefined;\n }, [ttlDays]);\n\n const AUTO_TERMINATE_OPTIONS = useMemo(() => {\n const options = [{\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: '183',\n }];\n if (ttlDays && ttlDays >= 365) {\n options.push({\n label: lang('Years', 1, 'i'),\n value: '365',\n });\n }\n return options;\n }, [lang, ttlDays]);\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 destructive: true,\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 React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiUser, ApiWebSession } from '../../../api/types';\n\nimport { getUserFullName } from '../../../global/helpers';\nimport buildClassName from '../../../util/buildClassName';\n\nimport useLang from '../../../hooks/useLang';\nimport useCurrentOrPrev from '../../../hooks/useCurrentOrPrev';\n\nimport Modal from '../../ui/Modal';\nimport Button from '../../ui/Button';\nimport Avatar from '../../common/Avatar';\n\nimport styles from './SettingsActiveWebsite.module.scss';\n\ntype OwnProps = {\n isOpen: boolean;\n hash?: string;\n onClose: () => void;\n};\n\ntype StateProps = {\n session?: ApiWebSession;\n bot?: ApiUser;\n};\n\nconst SettingsActiveWebsite: FC<OwnProps & StateProps> = ({\n isOpen, session, bot, onClose,\n}) => {\n const { terminateWebAuthorization } = getActions();\n const lang = useLang();\n\n const renderingSession = useCurrentOrPrev(session, true);\n const renderingBot = useCurrentOrPrev(bot, true);\n\n const handleTerminateSessionClick = useCallback(() => {\n terminateWebAuthorization({ hash: session!.hash });\n onClose();\n }, [onClose, session, terminateWebAuthorization]);\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('WebSessionsTitle')}</div>\n <Button\n color=\"danger\"\n onClick={handleTerminateSessionClick}\n className={buildClassName('modal-action-button', styles.headerButton)}\n >\n {lang('AuthSessions.LogOut')}\n </Button>\n </div>\n );\n }\n return (\n <Modal\n header={renderHeader()}\n isOpen={isOpen}\n hasCloseButton\n onClose={onClose}\n className={styles.root}\n >\n <Avatar className={styles.avatar} user={renderingBot} size=\"large\" />\n <h3 className={styles.title} dir=\"auto\">{getUserFullName(renderingBot)}</h3>\n <div className={styles.date} aria-label={lang('PrivacySettings.LastSeen')}>\n {renderingSession?.domain}\n </div>\n\n <dl className={styles.box}>\n <dt>{lang('AuthSessions.View.Browser')}</dt>\n <dd>\n {renderingSession?.browser}\n </dd>\n\n <dt>{lang('SessionPreview.Ip')}</dt>\n <dd>{renderingSession?.ip}</dd>\n\n <dt>{lang('SessionPreview.Location')}</dt>\n <dd>{renderingSession?.region}</dd>\n </dl>\n <p className={styles.note}>{lang('AuthSessions.View.LocationInfo')}</p>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global, { hash }) => {\n const session = hash ? global.activeWebSessions.byHash[hash] : undefined;\n const bot = session ? global.users.byId[session.botId] : undefined;\n return {\n session,\n bot,\n };\n})(SettingsActiveWebsite));\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"OeRWKjYQC6t7Uxv8I3j0\",\"avatar\":\"oy_023CG29VsnL9L5ulf\",\"title\":\"bg8UD_Pu2JWogmjuvVXg\",\"note\":\"TgiK64wG1hkOWSiXybQf\",\"date\":\"n6IYAeXnJBCHqpqItrnY\",\"box\":\"HSyJbRkyhkeT0s2QA4Ku\",\"action-header\":\"AQX7GM28GeWO4b1bXTNK\",\"actionHeader\":\"AQX7GM28GeWO4b1bXTNK\",\"action-name\":\"_VJHBZTk5qdYimQAoCWe\",\"actionName\":\"_VJHBZTk5qdYimQAoCWe\",\"header-button\":\"hlKLEbMQAsx572pUREy0\",\"headerButton\":\"hlKLEbMQAsx572pUREy0\"};","// extracted by mini-css-extract-plugin\nexport default {\"avatar\":\"n3bBygyO4j5MQyJ70Twt\",\"clear-help\":\"vUICy6ZQCYFSrvvxXe7f\",\"clearHelp\":\"vUICy6ZQCYFSrvvxXe7f\"};","import React, {\n memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiWebSession } from '../../../api/types';\n\nimport { formatPastTimeShort } from '../../../util/dateFormat';\nimport { getUserFullName } from '../../../global/helpers';\nimport buildClassName from '../../../util/buildClassName';\n\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport SettingsActiveWebsite from './SettingsActiveWebsite';\nimport Avatar from '../../common/Avatar';\n\nimport styles from './SettingsActiveWebsites.module.scss';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n byHash: Record<string, ApiWebSession>;\n orderedHashes: string[];\n};\n\nconst SettingsActiveWebsites: FC<OwnProps & StateProps> = ({\n isActive,\n byHash,\n orderedHashes,\n onReset,\n}) => {\n const {\n terminateWebAuthorization,\n terminateAllWebAuthorizations,\n } = getActions();\n\n const lang = useLang();\n const [isConfirmTerminateAllDialogOpen, openConfirmTerminateAllDialog, closeConfirmTerminateAllDialog] = useFlag();\n const [openedWebsiteHash, setOpenedWebsiteHash] = useState<string | undefined>();\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n const handleTerminateAuthClick = useCallback((hash: string) => {\n terminateWebAuthorization({ hash });\n }, [terminateWebAuthorization]);\n\n const handleTerminateAllAuth = useCallback(() => {\n closeConfirmTerminateAllDialog();\n terminateAllWebAuthorizations();\n }, [closeConfirmTerminateAllDialog, terminateAllWebAuthorizations]);\n\n const handleOpenSessionModal = useCallback((hash: string) => {\n setOpenedWebsiteHash(hash);\n openModal();\n }, [openModal]);\n\n const handleCloseWebsiteModal = useCallback(() => {\n setOpenedWebsiteHash(undefined);\n closeModal();\n }, [closeModal]);\n\n // Close when empty\n useEffect(() => {\n if (!orderedHashes.length) {\n onReset();\n }\n }, [onReset, orderedHashes]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function renderSessions(sessionHashes: string[]) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('WebSessionsTitle')}\n </h4>\n\n {sessionHashes.map(renderSession)}\n </div>\n );\n }\n\n function renderSession(sessionHash: string) {\n const session = byHash[sessionHash];\n const bot = getGlobal().users.byId[session.botId];\n\n return (\n <ListItem\n key={session.hash}\n ripple\n narrow\n contextActions={[{\n title: 'Terminate',\n icon: 'stop',\n destructive: true,\n handler: () => {\n handleTerminateAuthClick(session.hash);\n },\n }]}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleOpenSessionModal(session.hash)}\n >\n <Avatar className={styles.avatar} user={bot} size=\"tiny\" />\n <div className=\"multiline-menu-item full-size\" dir=\"auto\">\n <span className=\"date\">{formatPastTimeShort(lang, session.dateActive * 1000)}</span>\n <span className=\"title\">{getUserFullName(bot)}</span>\n <span className={buildClassName('subtitle', 'black', 'tight', styles.platform)}>\n {session.domain}, {session.browser}, {session.platform}\n </span>\n <span className=\"subtitle\">{session.ip} {session.region}</span>\n </div>\n </ListItem>\n );\n }\n\n if (!orderedHashes.length) return undefined;\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item\">\n <ListItem\n className=\"destructive mb-0 no-icon\"\n icon=\"stop\"\n ripple\n narrow\n onClick={openConfirmTerminateAllDialog}\n >\n {lang('AuthSessions.LogOutApplications')}\n </ListItem>\n <p className={buildClassName('settings-item-description', styles.clearHelp)}>\n {lang('ClearOtherWebSessionsHelp')}\n </p>\n </div>\n {renderSessions(orderedHashes)}\n <ConfirmDialog\n isOpen={isConfirmTerminateAllDialogOpen}\n onClose={closeConfirmTerminateAllDialog}\n title={lang('AuthSessions.LogOutApplications')}\n text={lang('AreYouSureWebSessions')}\n confirmHandler={handleTerminateAllAuth}\n confirmIsDestructive\n />\n <SettingsActiveWebsite isOpen={isModalOpen} hash={openedWebsiteHash} onClose={handleCloseWebsiteModal} />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { byHash, orderedHashes } = global.activeWebSessions;\n return {\n byHash,\n orderedHashes,\n };\n },\n)(SettingsActiveWebsites));\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} noVideo />\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.PrivacyVoiceMessagesAllowedContacts:\n case SettingsScreens.PrivacyVoiceMessagesDeniedContacts:\n return privacy.voiceMessages;\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 { selectIsCurrentUserPremium } from '../../../global/selectors';\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 isPremium?: boolean;\n selectedReaction?: string;\n};\n\nconst SettingsQuickReaction: FC<OwnProps & StateProps> = ({\n isActive,\n availableReactions,\n isPremium,\n selectedReaction,\n onReset,\n}) => {\n const { setDefaultReaction } = getActions();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const options = availableReactions?.filter((l) => (\n !(l.isInactive || (!isPremium && l.isPremium))\n )).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 const isPremium = selectIsCurrentUserPremium(global);\n\n return {\n availableReactions,\n selectedReaction: appConfig?.defaultReaction,\n isPremium,\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&apos;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&apos;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, 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 disablePictureInPicture />\n ) : (\n <img src={mediaData} className={transitionClassNames} alt=\"\" />\n )}\n </div>\n );\n};\n\nexport default memo(StickerSetCover);\n","import React, { memo, useCallback, useMemo } from '../../lib/teact/teact';\n\nimport type { ApiSticker, ApiStickerSet } from '../../api/types';\nimport type { FC } from '../../lib/teact/teact';\n\nimport { STICKER_SIZE_GENERAL_SETTINGS } from '../../config';\nimport buildClassName from '../../util/buildClassName';\n\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 './StickerButton';\n\nimport './StickerSetCard.scss';\n\ntype OwnProps = {\n stickerSet?: ApiStickerSet;\n className?: string;\n observeIntersection: ObserveFn;\n onClick: (value: ApiSticker) => void;\n};\n\nconst StickerSetCard: FC<OwnProps> = ({\n stickerSet,\n className,\n observeIntersection,\n onClick,\n}) => {\n const lang = useLang();\n\n const firstSticker = stickerSet?.stickers?.[0];\n\n const handleCardClick = useCallback(() => {\n if (firstSticker) onClick(firstSticker);\n }, [firstSticker, onClick]);\n\n const preview = useMemo(() => {\n if (!stickerSet) return undefined;\n if (stickerSet.hasThumbnail || !firstSticker) {\n return (\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 );\n } else {\n return (\n <StickerButton\n sticker={firstSticker}\n size={STICKER_SIZE_GENERAL_SETTINGS}\n title={stickerSet.title}\n observeIntersection={observeIntersection}\n clickArg={undefined}\n noContextMenu\n isCurrentUserPremium\n />\n );\n }\n }, [firstSticker, lang.isRtl, observeIntersection, stickerSet]);\n\n if (!stickerSet || !stickerSet.stickers) {\n return undefined;\n }\n\n return (\n <ListItem\n narrow\n className={buildClassName('StickerSetCard', className)}\n inactive={!firstSticker}\n onClick={handleCardClick}\n >\n {preview}\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\nexport default memo(StickerSetCard);\n","import React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport { SettingsScreens } from '../../../types';\nimport type { ISettings } from '../../../types';\nimport type { ApiSticker, ApiStickerSet } from '../../../api/types';\n\nimport renderText from '../../common/helpers/renderText';\nimport { pick } from '../../../util/iteratees';\n\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useLang from '../../../hooks/useLang';\n\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport Checkbox from '../../ui/Checkbox';\nimport ListItem from '../../ui/ListItem';\nimport StickerSetCard from '../../common/StickerSetCard';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps =\n Pick<ISettings, (\n 'shouldSuggestStickers' |\n 'shouldLoopStickers'\n )> & {\n addedSetIds?: string[];\n customEmojiSetIds?: string[];\n stickerSetsById: Record<string, ApiStickerSet>;\n defaultReaction?: string;\n };\n\nconst SettingsStickers: FC<OwnProps & StateProps> = ({\n isActive,\n addedSetIds,\n customEmojiSetIds,\n stickerSetsById,\n defaultReaction,\n shouldSuggestStickers,\n shouldLoopStickers,\n onReset,\n onScreenSelect,\n}) => {\n const {\n setSettingOption,\n openStickerSet,\n } = getActions();\n const lang = useLang();\n\n // eslint-disable-next-line no-null/no-null\n const stickerSettingsRef = useRef<HTMLDivElement>(null);\n const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: stickerSettingsRef });\n\n const handleStickerSetClick = useCallback((sticker: ApiSticker) => {\n openStickerSet({\n stickerSetInfo: sticker.stickerSetInfo,\n });\n }, [openStickerSet]);\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 = useMemo(() => (\n addedSetIds && Object.values(pick(stickerSetsById, addedSetIds))\n ), [addedSetIds, stickerSetsById]);\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 <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 <ListItem\n className=\"mt-4\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.CustomEmoji)}\n icon=\"smile\"\n >\n {lang('StickersList.EmojiItem')}\n {customEmojiSetIds && <span className=\"settings-item__current-value\">{customEmojiSetIds.length}</span>}\n </ListItem>\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 </div>\n {stickerSets && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('ChooseStickerMyStickerSets')}\n </h4>\n <div ref={stickerSettingsRef}>\n {stickerSets.map((stickerSet: ApiStickerSet) => (\n <StickerSetCard\n key={stickerSet.id}\n stickerSet={stickerSet}\n observeIntersection={observeIntersectionForCovers}\n onClick={handleStickerSetClick}\n />\n ))}\n </div>\n <p className=\"settings-item-description mt-3\" dir=\"auto\">\n {renderText(lang('StickersBotInfo'), ['links'])}\n </p>\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n ...pick(global.settings.byKey, [\n 'shouldSuggestStickers',\n 'shouldLoopStickers',\n ]),\n addedSetIds: global.stickers.added.setIds,\n customEmojiSetIds: global.customEmojis.added.setIds,\n stickerSetsById: global.stickers.setsById,\n defaultReaction: global.appConfig?.defaultReaction,\n };\n },\n)(SettingsStickers));\n","import React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiSticker, ApiStickerSet } from '../../../api/types';\n\nimport renderText from '../../common/helpers/renderText';\nimport { pick } from '../../../util/iteratees';\n\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useLang from '../../../hooks/useLang';\n\nimport StickerSetCard from '../../common/StickerSetCard';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n customEmojiSetIds?: string[];\n stickerSetsById: Record<string, ApiStickerSet>;\n};\n\nconst SettingsCustomEmoji: FC<OwnProps & StateProps> = ({\n isActive,\n customEmojiSetIds,\n stickerSetsById,\n onReset,\n}) => {\n const { openStickerSet } = getActions();\n const lang = useLang();\n\n // eslint-disable-next-line no-null/no-null\n const stickerSettingsRef = useRef<HTMLDivElement>(null);\n const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: stickerSettingsRef });\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const handleStickerSetClick = useCallback((sticker: ApiSticker) => {\n openStickerSet({\n stickerSetInfo: sticker.stickerSetInfo,\n });\n }, [openStickerSet]);\n\n const customEmojiSets = useMemo(() => (\n customEmojiSetIds && Object.values(pick(stickerSetsById, customEmojiSetIds))\n ), [customEmojiSetIds, stickerSetsById]);\n\n return (\n <div className=\"settings-content custom-scroll\">\n {customEmojiSets && (\n <div className=\"settings-item\">\n <div ref={stickerSettingsRef}>\n {customEmojiSets.map((stickerSet: ApiStickerSet) => (\n <StickerSetCard\n key={stickerSet.id}\n stickerSet={stickerSet}\n observeIntersection={observeIntersectionForCovers}\n onClick={handleStickerSetClick}\n />\n ))}\n </div>\n <p className=\"settings-item-description mt-3\" dir=\"auto\">\n {renderText(lang('EmojiBotInfo'), ['links'])}\n </p>\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global) => {\n return {\n customEmojiSetIds: global.customEmojis.added.setIds,\n stickerSetsById: global.stickers.setsById,\n };\n },\n)(SettingsCustomEmoji));\n","import React, { memo } from '../../../lib/teact/teact';\n\nimport type { FC } from '../../../lib/teact/teact';\n\nimport { getActions } from '../../../global';\nimport { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets';\n\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useLang from '../../../hooks/useLang';\n\nimport AnimatedIcon from '../../common/AnimatedIcon';\nimport ListItem from '../../ui/ListItem';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst SettingsExperimental: FC<OwnProps> = ({\n isActive,\n onReset,\n}) => {\n const { requestConfetti } = getActions();\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-content-header no-border\">\n <AnimatedIcon\n tgsUrl={LOCAL_TGS_URLS.Experimental}\n size={200}\n className=\"experimental-duck\"\n nonInteractive\n noLoop={false}\n />\n <p className=\"settings-item-description\" dir=\"auto\">{lang('lng_settings_experimental_about')}</p>\n </div>\n <div className=\"settings-item\">\n <ListItem\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => requestConfetti()}\n icon=\"animations\"\n >\n <div className=\"title\">Launch some confetti!</div>\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsExperimental);\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 SettingsActiveWebsites from './SettingsActiveWebsites';\nimport SettingsPrivacyBlockedUsers from './SettingsPrivacyBlockedUsers';\nimport SettingsTwoFa from './twoFa/SettingsTwoFa';\nimport SettingsPrivacyVisibilityExceptionList from './SettingsPrivacyVisibilityExceptionList';\nimport SettingsQuickReaction from './SettingsQuickReaction';\nimport SettingsPasscode from './passcode/SettingsPasscode';\nimport SettingsStickers from './SettingsStickers';\nimport SettingsCustomEmoji from './SettingsCustomEmoji';\nimport SettingsExperimental from './SettingsExperimental';\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.ActiveWebsites,\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_VOICE_MESSAGES_SCREENS = [\n SettingsScreens.PrivacyVoiceMessagesAllowedContacts,\n SettingsScreens.PrivacyVoiceMessagesDeniedContacts,\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.PrivacyVoiceMessages]: PRIVACY_VOICE_MESSAGES_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 || screen === SettingsScreens.CustomEmoji\n || isPrivacyScreen || isFoldersScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.QuickReaction:\n return (\n <SettingsQuickReaction isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.CustomEmoji:\n return (\n <SettingsCustomEmoji 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.Stickers:\n return (\n <SettingsStickers isActive={isScreenActive} onReset={handleReset} onScreenSelect={onScreenSelect} />\n );\n case SettingsScreens.Experimental:\n return (\n <SettingsExperimental 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.ActiveWebsites:\n return (\n <SettingsActiveWebsites\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.PrivacyVoiceMessages:\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.PrivacyVoiceMessagesAllowedContacts:\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.PrivacyVoiceMessagesDeniedContacts:\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 key=\"create-new-contact\"\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 { ALL_FOLDER_ID } from '../../config';\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?.filter((folderId) => folderId !== ALL_FOLDER_ID).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 isCurrentUserPremium?: boolean;\n};\n\nconst cn = createClassNameBuilder('ReactionSelectorReaction');\n\nconst ReactionSelectorReaction: FC<OwnProps> = ({\n reaction, previewIndex, onSendReaction, isReady, isCurrentUserPremium,\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 isCurrentUserPremium && 'premium',\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';\nimport { getActions } from '../../../global';\n\nimport ReactionSelectorReaction from './ReactionSelectorReaction';\nimport Button from '../../ui/Button';\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 canBuyPremium?: boolean;\n isCurrentUserPremium?: boolean;\n};\n\nconst cn = createClassNameBuilder('ReactionSelector');\n\nconst ReactionSelector: FC<OwnProps> = ({\n availableReactions,\n enabledReactions,\n onSendReaction,\n isPrivate,\n isReady,\n canBuyPremium,\n isCurrentUserPremium,\n}) => {\n const { openPremiumModal } = getActions();\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 || (reaction.isPremium && !isCurrentUserPremium)\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 isCurrentUserPremium={isCurrentUserPremium}\n />\n );\n })}\n {canBuyPremium && Boolean(\n availableReactions\n .filter((r) => r.isPremium && (!enabledReactions || enabledReactions.includes(r.reaction)))\n .length,\n ) && (\n <Button\n round\n color=\"translucent\"\n className={cn('blocked-button')}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openPremiumModal({\n initialSection: 'unique_reactions',\n })}\n >\n <i className=\"icon-lock-badge\" />\n </Button>\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 {\n ApiAvailableReaction, ApiMessage, ApiSponsoredMessage, ApiStickerSet, ApiUser,\n} 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';\nimport renderText from '../../common/helpers/renderText';\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 MenuSeparator from '../../ui/MenuSeparator';\nimport Skeleton from '../../ui/Skeleton';\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 | ApiSponsoredMessage;\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 canBuyPremium?: 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 isCurrentUserPremium?: boolean;\n canDownload?: boolean;\n canSaveGif?: boolean;\n canRevote?: boolean;\n canClosePoll?: boolean;\n isDownloading?: boolean;\n canShowSeenBy?: boolean;\n seenByRecentUsers?: ApiUser[];\n hasCustomEmoji?: boolean;\n customEmojiSets?: ApiStickerSet[];\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 onCancelVote?: () => void;\n onClosePoll?: () => void;\n onShowSeenBy?: () => void;\n onShowReactors?: () => void;\n onAboutAds?: () => void;\n onSponsoredHide?: () => 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 isCurrentUserPremium,\n enabledReactions,\n anchor,\n canSendNow,\n canReschedule,\n canBuyPremium,\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 canRevote,\n canClosePoll,\n isDownloading,\n canShowSeenBy,\n canShowReactionsCount,\n canRemoveReaction,\n canShowReactionList,\n seenByRecentUsers,\n hasCustomEmoji,\n customEmojiSets,\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 onCancelVote,\n onClosePoll,\n onShowSeenBy,\n onShowReactors,\n onSendReaction,\n onCopyMessages,\n onAboutAds,\n onSponsoredHide,\n}) => {\n const { showNotification, openStickerSet, openCustomEmojiSets } = 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 const isSponsoredMessage = !('id' in message);\n const messageId = !isSponsoredMessage ? message.id : '';\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 handleOpenCustomEmojiSets = useCallback(() => {\n if (!customEmojiSets) return;\n if (customEmojiSets.length === 1) {\n openStickerSet({\n stickerSetInfo: {\n shortName: customEmojiSets[0].shortName,\n },\n });\n } else {\n openCustomEmojiSets({\n setIds: customEmojiSets.map((set) => set.id),\n });\n }\n onClose();\n }, [customEmojiSets, onClose, openCustomEmojiSets, openStickerSet]);\n\n const copyOptions = isSponsoredMessage\n ? []\n : getMessageCopyOptions(\n message, handleAfterCopy, canCopyLink ? onCopyLink : undefined, onCopyMessages, onCopyNumber,\n );\n\n const getTriggerElement = useCallback(() => {\n return isSponsoredMessage\n ? document.querySelector('.Transition__slide--active > .MessageList .SponsoredMessage')\n : document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id=\"${messageId}\"]`);\n }, [isSponsoredMessage, messageId]);\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 canBuyPremium={canBuyPremium}\n isCurrentUserPremium={isCurrentUserPremium}\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 {canRevote && <MenuItem icon=\"revote\" onClick={onCancelVote}>{lang('lng_polls_retract')}</MenuItem>}\n {canClosePoll && <MenuItem icon=\"stop\" onClick={onClosePoll}>{lang('lng_polls_stop')}</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) && !isSponsoredMessage && (\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 noVideo\n />\n ))}\n </div>\n </MenuItem>\n )}\n {canDelete && <MenuItem destructive icon=\"delete\" onClick={onDelete}>{lang('Delete')}</MenuItem>}\n {hasCustomEmoji && (\n <>\n <MenuSeparator />\n {!customEmojiSets && (\n <>\n <Skeleton inline className=\"menu-loading-row\" />\n <Skeleton inline className=\"menu-loading-row\" />\n </>\n )}\n {customEmojiSets && customEmojiSets.length === 1 && (\n <MenuItem withWrap onClick={handleOpenCustomEmojiSets} className=\"menu-custom-emoji-sets\">\n {renderText(lang('MessageContainsEmojiPack', customEmojiSets[0].title), ['simple_markdown', 'emoji'])}\n </MenuItem>\n )}\n {customEmojiSets && customEmojiSets.length > 1 && (\n <MenuItem withWrap onClick={handleOpenCustomEmojiSets} className=\"menu-custom-emoji-sets\">\n {renderText(lang('MessageContainsEmojiPacks', customEmojiSets.length), ['simple_markdown'])}\n </MenuItem>\n )}\n </>\n )}\n {isSponsoredMessage && <MenuItem icon=\"help\" onClick={onAboutAds}>{lang('SponsoredMessageInfo')}</MenuItem>}\n {isSponsoredMessage && onSponsoredHide && (\n <MenuItem icon=\"stop\" onClick={onSponsoredHide}>{lang('HideAd')}</MenuItem>\n )}\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 {\n ApiAvailableReaction, ApiStickerSetInfo, ApiMessage, ApiStickerSet,\n} from '../../../api/types';\nimport type { IAlbum, IAnchorPosition } from '../../../types';\n\nimport {\n selectActiveDownloadIds,\n selectAllowedMessageActions,\n selectChat,\n selectCurrentMessageList, selectIsCurrentUserPremium,\n selectIsMessageProtected,\n selectIsPremiumPurchaseBlocked,\n selectMessageCustomEmojiSets,\n selectStickerSet,\n} from '../../../global/selectors';\nimport {\n isActionMessage, isChatChannel,\n isChatGroup, isOwnMessage, areReactionsEmpty, isUserId, isMessageLocal, getMessageVideo,\n} from '../../../global/helpers';\nimport { SERVICE_NOTIFICATIONS_USER_ID, TME_LINK_PREFIX } from '../../../config';\nimport { getDayStartAt } from '../../../util/dateFormat';\nimport buildClassName from '../../../util/buildClassName';\nimport { REM } from '../../common/helpers/mediaDimensions';\nimport { copyTextToClipboard } from '../../../util/clipboard';\n\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\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';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\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 customEmojiSetsInfo?: ApiStickerSetInfo[];\n customEmojiSets?: ApiStickerSet[];\n noOptions?: boolean;\n canSendNow?: boolean;\n canReschedule?: boolean;\n canReply?: boolean;\n canPin?: boolean;\n canShowReactionsCount?: boolean;\n canBuyPremium?: 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 isCurrentUserPremium?: boolean;\n hasFullInfo?: boolean;\n canCopyLink?: boolean;\n canSelect?: boolean;\n canDownload?: boolean;\n canSaveGif?: boolean;\n canRevote?: boolean;\n canClosePoll?: 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 customEmojiSetsInfo,\n customEmojiSets,\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 isCurrentUserPremium,\n canForward,\n canBuyPremium,\n canFaveSticker,\n canUnfaveSticker,\n canCopy,\n canCopyLink,\n canSelect,\n canDownload,\n canSaveGif,\n canRevote,\n canClosePoll,\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 loadStickers,\n cancelPollVote,\n closePoll,\n } = getActions();\n\n const lang = useLang();\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 const [isClosePollDialogOpen, openClosePollDialog, closeClosePollDialog] = useFlag();\n\n // `undefined` indicates that emoji are present and loading\n const hasCustomEmoji = customEmojiSetsInfo === undefined || Boolean(customEmojiSetsInfo.length);\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 (customEmojiSetsInfo?.length && customEmojiSets?.length !== customEmojiSetsInfo.length) {\n customEmojiSetsInfo.forEach((set) => {\n loadStickers({ stickerSetInfo: set });\n });\n }\n }, [customEmojiSetsInfo, customEmojiSets, loadStickers]);\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 handleCancelVote = useCallback(() => {\n closeMenu();\n cancelPollVote({ chatId: message.chatId, messageId: message.id });\n }, [closeMenu, message, cancelPollVote]);\n\n const handlePollClose = useCallback(() => {\n closeMenu();\n closePoll({ chatId: message.chatId, messageId: message.id });\n }, [closeMenu, message, closePoll]);\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(`${TME_LINK_PREFIX}${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 isCurrentUserPremium={isCurrentUserPremium}\n canBuyPremium={canBuyPremium}\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 canRevote={canRevote}\n canClosePoll={canClosePoll}\n canShowSeenBy={canShowSeenBy}\n hasCustomEmoji={hasCustomEmoji}\n customEmojiSets={customEmojiSets}\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 onCancelVote={handleCancelVote}\n onClosePoll={openClosePollDialog}\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 <ConfirmDialog\n isOpen={isClosePollDialogOpen}\n onClose={closeClosePollDialog}\n text={lang('lng_polls_stop_warning')}\n confirmLabel={lang('lng_polls_stop_sure')}\n confirmHandler={handlePollClose}\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 canRevote,\n canClosePoll,\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 const isCurrentUserPremium = selectIsCurrentUserPremium(global);\n\n const customEmojiSetsInfo = selectMessageCustomEmojiSets(global, message);\n const customEmojiSetsNotFiltered = customEmojiSetsInfo?.map((set) => selectStickerSet(global, set));\n const customEmojiSets = customEmojiSetsNotFiltered?.every<ApiStickerSet>(Boolean)\n ? customEmojiSetsNotFiltered : undefined;\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 canRevote,\n canClosePoll: !isScheduled && canClosePoll,\n activeDownloads,\n canShowSeenBy,\n enabledReactions: chat?.isForbidden ? undefined : chat?.fullInfo?.enabledReactions,\n isPrivate,\n isCurrentUserPremium,\n hasFullInfo: Boolean(chat?.fullInfo),\n canShowReactionsCount,\n canShowReactionList: !isLocal && !isAction && !isScheduled && chat?.id !== SERVICE_NOTIFICATIONS_USER_ID,\n canRemoveReaction,\n canBuyPremium: !isCurrentUserPremium && !selectIsPremiumPurchaseBlocked(global),\n customEmojiSetsInfo,\n customEmojiSets,\n };\n },\n)(ContextMenuContainer));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiSponsoredMessage } from '../../../api/types';\nimport type { IAnchorPosition } from '../../../types';\n\nimport { selectIsCurrentUserPremium, selectIsPremiumPurchaseBlocked } from '../../../global/selectors';\nimport buildClassName from '../../../util/buildClassName';\n\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useFlag from '../../../hooks/useFlag';\n\nimport MessageContextMenu from './MessageContextMenu';\n\nexport type OwnProps = {\n isOpen: boolean;\n message: ApiSponsoredMessage;\n anchor: IAnchorPosition;\n onAboutAds: () => void;\n onClose: () => void;\n onCloseAnimationEnd: () => void;\n};\n\ntype StateProps = {\n canBuyPremium?: boolean;\n};\n\nconst SponsoredMessageContextMenuContainer: FC<OwnProps & StateProps> = ({\n message,\n anchor,\n onAboutAds,\n onClose,\n onCloseAnimationEnd,\n canBuyPremium,\n}) => {\n const { openPremiumModal } = getActions();\n\n const [isMenuOpen, , closeMenu] = useFlag(true);\n const { transitionClassNames } = useShowTransition(isMenuOpen, onCloseAnimationEnd, undefined, false);\n\n const handleAboutAdsOpen = useCallback(() => {\n onAboutAds();\n closeMenu();\n }, [closeMenu, onAboutAds]);\n\n const handleSponsoredHide = useCallback(() => {\n closeMenu();\n openPremiumModal();\n onClose();\n }, [closeMenu, onClose, openPremiumModal]);\n\n if (!anchor) {\n return undefined;\n }\n\n return (\n <div className={buildClassName('ContextMenuContainer', transitionClassNames)}>\n <MessageContextMenu\n isOpen={isMenuOpen}\n anchor={anchor}\n message={message}\n onClose={closeMenu}\n onCloseAnimationEnd={closeMenu}\n onAboutAds={handleAboutAdsOpen}\n onSponsoredHide={canBuyPremium ? handleSponsoredHide : undefined}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n canBuyPremium: !selectIsCurrentUserPremium(global) && !selectIsPremiumPurchaseBlocked(global),\n };\n },\n)(SponsoredMessageContextMenuContainer));\n","import React, {\n memo, useCallback, useEffect, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { ApiSticker, ApiStickerSet } from '../../api/types';\n\nimport { EMOJI_SIZE_MODAL, STICKER_SIZE_MODAL } from '../../config';\nimport {\n selectCanScheduleUntilOnline,\n selectChat,\n selectCurrentMessageList,\n selectIsChatWithSelf, selectIsCurrentUserPremium,\n selectIsSetPremium,\n selectShouldSchedule,\n selectStickerSet,\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';\nimport usePrevious from '../../hooks/usePrevious';\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 isSetPremium?: boolean;\n isCurrentUserPremium?: 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 isSetPremium,\n isCurrentUserPremium,\n onClose,\n}) => {\n const {\n loadStickers,\n toggleStickerSet,\n sendMessage,\n openPremiumModal,\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 prevStickerSet = usePrevious(stickerSet);\n const renderingStickerSet = stickerSet || prevStickerSet;\n\n const isEmoji = renderingStickerSet?.isEmoji;\n const isButtonLocked = !renderingStickerSet?.installedDate && isSetPremium && !isCurrentUserPremium;\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 && !renderingStickerSet?.stickers) {\n loadStickers({\n stickerSetInfo: fromSticker ? fromSticker.stickerSetInfo : { shortName: stickerSetShortName! },\n });\n }\n }, [isOpen, fromSticker, loadStickers, stickerSetShortName, renderingStickerSet]);\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 (renderingStickerSet) {\n if (isButtonLocked) {\n openPremiumModal({ initialSection: 'animated_emoji' });\n return;\n }\n toggleStickerSet({ stickerSetId: renderingStickerSet.id });\n onClose();\n }\n }, [isButtonLocked, onClose, openPremiumModal, renderingStickerSet, toggleStickerSet]);\n\n const renderButtonText = () => {\n if (!renderingStickerSet) return lang('Loading');\n if (isButtonLocked) {\n return lang('EmojiInput.UnlockPack', renderingStickerSet.title);\n }\n\n const suffix = isEmoji ? 'Emoji' : 'Sticker';\n\n return lang(\n renderingStickerSet.installedDate ? `StickerPack.Remove${suffix}Count` : `StickerPack.Add${suffix}Count`,\n renderingStickerSet.count,\n 'i',\n );\n };\n\n return (\n <Modal\n className=\"StickerSetModal\"\n isOpen={isOpen}\n onClose={onClose}\n hasCloseButton\n title={renderingStickerSet\n ? renderText(renderingStickerSet.title, ['emoji', 'links']) : lang('AccDescrStickerSet')}\n >\n {renderingStickerSet?.stickers ? (\n <>\n <div ref={containerRef} className=\"stickers custom-scroll\">\n {renderingStickerSet.stickers.map((sticker) => (\n <StickerButton\n sticker={sticker}\n size={isEmoji ? EMOJI_SIZE_MODAL : STICKER_SIZE_MODAL}\n observeIntersection={observeIntersection}\n onClick={canSendStickers && !isEmoji ? handleSelect : undefined}\n clickArg={sticker}\n isSavedMessages={isSavedMessages}\n isCurrentUserPremium={isCurrentUserPremium}\n />\n ))}\n </div>\n <div className=\"button-wrapper\">\n <Button\n size=\"smaller\"\n fluid\n color={renderingStickerSet.installedDate ? 'danger' : 'primary'}\n isShiny={isButtonLocked}\n withPremiumGradient={isButtonLocked}\n onClick={handleButtonClick}\n >\n {renderButtonText()}\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 const stickerSetInfo = fromSticker ? fromSticker.stickerSetInfo\n : stickerSetShortName ? { shortName: stickerSetShortName } : undefined;\n\n const stickerSet = stickerSetInfo ? selectStickerSet(global, stickerSetInfo) : undefined;\n const isSetPremium = stickerSet && selectIsSetPremium(stickerSet);\n\n return {\n canScheduleUntilOnline: Boolean(chatId) && selectCanScheduleUntilOnline(global, chatId),\n canSendStickers,\n isSavedMessages,\n shouldSchedule: selectShouldSchedule(global),\n stickerSet,\n isCurrentUserPremium: selectIsCurrentUserPremium(global),\n isSetPremium,\n };\n },\n)(StickerSetModal));\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"Qzt_zq5gWHne6P2rw7Wj\",\"sets\":\"Ay41sqhq2QmXdgDHnt2E\"};","import React, {\n memo, useCallback, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { ApiSticker, ApiStickerSet } from '../../api/types';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport Modal from '../ui/Modal';\nimport StickerSetCard from './StickerSetCard';\n\nimport styles from './CustomEmojiSetsModal.module.scss';\n\nexport type OwnProps = {\n customEmojiSetIds?: string[];\n onClose: () => void;\n};\n\ntype StateProps = {\n customEmojiSets?: ApiStickerSet[];\n};\n\nconst CustomEmojiSetsModal: FC<OwnProps & StateProps> = ({\n customEmojiSets,\n onClose,\n}) => {\n const { openStickerSet } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const customEmojiModalRef = useRef<HTMLDivElement>(null);\n const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: customEmojiModalRef });\n\n const prevCustomEmojiSets = usePrevious(customEmojiSets);\n const renderingCustomEmojiSets = customEmojiSets || prevCustomEmojiSets;\n\n const handleSetClick = useCallback((sticker: ApiSticker) => {\n openStickerSet({\n stickerSetInfo: sticker.stickerSetInfo,\n });\n }, [openStickerSet]);\n\n return (\n <Modal\n isOpen={Boolean(customEmojiSets)}\n className={styles.root}\n onClose={onClose}\n hasCloseButton\n title=\"Sets of used emoji\"\n >\n <div className={buildClassName(styles.sets, 'custom-scroll')} ref={customEmojiModalRef}>\n {renderingCustomEmojiSets?.map((customEmojiSet) => (\n <StickerSetCard\n key={customEmojiSet.id}\n className={styles.setCard}\n stickerSet={customEmojiSet}\n onClick={handleSetClick}\n observeIntersection={observeIntersectionForCovers}\n />\n ))}\n </div>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { customEmojiSetIds }): StateProps => {\n const customEmojiSets = customEmojiSetIds?.map((id) => global.stickers.setsById[id]);\n\n return {\n customEmojiSets,\n };\n },\n)(CustomEmojiSetsModal));\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, selectIsPremiumPurchaseBlocked,\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 canGiftPremium?: 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 canGiftPremium,\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 openGiftPremiumModal,\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 handleGiftPremiumClick = useCallback(() => {\n openGiftPremiumModal({ forUserId: chatId });\n closeMenu();\n }, [openGiftPremiumModal, chatId, closeMenu]);\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 {canGiftPremium && (\n <MenuItem\n icon=\"gift\"\n onClick={handleGiftPremiumClick}\n >\n {lang('GiftPremium')}\n </MenuItem>\n )}\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 const canGiftPremium = Boolean(\n global.lastSyncTime\n && user?.fullInfo?.premiumGifts?.length\n && !selectIsPremiumPurchaseBlocked(global),\n );\n\n return {\n chat,\n isMuted: selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)),\n isPrivate,\n canAddContact,\n canReportChat,\n canDeleteChat: getCanDeleteChat(chat),\n canGiftPremium,\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 React, {\n memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport type { FC } from '../../../lib/teact/teact';\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';\nimport getFilesFromDataTransferItems from './helpers/getFilesFromDataTransferItems';\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 captionLimit: number;\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 captionLimit,\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\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(async (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n unmarkHovered();\n\n const { dataTransfer } = e;\n\n const files = await getFilesFromDataTransferItems(dataTransfer.items);\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\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 const leftChars = (captionLimit - caption.length) <= 100 ? captionLimit - caption.length : undefined;\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 data-dropzone\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 disablePictureInPicture />\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 captionLimit={leftChars}\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 shouldBeAnonymous?: 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, shouldBeAnonymous, 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 {!shouldBeAnonymous && (\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 = 8;\nconst EMOJI_MARGIN = 10;\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 { pick } from '../../../util/iteratees';\nimport buildClassName from '../../../util/buildClassName';\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'>;\n\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,\n recentEmojis,\n onEmojiSelect,\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 React, {\n memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiSticker } from '../../../api/types';\nimport type { StickerSetOrRecent } from '../../../types';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useOnIntersect } from '../../../hooks/useIntersectionObserver';\n\nimport {\n EMOJI_SIZE_PICKER, FAVORITE_SYMBOL_SET_ID, RECENT_SYMBOL_SET_ID, STICKER_SIZE_PICKER,\n} 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';\nimport Button from '../../ui/Button';\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 isCurrentUserPremium?: boolean;\n};\n\nconst STICKERS_PER_ROW_ON_DESKTOP = 5;\nconst EMOJI_PER_ROW_ON_DESKTOP = 8;\nconst STICKER_MARGIN = IS_SINGLE_COLUMN_LAYOUT ? 8 : 16;\nconst EMOJI_MARGIN = IS_SINGLE_COLUMN_LAYOUT ? 8 : 10;\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 isCurrentUserPremium,\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 [isExpanded, expand] = useFlag(!stickerSet.isEmoji);\n const lang = useLang();\n\n useOnIntersect(ref, observeIntersection);\n\n const transitionClassNames = useMediaTransition(shouldRender);\n\n const isEmoji = stickerSet.isEmoji;\n\n const handleClearRecent = useCallback(() => {\n clearRecentStickers();\n closeConfirmModal();\n }, [clearRecentStickers, closeConfirmModal]);\n\n const isLocked = !isSavedMessages && isEmoji && !isCurrentUserPremium\n && stickerSet.stickers?.some((l) => !l.isFree);\n const itemSize = isEmoji ? EMOJI_SIZE_PICKER : STICKER_SIZE_PICKER;\n const itemsPerRow = isEmoji ? EMOJI_PER_ROW_ON_DESKTOP : STICKERS_PER_ROW_ON_DESKTOP;\n const margin = isEmoji ? EMOJI_MARGIN : STICKER_MARGIN;\n\n const stickersPerRow = IS_SINGLE_COLUMN_LAYOUT\n ? Math.floor((windowSize.get().width - MOBILE_CONTAINER_PADDING) / (itemSize + margin))\n : itemsPerRow;\n\n const shouldCutSet = isEmoji && !isExpanded && !stickerSet.installedDate && stickerSet.id !== RECENT_SYMBOL_SET_ID;\n const itemsBeforeCutout = shouldCutSet ? stickersPerRow * 3 : Infinity;\n const height = Math.ceil((\n !shouldCutSet ? stickerSet.count : Math.min(itemsBeforeCutout, stickerSet.count))\n / stickersPerRow) * (itemSize + 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={\n buildClassName('symbol-set', isLocked && 'symbol-set-locked')\n }\n >\n <div className=\"symbol-set-header\">\n <p className=\"symbol-set-name\">\n {isLocked && <i className=\"symbol-set-locked-icon icon-lock-badge\" />}\n {stickerSet.title}\n </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\n .slice(0, !isExpanded ? (itemsBeforeCutout - 1) : stickerSet.stickers.length)\n .map((sticker) => (\n <StickerButton\n key={sticker.id}\n sticker={sticker}\n size={itemSize}\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 isCurrentUserPremium={isCurrentUserPremium}\n />\n ))}\n {!isExpanded && stickerSet.count > itemsBeforeCutout - 1 && (\n <Button className=\"StickerButton custom-emoji set-expand\" round color=\"translucent\" onClick={expand}>\n +{stickerSet.count - itemsBeforeCutout + 1}\n </Button>\n )}\n </div>\n\n {isRecent && (\n <ConfirmDialog\n text={lang('ClearRecentStickersAlertMessage')}\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,\n PREMIUM_STICKER_SET_ID,\n RECENT_SYMBOL_SET_ID,\n SLIDE_TRANSITION_DURATION,\n 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, uniqueByField } from '../../../util/iteratees';\nimport { selectChat, selectIsChatWithSelf, selectIsCurrentUserPremium } 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';\nimport PremiumIcon from '../../common/PremiumIcon';\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 premiumStickers: ApiSticker[];\n stickerSetsById: Record<string, ApiStickerSet>;\n addedSetIds?: string[];\n shouldPlay?: boolean;\n isSavedMessages?: boolean;\n isCurrentUserPremium?: 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 premiumStickers,\n addedSetIds,\n stickerSetsById,\n shouldPlay,\n isSavedMessages,\n onStickerSelect,\n isCurrentUserPremium,\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 const existingAddedSetIds = Object.values(pickTruthy(stickerSetsById, addedSetIds));\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 (isCurrentUserPremium) {\n const addedPremiumStickers = existingAddedSetIds\n .map((l) => l.stickers?.filter((sticker) => sticker.hasEffect))\n .flat()\n .filter(Boolean);\n\n const totalPremiumStickers = uniqueByField([...addedPremiumStickers, ...premiumStickers], 'id');\n\n if (totalPremiumStickers.length) {\n defaultSets.push({\n id: PREMIUM_STICKER_SET_ID,\n title: lang('PremiumStickers'),\n stickers: totalPremiumStickers,\n count: totalPremiumStickers.length,\n });\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 ...existingAddedSetIds,\n ];\n }, [\n addedSetIds, stickerSetsById, favoriteStickers, recentStickers, isCurrentUserPremium, chat, lang, premiumStickers,\n ]);\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.id === PREMIUM_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 === PREMIUM_STICKER_SET_ID ? (\n <PremiumIcon withGradient big />\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\" noVideo />\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 isCurrentUserPremium\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 isCurrentUserPremium={isCurrentUserPremium}\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 premiumSet,\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 premiumStickers: premiumSet.stickers,\n stickerSetsById: setsById,\n addedSetIds: added.setIds,\n shouldPlay: global.settings.byKey.shouldLoopStickers,\n isSavedMessages,\n isCurrentUserPremium: selectIsCurrentUserPremium(global),\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 disablePictureInPicture\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\nexport const SYMBOL_MENU_TAB_TITLES: Record<SymbolMenuTabs, string> = {\n [SymbolMenuTabs.Emoji]: 'Emoji',\n [SymbolMenuTabs.Stickers]: 'AccDescrStickers',\n [SymbolMenuTabs.GIFs]: 'GifsTab',\n};\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={lang(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 React, {\n memo, useCallback, useEffect, useLayoutEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiSticker, ApiVideo } from '../../../api/types';\nimport type { GlobalActions } from '../../../global/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport { fastRaf } from '../../../util/schedulers';\nimport buildClassName from '../../../util/buildClassName';\nimport { selectIsCurrentUserPremium } from '../../../global/selectors';\n\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: GlobalActions['addRecentEmoji'];\n};\n\ntype StateProps = {\n isLeftColumnShown: boolean;\n isCurrentUserPremium?: 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 isCurrentUserPremium,\n onLoad,\n onClose,\n onEmojiSelect,\n onStickerSelect,\n onGifSelect,\n onRemoveSymbol,\n onSearchOpen,\n addRecentEmoji,\n}) => {\n const { loadPremiumSetStickers } = getActions();\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 useEffect(() => {\n if (isCurrentUserPremium) {\n loadPremiumSetStickers();\n }\n }, [isCurrentUserPremium, loadPremiumSetStickers]);\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 || isOpen) {\n return;\n }\n\n recentEmojisRef.current.forEach((name) => {\n addRecentEmoji({ emoji: name });\n });\n\n setRecentEmojis([]);\n }, [isOpen, addRecentEmoji]);\n\n const handleEmojiSelect = useCallback((emoji: string, name: string) => {\n setRecentEmojis((emojis) => [...emojis, name]);\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={Object.values(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 isCurrentUserPremium: selectIsCurrentUserPremium(global),\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} noVideo />\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, selectIsCurrentUserPremium } 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 isCurrentUserPremium?: 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 isCurrentUserPremium,\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={isOpen ? onStickerSelect : undefined}\n clickArg={sticker}\n isSavedMessages={isSavedMessages}\n canViewSet\n isCurrentUserPremium={isCurrentUserPremium}\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 const isCurrentUserPremium = selectIsCurrentUserPremium(global);\n return { stickers, isSavedMessages, isCurrentUserPremium };\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 isCurrentUserPremium?: boolean;\n};\n\nconst StickerResult: FC<OwnProps> = ({\n inlineResult,\n isSavedMessages,\n observeIntersection,\n onClick,\n isCurrentUserPremium,\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 isCurrentUserPremium={isCurrentUserPremium}\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 isCurrentUserPremium?: boolean;\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 isCurrentUserPremium,\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: 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 isCurrentUserPremium={isCurrentUserPremium}\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 { ApiSticker, ApiStickerSet } from '../../api/types';\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\n\nimport { STICKER_SIZE_SEARCH } from '../../config';\nimport { selectIsCurrentUserPremium, selectShouldLoopStickers, selectStickerSet } from '../../global/selectors';\nimport useLang from '../../hooks/useLang';\n\nimport Button from '../ui/Button';\nimport StickerButton from '../common/StickerButton';\nimport Spinner from '../ui/Spinner';\n\ntype OwnProps = {\n stickerSetId: string;\n observeIntersection: ObserveFn;\n isModalOpen?: boolean;\n};\n\ntype StateProps = {\n set?: ApiStickerSet;\n shouldPlay?: boolean;\n isCurrentUserPremium?: boolean;\n};\n\nconst PREMIUM_STICKERS_TO_DISPLAY = 3;\nconst STICKERS_TO_DISPLAY = 5;\n\nconst StickerSetResult: FC<OwnProps & StateProps> = ({\n stickerSetId, observeIntersection, set, shouldPlay,\n isModalOpen, isCurrentUserPremium,\n}) => {\n const { loadStickers, toggleStickerSet, openStickerSet } = getActions();\n\n const lang = useLang();\n const isAdded = set && Boolean(set.installedDate);\n const areStickersLoaded = Boolean(set?.stickers);\n\n const displayedStickers = useMemo(() => {\n if (!set) {\n return [];\n }\n\n const premiumStickerIds = (set.stickers?.filter(({ hasEffect }) => hasEffect) ?? [])\n .slice(0, PREMIUM_STICKERS_TO_DISPLAY);\n const coverStickerIds = (set.covers || []).map(({ id }) => id);\n const otherStickers = set.stickers ? set.stickers.filter(({ id }) => !coverStickerIds.includes(id)) : [];\n\n return [...premiumStickerIds, ...(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 && set) {\n loadStickers({\n stickerSetInfo: {\n shortName: set.shortName,\n },\n });\n }\n }, [areStickersLoaded, displayedStickers.length, loadStickers, set, stickerSetId]);\n\n const handleAddClick = useCallback(() => {\n toggleStickerSet({ stickerSetId });\n }, [toggleStickerSet, stickerSetId]);\n\n const handleStickerClick = useCallback((sticker: ApiSticker) => {\n openStickerSet({ stickerSetInfo: sticker.stickerSetInfo });\n }, [openStickerSet]);\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}\n clickArg={sticker}\n onClick={handleStickerClick}\n noContextMenu\n isCurrentUserPremium={isCurrentUserPremium}\n />\n ))}\n </div>\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 isCurrentUserPremium: selectIsCurrentUserPremium(global),\n };\n },\n)(StickerSetResult));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useEffect, useRef,\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 isModalOpen: boolean;\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst StickerSearch: FC<OwnProps & StateProps> = ({\n isActive,\n query,\n featuredIds,\n resultIds,\n isModalOpen,\n onClose,\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 {\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 isModalOpen={isModalOpen}\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 isModalOpen={isModalOpen}\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 isModalOpen: Boolean(global.openedStickerSetShortName),\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, useRef,\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';\nimport TextArea from '../../ui/TextArea';\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 isChannelsPremiumLimitReached: boolean;\n};\n\nconst GROUP_TITLE_EMPTY = 'Group title can\\'t be empty';\nconst GROUP_MAX_DESCRIPTION = 255;\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 isChannelsPremiumLimitReached,\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 // eslint-disable-next-line no-null/no-null\n const isPreHistoryHiddenCheckboxRef = useRef<HTMLDivElement>(null);\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<HTMLTextAreaElement>) => {\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 useEffect(() => {\n if (!isChannelsPremiumLimitReached) {\n return;\n }\n\n // Teact does not have full support of controlled form components, we need to \"disable\" input value change manually\n // TODO Teact support added, this can now be removed\n const checkbox = isPreHistoryHiddenCheckboxRef.current?.querySelector('input') as HTMLInputElement;\n checkbox.checked = !chat.fullInfo?.isPreHistoryHidden;\n }, [isChannelsPremiumLimitReached, chat.fullInfo?.isPreHistoryHidden]);\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 <TextArea\n id=\"group-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n maxLength={GROUP_MAX_DESCRIPTION}\n maxLengthIndicator={(GROUP_MAX_DESCRIPTION - about.length).toString()}\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\" ref={isPreHistoryHiddenCheckboxRef}>\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 isChannelsPremiumLimitReached: global.limitReachedModal?.limit === 'channels',\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';\nimport TextArea from '../../ui/TextArea';\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';\nconst CHANNEL_MAX_DESCRIPTION = 255;\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<HTMLTextAreaElement>) => {\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 <TextArea\n id=\"channel-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n maxLength={CHANNEL_MAX_DESCRIPTION}\n maxLengthIndicator={(CHANNEL_MAX_DESCRIPTION - about.length).toString()}\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 { ChangeEvent } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, 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';\nimport { selectCurrentLimit } from '../../../global/selectors/limits';\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 maxPublicLinks: number;\n};\n\nconst ManageChatPrivacyType: FC<OwnProps & StateProps> = ({\n chat,\n onClose,\n isActive,\n isChannel,\n progress,\n isUsernameAvailable,\n isProtected,\n maxPublicLinks,\n}) => {\n const {\n checkPublicLink,\n updatePublicLink,\n updatePrivateLink,\n toggleIsProtected,\n openLimitReachedModal,\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, e: ChangeEvent<HTMLInputElement>) => {\n const myChats = Object.values(getGlobal().chats.byId).filter((l) => l.isCreator && l.username);\n if (myChats.length >= maxPublicLinks && value === 'public') {\n openLimitReachedModal({ limit: 'channelsPublic' });\n const radioGroup = e.currentTarget.closest('.radio-group') as HTMLDivElement;\n // Patch for Teact bug with controlled inputs\n // TODO Teact support added, this can now be removed\n (radioGroup.querySelector('[value=public]') as HTMLInputElement).checked = false;\n (radioGroup.querySelector('[value=private]') as HTMLInputElement).checked = true;\n return;\n }\n setPrivacyType(value as PrivacyType);\n }, [maxPublicLinks, openLimitReachedModal]);\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 maxPublicLinks: selectCurrentLimit(global, 'channelsPublic'),\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';\nimport Checkbox from '../../ui/Checkbox';\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 toggleJoinRequest,\n toggleJoinToSend,\n } = getActions();\n\n const [linkedGroupId, setLinkedGroupId] = useState<string>();\n const [isConfirmUnlinkGroupDialogOpen, openConfirmUnlinkGroupDialog, closeConfirmUnlinkGroupDialog] = useFlag();\n const [isConfirmLinkGroupDialogOpen, openConfirmLinkGroupDialog, closeConfirmLinkGroupDialog] = useFlag();\n const [isJoinToSend, setIsJoinToSend] = useState(linkedChat?.isJoinToSend);\n const [isJoinRequest, setIsJoinRequest] = useState(linkedChat?.isJoinRequest);\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 useEffect(() => {\n if (isActive) {\n setIsJoinToSend(linkedChat?.isJoinToSend || false);\n setIsJoinRequest(linkedChat?.isJoinRequest || false);\n }\n }, [linkedChat, isActive]);\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 handleJoinToSendCheck = useCallback((checked: boolean) => {\n setIsJoinToSend(checked);\n toggleJoinToSend({ chatId: linkedChatId!, isEnabled: checked });\n if (!checked) {\n setIsJoinRequest(false);\n }\n }, [linkedChatId, toggleJoinToSend]);\n\n const handleJoinRequestCheck = useCallback((checked: boolean) => {\n setIsJoinRequest(checked);\n toggleJoinRequest({ chatId: linkedChatId!, isEnabled: checked });\n }, [linkedChatId, toggleJoinRequest]);\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 {linkedChat && (\n <div className=\"section\">\n <h3 className=\"section-heading\">{lang('ChannelSettingsJoinTitle')}</h3>\n <Checkbox\n checked={isJoinToSend}\n onCheck={handleJoinToSendCheck}\n label={lang('ChannelSettingsJoinToSend')}\n />\n {isJoinToSend && (\n <Checkbox\n checked={isJoinRequest}\n onCheck={handleJoinRequestCheck}\n label={lang('ChannelSettingsJoinRequest')}\n />\n )}\n <p className=\"text-muted\">\n {isJoinToSend ? lang('ChannelSettingsJoinRequestInfo') : lang('ChannelSettingsJoinToSendInfo')}\n </p>\n </div>\n )}\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, TME_LINK_PREFIX } 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 ? `${TME_LINK_PREFIX}${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 getInviteIconClass = (invite: ApiExportedInvite) => {\n const {\n usage = 0, usageLimit, isRevoked, expireDate,\n } = invite;\n if (isRevoked) {\n return 'link-status-icon-gray';\n }\n if (usageLimit && usage < usageLimit) {\n return 'link-status-icon-green';\n }\n if (expireDate) {\n const diff = (expireDate - getServerTime(serverTimeOffset)) * 1000;\n if (diff <= 0) {\n return 'link-status-icon-red';\n }\n }\n return 'link-status-icon-blue';\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 leftElement={<i className={`icon-link link-status-icon ${getInviteIconClass(invite)}`} />}\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 leftElement={<i className={`icon-link link-status-icon ${getInviteIconClass(invite)}`} />}\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, useMemo,\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 setIsLoading(false);\n setIsTouched(false);\n setLocalEnabledReactions(enabledReactions || []);\n }, [enabledReactions]);\n\n const availableActiveReactions = useMemo<ApiAvailableReaction[] | undefined>(\n () => availableReactions?.filter((l) => !l.isInactive),\n [availableReactions],\n );\n\n const handleReactionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (!chat || !availableActiveReactions) return;\n\n const { name, checked } = e.currentTarget;\n const newEnabledReactions = name === 'all' ? (checked ? availableActiveReactions.map((l) => l.reaction) : [])\n : (!checked\n ? localEnabledReactions.filter((l) => l !== name)\n : [...localEnabledReactions, name]);\n\n setLocalEnabledReactions(newEnabledReactions);\n setIsTouched(true);\n }, [availableActiveReactions, 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 {availableActiveReactions?.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}$/;\nconst MIR = /^220[0-4]/;\n\nexport enum CardType {\n Default,\n Visa,\n Mastercard,\n Mir,\n}\n\nconst cards: Record<number, string> = {\n [CardType.Default]: '',\n [CardType.Visa]: 'visa',\n [CardType.Mastercard]: 'mastercard',\n [CardType.Mir]: 'mir',\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 (MIR.test(cardNumber)) {\n return CardType.Mir;\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' | 'resetState'\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 case 'resetState':\n return {\n ...INITIAL_STATE,\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 tabIndex?: number;\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 tabIndex,\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 tabIndex={tabIndex}\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 tabIndex={0}\n error={formErrors.streetLine1}\n />\n <InputText\n label={lang('PaymentShippingAddress2Placeholder')}\n onChange={handleAddress2Change}\n value={state.streetLine2}\n inputMode=\"text\"\n tabIndex={0}\n error={formErrors.streetLine2}\n />\n <InputText\n label={lang('PaymentShippingCityPlaceholder')}\n onChange={handleCityChange}\n value={state.city}\n inputMode=\"text\"\n tabIndex={0}\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 tabIndex={0}\n >\n {countryList.map(({ defaultName, name, iso2 }) => (\n <option\n value={iso2}\n className=\"county-item\"\n selected={iso2 === state.countryIso2}\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 tabIndex={0}\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 tabIndex={0}\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 tabIndex={0}\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 tabIndex={0}\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 tabIndex={0}\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","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"SM3T4awhZJvKn_c8aRuY\",\"description\":\"RWoBZem6PCNMF5hu6Shs\",\"checkout-picture\":\"prUKJGh6W9LIyjSnRbZc\",\"checkoutPicture\":\"prUKJGh6W9LIyjSnRbZc\",\"text\":\"xUG3uFeTiPPFkWHQELCc\",\"checkout-title\":\"MO45Rkd2ksVxfzAONvQ6\",\"checkoutTitle\":\"MO45Rkd2ksVxfzAONvQ6\",\"checkout-description\":\"LqaZe1TRdNI17BEa1gcl\",\"checkoutDescription\":\"LqaZe1TRdNI17BEa1gcl\",\"price-info\":\"mz2vhtmYPNRaJbeUrXKA\",\"priceInfo\":\"mz2vhtmYPNRaJbeUrXKA\",\"price-info-item\":\"Ct9Ine31cu5h7FCjtRWa\",\"priceInfoItem\":\"Ct9Ine31cu5h7FCjtRWa\",\"price-info-item-main\":\"JduVB3d3NxN9TybmxIgS\",\"priceInfoItemMain\":\"JduVB3d3NxN9TybmxIgS\",\"price-info-item-title\":\"O7d8G4OQ_yTJSHiHbgBR\",\"priceInfoItemTitle\":\"O7d8G4OQ_yTJSHiHbgBR\",\"invoice-info\":\"MyMLGHhiEKOVIoG3aQTS\",\"invoiceInfo\":\"MyMLGHhiEKOVIoG3aQTS\",\"checkout-info-item\":\"gLWXe4qIIINtZ3q9CmIX\",\"checkoutInfoItem\":\"gLWXe4qIIINtZ3q9CmIX\",\"checkout-info-item-icon\":\"YqZr6__8x50n06_r2wD8\",\"checkoutInfoItemIcon\":\"YqZr6__8x50n06_r2wD8\",\"provider\":\"hLVHJSaVspSZdzxNlBJk\",\"stripe\":\"nrKVVKzRmr7s0TE15uG1\",\"smartglocal\":\"oONvjFUTa5AbWvrbzbWn\",\"checkout-info-item-info-title\":\"bkIqUpVUAY04wdT8fySX\",\"checkoutInfoItemInfoTitle\":\"bkIqUpVUAY04wdT8fySX\",\"checkout-info-item-info-data\":\"VAzhVfK6c1pUriepo4Ga\",\"checkoutInfoItemInfoData\":\"VAzhVfK6c1pUriepo4Ga\",\"tos-checkbox\":\"WjrdCzbl3hROmSBGGnjy\",\"tosCheckbox\":\"WjrdCzbl3hROmSBGGnjy\"};","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport type { LangCode, Price } from '../../types';\nimport type { ApiChat, ApiWebDocument } from '../../api/types';\n\nimport { getWebDocumentHash } from '../../global/helpers';\nimport { formatCurrency } from '../../util/formatCurrency';\nimport buildClassName from '../../util/buildClassName';\nimport renderText from '../common/helpers/renderText';\n\nimport useLang from '../../hooks/useLang';\nimport useMedia from '../../hooks/useMedia';\n\nimport Checkbox from '../ui/Checkbox';\nimport Skeleton from '../ui/Skeleton';\nimport SafeLink from '../common/SafeLink';\n\nimport styles from './Checkout.module.scss';\n\nexport type OwnProps = {\n chat?: ApiChat;\n invoiceContent?: {\n title?: string;\n text?: string;\n photo?: ApiWebDocument;\n isRecurring?: boolean;\n recurringTermsUrl?: 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 isTosAccepted?: boolean;\n onAcceptTos?: (isAccepted: boolean) => void;\n};\n\nconst Checkout: FC<OwnProps> = ({\n chat,\n invoiceContent,\n prices,\n shippingPrices,\n checkoutInfo,\n currency,\n totalPrice,\n isTosAccepted,\n onAcceptTos,\n}) => {\n const lang = useLang();\n\n const {\n photo, title, text, isRecurring, recurringTermsUrl,\n } = invoiceContent || {};\n const {\n paymentMethod,\n paymentProvider,\n shippingAddress,\n name,\n phone,\n shippingMethod,\n } = (checkoutInfo || {});\n\n const photoUrl = useMedia(getWebDocumentHash(photo));\n\n function renderTosLink(url: string, isRtl?: boolean) {\n const langString = lang('PaymentCheckoutAcceptRecurrent', chat?.title);\n const langStringSplit = langString.split('*');\n return (\n <>\n {langStringSplit[0]}\n <SafeLink\n url={url}\n text=\"\"\n isRtl={isRtl}\n >\n {langStringSplit[1]}\n </SafeLink>\n {langStringSplit.slice(2)}\n </>\n );\n }\n\n function renderTos(url: string) {\n return (\n <Checkbox\n label={renderTosLink(url, lang.isRtl)}\n name=\"checkout_tos\"\n checked={Boolean(isTosAccepted)}\n className={styles.tosCheckbox}\n tabIndex={0}\n onCheck={onAcceptTos}\n />\n );\n }\n\n return (\n <div className={styles.root}>\n <div className={styles.description}>\n {photoUrl && <img className={styles.checkoutPicture} src={photoUrl} alt=\"\" />}\n {!photoUrl && photo && (\n <Skeleton\n width={photo.dimensions?.width}\n height={photo.dimensions?.height}\n className={styles.checkoutPicture}\n forceAspectRatio\n />\n )}\n <div className={styles.text}>\n <h5 className={styles.checkoutTitle}>{title}</h5>\n {text && <div className={styles.checkoutDescription}>{renderText(text, ['br', 'links', 'emoji'])}</div>}\n </div>\n </div>\n <div className={styles.priceInfo}>\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={styles.invoiceInfo}>\n {paymentMethod && renderCheckoutItem('icon-card', paymentMethod, lang('PaymentCheckoutMethod'))}\n {paymentProvider && renderCheckoutItem(\n buildClassName(styles.provider, styles[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 {isRecurring && renderTos(recurringTermsUrl!)}\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={buildClassName(styles.priceInfoItem, main && styles.priceInfoItemMain)}>\n <div className={styles.priceInfoItemTitle}>\n {title}\n </div>\n <div>\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={styles.checkoutInfoItem}>\n <i className={buildClassName(icon, styles.checkoutInfoItemIcon)}> </i>\n <div className={styles.checkoutInfoItemInfo}>\n <div className={styles.checkoutInfoItemInfoTitle}>\n {title}\n </div>\n <p className={styles.checkoutInfoItemInfoData}>\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 } 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\n const handleChange = useCallback((e) => {\n const newValue = e.target.value;\n // Allow deleting separator\n if (value.endsWith('/') && value.length > newValue.length) {\n onChange(newValue);\n } else {\n onChange(formatCardExpiry(e.target.value));\n }\n }, [onChange, value]);\n\n return (\n <InputText\n label={lang('PaymentCardExpireDate')}\n onChange={handleChange}\n value={value}\n error={error}\n inputMode=\"numeric\"\n tabIndex={0}\n maxLength={MAX_FIELD_LENGTH}\n teactExperimentControlled\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';\nimport mirIconPath from '../../assets/mir.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 }, [onChange]);\n\n const cardIcon = getCardIcon(cardType);\n\n return (\n <div className=\"CardInput\">\n <InputText\n ref={cardNumberRef}\n label={lang('PaymentCardNumber')}\n onChange={handleChange}\n value={value}\n inputMode=\"numeric\"\n className={cardType ? 'has-right-addon' : ''}\n error={error}\n tabIndex={0}\n maxLength={CARD_NUMBER_MAX_LENGTH}\n teactExperimentControlled\n />\n <span className=\"right-addon\">{cardIcon}</span>\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 case CardType.Mir:\n return <img src={mirIconPath} 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 const newValue = e.target.value.replace(/[^0-9]/g, '');\n dispatch({ type: 'changeCvvCode', payload: newValue });\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('Checkout.NewCard.CardholderNamePlaceholder')}\n onChange={handleCardholderChange}\n value={state.cardholder}\n inputMode=\"text\"\n tabIndex={0}\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 tabIndex={0}\n error={formErrors.cvv}\n teactExperimentControlled\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 tabIndex={0}\n ref={selectCountryRef}\n >\n {\n countryList.map(({ defaultName, name }) => (\n <option\n value={defaultName}\n className=\"county-item\"\n selected={defaultName === state.billingCountry}\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 tabIndex={0}\n maxLength={12}\n error={formErrors.billingZip}\n />\n )}\n { canSaveCredentials && (\n <Checkbox\n label={lang('PaymentCardSavePaymentInformation')}\n checked={state.saveCredentials}\n tabIndex={0}\n onChange={handleChangeSaveCredentials}\n />\n ) }\n </form>\n </div>\n );\n};\n\nexport default memo(PaymentInfo);\n","import React, { memo, useCallback, useEffect } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\n\nimport { TME_LINK_PREFIX } from '../../config';\nimport useLang from '../../hooks/useLang';\n\nimport './ConfirmPayment.scss';\n\nexport type OwnProps = {\n url: string;\n};\n\ninterface IframeCallbackEvent {\n eventType: string;\n eventData: {\n path_full: string;\n };\n}\n\nconst ConfirmPayment: FC<OwnProps> = ({ url }) => {\n const { closePaymentModal, openTelegramLink } = getActions();\n\n const lang = useLang();\n\n const handleMessage = useCallback((event: MessageEvent<string>) => {\n try {\n const data = JSON.parse(event.data) as IframeCallbackEvent;\n const { eventType, eventData } = data;\n\n if (eventType !== 'web_app_open_tg_link') {\n return;\n }\n\n const linkUrl = TME_LINK_PREFIX + eventData.path_full;\n openTelegramLink({ url: linkUrl });\n closePaymentModal();\n } catch (err) {\n // Ignore other messages\n }\n }, [closePaymentModal, openTelegramLink]);\n\n useEffect(() => {\n window.addEventListener('message', handleMessage);\n return () => window.removeEventListener('message', handleMessage);\n }, [handleMessage]);\n\n return (\n <div className=\"ConfirmPayment\">\n <iframe\n src={url}\n title={lang('Checkout.WebConfirmation.Title')}\n allow=\"payment\"\n sandbox=\"allow-modals 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 { ApiChat, ApiCountry } from '../../api/types';\nimport type { ShippingOption, Price } from '../../types';\nimport { PaymentStep } from '../../types';\n\nimport { selectChat } from '../../global/selectors';\nimport { formatCurrency } from '../../util/formatCurrency';\nimport buildClassName from '../../util/buildClassName';\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 chat?: ApiChat;\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 PaymentModal: FC<OwnProps & StateProps & GlobalStateProps> = ({\n isOpen,\n onClose,\n step,\n chat,\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 [isTosAccepted, setIsTosAccepted] = 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 countryIso2,\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 chat={chat}\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 isTosAccepted={isTosAccepted}\n onAcceptTos={setIsTosAccepted}\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 validateRequest();\n break;\n case PaymentStep.Shipping:\n setStep(PaymentStep.PaymentInfo);\n break;\n case PaymentStep.PaymentInfo:\n sendCredentials();\n break;\n case PaymentStep.Checkout:\n sendForm();\n break;\n }\n }, [step, validateRequest, setStep, sendCredentials, sendForm]);\n\n const handleModalClose = useCallback(() => {\n paymentDispatch({\n type: 'resetState',\n });\n setIsTosAccepted(false);\n }, [paymentDispatch]);\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 = step === PaymentStep.Checkout\n ? lang('Checkout.PayPrice', formatCurrency(totalPrice, currency!, lang.code))\n : lang('Next');\n\n const isSubmitDisabled = isLoading\n || Boolean(step === PaymentStep.Checkout && invoiceContent?.isRecurring && !isTosAccepted);\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&apos;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={buildClassName('PaymentModal', invoiceContent?.isRecurring && 'recurring')}\n isOpen={isOpen}\n onClose={onClose}\n onCloseAnimationEnd={handleModalClose}\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={isSubmitDisabled}\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 inputInvoice,\n } = global.payment;\n\n const chat = inputInvoice && 'chatId' in inputInvoice ? selectChat(global, inputInvoice.chatId) : undefined;\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 chat,\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)(PaymentModal));\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, ApiWebDocument } 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 photo?: ApiWebDocument;\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 photo,\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 photo,\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 photo,\n text,\n title,\n } = (receipt || {});\n\n return {\n currency,\n prices,\n info,\n totalAmount,\n credentialsTitle,\n shippingPrices,\n shippingMethod,\n photo,\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 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","useMediaProps","mediaId","avatarOwner","delay","photo","getMessagePhoto","undefined","video","getMessageVideo","webPagePhoto","getMessageWebPagePhoto","webPageVideo","getMessageWebPageVideo","isDocumentPhoto","isMessageDocumentPhoto","isDocumentVideo","isMessageDocumentVideo","videoSize","getMessageFileSize","avatarMedia","photos","isVideoAvatar","Boolean","isVideo","isPhoto","isGif","isFromSharedMedia","isFromSearch","getMediaHash","useMemo","isFull","getVideoAvatarMediaHash","getChatAvatarHash","getMessageMediaHash","pictogramBlobUrl","useMedia","ApiMediaFormat","previewMediaHash","previewBlobUrl","mediaData","fullMediaBlobUrl","loadProgress","useMediaWithLoadProgress","getMessageMediaFormat","localBlobUrl","blobUrl","bestImageData","thumbDataUri","dataUri","blurredRef","useRef","isChanged","useOnChange","current","width","canvas","imgToCanvas","fastBlur","getContext","height","toDataURL","blurredAsync","isDisabled","get","timeoutRef","forceUpdate","useForceUpdate","clearTimeout","useEffect","onload","blurredDataUri","size","clear","set","window","setTimeout","useBlur","useBlurSync","getMessageMediaThumbDataUri","fileName","getMessageFileName","hasVideoAvatar","dimensions","getMessageDocument","mediaSize","getPhotoFullDimensions","getVideoDimensions","VIDEO_AVATAR_FULL_DIMENSIONS","AVATAR_FULL_DIMENSIONS","avatarPhoto","memo","withGlobal","global","isDownloading","selectIsDownloading","isProtected","selectIsMessageProtected","isAvatar","canReport","onReport","onCloseMediaViewer","zoomLevelChange","setZoomLevelChange","onForward","downloadMessageMedia","cancelMessageMediaDownload","getActions","downloadProgress","handleDownloadClick","useCallback","handleZoomOut","handleZoomIn","lang","useLang","MenuButton","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","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","IS_TOUCH_ENV","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","formatFileSize","Menu","positionY","autoClose","onClose","rate","disabled","url","posterData","posterSize","isMediaViewerOpen","noPlay","toggleControls","areControlsVisible","setMediaViewerVolume","setMediaViewerMuted","setMediaViewerPlaybackRate","videoRef","setIsPlayed","setCurrentTime","setFullscreen","exitFullscreen","elRef","setIsFullscreen","useLayoutEffect","listener","listenerEnter","listenerExit","PLATFORM_ENV","requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","mozRequestFullScreen","mozCancelFullScreen","webkitCancelFullScreen","webkitExitFullscreen","useFullscreenStatus","handleVideoMove","handleVideoLeave","bounds","right","clientY","top","bottom","bufferingHandlers","useBuffering","shouldRender","shouldRenderSpinner","transitionClassNames","spinnerClassNames","useShowTransition","shouldRenderPlayButton","playButtonClassNames","pause","safePlay","togglePlayState","useVideoCleanup","handleTimeUpdate","currentTarget","handleEnded","handleFullscreenChange","position","handleVolumeChange","newVolume","handleVolumeMuted","handlePlaybackRateChange","newPlaybackRate","togglePayingStateBySpace","key","preventDefault","wrapperStyle","videoStyle","onMouseMove","onMouseOut","onContextMenu","onDoubleClick","autoPlay","controlsList","playsInline","loop","muted","onPlay","onEnded","onTimeUpdate","join","square","ownProps","chatId","threadId","avatarOwnerId","mediaViewer","selectChatMessage","senderId","selectUser","selectChat","selectScheduledMessage","props","isActive","animationLevel","onFooterClick","setControlsVisible","isGhostAnimation","calculateMediaViewerDimensions","renderPhoto","textParts","renderMessageText","hasFooter","imageSize","canDrag","Spinner","renderVideoPreview","alt","easeOutCubic","easeOutQuart","timingFunctions","SLIDES_GAP","ANIMATION_DURATION","cancelAnimation","cancelZoomAnimation","SwipeDirection","getMediaId","selectMedia","rest","containerRef","activeSlideRef","transformRef","x","y","scale","lastTransformRef","swipeDirectionRef","isActiveRef","isReleasedRef","activeMediaId","setActiveMediaId","prevZoomLevelChange","usePrevious","hasZoomChanged","isMouseDown","setIsMouseDown","windowHeight","windowWidth","isResizing","useWindowSize","setTransform","selectMediaDebounced","useDebouncedCallback","clearSwipeDirectionDebounced","setIsActiveDebounced","shouldCloseOnVideo","clickXThreshold","handleControlsVisibility","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","target","handleKeyDown","calculateOffsetBoundaries","inBoundsX","inBoundsY","centerX","centerY","minOffsetX","maxOffsetX","isBetween","clamp","minOffsetY","maxOffsetY","type","absX","abs","absY","s1","scaleFactor","x1","y1","k","Vx","Vy","dirX","cleanup","isNotPassive","withNativeDrag","excludedClosestSelector","minZoom","maxZoom","doubleTapZoom","checkIfControlTarget","event","captureEvent","cancelDrag","dragOffsetX","dragOffsetY","touches","IOS_SCREEN_EDGE_THRESHOLD","absOffsetX","absOffsetY","Vertical","Horizontal","limit","SWIPE_X_THRESHOLD","SWIPE_Y_THRESHOLD","transform","onZoom","zoom","zoomFactor","initialCenterX","initialCenterY","currentCenterX","currentCenterY","MIN_ZOOM","MAX_ZOOM","offsetX","offsetY","scaledCenterX","scaledCenterY","scaleOffsetX","scaleOffsetY","isInThreshold","hasNextSlide","checkIfInsideSelector","steps","prevValue","delta","wheelEvent","WheelEvent","deltaY","ctrlKey","dispatchEvent","nextMediaId","prevMediaId","hasPrev","hasNext","getAnimationStyle","isRtl","toFixed","selector","matches","messageId","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","animationKey","prevSenderId","headerAnimation","isReportModalOpen","openReportModal","closeReportModal","singleMediaId","mediaIds","p","i","getChatMediaMessageIds","selectedMediaIndex","indexOf","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","messageIds","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","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","action","actionText","Notification","onDismiss","toggleSafeLinkModal","handleOpen","open","ensureProtocol","handleDismiss","renderingUrl","ConfirmDialog","confirmLabel","confirmHandler","urlAuth","currentUser","closeUrlAuthModal","acceptBotUrlAuth","acceptLinkUrlAuth","isLoginChecked","setLoginChecked","isWriteAccessChecked","setWriteAccessChecked","currentAuth","domain","botId","shouldRequestWriteAccess","request","bot","button","isWriteAllowed","handleLoginChecked","Checkbox","checked","label","getUserFullName","onCheck","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","SANDBOX_ATTRIBUTES","DEFAULT_BUTTON_TEXT","ok","cancel","webApp","attachMenuBot","attachMenu","bots","selectCurrentChat","theme","selectTheme","isPaymentModalOpen","payment","paymentStatus","closeWebApp","sendWebViewData","prolongWebView","toggleBotInAttachMenu","openTelegramLink","openChat","openInvoice","setWebAppPaymentSlug","mainButton","setMainButton","isBackButtonVisible","setIsBackButtonVisible","backgroundColor","setBackgroundColor","extractCurrentThemeParams","bg_color","headerColor","setHeaderColor","confirmClose","setConfirmClose","isCloseModalOpen","openCloseModal","closeCloseModal","popupParams","setPopupParams","prevPopupParams","renderingPopupParams","buttonText","queryId","isSimple","handleEvent","eventType","eventData","slug","linkUrl","TME_LINK_PREFIX","path_full","is_visible","themeParams","validateHexColor","newColor","color_key","data","button_color","textColor","text_color","trim","is_active","isProgressVisible","is_progress_visible","need_confirmation","buttons","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","peerId","handleMainButtonClick","handleSettingsButtonClick","handleRefreshClick","handlePopupClose","buttonId","button_id","prevIsPaymentModalOpen","handleToggleClick","isEnabled","handleBackClick","openBotChat","MoreMenuButton","isMenuOpen","backButtonClassName","isAttachMenuBot","destructive","hasSettings","prevMainButtonColor","prevMainButtonTextColor","prevMainButtonIsActive","prevMainButtonText","mainButtonCurrentColor","mainButtonCurrentTextColor","mainButtonCurrentIsActive","mainButtonCurrentText","shouldDecreaseWebFrameSize","setShouldDecreaseWebFrameSize","shouldHideButton","setShouldHideButton","buttonChangeTimeout","hasCloseButton","sandbox","allow","allowFullScreen","confirmIsDestructive","fluid","cancelBotTrustRequest","markBotTrusted","previousBot","previousType","currentBot","currentType","handleBotTrustAccept","closeBotAttachRequestModal","confirmBotAttachRequest","deleteFolderDialogId","closeDeleteChatFolderModal","deleteChatFolder","handleDeleteFolderMessage","leftValue","rightValue","floatingBadgeIcon","rightStyle","dangerouslySetInnerHTML","__html","COLOR_START","COLOR_END","description","colorStepProgress","lerp","videoId","isReverseAnimation","isDown","videoThumbnail","thumbnailRef","useCanvasBlur","useMediaTransition","DeviceFrame","disablePictureInPicture","AnimatedCircleReaction","realIndex","isActivated","canPlay","reaction","maxLength","handleClick","activateAnimation","mediaDataAround","aroundAnimation","isAnimated","animate","inanimate","isEffectEnded","markEffectEnded","unmarkEffectEnded","circleSize","angle","PI","totalAngle","cos","scaleNotFull","sin","handleClickEmoji","AnimatedSticker","tgsUrl","play","isLowPriority","noLoop","availableReactions","isIntervalPaused","pauseInterval","unpauseInterval","lastUnpauseTimeout","setOffset","setSize","renderedReactions","l","isPremium","slice","cycleRestrict","clientWidth","onSelectSlide","startFrom","isPreLastBatch","isLastBatch","isFirstBatch","isPreFirstBatch","shownDotsCount","handleGoForward","handleGoBack","count","Array","fill","_","isLast","isPreLast","isFirst","isPreFirst","isInvisible","AnimatedCircleSticker","sticker","stickers","premium","renderedStickers","PREMIUM_FEATURE_TITLES","double_limits","unique_reactions","premium_stickers","animated_emoji","no_ads","voice_to_text","profile_badge","faster_download","more_upload","advanced_chat_management","animated_userpics","PREMIUM_FEATURE_DESCRIPTIONS","PREMIUM_FEATURE_SECTIONS","PREMIUM_BOTTOM_VIDEOS","LIMITS_ORDER","LIMITS_TITLES","channels","dialogFolderPinned","channelsPublic","savedGifs","stickersFaved","aboutLength","captionLength","dialogFilters","dialogFiltersChats","LIMITS_DESCRIPTIONS","promo","initialSection","onClickSubscribe","limits","scrollContainerRef","currentSlideIndex","setCurrentSlideIndex","reverseAnimationSlideIndex","setReverseAnimationSlideIndex","isScrolling","startScrolling","stopScrolling","isScrolledToTop","setIsScrolledToTop","isScrolledToBottom","setIsScrolledToBottom","prevInitialSection","handleLimitsScroll","scrollHeight","scrollContainer","fastSmoothScrollHorizontal","then","handleSelectSlide","async","onScroll","scrollLeft","scrollLeftOriginal","setProperty","toString","reverseIndex","ceil","prevElement","reverseElement","slide","section","defaultLimit","premiumLimit","videoSections","videos","thumbnail","isShiny","withPremiumGradient","formatCurrency","monthlyAmount","currency","COLORS","buttonClassName","PREMIUM_FEATURE_COLOR_ICONS","PremiumLimits","PremiumReactions","PremiumStickers","PremiumEmoji","PremiumAds","PremiumVoice","PremiumBadge","PremiumSpeed","PremiumFile","PremiumChats","PremiumVideo","premiumModal","isClosing","isSuccess","isGift","monthsAmount","fromUser","fromUserId","toUser","toUserId","selectIsCurrentUserPremium","limitChannels","selectPremiumLimit","limitFolders","limitPins","limitLinks","appConfig","premiumSlug","premiumInvoiceSlug","premiumBotUsername","premiumPromoOrder","dialogRef","closePremiumModal","requestConfetti","isHeaderHidden","setHeaderHidden","currentSection","setCurrentSection","handleClickWithStartParam","startParam","showConfetti","prevIsPremium","isClosed","PremiumLogo","renderTextWithEntities","statusText","statusEntities","renderFooterText","option","fullMonthlyAmount","months","amount","perMonth","floor","discount","handleChange","forUserId","monthlyCurrency","giftPremiumModal","gifts","fullInfo","premiumGifts","openPremiumModal","closeGiftPremiumModal","openUrl","renderedUser","renderedGifts","selectedOption","setSelectedOption","firstGift","cheaperGift","reduce","acc","gift","selectedGift","find","botUrl","handlePremiumClick","getUserFirstOrLastName","parts","match","Link","isPrimary","renderPremiumFeaturesLink","LIMIT_DESCRIPTION","uploadMaxFileparts","LIMIT_DESCRIPTION_BLOCKED","LIMIT_DESCRIPTION_PREMIUM","LIMIT_ICON","LIMIT_VALUE_FORMATTER","MAX_UPLOAD_FILEPART_SIZE","defaultValue","premiumValue","canBuyPremium","selectIsPremiumPurchaseBlocked","closeLimitReachedModal","startClosing","stopClosing","valueFormatter","limitType","defaultValueFormatted","premiumValueFormatted","getLimiterDescription","canUpgrade","SafeLink","isSchedule","selectCurrentMessageList","canDeleteForAll","selectAllowedMessageActions","contactName","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","isForwardModalOpen","forwardMessages","isModalShown","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","renderingMemberIds","noStatusOrTyping","reactorModal","reactions","reactors","loadReactors","closeReactorListModal","chosenTab","setChosenTab","canShowFilters","results","chatIdRef","handleCloseAnimationEnd","handleLoadMore","allReactions","concat","nextOffset","LoadMoreDirection","formatIntegerCompact","ReactionStaticEmoji","fullName","PremiumIcon","activeEmojiInteraction","animatedEffect","selectAnimatedEmojiEffect","effectAnimationId","localEffectAnimation","keys","LOCAL_TGS_URLS","stopActiveEmojiInteraction","isHiding","startHiding","isPlaying","startPlaying","stop","handleCancelAnimation","dispatchHeavyAnimationStop","effectTgsUrl","startSize","isReversed","quality","IS_ANDROID","onLoad","onSelect","buttonRef","activeElement","privateChatUserId","isPinned","selectIsChatPinned","selectIsChatMuted","selectNotifySettings","selectNotifyExceptions","canChangeFolder","chatFolders","orderedIds","withUsername","isChatFolderModalOpen","openChatFolderModal","closeChatFolderModal","contextActions","useChatContextActions","handleDelete","handleChatFolderChange","useSelectWithEnter","avatarSize","withVideoAvatar","DeleteChatModal","runThrottled","cb","topUserIds","topPeers","recentlyFoundChatIds","globalSearch","onReset","loadTopUsers","addRecentlyFoundChatId","clearRecentlyFoundChats","topUsersRef","useHorizontalScroll","shouldReplaceHistory","lastSyncTime","privateChatUser","searchQuery","mediaThumbnail","getMessageSticker","mediaBlobUrl","isRoundVideo","getMessageRoundVideo","isSavedMessages","isSelf","getChatTitle","isVerified","VerifiedIcon","fakeType","FakeIcon","formatPastTimeShort","renderMessageSummary","renderSummary","searchDate","suggestions","suggestion","currentDate","latestYear","getSuggestionsFromDate","localContactIds","fetchingStatus","globalResults","localResults","globalChatIds","globalUserIds","localChatIds","localUserIds","byChatId","globalMessagesByChatId","dateSearchQuery","onSearchDateSelect","searchMessagesGlobal","setGlobalSearchChatId","chatSelectionRef","shouldShowMoreLocal","setShouldShowMoreLocal","shouldShowMoreGlobal","setShouldShowMoreGlobal","handleChatClick","handlePickerItemClick","startsWith","MEMO_EMPTY_ARRAY","contactIdsWithMe","foundContactIds","foundMessages","split","sort","a","b","handleClickShowMoreLocal","handleClickShowMoreGlobal","nothingFound","noScrollRestoreOnTop","noFastList","NothingFound","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","TRANSITION_RENDER_COUNT","currentContent","setGlobalSearchContent","setGlobalSearchDate","activeTab","setActiveTab","parseDateString","handleSwitchTab","tab","handleSearchDateSelect","TabList","tabs","onSwitchTab","renderCount","INITIAL_STATE","currentPassword","password","hint","email","twoFaReducer","state","payload","currentScreen","editedFolderId","onSaveFilter","onScreenSelect","signOut","openDeleteChatFolderModal","isSignOutDialogOpen","setIsSignOutDialogOpen","handleMultiClick","callback","currentAmountRef","useMultiClick","SettingsScreens","openSignOutConfirmation","closeSignOutConfirmation","openDeleteFolderConfirmation","folderId","handleSignOutMessage","SettingsMenuButton","renderHeaderContent","sessionCount","activeSessions","orderedHashes","loadProfilePhotos","loadAuthorizations","profileId","ProfileInfo","forceShowSelf","ChatExtra","langName","leftElement","withGradient","big","LINK_PREFIX_REGEX","USERNAME_REGEX","runDebouncedForCheckUsername","currentUsername","asLink","isUsernameAvailable","checkUsername","username","setUsername","langPrefix","usernameSuccess","usernameError","test","handleUsernameChange","newUsername","isValid","isUsernameValid","success","readOnly","autoComplete","maxLengthIndicator","onInput","onKeyPress","onPaste","textareaRef","labelText","fullClassName","textarea","htmlFor","ERROR_FIRST_NAME_MISSING","profileEdit","maxBioLength","selectCurrentLimit","currentFirstName","currentLastName","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","ZERO_POINT","children","onDragEnd","externalStyle","knobStyle","setState","isDragging","translation","handleMouseDown","getClientCoordinate","offsetWidth","handleMouseMove","handleMouseUp","cssStyles","buildStyle","onMouseDown","onTouchStart","runThrottledForLoadRecommended","folderIds","foldersById","recommended","recommendedChatFolders","maxFolders","onCreateFolder","onEditFolder","loadRecommendedChatFolders","addChatFolder","openLimitReachedModal","sortChatFolders","orderedFolderIds","dragOrderIds","draggedIndex","handleCreateFolder","chatsCountByFolderId","useFolderManagerForChatsCount","userFolders","folder","ALL_FOLDER_ID","subtitle","getFolderDescriptionText","handleCreateFolderFromRecommended","handleDrag","splice","handleDragEnd","canCreateNewFolder","AnimatedIcon","STICKER_SIZE_FOLDER_SETTINGS","pill","isBlocked","isDragged","draggedTop","narrow","inactive","multiline","isStatic","secondaryIcon","handler","itemName","itemPluralName","ERROR_NO_TITLE","ERROR_NO_CHATS","loadedActiveChatIds","loadedArchivedChatIds","isRemoved","dispatch","onAddIncludedChats","onAddExcludedChats","editChatFolder","isIncludedChatsListExpanded","setIsIncludedChatsListExpanded","isExcludedChatsListExpanded","setIsExcludedChatsListExpanded","selectedChatIds","includedChatIds","selectedChatTypes","includedChatTypes","selectChatFilters","excludedChatIds","excludedChatTypes","visibleIncludedChatIds","visibleExcludedChatIds","allLoadedChatsSet","Set","loadedIncludedChatIds","findIntersectionWithSet","loadedExcludedChatIds","mode","folderUpdate","renderChats","visibleChatIds","isExpanded","leftChatsCount","clickHandler","chatType","INCLUDED_CHAT_TYPES","typeKey","EXCLUDED_CHAT_TYPES","renderChatType","isTouched","maxChats","selectedIds","filterValue","onSelectedIdsChange","onSelectedChatTypesChange","chatTypes","shouldMinimize","handleItemClick","newSelectedIds","handleChatTypeClick","newSelectedChatTypes","selectedType","isMinimized","canClose","isSelected","withChatType","chatFilter","folderAllOrderedIds","useFolderManagerForOrderedIds","folderArchivedOrderedIds","ARCHIVED_FOLDER_ID","displayedIds","newFilter","handleSelectedIdsChange","ids","includeFilters","excludeFilters","handleSelectedChatTypesChange","newFilters","forEach","shownScreen","handleReset","handleEditFolder","handleAddIncludedChats","handleAddExcludedChats","ANIMATION_LEVEL_OPTIONS","TIME_FORMAT_OPTIONS","shouldUseSystemTheme","messageTextSize","messageSendKeyCombo","timeFormat","APPEARANCE_THEME_OPTIONS","KEYBOARD_SEND_OPTIONS","subLabel","IS_MAC_OS","handleAnimationLevelChange","newLevel","handleMessageTextSizeChange","newSize","documentElement","setAttribute","handleAppearanceThemeChange","newTheme","getSystemTheme","switchTheme","ANIMATION_LEVEL_MAX","handleTimeFormatChange","newTimeFormat","wasTimeFormatSetManually","setTimeFormat","handleMessageSendComboChange","newCombo","RadioGroup","options","selected","wallpaper","localMediaHash","thumbRef","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","patternColor","DARK_THEME_PATTERN_COLOR","DEFAULT_PATTERN_COLOR","handleWallPaperSelect","currentWallpaper","getAverageColor","getPatternColor","rgbColor","rgb2hex","handleWallPaperBlurChange","isUploading","DEFAULT_HSB","rgb2hsb","hex2rgb","PREDEFINED_COLORS","hsb2positions","hsb","rects","colorPosition","colorRect","huePosition","hueRect","positions2hsb","colorPickerRef","huePickerRef","isFirstRunRef","setHsb","getInitialHsb","hsbRef","markIsDragging","unmarkIsDragging","rgbInput","setRgbInput","hexInput","setHexInput","rectsRef","colorCtxRef","offsetLeft","handleColorDrag","handleHueDrag","selectorToPreventScroll","withCursor","hex","hsb2rgb","hue","hueHex","rgb","w","h","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","shouldArchiveAndMuteNewNonContact","privacy","blocked","passcode","hasPasscode","isCurrentUserPremium","blockedCount","totalCount","webAuthCount","activeWebSessions","privacyPhoneNumber","privacyLastSeen","lastSeen","privacyProfilePhoto","profilePhoto","privacyForwarding","forwards","privacyVoiceMessages","voiceMessages","privacyGroupChats","chatInvite","privacyPhoneCall","phoneCall","privacyPhoneP2P","phoneP2P","loadPrivacySettings","loadBlockedContacts","loadContentSettings","updateContentSettings","loadGlobalPrivacySettings","updateGlobalPrivacySettings","loadWebAuthorizations","handleArchiveAndMuteChange","handleVoiceMessagesClick","getVisibilityValue","visibility","blockCount","blockChatIds","blockUserIds","allowCount","allowChatIds","allowUserIds","total","exceptionString","allowDisabledClick","rightElement","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","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","terminateWebAuthorization","renderingBot","browser","terminateAllWebAuthorizations","openedWebsiteHash","setOpenedWebsiteHash","handleTerminateAuthClick","handleTerminateAllAuth","handleCloseWebsiteModal","blockedIds","userSearch","setUserSearchQuery","blockContact","filteredContactIds","availableContactIds","contactId","firstId","secondId","secondName","localeCompare","handleRemoveUser","accessHash","chatsByIds","usersByIds","unblockContact","isBlockUserModalOpen","openBlockUserModal","closeBlockUserModal","handleUnblockClick","isPrivate","noVideo","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","newValue","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","selectedReaction","defaultReaction","setDefaultReaction","isInactive","STICKER_SIZE_PASSCODE","fullReset","onSetPasscode","setPasscode","clearPasscode","setPasscodeError","clearPasscodeError","currentPasscode","decryptSession","STICKER_SIZE_PICKER_HEADER","stickerSet","isIntersecting","useIsIntersecting","mediaHash","lottieData","firstLetters","getFirstLetters","hasThumbnail","isVideos","IS_WEBM_SUPPORTED","firstSticker","handleCardClick","preview","isLottie","STICKER_SIZE_GENERAL_SETTINGS","StickerButton","noContextMenu","addedSetIds","added","setIds","customEmojiSetIds","customEmojis","stickerSetsById","setsById","shouldSuggestStickers","shouldLoopStickers","openStickerSet","stickerSettingsRef","observeIntersectionForCovers","handleStickerSetClick","stickerSetInfo","handleSuggestStickersChange","handleShouldLoopStickersChange","stickerSets","values","customEmojiSets","nonInteractive","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_VOICE_MESSAGES_SCREENS","PRIVACY_GROUP_CHATS_SCREENS","foldersState","foldersDispatch","shouldSkipTransition","twoFaState","twoFaDispatch","useReducer","privacyPasscode","setPrivacyPasscode","forceReturnToChatList","handleSaveFilter","renderCurrentSection","isScreenActive","isFrom","currentKey","privacyAllowScreens","isTwoFaScreen","isPasscodeScreen","isFoldersScreen","isPrivacyScreen","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","preventDefaultForScrollKeys","HTMLElement","tagName","getAttribute","isTextBox","disableScrolling","el","_excludedClosestSelector","passive","onkeydown","enableScrolling","REACTION_SIZE","IS_COMPACT_MENU","cn","createClassNameBuilder","previewIndex","onSendReaction","isReady","selectAnimation","activate","deactivate","isAnimationLoaded","markAnimationLoaded","shouldRenderAnimated","animatedClassNames","shouldRenderStatic","staticClassNames","onMouseEnter","enabledReactions","itemsScrollRef","isHorizontalScrollEnabled","enableHorizontalScroll","handleWheel","onWheelCapture","onTouchMove","r","anchor","canSendNow","canReschedule","canReply","canEdit","canPin","canUnpin","canForward","canFaveSticker","canUnfaveSticker","canCopy","canCopyLink","canSelect","canSaveGif","canRevote","canClosePoll","canShowSeenBy","canShowReactionsCount","canRemoveReaction","canShowReactionList","seenByRecentUsers","hasCustomEmoji","onReply","onEdit","onPin","onFaveSticker","onUnfaveSticker","onSend","onReschedule","onCopyLink","onCopyNumber","onDownload","onSaveGif","onCancelVote","onClosePoll","onShowSeenBy","onShowReactors","onCopyMessages","onAboutAds","onSponsoredHide","openCustomEmojiSets","menuRef","scrollableRef","noReactions","withReactions","isSponsoredMessage","markIsReady","unmarkIsReady","handleAfterCopy","handleOpenCustomEmojiSets","shortName","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","MenuSeparator","Skeleton","inline","withWrap","START_SIZE","selectActiveDownloadIds","seenByExpiresAt","seenByMaxChatMembers","noOptions","isScheduled","isLocal","isMessageLocal","isChatGroup","isOwnMessage","isAction","isActionMessage","areReactionsEmpty","canSeeList","some","isChosen","canCopyNumber","customEmojiSetsInfo","selectMessageCustomEmojiSets","customEmojiSetsNotFiltered","selectStickerSet","every","isForbidden","hasFullInfo","SERVICE_NOTIFICATIONS_USER_ID","chatUsername","setReplyingToId","setEditingId","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","loadSeenBy","openSeenByModal","sendReaction","openReactorListModal","loadFullChat","copyMessagesByIds","saveGif","loadStickers","cancelPollVote","closePoll","setIsMenuOpen","setIsDeleteModalOpen","setIsReportModalOpen","isPinModalOpen","setIsPinModalOpen","isCalendarOpen","openCalendar","closeCalendar","isClosePollDialogOpen","openClosePollDialog","closeClosePollDialog","recentReactions","msg","handleReport","closeMenu","closePinModal","handleCloseCalendar","handleReply","handleEdit","handlePin","handleUnpin","handleFaveSticker","handleUnfaveSticker","handleCancelVote","handlePollClose","handleSelectMessage","params","childMessageIds","withShift","handleScheduledMessageSend","handleOpenCalendar","handleOpenSeenByModal","handleOpenReactorListModal","handleRescheduleMessage","scheduledAt","handleCopyMessages","handleCopyLink","handleCopyNumber","handleSaveGif","gif","handleSendReaction","reportMessageIds","scheduledMaxDate","getDayStartAt","handleAboutAdsOpen","handleSponsoredHide","fromSticker","stickerSetShortName","currentMessageList","sendOptions","getAllowedAttachmentOptions","canSendStickers","isSetPremium","selectIsSetPremium","canScheduleUntilOnline","selectCanScheduleUntilOnline","shouldSchedule","selectShouldSchedule","toggleStickerSet","prevStickerSet","renderingStickerSet","isEmoji","isButtonLocked","installedDate","requestCalendar","calendar","useSchedule","isScheduleRequested","isPreloadedGlobally","handleButtonClick","stickerSetId","EMOJI_SIZE_MODAL","STICKER_SIZE_MODAL","suffix","renderButtonText","customEmojiModalRef","prevCustomEmojiSets","renderingCustomEmojiSets","handleSetClick","customEmojiSet","BOT_BUTTONS","help","isRestricted","canAddContact","getCanAddContact","canReportChat","chatBot","REPLIES_USER_ID","selectChatBot","canGiftPremium","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","openGiftPremiumModal","handleStartBot","command","handleRestartBot","handleToggleMuteClick","handleEnterVoiceChatClick","handleLinkedChatClick","handleGiftPremiumClick","handleAddContactClick","handleSubscribe","handleVideoCall","handleCall","handleSearch","handleStatisticsClick","handleSelectMessages","botButtons","cmd","Portal","runDebouncedForSearch","selectCurrentTextSearch","isHistoryCalendarOpen","setLocalTextSearchQuery","searchTextMessagesLocal","closeLocalTextSearch","openHistoryCalendar","focusedIndex","setFocusedIndex","visualViewport","mainEl","pageTop","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","handleArrowKey","handleItemSelect","item","isSelectionOutOfRange","onUp","onDown","onLeft","onRight","onTab","onInsertUserName","filteredUsers","handleUserSelect","forceFocus","handleSelectMention","member","selectedMentionIndex","prevChatMembers","renderedChatMembers","attachments","caption","canShowCustomSendMenu","captionLimit","groupChatMembers","recentEmojis","baseEmojiKeywords","emojiKeywords","addRecentEmoji","onCaptionUpdate","onFileAppend","onClear","onSendSilent","onSendScheduled","captionRef","useStateRef","mainButtonRef","hideTimeoutRef","prevAttachments","renderingAttachments","isHovered","markHovered","unmarkHovered","isQuick","quick","isMentionTooltipOpen","closeMentionTooltip","insertMention","mentionFilteredUsers","useMentionTooltip","EDITABLE_INPUT_MODAL_ID","isEmojiTooltipOpen","closeEmojiTooltip","filteredEmojis","insertEmoji","useEmojiTooltip","isContextMenuOpen","isCustomSendMenuOpen","handleContextMenu","handleContextMenuClose","handleContextMenuHide","useContextMenuHandlers","sendAttachments","handleFilesDrop","dataTransfer","getFilesFromDataTransferItems","newFiles","file","CONTENT_TYPES_WITH_PREVIEW","areAllPhotos","SUPPORTED_IMAGE_CONTENT_TYPES","mimeType","areAllVideos","SUPPORTED_VIDEO_CONTENT_TYPES","areAllAudios","SUPPORTED_AUDIO_CONTENT_TYPES","leftChars","isOpenToBottom","onSendSchedule","renderHeader","onDragEnter","onDrop","onDragOver","onDragLeave","relatedTarget","toTarget","fromTarget","attachment","File","filename","extension","getFileExtension","previewData","emojis","onEmojiSelect","MessageInput","isAttachmentModalInput","html","editableInputId","canAutoFocus","isQuiz","shouldBeAnonymous","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","substring","optionsTrimmed","o","summary","answers","correct","isPublic","multipleChoice","quiz","entities","parseMessageInput","correctAnswers","solutionEntities","updateOption","removeOption","handleCorrectOptionChange","handleIsAnonymousChange","handleMultipleAnswersChange","handleQuizModeChange","handleKeyPress","keyCode","handleQuestionChange","getQuestionError","getOptionsError","renderOptions","renderQuizNoOptionError","hidden","emoji","native","image","isLoaded","LOADED_EMOJIS","names","IS_EMOJI_SUPPORTED","loading","handleEmojiLoad","category","allEmojis","useOnIntersect","emojisPerRow","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","allCategories","themeCategories","unshift","exec","default","uncompressEmoji","ensureEmojiData","selectCategory","categoryEl","handleEmojiSelect","MENU_TRANSITION_DURATION","containerClassName","faded","STICKER_MARGIN","EMOJI_MARGIN","loadAndPlay","favoriteStickers","onStickerSelect","onStickerUnfave","onStickerFave","onStickerRemoveRecent","clearRecentStickers","isConfirmModalOpen","openConfirmModal","closeConfirmModal","expand","handleClearRecent","isLocked","isFree","itemSize","EMOJI_SIZE_PICKER","STICKER_SIZE_PICKER","itemsPerRow","stickersPerRow","shouldCutSet","itemsBeforeCutout","Infinity","favoriteStickerIdsSet","isRecent","noAnimate","onUnfaveClick","FAVORITE_SYMBOL_SET_ID","has","onFaveClick","onRemoveRecentClick","canViewSet","stickerSetIntersections","favorite","premiumSet","recentStickers","premiumStickers","shouldPlay","loadRecentStickers","addRecentSticker","removeRecentSticker","activeSetIndex","setActiveSetIndex","sendMessageAction","useSendMessageAction","areAddedLoaded","allSets","defaultSets","existingAddedSetIds","pickTruthy","addedPremiumStickers","hasEffect","flat","totalPremiumStickers","uniqueByField","PREMIUM_STICKER_SET_ID","fullSet","CHAT_STICKER_SET_ID","noPopulatedSets","stickerSetEl","handleStickerSelect","handleStickerUnfave","handleStickerFave","handleRemoveRecentSticker","onUnsaveClick","videoData","shouldRenderVideo","isVideoReady","contextMenuPosition","handleBeforeContextMenu","handleUnsaveClick","handleContextDelete","handleSendQuiet","handleSendScheduled","preventMessageInputBlurWithBubbling","preload","gifs","saved","canSendGifs","onGifSelect","loadSavedGifs","debounceMs","shouldUnsave","SymbolMenuTabs","SYMBOL_MENU_TAB_TITLES","Emoji","Stickers","GIFs","SYMBOL_MENU_TAB_ICONS","onRemoveSymbol","onSearchOpen","renderTabButton","handleSearchOpen","isLeftColumnShown","loadPremiumSetStickers","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","param","prevInlineBotResults","renderedInlineBotResults","sensitiveArea","inlineBotResult","selectedSendAsId","sendAsIds","saveDefaultSendAs","markMouseInside","sendAsId","selectedSendAsIndex","messagesById","viewportResults","senderUser","senderChat","forwardInfo","isChannelPost","foundResult","isOnTop","preloadBackwards","teactOrderKey","LastMessageMeta","selectShouldLoopStickers","isAdded","areStickersLoaded","premiumStickerIds","coverStickerIds","covers","otherStickers","handleAddClick","handleStickerClick","canRenderStickers","STICKER_SIZE_SEARCH","selectCurrentStickerSearch","resultIds","featured","featuredIds","openedStickerSetShortName","loadFeaturedStickers","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","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","isChannelsPremiumLimitReached","limitReachedModal","togglePreHistoryHidden","updateChat","deleteChat","leaveChannel","deleteChannel","loadExportedChatInvites","loadChatJoinRequests","currentTitle","currentAbout","imageHash","isPublicGroup","isPreHistoryHiddenCheckboxRef","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","isAdmin","isOwner","canDeleteMembers","updateChatMemberBannedRights","isRemoveUserModalOpen","openRemoveUserModal","closeRemoveUserModal","removedMembers","getRemovedBy","kickedByUserId","kickedByUser","getContextActions","CHANNEL_TITLE_EMPTY","isSignaturesShown","toggleSignatures","handleUpdateChannel","handleToggleSignatures","handleClickSubscribers","handleDeleteChannel","selectManagement","maxPublicLinks","checkPublicLink","updatePublicLink","updatePrivateLink","toggleIsProtected","privateLink","inviteLink","privacyType","setPrivacyType","isRevokeConfirmDialogOpen","openRevokeConfirmDialog","closeRevokeConfirmDialog","canUpdate","handleOptionChange","radioGroup","handleForwardingOptionChange","handleSave","handleRevokePrivateLink","langPrefix1","langPrefix2","forwardingOptions","forDiscussionIds","linkedChat","loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup","toggleJoinRequest","toggleJoinToSend","linkedGroupId","setLinkedGroupId","isConfirmUnlinkGroupDialogOpen","openConfirmUnlinkGroupDialog","closeConfirmUnlinkGroupDialog","isConfirmLinkGroupDialogOpen","openConfirmLinkGroupDialog","closeConfirmLinkGroupDialog","isJoinToSend","setIsJoinToSend","isJoinRequest","setIsJoinRequest","handleUnlinkGroupSessions","channelId","handleLinkGroupSessions","handleJoinToSendCheck","handleJoinRequestCheck","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","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","getInviteIconClass","prepareContextActions","actions","editInvite","PrimaryLinkMenuButton","STICKER_SIZE_INVITES","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","parseInt","handleExpireDateChange","handleSaveClick","n","setChatEnabledReactions","localEnabledReactions","setLocalEnabledReactions","handleSaveReactions","availableActiveReactions","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","MIR","CardType","cards","Default","Visa","Mastercard","Mir","detectCardType","cardNumber","streetLine1","streetLine2","city","countryIso2","postCode","shipping","cardholder","expiry","cvv","billingCountry","billingZip","saveInfo","saveCredentials","formErrors","reducer","iso2","defaultName","useFocusAfterAnimation","animationDuration","hasArrow","needEmail","needPhone","needName","needAddress","phoneRef","selectCountryRef","handleAddress1Change","handleAddress2Change","handleCityChange","handleStateChange","handleCountryChange","handlePostCodeChange","handleFullNameChange","handleEmailChange","handleSaveInfoChange","shippingOptions","handleShippingSelect","renderPaymentItem","main","renderCheckoutItem","invoiceContent","prices","shippingPrices","checkoutInfo","totalPrice","isTosAccepted","onAcceptTos","isRecurring","recurringTermsUrl","paymentMethod","paymentProvider","shippingAddress","shippingMethod","photoUrl","getWebDocumentHash","forceAspectRatio","langStringSplit","renderTosLink","endsWith","formatCardExpiry","teactExperimentControlled","cardNumberRef","cardType","setCardType","newCardType","formatCardNumber","cardIcon","mastercardIconPath","visaIconPath","mirIconPath","getCardIcon","canSaveCredentials","needCardholderName","needCountry","needZip","handleCardNumberChange","handleCardholderChange","toUpperCase","handleExpiryChange","handleCvvChange","handleBillingPostCodeChange","handleChangeSaveCredentials","closePaymentModal","SUPPORTED_PROVIDERS","step","savedInfo","invoice","nativeProvider","nativeParams","passwordMissing","confirmPaymentUrl","inputInvoice","isProviderError","nameRequested","phoneRequested","emailRequested","shippingAddressRequested","flexible","phoneToProvider","emailToProvider","general","validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError","paymentState","paymentDispatch","setIsTosAccepted","canRenderFooter","PaymentStep","shippingAddressRest","shippingCountry","charAt","handleErrorModalClose","shippingOption","getShippingPrices","totalPrices","cur","getTotalPrice","detectCardTypeText","findShippingOption","getCheckoutInfo","validateRequest","requestInfo","getRequestInfo","sendCredentials","credentials","expiryMonth","expiryYear","zip","getCredentials","sendForm","shippingOptionId","setStep","nextStep","handleModalClose","isSubmitDisabled","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","labelClassName","accept"],"sourceRoot":""}