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AAK,iBACH,MAAO,IACFmhD,EACHzL,SAAUhpB,EAAO00B,QACjB68D,WAAY,IACP98D,EAAM88D,WACTvoE,cAAU11C,IAGhB,IAAK,cACH,MAAO,IACFmhD,EACHF,MAAOv0B,EAAO00B,QACd68D,WAAY,IACP98D,EAAM88D,WACTh9D,WAAOjhD,IAGb,IAAK,cACH,MAAO,IACFmhD,EACHxrB,MAAOjJ,EAAO00B,QACd68D,WAAY,IACP98D,EAAM88D,WACTtoF,WAAO31B,IAGb,IAAK,iBACH,MAAO,IAAKmhD,EAAOs8D,SAAU/wF,EAAO00B,SACtC,IAAK,mBACH,MAAO,IACFD,EACHg8D,WAAYzwF,EAAO00B,QACnB68D,WAAY,IACP98D,EAAM88D,WACTd,gBAAYn9G,IAGlB,IAAK,mBACH,MAAO,IACFmhD,EACHu8D,WAAYhxF,EAAO00B,QACnB68D,WAAY,IACP98D,EAAM88D,WACTP,gBAAY19G,IAGlB,IAAK,mBACH,MAAO,IACFmhD,EACHw8D,OAAQjxF,EAAO00B,QACf68D,WAAY,IACP98D,EAAM88D,WACTN,YAAQ39G,IAGd,IAAK,gBACH,MAAO,IACFmhD,EACHy8D,IAAKlxF,EAAO00B,QACZ68D,WAAY,IACP98D,EAAM88D,WACTL,SAAK59G,IAGX,IAAK,uBACH,MAAO,IACFmhD,EACH08D,eAAgBnxF,EAAO00B,QACvB68D,WAAY,IACP98D,EAAM88D,WACTJ,oBAAgB79G,IAGtB,IAAK,mBACH,MAAO,IACFmhD,EACH28D,WAAYpxF,EAAO00B,QACnB68D,WAAY,IACP98D,EAAM88D,WACTH,gBAAY99G,IAGlB,IAAK,iBACH,MAAO,IAAKmhD,EAAO48D,SAAUrxF,EAAO00B,SACtC,IAAK,wBACH,MAAO,IAAKD,EAAO68D,gBAAiBtxF,EAAO00B,SAC7C,IAAK,iBACH,OAAI10B,EAAO00B,QAAQ2gB,QACV,IACF5gB,KACAz0B,EAAO00B,QACVy8D,eAAgBnxF,EAAO00B,QAAQ2gB,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OAAgB1oH,KACf,IAEGipH,GAAiBhgH,EAAAA,EAAAA,GACrB0/G,GAAkB,SAClB96G,GAAY,YAGd,OACE,0BAAK3G,UAAU,kBACb,4BACEA,UAAW+hH,EACXn1F,KAAK,SACLC,SAAU,EACVtI,MAAOA,GAEP,4BACEpS,KAAK,OACLjM,SAxCR,SAA0BqN,GACxB,MAAMjC,EAASiC,EAAMjC,OAEhBA,GAAWA,EAAOs8C,OAAUt8C,EAAOs8C,MAAM,KAI9C4zD,EAAgBlwG,EAAOs8C,MAAM,IAC7Bt8C,EAAOrL,MAAQ,KAiCT+7G,OAAO,0BAET,wBAAGhiH,UAAU,oBACZyhH,GAAkB,0BAAKzrH,IAAKyrH,EAAgBr0G,IAAI,YAEnD,mBAAC,EAAD,CAAWm5E,KAAMg7B,EAAc96G,QAASi4G,EAAkBx4G,SAAUy7G","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/common/RecipientPicker.tsx","webpack://telegram-t/./src/components/main/ForwardRecipientPicker.tsx","webpack://telegram-t/./src/components/main/DraftRecipientPicker.tsx","webpack://telegram-t/./src/components/main/AttachBotRecipientPicker.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/AttachBotInstallModal.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 type { AnimationLevel } from '../../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: AnimationLevel;\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 { AnimationLevel, 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: AnimationLevel;\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';\nimport type { AnimationLevel } from '../../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 animationLevel: AnimationLevel;\n};\n\nconst ANIMATION_DURATION = 350;\n\nconst SenderInfo: FC<OwnProps & StateProps> = ({\n chatId,\n messageId,\n sender,\n isAvatar,\n message,\n animationLevel,\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} animationLevel={animationLevel} withVideo />\n ) : (\n <Avatar key={sender.id} size=\"medium\" chat={sender as ApiChat} animationLevel={animationLevel} withVideo />\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 const { animationLevel } = global.settings.byKey;\n if (isAvatar && chatId) {\n return {\n sender: isUserId(chatId) ? selectUser(global, chatId) : selectChat(global, chatId),\n animationLevel,\n };\n }\n\n if (!messageId || !chatId) {\n return { animationLevel };\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n\n return {\n message,\n sender: message && selectSender(global, message),\n animationLevel,\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 type { AnimationLevel } from '../../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: AnimationLevel;\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 { 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 searchPlaceholder: string;\n search: string;\n loadMore?: NoneToVoidFunction;\n onSearchChange: (search: 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 search,\n searchPlaceholder,\n loadMore,\n onSearchChange,\n onSelectChatOrUser,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const lang = useLang();\n const [viewportIds, getMore] = useInfiniteScroll(loadMore, chatOrUserIds, Boolean(search));\n // eslint-disable-next-line no-null/no-null\n const searchRef = useRef<HTMLInputElement>(null);\n\n const resetSearch = useCallback(() => {\n onSearchChange('');\n }, [onSearchChange]);\n useInputFocusOnOpen(searchRef, isOpen, resetSearch);\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const handleSearchChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n onSearchChange(e.currentTarget.value);\n }, [onSearchChange]);\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={searchRef}\n value={search}\n onChange={handleSearchChange}\n onKeyDown={handleKeyDown}\n placeholder={searchPlaceholder}\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 React, { memo, useMemo, useState } from '../../lib/teact/teact';\nimport { getGlobal, withGlobal } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { ApiChat, ApiChatType } from '../../api/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\n\nimport { API_CHAT_TYPES } from '../../config';\nimport { unique } from '../../util/iteratees';\nimport {\n filterChatsByName,\n filterUsersByName,\n getCanPostInChat,\n isDeletedUser,\n sortChatIds,\n} from '../../global/helpers';\n\nimport useLang from '../../hooks/useLang';\n\nimport ChatOrUserPicker from './ChatOrUserPicker';\nimport { filterChatIdsByType } from '../../global/selectors';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\n\nexport type OwnProps = {\n isOpen: boolean;\n searchPlaceholder: string;\n filter?: ApiChatType[];\n loadMore?: NoneToVoidFunction;\n onSelectRecipient: (peerId: string) => void;\n onClose: NoneToVoidFunction;\n onCloseAnimationEnd?: NoneToVoidFunction;\n};\n\ntype StateProps = {\n currentUserId?: string;\n chatsById: Record<string, ApiChat>;\n activeListIds?: string[];\n archivedListIds?: string[];\n pinnedIds?: string[];\n contactIds?: string[];\n};\n\nconst RecipientPicker: FC<OwnProps & StateProps> = ({\n isOpen,\n currentUserId,\n chatsById,\n activeListIds,\n archivedListIds,\n pinnedIds,\n contactIds,\n filter = API_CHAT_TYPES,\n searchPlaceholder,\n loadMore,\n onSelectRecipient,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const lang = useLang();\n const [search, setSearch] = useState('');\n const ids = useMemo(() => {\n if (!isOpen) return undefined;\n\n let priorityIds = pinnedIds || [];\n if (currentUserId) {\n priorityIds = unique([currentUserId, ...priorityIds]);\n }\n\n // No need for expensive global updates on users, so we avoid them\n const global = getGlobal();\n const usersById = global.users.byId;\n\n const chatIds = [\n ...(activeListIds || []),\n ...((search && archivedListIds) || []),\n ].filter((id) => {\n const chat = chatsById[id];\n const user = usersById[id];\n if (user && isDeletedUser(user)) return false;\n\n return chat && getCanPostInChat(chat, MAIN_THREAD_ID);\n });\n\n const sorted = sortChatIds(unique([\n ...filterChatsByName(lang, chatIds, chatsById, search, currentUserId),\n ...(contactIds && filter.includes('users') ? filterUsersByName(contactIds, usersById, search) : []),\n ]), chatsById, undefined, priorityIds);\n\n return filterChatIdsByType(global, sorted, filter);\n }, [pinnedIds, currentUserId, activeListIds, search, archivedListIds, lang, chatsById, contactIds, filter, isOpen]);\n\n const renderingIds = useCurrentOrPrev(ids, true)!;\n\n return (\n <ChatOrUserPicker\n isOpen={isOpen}\n chatOrUserIds={renderingIds}\n searchPlaceholder={searchPlaceholder}\n search={search}\n onSearchChange={setSearch}\n loadMore={loadMore}\n onSelectChatOrUser={onSelectRecipient}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\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 } = 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 };\n },\n)(RecipientPicker));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\n\nimport RecipientPicker from '../common/RecipientPicker';\n\nexport type OwnProps = {\n isOpen: boolean;\n};\n\nconst ForwardRecipientPicker: FC<OwnProps> = ({\n isOpen,\n}) => {\n const {\n setForwardChatId,\n exitForwardMode,\n } = getActions();\n\n const lang = useLang();\n\n const [isShown, markIsShown, unmarkIsShown] = useFlag();\n useEffect(() => {\n if (isOpen) {\n markIsShown();\n }\n }, [isOpen, markIsShown]);\n\n const handleSelectRecipient = useCallback((recipientId: string) => {\n setForwardChatId({ id: recipientId });\n }, [setForwardChatId]);\n\n const handleClose = useCallback(() => {\n exitForwardMode();\n }, [exitForwardMode]);\n\n if (!isOpen && !isShown) {\n return undefined;\n }\n\n return (\n <RecipientPicker\n isOpen={isOpen}\n searchPlaceholder={lang('ForwardTo')}\n onSelectRecipient={handleSelectRecipient}\n onClose={handleClose}\n onCloseAnimationEnd={unmarkIsShown}\n />\n );\n};\n\nexport default memo(ForwardRecipientPicker);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { GlobalState } from '../../global/types';\n\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\n\nimport RecipientPicker from '../common/RecipientPicker';\n\nexport type OwnProps = {\n requestedDraft?: GlobalState['requestedDraft'];\n};\n\nconst DraftRecipientPicker: FC<OwnProps> = ({\n requestedDraft,\n}) => {\n const isOpen = Boolean(requestedDraft && !requestedDraft.chatId);\n const {\n openChatWithDraft,\n resetOpenChatWithDraft,\n } = getActions();\n\n const lang = useLang();\n\n const [isShown, markIsShown, unmarkIsShown] = useFlag();\n useEffect(() => {\n if (isOpen) {\n markIsShown();\n }\n }, [isOpen, markIsShown]);\n\n const handleSelectRecipient = useCallback((recipientId: string) => {\n openChatWithDraft({ chatId: recipientId, text: requestedDraft!.text });\n }, [openChatWithDraft, requestedDraft]);\n\n const handleClose = useCallback(() => {\n resetOpenChatWithDraft();\n }, [resetOpenChatWithDraft]);\n\n if (!isOpen && !isShown) {\n return undefined;\n }\n\n return (\n <RecipientPicker\n isOpen={isOpen}\n searchPlaceholder={lang('ForwardTo')}\n onSelectRecipient={handleSelectRecipient}\n onClose={handleClose}\n onCloseAnimationEnd={unmarkIsShown}\n />\n );\n};\n\nexport default memo(DraftRecipientPicker);\n","import React, { memo, useCallback, useEffect } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { GlobalState } from '../../global/types';\n\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\n\nimport RecipientPicker from '../common/RecipientPicker';\n\nexport type OwnProps = {\n requestedAttachBotInChat?: GlobalState['requestedAttachBotInChat'];\n};\n\nconst AttachBotRecipientPicker: FC<OwnProps> = ({\n requestedAttachBotInChat,\n}) => {\n const { cancelAttachBotInChat, callAttachBot } = getActions();\n const lang = useLang();\n\n const isOpen = Boolean(requestedAttachBotInChat);\n const [isShown, markIsShown, unmarkIsShown] = useFlag();\n useEffect(() => {\n if (isOpen) {\n markIsShown();\n }\n }, [isOpen, markIsShown]);\n\n const { botId, filter, startParam } = requestedAttachBotInChat || {};\n\n const handlePeerRecipient = useCallback((recipientId: string) => {\n callAttachBot({ botId: botId!, chatId: recipientId, startParam });\n cancelAttachBotInChat();\n }, [botId, callAttachBot, cancelAttachBotInChat, startParam]);\n\n if (!isOpen && !isShown) {\n return undefined;\n }\n\n return (\n <RecipientPicker\n isOpen={isOpen}\n searchPlaceholder={lang('Search')}\n filter={filter}\n onSelectRecipient={handlePeerRecipient}\n onClose={cancelAttachBotInChat}\n onCloseAnimationEnd={unmarkIsShown}\n />\n );\n};\n\nexport default memo(AttachBotRecipientPicker);\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';\nimport type { AnimationLevel } from '../../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 animationLevel: AnimationLevel;\n};\n\nconst Dialogs: FC<StateProps> = ({ dialogs, animationLevel }) => {\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} animationLevel={animationLevel} withVideo />}\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 => {\n return {\n dialogs: global.dialogs,\n animationLevel: global.settings.byKey.animationLevel,\n };\n },\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 { ApiAttachBot, 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 attachBot?: ApiAttachBot;\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 attachBot,\n theme,\n isPaymentModalOpen,\n paymentStatus,\n}) => {\n const {\n closeWebApp,\n sendWebViewData,\n prolongWebView,\n toggleAttachBot,\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 toggleAttachBot({\n botId: bot!.id,\n isEnabled: !attachBot,\n });\n }, [bot, attachBot, toggleAttachBot]);\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?.isAttachBot && (\n <MenuItem\n icon={attachBot ? 'stop' : 'install'}\n onClick={handleToggleClick}\n destructive={Boolean(attachBot)}\n >\n {lang(attachBot ? 'WebApp.RemoveBot' : 'WebApp.AddToAttachmentAdd')}\n </MenuItem>\n )}\n {attachBot?.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, attachBot,\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 attachBot = 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 attachBot,\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 React, { memo } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\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 AttachBotInstallModal: FC<OwnProps> = ({\n bot,\n}) => {\n const { cancelAttachBotInstall, confirmAttachBotInstall } = getActions();\n\n const lang = useLang();\n\n const name = bot?.firstName;\n\n return (\n <ConfirmDialog\n isOpen={Boolean(bot)}\n onClose={cancelAttachBotInstall}\n confirmHandler={confirmAttachBotInstall}\n title={name}\n textParts={lang('WebApp.AddToAttachmentText', name)}\n />\n );\n};\n\nexport default memo(AttachBotInstallModal);\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')}> −{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';\nimport type { AnimationLevel } from '../../../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 animationLevel: AnimationLevel;\n};\n\nconst GiftPremiumModal: FC<OwnProps & StateProps> = ({\n isOpen,\n user,\n gifts,\n monthlyCurrency,\n monthlyAmount,\n animationLevel,\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} animationLevel={animationLevel} withVideo />\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 animationLevel: global.settings.byKey.animationLevel,\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 isAnyModalOpen?: 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 isAnyModalOpen,\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 && !isAnyModalOpen\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, isAnyModalOpen,\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 const isAnyModalOpen = Boolean(isForwardModalOpen || global.requestedDraft\n || global.requestedAttachBotInChat || global.requestedAttachBotInstall);\n\n return {\n isSchedule,\n selectedMessagesCount: selectSelectedMessagesCount(global),\n canDeleteMessages: canDelete,\n canReportMessages: canReport,\n canDownloadMessages: canDownload,\n selectedMessageIds,\n hasProtectedMessage,\n isAnyModalOpen,\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 type { AnimationLevel } from '../../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 animationLevel: AnimationLevel;\n};\n\nconst ReactorListModal: FC<OwnProps & StateProps> = ({\n isOpen,\n reactors,\n reactions,\n chatId,\n messageId,\n seenByUserIds,\n animationLevel,\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\" animationLevel={animationLevel} withVideo />\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 animationLevel: global.settings.byKey.animationLevel,\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';\nimport type { AnimationLevel } from '../../../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 animationLevel: AnimationLevel;\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,\n usersById,\n recentlyFoundChatIds,\n animationLevel,\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]} animationLevel={animationLevel} withVideo />\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 const { animationLevel } = global.settings.byKey;\n\n return {\n topUserIds,\n usersById,\n recentlyFoundChatIds,\n animationLevel,\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';\nimport type { AnimationLevel } from '../../../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 animationLevel?: AnimationLevel;\n};\n\nconst ChatMessage: FC<OwnProps & StateProps> = ({\n message,\n searchQuery,\n chatId,\n chat,\n privateChatUser,\n animationLevel,\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 withVideo\n animationLevel={animationLevel}\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 animationLevel: global.settings.byKey.animationLevel,\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 <div key=\"header\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterChatTypes')}\n </h4>\n {chatTypes.map(renderChatType)}\n <div className=\"picker-list-divider\" />\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterChats')}\n </h4>\n </div>\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 // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyBlockedUsers)}\n >\n {lang('BlockedUsers')}\n <span className=\"settings-item__current-value\">{blockedCount || ''}</span>\n </ListItem>\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 <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\">−{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';\nimport type { AnimationLevel } from '../../../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 animationLevel: AnimationLevel;\n};\n\nconst SettingsActiveWebsite: FC<OwnProps & StateProps> = ({\n isOpen,\n session,\n bot,\n animationLevel,\n 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\" animationLevel={animationLevel} withVideo />\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 animationLevel: global.settings.byKey.animationLevel,\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';\nimport type { AnimationLevel } from '../../../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 animationLevel: AnimationLevel;\n};\n\nconst SettingsActiveWebsites: FC<OwnProps & StateProps> = ({\n isActive,\n byHash,\n orderedHashes,\n animationLevel,\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\" animationLevel={animationLevel} withVideo />\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 animationLevel: global.settings.byKey.animationLevel,\n };\n },\n)(SettingsActiveWebsites));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useMemo, useState, memo, 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 [search, setSearch] = useState('');\n\n useEffect(() => {\n setUserSearchQuery({ query: search });\n }, [search, 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, search)\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, search, 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 searchPlaceholder={lang('BlockedUsers.BlockUser')}\n search={search}\n onSearchChange={setSearch}\n onSelectChatOrUser={handleRemoveUser}\n onClose={onClose}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n users: {\n byId: usersById,\n },\n blocked: {\n ids: blockedIds,\n },\n contactList,\n currentUserId,\n } = global;\n\n return {\n usersById,\n blockedIds,\n contactIds: contactList?.userIds,\n localContactIds: global.userSearch.localUserIds,\n currentUserId,\n };\n },\n)(BlockUserModal));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiCountryCode, ApiUser } from '../../../api/types';\n\nimport { CHAT_HEIGHT_PX } from '../../../config';\nimport { formatPhoneNumberWithCode } from '../../../util/phoneNumber';\nimport {\n getChatTitle, getUserFullName, isUserId,\n} from '../../../global/helpers';\nimport renderText from '../../common/helpers/renderText';\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useFlag from '../../../hooks/useFlag';\n\nimport ListItem from '../../ui/ListItem';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Avatar from '../../common/Avatar';\nimport Loading from '../../ui/Loading';\nimport BlockUserModal from './BlockUserModal';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n chatsByIds: Record<string, ApiChat>;\n usersByIds: Record<string, ApiUser>;\n blockedIds: string[];\n phoneCodeList: ApiCountryCode[];\n};\n\nconst SettingsPrivacyBlockedUsers: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n chatsByIds,\n usersByIds,\n blockedIds,\n phoneCodeList,\n}) => {\n const { unblockContact } = getActions();\n\n const lang = useLang();\n const [isBlockUserModalOpen, openBlockUserModal, closeBlockUserModal] = useFlag();\n const handleUnblockClick = useCallback((contactId: string) => {\n unblockContact({ contactId });\n }, [unblockContact]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function renderContact(contactId: string, i: number, viewportOffset: number) {\n const isPrivate = isUserId(contactId);\n const user = isPrivate ? usersByIds[contactId] : undefined;\n const chat = !isPrivate ? chatsByIds[contactId] : undefined;\n\n const className = buildClassName(\n 'Chat chat-item-clickable blocked-list-item small-icon',\n isPrivate ? 'private' : 'group',\n );\n\n return (\n <ListItem\n key={contactId}\n className={className}\n ripple\n narrow\n contextActions={[{\n title: 'Unblock',\n icon: 'unlock',\n handler: () => {\n handleUnblockClick(contactId);\n },\n }]}\n style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}\n >\n <Avatar size=\"medium\" user={user} chat={chat} />\n <div className=\"contact-info\" dir=\"auto\">\n <h3 dir=\"auto\">{renderText((isPrivate ? getUserFullName(user) : getChatTitle(lang, chat!)) || '')}</h3>\n {user?.phoneNumber && (\n <div className=\"contact-phone\" dir=\"auto\">{formatPhoneNumberWithCode(phoneCodeList, user.phoneNumber)}</div>\n )}\n {user && !user.phoneNumber && user.username && (\n <div className=\"contact-username\" dir=\"auto\">@{user.username}</div>\n )}\n </div>\n </ListItem>\n );\n }\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content infinite-scroll\">\n <div className=\"settings-item no-border\">\n <p className=\"settings-item-description-larger mt-0 mb-2\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('BlockedUsersInfo')}\n </p>\n </div>\n\n <div className=\"chat-list custom-scroll\">\n {blockedIds?.length ? (\n <div className=\"scroll-container\">\n {blockedIds!.map((contactId, i) => renderContact(contactId, i, 0))}\n </div>\n ) : blockedIds && !blockedIds.length ? (\n <div className=\"no-results\" dir=\"auto\">{lang('NoBlocked')}</div>\n ) : (\n <Loading key=\"loading\" />\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown\n onClick={openBlockUserModal}\n ariaLabel={lang('BlockContact')}\n >\n <i className=\"icon-add\" />\n </FloatingActionButton>\n <BlockUserModal\n isOpen={isBlockUserModalOpen}\n onClose={closeBlockUserModal}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n chats: {\n byId: chatsByIds,\n },\n users: {\n byId: usersByIds,\n },\n blocked: {\n ids,\n },\n countryList: {\n phoneCodes: phoneCodeList,\n },\n } = global;\n\n return {\n chatsByIds,\n usersByIds,\n blockedIds: ids,\n phoneCodeList,\n };\n },\n)(SettingsPrivacyBlockedUsers));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport ListItem from '../../../ui/ListItem';\nimport renderText from '../../../common/helpers/renderText';\nimport AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview';\n\nimport lockPreviewUrl from '../../../../assets/lock.png';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsTwoFaEnabled: FC<OwnProps> = ({\n isActive, onReset, onScreenSelect,\n}) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={160}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {renderText(lang('EnabledPasswordText'), ['br'])}\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <ListItem\n icon=\"edit\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.TwoFaChangePasswordCurrent)}\n >\n {lang('ChangePassword')}\n </ListItem>\n <ListItem\n icon=\"password-off\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.TwoFaTurnOff)}\n >\n {lang('TurnPasswordOff')}\n </ListItem>\n <ListItem\n icon=\"email\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCurrentPassword)}\n >\n {lang('SetRecoveryEmail')}\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsTwoFaEnabled);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useState } from '../../../lib/teact/teact';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport PasswordMonkey from '../../common/PasswordMonkey';\nimport PasswordForm from '../../common/PasswordForm';\n\ntype OwnProps = {\n error?: string;\n isLoading?: boolean;\n shouldDisablePasswordManager?: boolean;\n expectedPassword?: string;\n placeholder?: string;\n hint?: string;\n submitLabel?: string;\n clearError?: NoneToVoidFunction;\n onSubmit: (password: string) => void;\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst EQUAL_PASSWORD_ERROR = 'Passwords Should Be Equal';\n\nconst SettingsPasswordForm: FC<OwnProps> = ({\n isActive,\n onReset,\n error,\n isLoading,\n shouldDisablePasswordManager,\n expectedPassword,\n placeholder = 'Current Password',\n hint,\n submitLabel,\n clearError,\n onSubmit,\n}) => {\n const [validationError, setValidationError] = useState<string>('');\n const [shouldShowPassword, setShouldShowPassword] = useState(false);\n\n const handleSubmit = useCallback((newPassword) => {\n if (expectedPassword && newPassword !== expectedPassword) {\n setValidationError(EQUAL_PASSWORD_ERROR);\n } else {\n onSubmit(newPassword);\n }\n }, [onSubmit, expectedPassword]);\n\n const handleClearError = useCallback(() => {\n if (clearError) {\n clearError();\n }\n setValidationError('');\n }, [clearError]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content password-form custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <PasswordMonkey isBig isPasswordVisible={shouldShowPassword} />\n </div>\n\n <div className=\"settings-item pt-0\">\n <PasswordForm\n error={validationError || error}\n hint={hint}\n placeholder={placeholder}\n shouldDisablePasswordManager={shouldDisablePasswordManager}\n submitLabel={submitLabel || lang('Next')}\n clearError={handleClearError}\n isLoading={isLoading}\n isPasswordVisible={shouldShowPassword}\n shouldResetValue={isActive}\n onChangePasswordVisibility={setShouldShowPassword}\n onSubmit={handleSubmit}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasswordForm);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview';\n\nimport lockPreviewUrl from '../../../../assets/lock.png';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\n\ntype OwnProps = {\n onStart: NoneToVoidFunction;\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst SettingsTwoFaStart: FC<OwnProps> = ({\n isActive, onReset, onStart,\n}) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={160}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {lang('SetAdditionalPasswordInfo')}\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={onStart}>{lang('EditAdminTransferSetPassword')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsTwoFaStart);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport type { ApiSticker } from '../../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../../util/environment';\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\nimport renderText from '../../../common/helpers/renderText';\nimport useFlag from '../../../../hooks/useFlag';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport Modal from '../../../ui/Modal';\nimport InputText from '../../../ui/InputText';\nimport AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker';\n\ntype OwnProps = {\n icon: 'hint' | 'email';\n type?: 'text' | 'email';\n isLoading?: boolean;\n error?: string;\n placeholder: string;\n shouldConfirm?: boolean;\n clearError?: NoneToVoidFunction;\n onSubmit: (value?: string) => void;\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\nconst ICON_SIZE = 160;\n\nconst SettingsTwoFaSkippableForm: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n type = 'text',\n isLoading,\n error,\n placeholder,\n shouldConfirm,\n clearError,\n onSubmit,\n isActive,\n onReset,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n const [isConfirmShown, markIsConfirmShown, unmarkIsConfirmShown] = useFlag(false);\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (error && clearError) {\n clearError();\n }\n\n setValue(e.target.value);\n }, [clearError, error]);\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n\n if (!inputRef.current) {\n return;\n }\n\n onSubmit(value);\n };\n\n const handleSkip = useCallback(() => {\n onSubmit();\n }, [onSubmit]);\n\n const handleSkipConfirm = useCallback(() => {\n unmarkIsConfirmShown();\n onSubmit();\n }, [onSubmit, unmarkIsConfirmShown]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconFromSticker sticker={animatedEmoji} size={ICON_SIZE} className=\"settings-content-icon\" />\n </div>\n\n <div className=\"settings-item pt-0\">\n <form action=\"\" onSubmit={handleSubmit}>\n <InputText\n ref={inputRef}\n value={value}\n inputMode={type}\n label={placeholder}\n error={error}\n onChange={handleInputChange}\n />\n\n {value ? (\n <Button type=\"submit\" isLoading={isLoading} ripple>{lang('Continue')}</Button>\n ) : (\n <Button\n isText\n isLoading={isLoading}\n ripple\n onClick={shouldConfirm ? markIsConfirmShown : handleSkip}\n >\n {lang('YourEmailSkip')}\n </Button>\n )}\n </form>\n {shouldConfirm && (\n <Modal\n className=\"narrow\"\n isOpen={isConfirmShown}\n title={lang('YourEmailSkipWarning')}\n onClose={unmarkIsConfirmShown}\n >\n {renderText(lang('YourEmailSkipWarningText'), ['br', 'simple_markdown'])}\n <div className=\"dialog-buttons\">\n <Button\n color=\"danger\"\n ripple\n isText\n className=\"confirm-dialog-button\"\n onClick={handleSkipConfirm}\n >\n {lang('YourEmailSkip')}\n </Button>\n <Button\n color=\"primary\"\n ripple\n isText\n className=\"confirm-dialog-button\"\n onClick={unmarkIsConfirmShown}\n >\n {lang('Cancel')}\n </Button>\n </div>\n </Modal>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global, { icon }) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, icon === 'email' ? '💌' : '💡'),\n };\n})(SettingsTwoFaSkippableForm));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport { STICKER_SIZE_TWO_FA } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedIcon from '../../../common/AnimatedIcon';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsTwoFaCongratulations: FC<OwnProps> = ({\n isActive, onReset, onScreenSelect,\n}) => {\n const lang = useLang();\n\n const handleClick = useCallback(() => {\n onScreenSelect(SettingsScreens.Privacy);\n }, [onScreenSelect]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIcon\n size={STICKER_SIZE_TWO_FA}\n tgsUrl={LOCAL_TGS_URLS.Congratulations}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {lang('TwoStepVerificationPasswordSetInfo')}\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={handleClick}>{lang('TwoStepVerificationPasswordReturnSettings')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsTwoFaCongratulations);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport type { ApiSticker } from '../../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../../util/environment';\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport InputText from '../../../ui/InputText';\nimport Loading from '../../../ui/Loading';\nimport AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker';\n\ntype OwnProps = {\n isLoading?: boolean;\n error?: string;\n clearError: NoneToVoidFunction;\n onSubmit: (hint: string) => void;\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n codeLength: number;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\nconst ICON_SIZE = 160;\n\nconst SettingsTwoFaEmailCode: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n codeLength,\n isLoading,\n error,\n clearError,\n onSubmit,\n isActive,\n onReset,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (error && clearError) {\n clearError();\n }\n\n const newValue = e.target.value.slice(0, codeLength);\n\n if (newValue.length === codeLength) {\n onSubmit(newValue);\n }\n\n setValue(newValue);\n e.target.value = newValue;\n }, [clearError, codeLength, error, onSubmit]);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconFromSticker sticker={animatedEmoji} size={ICON_SIZE} className=\"settings-content-icon\" />\n </div>\n\n <div className=\"settings-item pt-0\">\n <InputText\n value={value}\n ref={inputRef}\n inputMode=\"decimal\"\n label={lang('YourEmailCode')}\n error={error}\n onChange={handleInputChange}\n />\n {isLoading && <Loading />}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, '💌'),\n codeLength: global.twoFaSettings.waitingEmailCodeLength,\n };\n})(SettingsTwoFaEmailCode));\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport type { GlobalState } from '../../../../global/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport type { TwoFaDispatch, TwoFaState } from '../../../../hooks/reducers/useTwoFaReducer';\nimport useLang from '../../../../hooks/useLang';\n\nimport SettingsTwoFaEnabled from './SettingsTwoFaEnabled';\nimport SettingsTwoFaPassword from '../SettingsPasswordForm';\nimport SettingsTwoFaStart from './SettingsTwoFaStart';\nimport SettingsTwoFaSkippableForm from './SettingsTwoFaSkippableForm';\nimport SettingsTwoFaCongratulations from './SettingsTwoFaCongratulations';\nimport SettingsTwoFaEmailCode from './SettingsTwoFaEmailCode';\n\nexport type OwnProps = {\n state: TwoFaState;\n currentScreen: SettingsScreens;\n shownScreen: SettingsScreens;\n dispatch: TwoFaDispatch;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = GlobalState['twoFaSettings'];\n\nconst SettingsTwoFa: FC<OwnProps & StateProps> = ({\n currentScreen,\n shownScreen,\n state,\n hint,\n isLoading,\n error,\n waitingEmailCodeLength,\n dispatch,\n isActive,\n onScreenSelect,\n onReset,\n}) => {\n const {\n updatePassword,\n checkPassword,\n clearTwoFaError,\n updateRecoveryEmail,\n provideTwoFaEmailCode,\n clearPassword,\n } = getActions();\n\n useEffect(() => {\n if (waitingEmailCodeLength) {\n if (currentScreen === SettingsScreens.TwoFaNewPasswordEmail) {\n onScreenSelect(SettingsScreens.TwoFaNewPasswordEmailCode);\n } else if (currentScreen === SettingsScreens.TwoFaRecoveryEmail) {\n onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCode);\n }\n }\n }, [currentScreen, onScreenSelect, waitingEmailCodeLength]);\n\n const handleStartWizard = useCallback(() => {\n dispatch({ type: 'reset' });\n onScreenSelect(SettingsScreens.TwoFaNewPassword);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPassword = useCallback((value: string) => {\n dispatch({ type: 'setPassword', payload: value });\n onScreenSelect(SettingsScreens.TwoFaNewPasswordConfirm);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPasswordConfirm = useCallback(() => {\n onScreenSelect(SettingsScreens.TwoFaNewPasswordHint);\n }, [onScreenSelect]);\n\n const handleNewPasswordHint = useCallback((value?: string) => {\n dispatch({ type: 'setHint', payload: value });\n onScreenSelect(SettingsScreens.TwoFaNewPasswordEmail);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPasswordEmail = useCallback((value?: string) => {\n dispatch({ type: 'setEmail', payload: value });\n updatePassword({\n ...state,\n email: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updatePassword]);\n\n const handleChangePasswordCurrent = useCallback((value: string) => {\n dispatch({ type: 'setCurrentPassword', payload: value });\n checkPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaChangePasswordNew);\n },\n });\n }, [checkPassword, dispatch, onScreenSelect]);\n\n const handleChangePasswordNew = useCallback((value: string) => {\n dispatch({ type: 'setPassword', payload: value });\n onScreenSelect(SettingsScreens.TwoFaChangePasswordConfirm);\n }, [dispatch, onScreenSelect]);\n\n const handleChangePasswordConfirm = useCallback(() => {\n onScreenSelect(SettingsScreens.TwoFaChangePasswordHint);\n }, [onScreenSelect]);\n\n const handleChangePasswordHint = useCallback((value?: string) => {\n dispatch({ type: 'setHint', payload: value });\n updatePassword({\n ...state,\n hint: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updatePassword]);\n\n const handleTurnOff = useCallback((value: string) => {\n clearPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.Privacy);\n },\n });\n }, [clearPassword, onScreenSelect]);\n\n const handleRecoveryEmailCurrentPassword = useCallback((value: string) => {\n dispatch({ type: 'setCurrentPassword', payload: value });\n checkPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaRecoveryEmail);\n },\n });\n }, [checkPassword, dispatch, onScreenSelect]);\n\n const handleRecoveryEmail = useCallback((value?: string) => {\n dispatch({ type: 'setEmail', payload: value });\n updateRecoveryEmail({\n ...state,\n email: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updateRecoveryEmail]);\n\n const handleEmailCode = useCallback((code: string) => {\n provideTwoFaEmailCode({ code });\n }, [provideTwoFaEmailCode]);\n\n const lang = useLang();\n\n switch (currentScreen) {\n case SettingsScreens.TwoFaDisabled:\n return (\n <SettingsTwoFaStart\n onStart={handleStartWizard}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPassword,\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPassword:\n return (\n <SettingsTwoFaPassword\n placeholder={lang('PleaseEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPassword}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordConfirm:\n return (\n <SettingsTwoFaPassword\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPasswordConfirm}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleNewPasswordHint}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmail:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"email\"\n type=\"email\"\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n placeholder={lang('RecoveryEmailTitle')}\n shouldConfirm\n onSubmit={handleNewPasswordEmail}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n return (\n <SettingsTwoFaEmailCode\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaCongratulations:\n return (\n <SettingsTwoFaCongratulations\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaEnabled:\n return (\n <SettingsTwoFaEnabled\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordCurrent,\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaTurnOff,\n SettingsScreens.TwoFaRecoveryEmailCurrentPassword,\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordCurrent:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleChangePasswordCurrent}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordNew:\n return (\n <SettingsTwoFaPassword\n placeholder={lang('PleaseEnterNewFirstPassword')}\n onSubmit={handleChangePasswordNew}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordConfirm:\n return (\n <SettingsTwoFaPassword\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n onSubmit={handleChangePasswordConfirm}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleChangePasswordHint}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaTurnOff:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleTurnOff}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleRecoveryEmailCurrentPassword}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmail:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"email\"\n type=\"email\"\n placeholder={lang('RecoveryEmailTitle')}\n onSubmit={handleRecoveryEmail}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFaEmailCode\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => ({ ...global.twoFaSettings }),\n)(SettingsTwoFa));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { GlobalState } from '../../../global/types';\nimport type { ApiPrivacySettings } from '../../../types';\nimport { SettingsScreens } from '../../../types';\n\nimport { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID } from '../../../config';\nimport { unique } from '../../../util/iteratees';\nimport { filterChatsByName, isUserId } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager';\nimport { getPrivacyKey } from './helpers/privacy';\n\nimport Picker from '../../common/Picker';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\n\nexport type OwnProps = {\n isAllowList?: boolean;\n screen: SettingsScreens;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n currentUserId?: string;\n settings?: ApiPrivacySettings;\n};\n\nconst SettingsPrivacyVisibilityExceptionList: FC<OwnProps & StateProps> = ({\n isAllowList,\n screen,\n isActive,\n onScreenSelect,\n onReset,\n currentUserId,\n settings,\n}) => {\n const { setPrivacySettings } = getActions();\n\n const lang = useLang();\n\n const selectedContactIds = useMemo(() => {\n if (!settings) {\n return [];\n }\n\n if (isAllowList) {\n return [...settings.allowUserIds, ...settings.allowChatIds];\n } else {\n return [...settings.blockUserIds, ...settings.blockChatIds];\n }\n }, [isAllowList, settings]);\n const [searchQuery, setSearchQuery] = useState<string>('');\n const [isSubmitShown, setIsSubmitShown] = useState<boolean>(false);\n const [newSelectedContactIds, setNewSelectedContactIds] = useState<string[]>(selectedContactIds);\n\n const folderAllOrderedIds = useFolderManagerForOrderedIds(ALL_FOLDER_ID);\n const folderArchivedOrderedIds = useFolderManagerForOrderedIds(ARCHIVED_FOLDER_ID);\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on chats, so we avoid them\n const chatsById = getGlobal().chats.byId;\n\n const chatIds = unique([...folderAllOrderedIds || [], ...folderArchivedOrderedIds || []])\n .filter((chatId) => {\n const chat = chatsById[chatId];\n\n return chat && isUserId(chat.id) && chat.id !== currentUserId;\n });\n\n return unique([\n ...selectedContactIds,\n ...filterChatsByName(lang, chatIds, chatsById, searchQuery),\n ]);\n }, [folderAllOrderedIds, folderArchivedOrderedIds, selectedContactIds, lang, searchQuery, currentUserId]);\n\n const handleSelectedContactIdsChange = useCallback((value: string[]) => {\n setNewSelectedContactIds(value);\n setIsSubmitShown(true);\n }, []);\n\n const handleSubmit = useCallback(() => {\n setPrivacySettings({\n privacyKey: getPrivacyKey(screen),\n isAllowList: Boolean(isAllowList),\n contactsIds: newSelectedContactIds,\n });\n\n onScreenSelect(SettingsScreens.Privacy);\n }, [isAllowList, newSelectedContactIds, onScreenSelect, screen, setPrivacySettings]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"NewChat-inner step-1\">\n <Picker\n itemIds={displayedIds || []}\n selectedIds={newSelectedContactIds}\n filterValue={searchQuery}\n filterPlaceholder={isAllowList ? lang('AlwaysAllowPlaceholder') : lang('NeverAllowPlaceholder')}\n searchInputId=\"new-group-picker-search\"\n onSelectedIdsChange={handleSelectedContactIdsChange}\n onFilterChange={setSearchQuery}\n />\n\n <FloatingActionButton\n isShown={isSubmitShown}\n onClick={handleSubmit}\n ariaLabel={isAllowList ? lang('AlwaysAllow') : lang('NeverAllow')}\n >\n <i className=\"icon-arrow-right\" />\n </FloatingActionButton>\n </div>\n );\n};\n\nfunction getCurrentPrivacySettings(global: GlobalState, screen: SettingsScreens) {\n const { privacy } = global.settings;\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n return privacy.phoneNumber;\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n return privacy.lastSeen;\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n return privacy.profilePhoto;\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n return privacy.phoneCall;\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n return privacy.phoneP2P;\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return privacy.forwards;\n case SettingsScreens.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'll need to log out of Telegram WebZ and log in again.\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={onStart}>{lang('EnablePasscode')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasscodeStart);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport ListItem from '../../../ui/ListItem';\nimport AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview';\n\nimport lockPreviewUrl from '../../../../assets/lock.png';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsPasscodeEnabled: FC<OwnProps> = ({\n isActive, onReset, onScreenSelect,\n}) => {\n const lang = useLang();\n\n useHistoryBack({ isActive, onBack: onReset });\n\n return (\n <div className=\"settings-content local-passcode custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={160}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n Local passcode is enabled.\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <ListItem\n icon=\"edit\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PasscodeChangePasscodeCurrent)}\n >\n {lang('Passcode.Change')}\n </ListItem>\n <ListItem\n icon=\"password-off\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PasscodeTurnOff)}\n >\n {lang('Passcode.TurnOff')}\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasscodeEnabled);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\n\nimport { STICKER_SIZE_PASSCODE } from '../../../../config';\nimport { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedIcon from '../../../common/AnimatedIcon';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: (forceReturnToChatList?: boolean) => void;\n};\n\nconst SettingsPasscodeCongratulations: FC<OwnProps> = ({\n isActive, onReset,\n}) => {\n const lang = useLang();\n\n const fullReset = useCallback(() => {\n onReset(true);\n }, [onReset]);\n\n useHistoryBack({ isActive, onBack: onReset });\n\n return (\n <div className=\"settings-content local-passcode custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedIcon\n size={STICKER_SIZE_PASSCODE}\n tgsUrl={LOCAL_TGS_URLS.Congratulations}\n className=\"settings-content-icon\"\n />\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n Congratulations!\n </p>\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n Now you can lock the app with a passcode so that others can't open it.\n </p>\n </div>\n\n <div className=\"settings-item pt-0\">\n <Button onClick={fullReset}>{lang('Back')}</Button>\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsPasscodeCongratulations);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport type { GlobalState } from '../../../../global/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport useLang from '../../../../hooks/useLang';\nimport { decryptSession } from '../../../../util/passcode';\n\nimport SettingsPasscodeStart from './SettingsPasscodeStart';\nimport SettingsPasscodeForm from '../SettingsPasswordForm';\nimport SettingsPasscodeEnabled from './SettingsPasscodeEnabled';\nimport SettingsPasscodeCongratulations from './SettingsPasscodeCongratulations';\n\nexport type OwnProps = {\n passcode: string;\n currentScreen: SettingsScreens;\n shownScreen: SettingsScreens;\n isActive?: boolean;\n onSetPasscode: (passcode: string) => void;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = GlobalState['passcode'];\n\nconst SettingsPasscode: FC<OwnProps & StateProps> = ({\n passcode,\n currentScreen,\n shownScreen,\n error,\n isActive,\n isLoading,\n onScreenSelect,\n onSetPasscode,\n onReset,\n}) => {\n const {\n setPasscode,\n clearPasscode,\n setPasscodeError,\n clearPasscodeError,\n } = getActions();\n\n const lang = useLang();\n\n const handleStartWizard = useCallback(() => {\n onSetPasscode('');\n onScreenSelect(SettingsScreens.PasscodeNewPasscode);\n }, [onScreenSelect, onSetPasscode]);\n\n const handleNewPassword = useCallback((value: string) => {\n onSetPasscode(value);\n onScreenSelect(SettingsScreens.PasscodeNewPasscodeConfirm);\n }, [onScreenSelect, onSetPasscode]);\n\n const handleNewPasswordConfirm = useCallback(() => {\n setPasscode({ passcode });\n onSetPasscode('');\n onScreenSelect(SettingsScreens.PasscodeCongratulations);\n }, [onScreenSelect, onSetPasscode, passcode, setPasscode]);\n\n const handleChangePasswordCurrent = useCallback((currentPasscode: string) => {\n onSetPasscode('');\n decryptSession(currentPasscode).then(() => {\n onScreenSelect(SettingsScreens.PasscodeChangePasscodeNew);\n }, () => {\n setPasscodeError({\n error: lang('PasscodeController.Error.Current'),\n });\n });\n }, [lang, onScreenSelect, onSetPasscode, setPasscodeError]);\n\n const handleChangePasswordNew = useCallback((value: string) => {\n onSetPasscode(value);\n onScreenSelect(SettingsScreens.PasscodeChangePasscodeConfirm);\n }, [onScreenSelect, onSetPasscode]);\n\n const handleTurnOff = useCallback((currentPasscode: string) => {\n decryptSession(currentPasscode).then(() => {\n clearPasscode();\n onScreenSelect(SettingsScreens.Privacy);\n }, () => {\n setPasscodeError({\n error: lang('PasscodeController.Error.Current'),\n });\n });\n }, [clearPasscode, lang, onScreenSelect, setPasscodeError]);\n\n switch (currentScreen) {\n case SettingsScreens.PasscodeDisabled:\n return (\n <SettingsPasscodeStart\n onStart={handleStartWizard}\n isActive={isActive || [\n SettingsScreens.PasscodeNewPasscode,\n SettingsScreens.PasscodeNewPasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeNewPasscode:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n placeholder={lang('EnterNewPasscode')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPassword}\n isActive={isActive || [\n SettingsScreens.PasscodeNewPasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeNewPasscodeConfirm:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n expectedPassword={passcode}\n placeholder={lang('ReEnterYourPasscode')}\n submitLabel={lang('Continue')}\n isLoading={isLoading}\n onSubmit={handleNewPasswordConfirm}\n isActive={isActive || [\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeCongratulations:\n return (\n <SettingsPasscodeCongratulations\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeEnabled:\n return (\n <SettingsPasscodeEnabled\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.PasscodeChangePasscodeCurrent,\n SettingsScreens.PasscodeChangePasscodeNew,\n SettingsScreens.PasscodeChangePasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n SettingsScreens.PasscodeTurnOff,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeChangePasscodeCurrent:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n error={error}\n clearError={clearPasscodeError}\n placeholder={lang('PasscodeController.Current.Placeholder')}\n onSubmit={handleChangePasswordCurrent}\n isActive={isActive || [\n SettingsScreens.PasscodeChangePasscodeNew,\n SettingsScreens.PasscodeChangePasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeChangePasscodeNew:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n placeholder={lang('PleaseEnterNewFirstPassword')}\n onSubmit={handleChangePasswordNew}\n isActive={isActive || [\n SettingsScreens.PasscodeChangePasscodeConfirm,\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeChangePasscodeConfirm:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n expectedPassword={passcode}\n placeholder={lang('PasscodeController.ReEnterPasscode.Placeholder')}\n isLoading={isLoading}\n onSubmit={handleNewPasswordConfirm}\n isActive={isActive || [\n SettingsScreens.PasscodeCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.PasscodeTurnOff:\n return (\n <SettingsPasscodeForm\n shouldDisablePasswordManager\n error={error ? lang(error) : undefined}\n clearError={clearPasscodeError}\n placeholder={lang('PasscodeController.Current.Placeholder')}\n onSubmit={handleTurnOff}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => ({ ...global.passcode }),\n)(SettingsPasscode));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, 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 { IS_COMPACT_MENU } from '../../../util/environment';\nimport { createClassNameBuilder } from '../../../util/buildClassName';\nimport useMedia from '../../../hooks/useMedia';\nimport useFlag from '../../../hooks/useFlag';\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 shouldRenderStatic = !isReady || !isAnimationLoaded;\n const shouldRenderAnimated = Boolean(isReady && mediaData);\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 )}\n style={`background-position-x: ${previewIndex * -REACTION_SIZE}px;`}\n />\n )}\n {shouldRenderAnimated && (\n <AnimatedSticker\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 />\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 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';\nimport type { FC } from '../../../lib/teact/teact';\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 isCurrentUserPremium,\n onStickerSelect,\n}) => {\n const {\n loadRecentStickers,\n addRecentSticker,\n unfaveSticker,\n faveSticker,\n removeRecentSticker,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const headerRef = useRef<HTMLDivElement>(null);\n const [activeSetIndex, setActiveSetIndex] = useState<number>(0);\n\n const sendMessageAction = useSendMessageAction(chat!.id, threadId);\n\n const { observe: observeIntersection } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: STICKER_INTERSECTION_THROTTLE,\n }, (entries) => {\n entries.forEach((entry) => {\n const { id } = entry.target as HTMLDivElement;\n if (!id || !id.startsWith('sticker-set-')) {\n return;\n }\n\n const index = Number(id.replace('sticker-set-', ''));\n stickerSetIntersections[index] = entry.isIntersecting;\n });\n\n const intersectingWithIndexes = stickerSetIntersections\n .map((isIntersecting, index) => ({ index, isIntersecting }))\n .filter(({ isIntersecting }) => isIntersecting);\n\n if (!intersectingWithIndexes.length) {\n return;\n }\n\n setActiveSetIndex(intersectingWithIndexes[Math.floor(intersectingWithIndexes.length / 2)].index);\n });\n const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: headerRef });\n\n const lang = useLang();\n\n const areAddedLoaded = Boolean(addedSetIds);\n\n const allSets = useMemo(() => {\n if (!addedSetIds) {\n return MEMO_EMPTY_ARRAY;\n }\n\n const defaultSets = [];\n\n 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) return;\n loadRecentStickers();\n if (!canSendStickers) return;\n sendMessageAction({ type: 'chooseSticker' });\n }, [canSendStickers, 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 if (!canSendStickers) return;\n sendMessageAction({ type: 'chooseSticker' });\n }, [canSendStickers, 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\" />\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} />\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 useCurrentOrPrev from '../../../hooks/useCurrentOrPrev';\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 renderedIsGallery = useCurrentOrPrev(isGallery, shouldRender);\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: renderedIsGallery,\n noArrowNavigation: renderedIsGallery,\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?.length ? inlineBotResults : prevInlineBotResults;\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 renderedIsGallery && '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={renderedIsGallery}\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 React, { useMemo, memo, useRef } from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { ApiMessage, ApiUser, ApiChat } from '../../api/types';\nimport type { AnimationLevel } from '../../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 animationLevel?: AnimationLevel;\n};\n\nconst RightSearch: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n isActive,\n chat,\n messagesById,\n query,\n totalCount,\n foundIds,\n animationLevel,\n onClose,\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} animationLevel={animationLevel} withVideo />\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 animationLevel: global.settings.byKey.animationLevel,\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, 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 [search, setSearch] = useState('');\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, search);\n }, [chat.fullInfo?.members, currentUserId, search]);\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 searchPlaceholder={lang('ChannelBlockUser')}\n search={search}\n onSearchChange={setSearch}\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, useState,\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, getHasAdminRight,\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';\nimport DeleteMemberModal from '../DeleteMemberModal';\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 currentUserId?: string;\n canDeleteMembers?: boolean;\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 currentUserId,\n canDeleteMembers,\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 [deletingUserId, setDeletingUserId] = useState<string | undefined>();\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 const handleDeleteMembersModalClose = useCallback(() => {\n setDeletingUserId(undefined);\n }, []);\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n function getMemberContextAction(memberId: string) {\n return memberId === currentUserId || !canDeleteMembers ? undefined : [{\n title: lang('lng_context_remove_from_group'),\n icon: 'stop',\n handler: () => {\n setDeletingUserId(memberId);\n },\n }];\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 contextActions={getMemberContextAction(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 {canDeleteMembers && (\n <DeleteMemberModal\n isOpen={Boolean(deletingUserId)}\n userId={deletingUserId}\n onClose={handleDeleteMembersModalClose}\n />\n )}\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 const canDeleteMembers = chat && (chat.isCreator || getHasAdminRight(chat, 'banUsers'));\n\n return {\n members,\n adminMembers,\n userStatusesById,\n isChannel,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus,\n globalUserIds,\n localUserIds,\n canDeleteMembers,\n serverTimeOffset: global.serverTimeOffset,\n currentUserId: global.currentUserId,\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 { AnimationLevel } from '../../../types';\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 animationLevel: AnimationLevel;\n serverTimeOffset: number;\n};\n\nconst JoinRequest: FC<OwnProps & StateProps> = ({\n userId,\n chatId,\n about,\n date,\n isChannel,\n user,\n animationLevel,\n serverTimeOffset,\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 animationLevel={animationLevel}\n withVideo\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 animationLevel: global.settings.byKey.animationLevel,\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'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","settings","byKey","sender","isUserId","selectSender","closeMediaViewer","focusMessage","toggleChatInfo","handleFocusMessage","forceSyncOnIOs","senderTitle","getSenderTitle","Avatar","user","withVideo","chat","renderText","formatMediaDateTime","date","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","search","searchPlaceholder","loadMore","onSearchChange","onSelectChatOrUser","onCloseAnimationEnd","viewportIds","getMore","useInfiniteScroll","searchRef","resetSearch","useInputFocusOnOpen","handleSearchChange","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","activeListIds","active","archivedListIds","archived","pinnedIds","contactIds","contactList","userIds","filter","API_CHAT_TYPES","onSelectRecipient","setSearch","ids","priorityIds","unique","getGlobal","usersById","users","chatIds","isDeletedUser","getCanPostInChat","MAIN_THREAD_ID","sorted","sortChatIds","filterChatsByName","filterUsersByName","filterChatIdsByType","renderingIds","useCurrentOrPrev","setForwardChatId","exitForwardMode","isShown","markIsShown","unmarkIsShown","handleSelectRecipient","recipientId","handleClose","requestedDraft","openChatWithDraft","resetOpenChatWithDraft","requestedAttachBotInChat","cancelAttachBotInChat","callAttachBot","botId","startParam","handlePeerRecipient","getErrorHeader","error","isSlowMode","hasErrorKey","dialogs","dismissDialog","acceptInviteConfirmation","sendMessage","showNotification","isModalOpen","openModal","closeModal","dialog","contactRequest","invite","hash","title","about","participantsCount","isChannel","isRequestNeeded","participantsText","joinText","requestToJoinText","renderInviteHeader","isText","renderInvite","contact","pick","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","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","attachBot","attachMenu","bots","selectCurrentChat","theme","selectTheme","isPaymentModalOpen","payment","paymentStatus","closeWebApp","sendWebViewData","prolongWebView","toggleAttachBot","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","isAttachBot","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","cancelAttachBotInstall","confirmAttachBotInstall","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","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","isAnyModalOpen","requestedAttachBotInstall","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","query","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","onFilterChange","chatTypes","shouldMinimize","handleItemClick","newSelectedIds","handleChatTypeClick","newSelectedChatTypes","handleFilterChange","selectedType","isMinimized","canClose","isSelected","withChatType","chatFilter","folderAllOrderedIds","useFolderManagerForOrderedIds","folderArchivedOrderedIds","ARCHIVED_FOLDER_ID","displayedIds","newFilter","handleSelectedIdsChange","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","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","filterPlaceholder","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","shouldRenderStatic","shouldRenderAnimated","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","renderedIsGallery","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","deletingUserId","setDeletingUserId","adminIds","shouldUseSearchResults","listedIds","handleDeleteMembersModalClose","noScrollRestore","memberId","DeleteMemberModal","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":""} |