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AG1nG,UAAU,oBACZknG,GAAkB,0BAAK/tG,IAAK+tG,EAAgB/2F,IAAI,YAEnD,mBAAC,EAAD,CAAWq+D,KAAMw4B,EAAchgG,QAASwgG,EAAkBjhG,SAAU6gG","sources":["webpack://telegram-t/./src/hooks/useBlur.ts","webpack://telegram-t/./src/hooks/useBlurSync.ts","webpack://telegram-t/./src/components/mediaViewer/helpers/ghostAnimation.ts","webpack://telegram-t/./src/components/mediaViewer/MediaViewerActions.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewerFooter.tsx","webpack://telegram-t/./src/hooks/useFullscreen.ts","webpack://telegram-t/./src/components/mediaViewer/helpers/formatFileSize.ts","webpack://telegram-t/./src/components/mediaViewer/VideoPlayerControls.tsx","webpack://telegram-t/./src/components/mediaViewer/VideoPlayer.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewerContent.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewerSlides.tsx","webpack://telegram-t/./src/components/mediaViewer/PanZoom.tsx","webpack://telegram-t/./src/components/mediaViewer/SenderInfo.tsx","webpack://telegram-t/./src/components/mediaViewer/SlideTransition.tsx","webpack://telegram-t/./src/components/mediaViewer/ZoomControls.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewer.tsx","webpack://telegram-t/./src/components/common/ChatOrUserPicker.tsx","webpack://telegram-t/./src/components/main/ForwardPicker.tsx","webpack://telegram-t/./src/components/main/Dialogs.tsx","webpack://telegram-t/./src/components/main/Notifications.tsx","webpack://telegram-t/./src/components/main/SafeLinkModal.tsx","webpack://telegram-t/./src/components/common/CalendarModal.tsx","webpack://telegram-t/./src/components/main/HistoryCalendar.tsx","webpack://telegram-t/./src/components/main/NewContactModal.tsx","webpack://telegram-t/./src/components/main/hooks/useWebAppFrame.ts","webpack://telegram-t/./src/components/main/WebAppModal.tsx","webpack://telegram-t/./src/components/main/BotTrustModal.tsx","webpack://telegram-t/./src/components/main/BotAttachModal.tsx","webpack://telegram-t/./src/components/common/DeleteMessageModal.tsx","webpack://telegram-t/./src/components/common/PinMessageModal.tsx","webpack://telegram-t/./src/components/common/UnpinAllMessagesModal.tsx","webpack://telegram-t/./src/components/middle/hooks/useCopySelectedMessages.ts","webpack://telegram-t/./src/components/middle/DeleteSelectedMessageModal.tsx","webpack://telegram-t/./src/components/middle/MessageSelectToolbar.tsx","webpack://telegram-t/./src/components/common/SeenByModal.tsx","webpack://telegram-t/./src/components/middle/ReactorListModal.tsx","webpack://telegram-t/./src/components/middle/EmojiInteractionAnimation.tsx","webpack://telegram-t/./src/hooks/useSelectWithEnter.ts","webpack://telegram-t/./src/components/left/search/LeftSearchResultChat.tsx","webpack://telegram-t/./src/components/left/search/RecentContacts.tsx","webpack://telegram-t/./src/components/left/search/ChatMessage.tsx","webpack://telegram-t/./src/components/left/search/DateSuggest.tsx","webpack://telegram-t/./src/components/left/search/ChatResults.tsx","webpack://telegram-t/./src/components/left/search/ChatMessageResults.tsx","webpack://telegram-t/./src/components/left/search/helpers/createMapStateToProps.ts","webpack://telegram-t/./src/components/left/search/MediaResults.tsx","webpack://telegram-t/./src/components/left/search/LinkResults.tsx","webpack://telegram-t/./src/components/left/search/FileResults.tsx","webpack://telegram-t/./src/components/left/search/AudioResults.tsx","webpack://telegram-t/./src/components/left/search/LeftSearch.tsx","webpack://telegram-t/./src/hooks/reducers/useTwoFaReducer.ts","webpack://telegram-t/./src/components/left/settings/SettingsHeader.tsx","webpack://telegram-t/./src/components/left/settings/SettingsMain.tsx","webpack://telegram-t/./src/components/common/UsernameInput.tsx","webpack://telegram-t/./src/components/left/settings/SettingsEditProfile.tsx","webpack://telegram-t/./src/components/left/settings/SettingsDataStorage.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersMain.tsx","webpack://telegram-t/./src/components/ui/ShowMoreButton.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersEdit.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersChatsPicker.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFoldersChatFilters.tsx","webpack://telegram-t/./src/components/left/settings/folders/SettingsFolders.tsx","webpack://telegram-t/./src/components/middle/composer/StickerSetCoverAnimated.tsx","webpack://telegram-t/./src/components/middle/composer/StickerSetCover.tsx","webpack://telegram-t/./src/components/left/settings/SettingsStickerSet.tsx","webpack://telegram-t/./src/components/left/settings/SettingsGeneral.tsx","webpack://telegram-t/./src/util/colors.ts","webpack://telegram-t/./src/components/left/settings/WallpaperTile.tsx","webpack://telegram-t/./src/components/left/settings/SettingsGeneralBackground.tsx","webpack://telegram-t/./src/components/left/settings/SettingsGeneralBackgroundColor.tsx","webpack://telegram-t/./src/components/left/settings/SettingsNotifications.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPrivacy.tsx","webpack://telegram-t/./src/components/left/settings/SettingsLanguage.tsx","webpack://telegram-t/./src/components/left/settings/helpers/privacy.ts","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyVisibility.tsx","webpack://telegram-t/./src/components/left/settings/helpers/getSessionIcon.ts","webpack://telegram-t/./src/components/left/settings/SettingsActiveSessions.tsx","webpack://telegram-t/./src/components/left/settings/BlockUserModal.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyBlockedUsers.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaEnabled.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaPassword.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/Settings.tsx","webpack://telegram-t/./src/components/left/main/ContactList.tsx","webpack://telegram-t/./src/components/left/newChat/NewChatStep1.tsx","webpack://telegram-t/./src/components/left/newChat/NewChatStep2.tsx","webpack://telegram-t/./src/components/left/newChat/NewChat.tsx","webpack://telegram-t/./src/components/left/ArchivedChats.tsx","webpack://telegram-t/./src/components/left/ChatFolderModal.tsx","webpack://telegram-t/./src/components/middle/message/helpers/copyOptions.ts","webpack://telegram-t/./src/util/scrollLock.ts","webpack://telegram-t/./src/components/middle/message/ReactionSelectorReaction.tsx","webpack://telegram-t/./src/components/middle/message/ReactionSelector.tsx","webpack://telegram-t/./src/components/middle/message/MessageContextMenu.tsx","webpack://telegram-t/./src/components/middle/message/ContextMenuContainer.tsx","webpack://telegram-t/./src/components/common/StickerSetModal.tsx","webpack://telegram-t/./src/components/middle/HeaderMenuContainer.tsx","webpack://telegram-t/./src/components/middle/MobileSearch.tsx","webpack://telegram-t/./src/util/findInViewport.ts","webpack://telegram-t/./src/util/isFullyVisible.ts","webpack://telegram-t/./src/util/setTooltipItemVisible.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useKeyboardNavigation.ts","webpack://telegram-t/./src/components/middle/composer/MentionTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/AttachmentModal.tsx","webpack://telegram-t/./src/components/middle/composer/PollModal.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiButton.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiCategory.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiPicker.tsx","webpack://telegram-t/./src/components/middle/composer/StickerSet.tsx","webpack://telegram-t/./src/components/middle/composer/StickerPicker.tsx","webpack://telegram-t/./src/components/common/GifButton.tsx","webpack://telegram-t/./src/components/middle/composer/GifPicker.tsx","webpack://telegram-t/./src/components/middle/composer/SymbolMenuFooter.tsx","webpack://telegram-t/./src/components/middle/composer/SymbolMenu.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommand.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommandTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommandMenu.tsx","webpack://telegram-t/./src/components/middle/composer/StickerTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/CustomSendMenu.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/BaseResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/MediaResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/ArticleResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/GifResult.tsx","webpack://telegram-t/./src/components/middle/composer/inlineResults/StickerResult.tsx","webpack://telegram-t/./src/components/middle/composer/InlineBotTooltip.tsx","webpack://telegram-t/./src/components/middle/composer/SendAsMenu.tsx","webpack://telegram-t/./src/components/right/RightSearch.tsx","webpack://telegram-t/./src/components/right/StickerSetResult.tsx","webpack://telegram-t/./src/components/right/StickerSearch.tsx","webpack://telegram-t/./src/components/right/GifSearch.tsx","webpack://telegram-t/./src/components/right/statistics/StatisticsOverview.tsx","webpack://telegram-t/./src/components/right/statistics/StatisticsRecentMessage.tsx","webpack://telegram-t/./src/components/right/statistics/Statistics.tsx","webpack://telegram-t/./src/components/right/statistics/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/util/countries.ts","webpack://telegram-t/./src/hooks/reducers/usePaymentReducer.ts","webpack://telegram-t/./src/hooks/useFocusAfterAnimation.tsx","webpack://telegram-t/./src/components/ui/Select.tsx","webpack://telegram-t/./src/components/payment/ShippingInfo.tsx","webpack://telegram-t/./src/components/payment/Shipping.tsx","webpack://telegram-t/./src/components/payment/Checkout.tsx","webpack://telegram-t/./src/components/payment/ExpiryInput.tsx","webpack://telegram-t/./src/components/middle/helpers/inputFormatters.ts","webpack://telegram-t/./src/components/payment/CardInput.tsx","webpack://telegram-t/./src/components/payment/PaymentInfo.tsx","webpack://telegram-t/./src/components/payment/ConfirmPayment.tsx","webpack://telegram-t/./src/components/payment/PaymentModal.tsx","webpack://telegram-t/./src/components/payment/ReceiptModal.tsx","webpack://telegram-t/./src/components/common/PasswordForm.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 { useEffect, useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport { imgToCanvas } from '../util/files';\nimport useForceUpdate from './useForceUpdate';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\nconst MAX_CACHE_SIZE = 1000;\n\nconst cache = new Map<string, string>();\n\nexport default function useBlur(dataUri?: string, isDisabled = false, delay?: number) {\n const blurredRef = useRef<string | undefined>(dataUri ? cache.get(dataUri) : undefined);\n const timeoutRef = useRef<number>();\n const forceUpdate = useForceUpdate();\n\n if (timeoutRef.current && isDisabled) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n\n useEffect(() => {\n if (!dataUri || blurredRef.current || isDisabled) {\n return;\n }\n\n const img = new Image();\n\n img.onload = () => {\n const canvas = imgToCanvas(img);\n fastBlur(canvas.getContext('2d'), 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n const blurredDataUri = canvas.toDataURL();\n\n blurredRef.current = blurredDataUri;\n forceUpdate();\n\n if (cache.size >= MAX_CACHE_SIZE) {\n cache.clear();\n }\n cache.set(dataUri, blurredDataUri);\n };\n\n if (delay) {\n timeoutRef.current = window.setTimeout(() => {\n img.src = dataUri;\n }, delay);\n } else {\n img.src = dataUri;\n }\n }, [dataUri, delay, forceUpdate, isDisabled]);\n\n return blurredRef.current;\n}\n","import { useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport useOnChange from './useOnChange';\nimport useBlur from './useBlur';\nimport { imgToCanvas } from '../util/files';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\n\nexport default function useBlurSync(dataUri: string | false | undefined) {\n const blurredRef = useRef<string>();\n\n let isChanged = false;\n\n useOnChange(() => {\n isChanged = true;\n\n blurredRef.current = undefined;\n\n if (!dataUri) {\n return;\n }\n\n const img = new Image();\n img.src = dataUri;\n if (!img.width) {\n return;\n }\n\n const canvas = imgToCanvas(img);\n fastBlur(canvas.getContext('2d'), 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n\n blurredRef.current = canvas.toDataURL();\n }, [dataUri]);\n\n // Sometimes `Image` do not manage to load synchronously,\n // so we fall back the non-blurred variant and prepare the async one at least for the next time\n const blurredAsync = useBlur(dataUri || undefined, Boolean(blurredRef.current));\n\n return blurredRef.current || (!isChanged && blurredAsync) || dataUri || undefined;\n}\n","import { 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';\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 isElementInViewport(el: HTMLElement) {\n if (el.style.display === 'none') {\n return false;\n }\n\n const rect = el.getBoundingClientRect();\n const { height: windowHeight } = windowSize.get();\n\n return (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\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 React, {\n FC,\n memo,\n useCallback,\n useMemo,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiMessage } from '../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { getMessageMediaHash } from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport { selectIsDownloading, selectIsMessageProtected } from '../../global/selectors';\n\nimport Button from '../ui/Button';\nimport DropdownMenu from '../ui/DropdownMenu';\nimport MenuItem from '../ui/MenuItem';\nimport ProgressSpinner from '../ui/ProgressSpinner';\n\nimport './MediaViewerActions.scss';\n\ntype StateProps = {\n isDownloading: boolean;\n isProtected?: boolean;\n};\n\ntype OwnProps = {\n mediaData?: string;\n isVideo: boolean;\n isZoomed: boolean;\n message?: ApiMessage;\n fileName?: string;\n isAvatar?: boolean;\n canReport?: boolean;\n onReport: NoneToVoidFunction;\n onCloseMediaViewer: NoneToVoidFunction;\n onForward: NoneToVoidFunction;\n onZoomToggle: NoneToVoidFunction;\n};\n\nconst MediaViewerActions: FC<OwnProps & StateProps> = ({\n mediaData,\n isVideo,\n isZoomed,\n message,\n fileName,\n isAvatar,\n isDownloading,\n isProtected,\n canReport,\n onReport,\n onCloseMediaViewer,\n onForward,\n onZoomToggle,\n}) => {\n const {\n downloadMessageMedia,\n cancelMessageMediaDownload,\n } = getActions();\n\n const { loadProgress: downloadProgress } = useMediaWithLoadProgress(\n message && getMessageMediaHash(message, 'download'),\n !isDownloading,\n );\n\n const handleDownloadClick = useCallback(() => {\n if (isDownloading) {\n cancelMessageMediaDownload({ message: message! });\n } else {\n downloadMessageMedia({ message: message! });\n }\n }, [cancelMessageMediaDownload, downloadMessageMedia, isDownloading, message]);\n\n const 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={isZoomed ? 'Zoom Out' : 'Zoom In'}\n onClick={onZoomToggle}\n >\n <i className={isZoomed ? 'icon-zoom-out' : '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 React, { FC, useEffect, useState } from '../../lib/teact/teact';\n\nimport { TextPart } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { throttle } from '../../util/schedulers';\nimport buildClassName from '../../util/buildClassName';\nimport { REM } from '../common/helpers/mediaDimensions';\n\nimport './MediaViewerFooter.scss';\n\nconst RESIZE_THROTTLE_MS = 500;\n\ntype OwnProps = {\n text: TextPart | TextPart[];\n onClick: () => void;\n isHidden?: boolean;\n isForVideo: boolean;\n};\n\nconst MediaViewerFooter: FC<OwnProps> = ({\n text = '', isHidden, isForVideo, onClick,\n}) => {\n const [isMultiline, setIsMultiline] = useState(false);\n useEffect(() => {\n const footerContent = document.querySelector('.MediaViewerFooter .media-text') as HTMLDivElement | null;\n\n const checkIsMultiline = () => {\n const height = footerContent ? footerContent.clientHeight : 0;\n\n setIsMultiline(height > REM * 2);\n };\n\n // First run for initial detection of multiline footer text\n checkIsMultiline();\n\n const handleResize = throttle(checkIsMultiline, RESIZE_THROTTLE_MS, true);\n\n window.addEventListener('resize', handleResize, false);\n\n return () => {\n window.removeEventListener('resize', handleResize, false);\n };\n }, []);\n\n function stopEvent(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (text) {\n e.stopPropagation();\n }\n }\n\n const classNames = buildClassName(\n 'MediaViewerFooter',\n isForVideo && 'is-for-video',\n isHidden && 'is-hidden',\n );\n\n return (\n <div className={classNames} onClick={stopEvent}>\n {text && (\n <div className=\"media-viewer-footer-content\" onClick={!IS_SINGLE_COLUMN_LAYOUT ? onClick : undefined}>\n <p className={`media-text custom-scroll ${isMultiline ? 'multiline' : ''}`} dir=\"auto\">{text}</p>\n </div>\n )}\n </div>\n );\n};\n\nexport default MediaViewerFooter;\n","import { useLayoutEffect, useState } from '../lib/teact/teact';\nimport { PLATFORM_ENV } from '../util/environment';\n\ntype RefType = {\n current: HTMLElement | null;\n};\n\ntype ReturnType = [boolean, () => void, () => void] | [false];\ntype CallbackType = (isPlayed: boolean) => void;\n\nconst prop = getBrowserFullscreenElementProp();\n\nexport default function useFullscreenStatus(elRef: RefType, setIsPlayed: CallbackType): ReturnType {\n const [isFullscreen, setIsFullscreen] = useState(Boolean(prop && document[prop]));\n\n const setFullscreen = () => {\n if (!elRef.current || !(prop || PLATFORM_ENV === 'iOS')) {\n return;\n }\n\n if (elRef.current.requestFullscreen) {\n elRef.current.requestFullscreen();\n } else if (elRef.current.webkitRequestFullscreen) {\n elRef.current.webkitRequestFullscreen();\n } else if (elRef.current.webkitEnterFullscreen) {\n elRef.current.webkitEnterFullscreen();\n } else if (elRef.current.mozRequestFullScreen) {\n elRef.current.mozRequestFullScreen();\n }\n\n setIsFullscreen(true);\n };\n\n const exitFullscreen = () => {\n if (!elRef.current) {\n return;\n }\n\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.webkitCancelFullScreen) {\n document.webkitCancelFullScreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n }\n\n setIsFullscreen(false);\n };\n\n useLayoutEffect(() => {\n const listener = () => { setIsFullscreen(Boolean(prop && document[prop])); };\n const listenerEnter = () => { setIsFullscreen(true); };\n const listenerExit = () => {\n setIsFullscreen(false);\n setIsPlayed(false);\n };\n const video = elRef.current;\n\n document.addEventListener('fullscreenchange', listener, false);\n document.addEventListener('webkitfullscreenchange', listener, false);\n document.addEventListener('mozfullscreenchange', listener, false);\n\n if (video) {\n video.addEventListener('webkitbeginfullscreen', listenerEnter, false);\n video.addEventListener('webkitendfullscreen', listenerExit, false);\n }\n\n return () => {\n document.removeEventListener('fullscreenchange', listener, false);\n document.removeEventListener('webkitfullscreenchange', listener, false);\n document.removeEventListener('mozfullscreenchange', listener, false);\n if (video) {\n video.removeEventListener('webkitbeginfullscreen', listenerEnter, false);\n video.removeEventListener('webkitendfullscreen', listenerExit, false);\n }\n };\n // eslint-disable-next-line\n }, []);\n\n if (!prop && PLATFORM_ENV !== 'iOS') {\n return [false];\n }\n\n return [isFullscreen, setFullscreen, exitFullscreen];\n}\n\nfunction getBrowserFullscreenElementProp() {\n if (typeof document.fullscreenElement !== 'undefined') {\n return 'fullscreenElement';\n } else if (typeof document.mozFullScreenElement !== 'undefined') {\n return 'mozFullScreenElement';\n } else if (typeof document.webkitFullscreenElement !== 'undefined') {\n return 'webkitFullscreenElement';\n }\n\n return '';\n}\n","const units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'];\n\nconst formatFileSize = (bytes: number) => {\n const number = bytes === 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024));\n\n return `${(bytes / 1024 ** Math.floor(number)).toFixed(1)} ${units[number]}`;\n};\n\nexport default formatFileSize;\n","import React, {\n FC, useEffect, useRef, useCallback, useMemo,\n} from '../../lib/teact/teact';\nimport buildClassName from '../../util/buildClassName';\n\nimport useFlag from '../../hooks/useFlag';\nimport { IS_IOS, IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { formatMediaDuration } from '../../util/dateFormat';\nimport formatFileSize from './helpers/formatFileSize';\nimport useLang from '../../hooks/useLang';\nimport { BufferedRange } from '../../hooks/useBuffering';\nimport { captureEvents } from '../../util/captureEvents';\n\nimport Button from '../ui/Button';\nimport RangeSlider from '../ui/RangeSlider';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\n\nimport './VideoPlayerControls.scss';\n\ntype OwnProps = {\n bufferedRanges: BufferedRange[];\n bufferedProgress: number;\n currentTime: number;\n duration: number;\n fileSize: number;\n isForceMobileVersion?: boolean;\n isPlayed: boolean;\n isFullscreenSupported: boolean;\n isFullscreen: boolean;\n isVisible: boolean;\n isBuffered: boolean;\n volume: number;\n isMuted: boolean;\n playbackRate: number;\n onChangeFullscreen: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n onVolumeClick: () => void;\n onVolumeChange: (volume: number) => void;\n onPlaybackRateChange: (playbackRate: number) => void;\n onPlayPause: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n setVisibility: (isVisible: boolean) => void;\n onSeek: (position: number) => void;\n};\n\nconst stopEvent = (e: React.MouseEvent<HTMLElement>) => {\n e.stopPropagation();\n};\n\nconst PLAYBACK_RATES = [\n 0.5,\n 1,\n 1.5,\n 2,\n];\n\nconst HIDE_CONTROLS_TIMEOUT_MS = 1500;\n\nconst VideoPlayerControls: FC<OwnProps> = ({\n bufferedRanges,\n bufferedProgress,\n currentTime,\n duration,\n fileSize,\n isForceMobileVersion,\n isPlayed,\n isFullscreenSupported,\n isFullscreen,\n isVisible,\n isBuffered,\n volume,\n isMuted,\n playbackRate,\n onChangeFullscreen,\n onVolumeClick,\n onVolumeChange,\n onPlaybackRateChange,\n onPlayPause,\n setVisibility,\n onSeek,\n}) => {\n const [isPlaybackMenuOpen, openPlaybackMenu, closePlaybackMenu] = useFlag();\n // eslint-disable-next-line no-null/no-null\n const seekerRef = useRef<HTMLDivElement>(null);\n const isSeekingRef = useRef<boolean>(false);\n const isSeeking = isSeekingRef.current;\n\n useEffect(() => {\n let timeout: number | undefined;\n if (!isVisible || !isPlayed || isSeeking || isPlaybackMenuOpen) {\n if (timeout) window.clearTimeout(timeout);\n return undefined;\n }\n timeout = window.setTimeout(() => {\n setVisibility(false);\n }, HIDE_CONTROLS_TIMEOUT_MS);\n return () => {\n if (timeout) window.clearTimeout(timeout);\n };\n }, [isPlayed, isVisible, isSeeking, setVisibility, isPlaybackMenuOpen]);\n\n useEffect(() => {\n if (isVisible) {\n document.body.classList.add('video-controls-visible');\n } else {\n document.body.classList.remove('video-controls-visible');\n }\n return () => {\n document.body.classList.remove('video-controls-visible');\n };\n }, [isVisible]);\n\n useEffect(() => {\n if (!isVisible) {\n closePlaybackMenu();\n }\n }, [closePlaybackMenu, isVisible]);\n\n const lang = useLang();\n\n const handleSeek = useCallback((e: MouseEvent | TouchEvent) => {\n if (isSeekingRef.current && seekerRef.current) {\n const {\n width,\n left,\n } = seekerRef.current.getBoundingClientRect();\n const clientX = e instanceof MouseEvent ? e.clientX : e.targetTouches[0].clientX;\n onSeek(Math.max(Math.min(duration * ((clientX - left) / width), duration), 0));\n }\n }, [duration, onSeek]);\n\n const handleStartSeek = useCallback((e: MouseEvent | TouchEvent) => {\n isSeekingRef.current = true;\n handleSeek(e);\n }, [handleSeek]);\n\n const handleStopSeek = useCallback(() => {\n isSeekingRef.current = false;\n }, []);\n\n useEffect(() => {\n if (!seekerRef.current || !isVisible) return undefined;\n return captureEvents(seekerRef.current, {\n onCapture: handleStartSeek,\n onRelease: handleStopSeek,\n onClick: handleStopSeek,\n onDrag: handleSeek,\n });\n }, [isVisible, handleStartSeek, handleSeek, handleStopSeek]);\n\n const volumeIcon = useMemo(() => {\n if (volume === 0 || isMuted) return 'icon-muted';\n if (volume < 0.3) return 'icon-volume-1';\n if (volume < 0.6) return 'icon-volume-2';\n return 'icon-volume-3';\n }, [volume, isMuted]);\n\n return (\n <div\n className={buildClassName('VideoPlayerControls', isForceMobileVersion && 'mobile', isVisible && 'active')}\n onClick={stopEvent}\n >\n {renderSeekLine(currentTime, duration, bufferedRanges, seekerRef)}\n <div className=\"buttons\">\n <Button\n ariaLabel={lang('AccActionPlay')}\n size=\"tiny\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n color=\"translucent-white\"\n className=\"play\"\n round\n onClick={onPlayPause}\n >\n <i className={isPlayed ? 'icon-pause' : 'icon-play'} />\n </Button>\n <Button\n ariaLabel=\"Volume\"\n size=\"tiny\"\n color=\"translucent-white\"\n className=\"volume\"\n round\n onClick={onVolumeClick}\n >\n <i className={volumeIcon} />\n </Button>\n {!IS_IOS && (\n <RangeSlider bold className=\"volume-slider\" value={isMuted ? 0 : volume * 100} onChange={onVolumeChange} />\n )}\n {renderTime(currentTime, duration)}\n {!isBuffered && renderFileSize(bufferedProgress, fileSize)}\n <div className=\"spacer\" />\n <Button\n ariaLabel=\"Playback rate\"\n size=\"tiny\"\n color=\"translucent-white\"\n className=\"playback-rate\"\n round\n onClick={openPlaybackMenu}\n >\n {`${playbackRate}x`}\n </Button>\n {isFullscreenSupported && (\n <Button\n ariaLabel=\"Fullscreen\"\n size=\"tiny\"\n color=\"translucent-white\"\n className=\"fullscreen\"\n round\n onClick={onChangeFullscreen}\n >\n <i className={isFullscreen ? 'icon-smallscreen' : 'icon-fullscreen'} />\n </Button>\n )}\n </div>\n <Menu\n isOpen={isPlaybackMenuOpen}\n className=\"playback-rate-menu\"\n positionX=\"right\"\n positionY=\"bottom\"\n autoClose\n onClose={closePlaybackMenu}\n >\n {PLAYBACK_RATES.map((rate) => (\n // eslint-disable-next-line react/jsx-no-bind\n <MenuItem disabled={playbackRate === rate} onClick={() => onPlaybackRateChange(rate)}>\n {`${rate}x`}\n </MenuItem>\n ))}\n </Menu>\n </div>\n );\n};\n\nfunction renderTime(currentTime: number, duration: number) {\n return (\n <div className=\"player-time\">\n {`${formatMediaDuration(currentTime)} / ${formatMediaDuration(duration)}`}\n </div>\n );\n}\n\nfunction renderFileSize(loadedPercent: number, totalSize: number) {\n return (\n <div className=\"player-file-size\">\n {`${formatFileSize(totalSize * loadedPercent)} / ${formatFileSize(totalSize)}`}\n </div>\n );\n}\n\nfunction renderSeekLine(\n currentTime: number, duration: number, bufferedRanges: BufferedRange[], seekerRef: React.RefObject<HTMLDivElement>,\n) {\n const percentagePlayed = (currentTime / duration) * 100;\n\n return (\n <div className=\"player-seekline\" ref={seekerRef}>\n <div className=\"player-seekline-track\">\n {bufferedRanges.map(({ start, end }) => (\n <div\n className=\"player-seekline-buffered\"\n style={`left: ${start * 100}%; right: ${100 - end * 100}%`}\n />\n ))}\n <div\n className=\"player-seekline-played\"\n style={`width: ${percentagePlayed || 0}%`}\n />\n </div>\n </div>\n );\n}\n\nexport default VideoPlayerControls;\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport { ApiDimensions } from '../../api/types';\n\nimport useBuffering from '../../hooks/useBuffering';\nimport useFullscreenStatus from '../../hooks/useFullscreen';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useVideoCleanup from '../../hooks/useVideoCleanup';\nimport { IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport safePlay from '../../util/safePlay';\n\nimport Button from '../ui/Button';\nimport ProgressSpinner from '../ui/ProgressSpinner';\n\nimport './VideoPlayer.scss';\n\nimport VideoPlayerControls from './VideoPlayerControls';\n\ntype OwnProps = {\n url?: string;\n isGif?: boolean;\n posterData?: string;\n posterSize?: ApiDimensions;\n loadProgress?: number;\n fileSize: number;\n isMediaViewerOpen?: boolean;\n noPlay?: boolean;\n areControlsVisible: boolean;\n volume: number;\n isMuted: boolean;\n playbackRate: number;\n toggleControls: (isVisible: boolean) => void;\n onClose: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n};\n\nconst MOBILE_VERSION_CONTROL_WIDTH = 400;\n\nconst VideoPlayer: FC<OwnProps> = ({\n url,\n isGif,\n posterData,\n posterSize,\n loadProgress,\n fileSize,\n isMediaViewerOpen,\n noPlay,\n volume,\n isMuted,\n playbackRate,\n onClose,\n toggleControls,\n areControlsVisible,\n}) => {\n const {\n setMediaViewerVolume,\n setMediaViewerMuted,\n setMediaViewerPlaybackRate,\n } = getActions();\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isPlayed, setIsPlayed] = useState(!IS_TOUCH_ENV || !IS_IOS);\n const [currentTime, setCurrentTime] = useState(0);\n\n const [isFullscreen, setFullscreen, exitFullscreen] = useFullscreenStatus(videoRef, setIsPlayed);\n\n const {\n isBuffered, bufferedRanges, bufferingHandlers, bufferedProgress,\n } = useBuffering();\n const {\n shouldRender: shouldRenderSpinner,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(!isBuffered, undefined, undefined, 'slow');\n const {\n shouldRender: shouldRenderPlayButton,\n transitionClassNames: playButtonClassNames,\n } = useShowTransition(IS_IOS && !isPlayed && !shouldRenderSpinner, undefined, undefined, 'slow');\n\n useEffect(() => {\n if (noPlay || !isMediaViewerOpen) {\n videoRef.current!.pause();\n } else if (url && !IS_TOUCH_ENV) {\n // Chrome does not automatically start playing when `url` becomes available (even with `autoPlay`),\n // so we force it here. Contrary, iOS does not allow to call `play` without mouse event,\n // so we need to use `autoPlay` instead to allow pre-buffering.\n safePlay(videoRef.current!);\n }\n }, [noPlay, isMediaViewerOpen, url]);\n\n useEffect(() => {\n if (videoRef.current!.currentTime === videoRef.current!.duration) {\n setCurrentTime(0);\n setIsPlayed(false);\n } else {\n setCurrentTime(videoRef.current!.currentTime);\n }\n }, [currentTime]);\n\n useEffect(() => {\n videoRef.current!.volume = volume;\n }, [volume]);\n\n useEffect(() => {\n videoRef.current!.playbackRate = playbackRate;\n }, [playbackRate]);\n\n const togglePlayState = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent> | KeyboardEvent) => {\n e.stopPropagation();\n if (isPlayed) {\n videoRef.current!.pause();\n setIsPlayed(false);\n } else {\n safePlay(videoRef.current!);\n setIsPlayed(true);\n }\n }, [isPlayed]);\n\n useVideoCleanup(videoRef, []);\n\n const handleMouseMove = useCallback(() => {\n toggleControls(true);\n }, [toggleControls]);\n\n const handleMouseOut = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (e.target === videoRef.current) {\n toggleControls(false);\n }\n }, [toggleControls]);\n\n const handleTimeUpdate = useCallback((e: React.SyntheticEvent<HTMLVideoElement>) => {\n setCurrentTime(e.currentTarget.currentTime);\n }, []);\n\n const handleEnded = useCallback(() => {\n setCurrentTime(0);\n setIsPlayed(false);\n toggleControls(true);\n }, [toggleControls]);\n\n const handleFullscreenChange = useCallback(() => {\n if (isFullscreen && exitFullscreen) {\n exitFullscreen();\n } else if (!isFullscreen && setFullscreen) {\n setFullscreen();\n }\n }, [exitFullscreen, isFullscreen, setFullscreen]);\n\n const handleSeek = useCallback((position: number) => {\n videoRef.current!.currentTime = position;\n }, []);\n\n const handleVolumeChange = useCallback((newVolume: number) => {\n setMediaViewerVolume({ volume: newVolume / 100 });\n }, [setMediaViewerVolume]);\n\n const handleVolumeMuted = useCallback(() => {\n setMediaViewerMuted({ isMuted: !isMuted });\n }, [isMuted, setMediaViewerMuted]);\n\n const handlePlaybackRateChange = useCallback((newPlaybackRate: number) => {\n setMediaViewerPlaybackRate({ playbackRate: newPlaybackRate });\n }, [setMediaViewerPlaybackRate]);\n\n useEffect(() => {\n if (!isMediaViewerOpen) return undefined;\n const togglePayingStateBySpace = (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n togglePlayState(e);\n }\n };\n\n document.addEventListener('keydown', togglePayingStateBySpace, false);\n\n return () => {\n document.removeEventListener('keydown', togglePayingStateBySpace, false);\n };\n }, [togglePlayState, isMediaViewerOpen]);\n\n const wrapperStyle = posterSize && `width: ${posterSize.width}px; height: ${posterSize.height}px`;\n const videoStyle = `background-image: url(${posterData})`;\n\n return (\n <div\n className=\"VideoPlayer\"\n onMouseMove={!isGif && !IS_TOUCH_ENV ? handleMouseMove : undefined}\n onMouseOut={!isGif && !IS_TOUCH_ENV ? handleMouseOut : undefined}\n >\n <div\n style={wrapperStyle}\n >\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <video\n ref={videoRef}\n autoPlay={IS_TOUCH_ENV}\n playsInline\n loop={isGif}\n // This is to force auto playing on mobiles\n muted={isGif || isMuted}\n id=\"media-viewer-video\"\n style={videoStyle}\n onPlay={IS_IOS ? () => setIsPlayed(true) : undefined}\n onEnded={handleEnded}\n onClick={!IS_SINGLE_COLUMN_LAYOUT ? togglePlayState : undefined}\n onDoubleClick={!IS_TOUCH_ENV ? handleFullscreenChange : undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...bufferingHandlers}\n onTimeUpdate={handleTimeUpdate}\n >\n {url && <source src={url} />}\n </video>\n </div>\n {shouldRenderPlayButton && (\n <Button round className={`play-button ${playButtonClassNames}`} onClick={togglePlayState}>\n <i className=\"icon-play\" />\n </Button>\n )}\n {shouldRenderSpinner && (\n <div className={['spinner-container', spinnerClassNames].join(' ')}>\n {!isBuffered && <div className=\"buffering\">Buffering...</div>}\n <ProgressSpinner\n size=\"xl\"\n progress={isBuffered ? 1 : loadProgress}\n square\n onClick={onClose}\n />\n </div>\n )}\n {!isGif && !shouldRenderSpinner && (\n <VideoPlayerControls\n isPlayed={isPlayed}\n bufferedRanges={bufferedRanges}\n bufferedProgress={bufferedProgress}\n isBuffered={isBuffered}\n currentTime={currentTime}\n isFullscreenSupported={Boolean(setFullscreen)}\n isFullscreen={isFullscreen}\n fileSize={fileSize}\n duration={videoRef.current ? videoRef.current.duration || 0 : 0}\n isVisible={areControlsVisible}\n setVisibility={toggleControls}\n isForceMobileVersion={posterSize && posterSize.width < MOBILE_VERSION_CONTROL_WIDTH}\n onSeek={handleSeek}\n onChangeFullscreen={handleFullscreenChange}\n onPlayPause={togglePlayState}\n volume={volume}\n playbackRate={playbackRate}\n isMuted={isMuted}\n onVolumeClick={handleVolumeMuted}\n onVolumeChange={handleVolumeChange}\n onPlaybackRateChange={handlePlaybackRateChange}\n />\n )}\n </div>\n );\n};\n\nexport default memo(VideoPlayer);\n","import React, { FC, memo, useCallback } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport {\n ApiChat, ApiDimensions, ApiMediaFormat, ApiMessage, ApiUser,\n} from '../../api/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport useBlurSync from '../../hooks/useBlurSync';\nimport useMedia from '../../hooks/useMedia';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport {\n getChatAvatarHash,\n getMessageDocument,\n getMessageFileSize,\n getMessageMediaFormat,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessagePhoto,\n getMessageVideo,\n getMessageWebPagePhoto,\n getMessageWebPageVideo,\n getPhotoFullDimensions,\n getVideoDimensions,\n isMessageDocumentPhoto,\n isMessageDocumentVideo,\n} from '../../global/helpers';\nimport {\n selectChat, selectChatMessage, selectIsMessageProtected, selectScheduledMessage, selectUser,\n} from '../../global/selectors';\nimport { AVATAR_FULL_DIMENSIONS, calculateMediaViewerDimensions } from '../common/helpers/mediaDimensions';\nimport { renderMessageText } from '../common/helpers/renderMessageText';\nimport stopEvent from '../../util/stopEvent';\n\nimport Spinner from '../ui/Spinner';\nimport MediaViewerFooter from './MediaViewerFooter';\nimport VideoPlayer from './VideoPlayer';\n\nimport './MediaViewerContent.scss';\n\ntype OwnProps = {\n messageId?: number;\n chatId?: string;\n threadId?: number;\n avatarOwnerId?: string;\n profilePhotoIndex?: number;\n origin?: MediaViewerOrigin;\n isActive?: boolean;\n animationLevel: 0 | 1 | 2;\n onClose: () => void;\n onFooterClick: () => void;\n setIsFooterHidden?: (isHidden: boolean) => void;\n isFooterHidden?: boolean;\n};\n\ntype StateProps = {\n chatId?: string;\n messageId?: number;\n senderId?: string;\n threadId?: number;\n avatarOwner?: ApiChat | ApiUser;\n profilePhotoIndex?: number;\n message?: ApiMessage;\n origin?: MediaViewerOrigin;\n isProtected?: boolean;\n volume: number;\n isMuted: boolean;\n playbackRate: number;\n};\n\nconst ANIMATION_DURATION = 350;\n\nconst MediaViewerContent: FC<OwnProps & StateProps> = (props) => {\n const {\n messageId,\n isActive,\n avatarOwner,\n chatId,\n message,\n profilePhotoIndex,\n origin,\n animationLevel,\n isFooterHidden,\n isProtected,\n volume,\n playbackRate,\n isMuted,\n onClose,\n onFooterClick,\n setIsFooterHidden,\n } = props;\n /* Content */\n const photo = message ? getMessagePhoto(message) : undefined;\n const video = message ? getMessageVideo(message) : undefined;\n const webPagePhoto = message ? getMessageWebPagePhoto(message) : undefined;\n const webPageVideo = message ? getMessageWebPageVideo(message) : undefined;\n const isDocumentPhoto = message ? isMessageDocumentPhoto(message) : false;\n const isDocumentVideo = message ? isMessageDocumentVideo(message) : false;\n const isVideo = Boolean(video || webPageVideo || isDocumentVideo);\n const isPhoto = Boolean(!isVideo && (photo || webPagePhoto || isDocumentPhoto));\n const { isGif } = video || webPageVideo || {};\n\n const isOpen = Boolean(avatarOwner || messageId);\n const isAvatar = Boolean(avatarOwner);\n\n const isFromSharedMedia = origin === MediaViewerOrigin.SharedMedia;\n const isFromSearch = origin === MediaViewerOrigin.SearchResult;\n\n const isGhostAnimation = animationLevel === 2;\n\n /* Media data */\n function getMediaHash(isFull?: boolean) {\n if (isAvatar && profilePhotoIndex !== undefined) {\n const { photos } = avatarOwner!;\n return photos && photos[profilePhotoIndex]\n ? `photo${photos[profilePhotoIndex].id}?size=c`\n : getChatAvatarHash(avatarOwner!, isFull ? 'big' : 'normal');\n }\n\n return message && getMessageMediaHash(message, isFull ? 'viewerFull' : 'viewerPreview');\n }\n\n const pictogramBlobUrl = useMedia(\n message && (isFromSharedMedia || isFromSearch) && getMessageMediaHash(message, 'pictogram'),\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const previewMediaHash = getMediaHash();\n const previewBlobUrl = useMedia(\n previewMediaHash,\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const {\n mediaData: fullMediaBlobUrl,\n loadProgress,\n } = useMediaWithLoadProgress(\n getMediaHash(true),\n undefined,\n message && getMessageMediaFormat(message, 'viewerFull'),\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n\n const toggleControls = useCallback((isVisible) => {\n setIsFooterHidden?.(!isVisible);\n }, [setIsFooterHidden]);\n\n const localBlobUrl = (photo || video) ? (photo || video)!.blobUrl : undefined;\n let bestImageData = (!isVideo && (localBlobUrl || fullMediaBlobUrl)) || previewBlobUrl || pictogramBlobUrl;\n const thumbDataUri = useBlurSync(!bestImageData && message && getMessageMediaThumbDataUri(message));\n if (!bestImageData && origin !== MediaViewerOrigin.SearchResult) {\n bestImageData = thumbDataUri;\n }\n\n const videoSize = message ? getMessageFileSize(message) : undefined;\n\n let dimensions!: ApiDimensions;\n if (message) {\n if (isDocumentPhoto || isDocumentVideo) {\n dimensions = getMessageDocument(message)!.mediaSize!;\n } else if (photo || webPagePhoto) {\n dimensions = getPhotoFullDimensions((photo || webPagePhoto)!)!;\n } else if (video || webPageVideo) {\n dimensions = getVideoDimensions((video || webPageVideo)!)!;\n }\n } else {\n dimensions = AVATAR_FULL_DIMENSIONS;\n }\n\n if (isAvatar) {\n return (\n <div key={chatId} className=\"MediaViewerContent\">\n {renderPhoto(\n fullMediaBlobUrl || previewBlobUrl,\n calculateMediaViewerDimensions(AVATAR_FULL_DIMENSIONS, false),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n )}\n </div>\n );\n }\n\n if (!message) return undefined;\n const textParts = renderMessageText(message);\n const hasFooter = Boolean(textParts);\n\n return (\n <div\n className={`MediaViewerContent ${hasFooter ? 'has-footer' : ''}`}\n >\n {isProtected && <div onContextMenu={stopEvent} className=\"protector\" />}\n {isPhoto && renderPhoto(\n localBlobUrl || fullMediaBlobUrl || previewBlobUrl || pictogramBlobUrl,\n message && calculateMediaViewerDimensions(dimensions!, hasFooter),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n )}\n {isVideo && ((!isActive && IS_TOUCH_ENV) ? renderVideoPreview(\n bestImageData,\n message && calculateMediaViewerDimensions(dimensions!, hasFooter, true),\n !IS_SINGLE_COLUMN_LAYOUT && !isProtected,\n ) : (\n <VideoPlayer\n key={messageId}\n url={localBlobUrl || fullMediaBlobUrl}\n isGif={isGif}\n posterData={bestImageData}\n posterSize={message && calculateMediaViewerDimensions(dimensions!, hasFooter, true)}\n loadProgress={loadProgress}\n fileSize={videoSize!}\n isMediaViewerOpen={isOpen && isActive}\n areControlsVisible={!isFooterHidden}\n toggleControls={toggleControls}\n noPlay={!isActive}\n onClose={onClose}\n isMuted={isMuted}\n volume={volume}\n playbackRate={playbackRate}\n />\n ))}\n {textParts && (\n <MediaViewerFooter\n text={textParts}\n onClick={onFooterClick}\n isHidden={isFooterHidden && IS_TOUCH_ENV}\n isForVideo={isVideo && !isGif}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, ownProps): StateProps => {\n const {\n chatId,\n threadId,\n messageId,\n avatarOwnerId,\n profilePhotoIndex,\n origin,\n } = ownProps;\n\n const {\n volume,\n isMuted,\n playbackRate,\n } = global.mediaViewer;\n\n if (origin === MediaViewerOrigin.SearchResult) {\n if (!(chatId && messageId)) {\n return { volume, isMuted, playbackRate };\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n if (!message) {\n return { volume, isMuted, playbackRate };\n }\n\n return {\n chatId,\n messageId,\n senderId: message.senderId,\n origin,\n message,\n isProtected: selectIsMessageProtected(global, message),\n volume,\n isMuted,\n playbackRate,\n };\n }\n\n if (avatarOwnerId) {\n const sender = selectUser(global, avatarOwnerId) || selectChat(global, avatarOwnerId);\n\n return {\n messageId: -1,\n senderId: avatarOwnerId,\n avatarOwner: sender,\n profilePhotoIndex: profilePhotoIndex || 0,\n origin,\n volume,\n isMuted,\n playbackRate,\n };\n }\n\n if (!(chatId && threadId && messageId)) {\n return { volume, isMuted, playbackRate };\n }\n\n let message: ApiMessage | undefined;\n if (origin && [MediaViewerOrigin.ScheduledAlbum, MediaViewerOrigin.ScheduledInline].includes(origin)) {\n message = selectScheduledMessage(global, chatId, messageId);\n } else {\n message = selectChatMessage(global, chatId, messageId);\n }\n\n if (!message) {\n return { volume, isMuted, playbackRate };\n }\n\n return {\n chatId,\n threadId,\n messageId,\n senderId: message.senderId,\n origin,\n message,\n isProtected: selectIsMessageProtected(global, message),\n volume,\n isMuted,\n playbackRate,\n };\n },\n)(MediaViewerContent));\n\nfunction renderPhoto(blobUrl?: string, imageSize?: ApiDimensions, canDrag?: boolean) {\n return blobUrl\n ? (\n <img\n src={blobUrl}\n alt=\"\"\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n draggable={Boolean(canDrag)}\n />\n )\n : (\n <div\n className=\"spinner-wrapper\"\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n >\n <Spinner color=\"white\" />\n </div>\n );\n}\n\nfunction renderVideoPreview(blobUrl?: string, imageSize?: ApiDimensions, canDrag?: boolean) {\n const wrapperStyle = imageSize && `width: ${imageSize.width}px; height: ${imageSize.height}px`;\n const videoStyle = `background-image: url(${blobUrl})`;\n return blobUrl\n ? (\n <div\n className=\"VideoPlayer\"\n >\n <div\n style={wrapperStyle}\n >\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <video\n style={videoStyle}\n draggable={Boolean(canDrag)}\n />\n </div>\n </div>\n )\n : (\n <div\n className=\"spinner-wrapper\"\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n >\n <Spinner color=\"white\" />\n </div>\n );\n}\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport { MediaViewerOrigin } from '../../types';\n\nimport useForceUpdate from '../../hooks/useForceUpdate';\nimport { animateNumber, timingFunctions } from '../../util/animation';\nimport arePropsShallowEqual from '../../util/arePropsShallowEqual';\nimport { captureEvents, IOS_SCREEN_EDGE_THRESHOLD, RealTouchEvent } from '../../util/captureEvents';\nimport { IS_IOS, IS_TOUCH_ENV } from '../../util/environment';\nimport { debounce } from '../../util/schedulers';\nimport useTimeout from '../../hooks/useTimeout';\nimport useDebouncedCallback from '../../hooks/useDebouncedCallback';\n\nimport MediaViewerContent from './MediaViewerContent';\n\nimport './MediaViewerSlides.scss';\n\ntype OwnProps = {\n messageId?: number;\n getMessageId: (fromId?: number, direction?: number) => number | undefined;\n isVideo?: boolean;\n isGif?: boolean;\n isPhoto?: boolean;\n isOpen?: boolean;\n selectMessage: (id?: number) => void;\n chatId?: string;\n threadId?: number;\n isActive?: boolean;\n avatarOwnerId?: string;\n profilePhotoIndex?: number;\n origin?: MediaViewerOrigin;\n isZoomed?: boolean;\n animationLevel: 0 | 1 | 2;\n onClose: () => void;\n hasFooter?: boolean;\n onFooterClick: () => void;\n};\n\nconst SWIPE_X_THRESHOLD = 50;\nconst SWIPE_Y_THRESHOLD = 50;\nconst SLIDES_GAP = 40;\nconst ANIMATION_DURATION = 350;\nconst DEBOUNCE_MESSAGE = 350;\nconst DEBOUNCE_SWIPE = 500;\nconst DEBOUNCE_ACTIVE = 800;\nconst MAX_ZOOM = 4;\nconst MIN_ZOOM = 0.6;\nconst DOUBLE_TAP_ZOOM = 3;\nconst CLICK_X_THRESHOLD = 40;\nconst CLICK_Y_THRESHOLD = 80;\nlet cancelAnimation: Function | undefined;\n\ntype Transform = {\n x: number;\n y: number;\n scale: number;\n};\n\nenum SwipeDirection {\n Horizontal,\n Vertical,\n}\n\nconst MediaViewerSlides: FC<OwnProps> = ({\n messageId,\n getMessageId,\n selectMessage,\n isVideo,\n isGif,\n isPhoto,\n isOpen,\n isActive,\n hasFooter,\n ...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 swipeDirectionRef = useRef<SwipeDirection | undefined>(undefined);\n const isActiveRef = useRef(true);\n const [activeMessageId, setActiveMessageId] = useState<number | undefined>(messageId);\n const forceUpdate = useForceUpdate();\n const [isFooterHidden, setIsFooterHidden] = useState<boolean>(true);\n\n const {\n isZoomed,\n onClose,\n } = rest;\n\n const setTransform = useCallback((value: Transform) => {\n transformRef.current = value;\n forceUpdate();\n }, [forceUpdate]);\n\n const selectMessageDebounced = useDebouncedCallback(selectMessage, [], DEBOUNCE_MESSAGE, true);\n const clearSwipeDirectionDebounced = useDebouncedCallback(() => {\n swipeDirectionRef.current = undefined;\n }, [], DEBOUNCE_SWIPE, true);\n const setIsActiveDebounced = useDebouncedCallback((value: boolean) => {\n isActiveRef.current = value;\n forceUpdate();\n }, [forceUpdate], DEBOUNCE_ACTIVE, true);\n\n const handleToggleFooterVisibility = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (!IS_TOUCH_ENV) return;\n const isFooter = window.innerHeight - e.pageY < CLICK_Y_THRESHOLD;\n if (!isFooter && e.pageX < CLICK_X_THRESHOLD) return;\n if (!isFooter && e.pageX > window.innerWidth - CLICK_X_THRESHOLD) return;\n setIsFooterHidden(!isFooterHidden);\n }, [isFooterHidden]);\n\n useTimeout(() => setIsFooterHidden(false), ANIMATION_DURATION - 150);\n\n useEffect(() => {\n if (!IS_TOUCH_ENV || !containerRef.current || isZoomed || !activeMessageId) {\n return undefined;\n }\n let lastTransform = { x: 0, y: 0, scale: 1 };\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 = (e: MouseEvent) => {\n if (transformRef.current.scale !== 1) return false;\n let direction = 0;\n if (window.innerHeight - e.pageY < CLICK_Y_THRESHOLD) {\n return false;\n }\n if (e.pageX < CLICK_X_THRESHOLD) {\n direction = -1;\n } else if (e.pageX > window.innerWidth - CLICK_X_THRESHOLD) {\n direction = 1;\n }\n const mId = getMessageId(activeMessageId, direction);\n if (mId) {\n const offset = (window.innerWidth + SLIDES_GAP) * direction;\n transformRef.current.x += offset;\n isActiveRef.current = false;\n setActiveMessageId(mId);\n selectMessageDebounced(mId);\n setIsActiveDebounced(true);\n lastTransform = { x: 0, y: 0, scale: 1 };\n cancelAnimation = animateNumber({\n from: transformRef.current.x,\n to: 0,\n duration: ANIMATION_DURATION,\n timing: timingFunctions.easeOutCubic,\n onUpdate: (value) => setTransform({\n y: 0,\n x: value,\n scale: 1,\n }),\n });\n }\n return direction !== 0;\n };\n\n return captureEvents(containerRef.current, {\n isNotPassive: true,\n excludedClosestSelector: '.MediaViewerFooter',\n onCapture: (e) => {\n if (checkIfControlTarget(e)) return;\n lastGestureTime = Date.now();\n if (arePropsShallowEqual(transformRef.current, { x: 0, y: 0, scale: 1 })) {\n if (!activeSlideRef.current) return;\n content = activeSlideRef.current.querySelector('img, video');\n if (!content) return;\n // Store initial content rect, without transformations\n initialContentRect = content.getBoundingClientRect();\n }\n },\n onDrag: (event, captureEvent, {\n dragOffsetX,\n dragOffsetY,\n }) => {\n if (checkIfControlTarget(event)) return;\n // Avoid conflicts with swipe-to-back gestures\n if (IS_IOS) {\n const { pageX } = (captureEvent as RealTouchEvent).touches[0];\n if (pageX <= IOS_SCREEN_EDGE_THRESHOLD || pageX >= window.innerWidth - IOS_SCREEN_EDGE_THRESHOLD) {\n return;\n }\n }\n if (cancelAnimation) {\n cancelAnimation();\n cancelAnimation = undefined;\n }\n panDelta.x = lastDragOffset.x - dragOffsetX;\n panDelta.y = lastDragOffset.y - dragOffsetY;\n lastDragOffset.x = dragOffsetX;\n lastDragOffset.y = dragOffsetY;\n const absOffsetX = Math.abs(dragOffsetX);\n const absOffsetY = Math.abs(dragOffsetY);\n const {\n scale,\n x,\n y,\n } = transformRef.current;\n const h = 10;\n\n // If user is inactive but is still touching the screen\n // we reset last gesture time\n setLastGestureTime();\n\n // If image is scaled we just need to pan it\n if (scale !== 1) {\n if ('touches' in event && event.touches.length === 1) {\n setTransform({\n x: lastTransform.x + dragOffsetX,\n y: lastTransform.y + dragOffsetY,\n scale,\n });\n }\n return;\n }\n if (swipeDirectionRef.current !== SwipeDirection.Vertical) {\n // If user is swiping horizontally or horizontal shift is dominant\n // we change only horizontal position\n if (swipeDirectionRef.current === SwipeDirection.Horizontal\n || Math.abs(x) > h || (absOffsetX > h && absOffsetY < h)) {\n swipeDirectionRef.current = SwipeDirection.Horizontal;\n isActiveRef.current = false;\n setTransform({\n x: dragOffsetX,\n y: 0,\n scale,\n });\n return;\n }\n }\n // If vertical shift is dominant we change only vertical position\n if (swipeDirectionRef.current === SwipeDirection.Vertical\n || Math.abs(y) > h || (absOffsetY > h && absOffsetX < h)) {\n swipeDirectionRef.current = SwipeDirection.Vertical;\n setTransform({\n x: 0,\n y: dragOffsetY,\n scale,\n });\n }\n },\n onZoom: (e, {\n zoomFactor,\n initialCenterX,\n initialCenterY,\n dragOffsetX,\n dragOffsetY,\n currentCenterX,\n currentCenterY,\n }) => {\n // Calculate current scale based on zoom factor and limits, add max zoom margin for bounce back effect\n const scale = Math.min(MAX_ZOOM * 3, Math.max(lastTransform.scale * zoomFactor, MIN_ZOOM));\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 // Calculate new center relative to the shifted image\n const scaledCenterX = offsetX + initialCenterX;\n const scaledCenterY = offsetY + initialCenterY;\n\n // Save last zoom center for bounce back effect\n lastZoomCenter.x = currentCenterX;\n lastZoomCenter.y = currentCenterY;\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 setTransform({\n x: lastTransform.x + scaleOffsetX + dragOffsetX,\n y: lastTransform.y + scaleOffsetY + dragOffsetY,\n scale,\n });\n },\n onClick(e) {\n if (changeSlide(e as MouseEvent)) {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n onDoubleClick(e, {\n centerX,\n centerY,\n }) {\n if (changeSlide(e as MouseEvent)) {\n e.preventDefault();\n e.stopPropagation();\n return undefined;\n }\n // Calculate how much we need to shift the image to keep the zoom center at the same position\n const scaleOffsetX = (centerX - DOUBLE_TAP_ZOOM * centerX);\n const scaleOffsetY = (centerY - DOUBLE_TAP_ZOOM * centerY);\n const {\n scale,\n x,\n y,\n } = transformRef.current;\n if (scale === 1) {\n if (x !== 0 || y !== 0) return undefined;\n lastTransform = {\n x: scaleOffsetX,\n y: scaleOffsetY,\n scale: DOUBLE_TAP_ZOOM,\n };\n } else {\n lastTransform = {\n x: 0,\n y: 0,\n scale: 1,\n };\n }\n return animateNumber({\n from: [x, y, scale],\n to: [lastTransform.x, lastTransform.y, lastTransform.scale],\n duration: ANIMATION_DURATION,\n timing: timingFunctions.easeOutCubic,\n onUpdate: (value) => setTransform({\n x: value[0],\n y: value[1],\n scale: value[2],\n }),\n });\n },\n onRelease: () => {\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 return animateNumber({\n from: [x, y, scale],\n to: [0, 0, 1],\n duration: ANIMATION_DURATION,\n timing: timingFunctions.easeOutCubic,\n onUpdate: (value) => setTransform({\n x: value[0],\n y: value[1],\n scale: value[2],\n }),\n });\n }\n if (scale > 1) {\n if (!content || !initialContentRect) {\n lastTransform = {\n x,\n y,\n scale,\n };\n return undefined;\n }\n // Get current content boundaries\n const boundaries = content.getBoundingClientRect();\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 (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 // If content is outside window we calculate offset boundaries\n // based on initial content rect and current scale\n if (boundaries.width > window.innerWidth) {\n const minOffsetX = -initialContentRect.left * s1;\n const maxOffsetX = window.innerWidth - initialContentRect.right * s1;\n x1 = Math.min(minOffsetX, Math.max(maxOffsetX, x1));\n } else {\n // Else we center the content on the screen\n x1 = (window.innerWidth - window.innerWidth * s1) / 2;\n }\n\n if (boundaries.height > window.innerHeight) {\n const minOffsetY = -initialContentRect.top * s1;\n const maxOffsetY = window.innerHeight - initialContentRect.bottom * s1;\n y1 = Math.min(minOffsetY, Math.max(maxOffsetY, y1));\n } else {\n y1 = (window.innerHeight - window.innerHeight * s1) / 2;\n }\n lastTransform = {\n x: x1,\n y: y1,\n scale: s1,\n };\n cancelAnimation = animateNumber({\n from: [x, y, scale],\n to: [x1, y1, s1],\n duration: ANIMATION_DURATION,\n timing: timingFunctions.easeOutCubic,\n onUpdate: (value) => setTransform({\n x: value[0],\n y: value[1],\n scale: value[2],\n }),\n });\n return undefined;\n }\n lastTransform = {\n x,\n y,\n scale,\n };\n if (absY >= SWIPE_Y_THRESHOLD) return onClose();\n // Bounce back if vertical swipe is below threshold\n if (absY > 0) {\n return animateNumber({\n from: y,\n to: 0,\n duration: ANIMATION_DURATION,\n timing: timingFunctions.easeOutCubic,\n onUpdate: (value) => setTransform({\n x: 0,\n y: value,\n scale,\n }),\n });\n }\n // Get horizontal swipe direction\n const direction = x < 0 ? 1 : -1;\n const mId = getMessageId(activeMessageId, x < 0 ? 1 : -1);\n // Get the direction of the last pan gesture.\n // Could be different from the total horizontal swipe direction\n // if user starts a swipe in one direction and then changes the direction\n // we need to cancel slide transition\n const dirX = panDelta.x < 0 ? -1 : 1;\n if (mId && absX >= SWIPE_X_THRESHOLD && direction === dirX) {\n const offset = (window.innerWidth + SLIDES_GAP) * direction;\n // If image is shifted by more than SWIPE_X_THRESHOLD,\n // We shift everything by one screen width and then set new active message id\n transformRef.current.x += offset;\n setActiveMessageId(mId);\n selectMessageDebounced(mId);\n }\n // Then we always return to the original position\n cancelAnimation = animateNumber({\n from: transformRef.current.x,\n to: 0,\n duration: ANIMATION_DURATION,\n timing: timingFunctions.easeOutCubic,\n onUpdate: (value) => setTransform({\n y: 0,\n x: value,\n scale: transformRef.current.scale,\n }),\n });\n return undefined;\n },\n });\n }, [\n isZoomed,\n onClose,\n setTransform,\n getMessageId,\n activeMessageId,\n selectMessageDebounced,\n setIsActiveDebounced,\n clearSwipeDirectionDebounced,\n ]);\n\n if (!activeMessageId) return undefined;\n\n const nextMessageId = getMessageId(activeMessageId, 1);\n const previousMessageId = getMessageId(activeMessageId, -1);\n const offsetX = transformRef.current.x;\n const offsetY = transformRef.current.y;\n const { scale } = transformRef.current;\n\n return (\n <div className=\"MediaViewerSlides\" ref={containerRef}>\n {previousMessageId && scale === 1 && (\n <div className=\"MediaViewerSlide\" style={getAnimationStyle(-window.innerWidth + offsetX - SLIDES_GAP)}>\n <MediaViewerContent\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n messageId={previousMessageId}\n />\n </div>\n )}\n {activeMessageId && (\n <div\n className={`MediaViewerSlide ${isActive ? 'MediaViewerSlide--active' : ''}`}\n onClick={handleToggleFooterVisibility}\n ref={activeSlideRef}\n style={getAnimationStyle(offsetX, offsetY, scale)}\n >\n <MediaViewerContent\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n messageId={activeMessageId}\n isActive={isActive && isActiveRef.current}\n setIsFooterHidden={setIsFooterHidden}\n isFooterHidden={isFooterHidden || isZoomed || scale !== 1}\n />\n </div>\n )}\n {nextMessageId && scale === 1 && (\n <div className=\"MediaViewerSlide\" style={getAnimationStyle(window.innerWidth + offsetX + SLIDES_GAP)}>\n <MediaViewerContent\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n messageId={nextMessageId}\n />\n </div>\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","/*\n @source https://github.com/ajainarayanan/react-pan-zoom\n\n Heavily inspired/lifted from this idea: https://stackoverflow.com/a/39311435/661768\n without jqueryUI or jquery dependency.\n*/\nimport React, {\n FC, memo, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport { areSortedArraysEqual } from '../../util/iteratees';\n\nimport './PanZoom.scss';\n\nexport interface IDragData {\n x: number;\n y: number;\n dx: number;\n dy: number;\n}\n\nexport interface OwnProps {\n children: React.ReactNode;\n className?: string;\n noWrap: boolean;\n canPan: boolean;\n zoomLevel: number;\n panDeltaX: number;\n panDeltaY: number;\n onPan?: (x: number, y: number) => void;\n}\n\nconst INITIAL_MATRIX = [\n 1, 0, 0, 1, 0, 0,\n];\n\nconst SCALE_VALUES = {\n 1: 1,\n 1.5: 1.5,\n 2: 2.2,\n 2.5: 3.3,\n 3: 5.5,\n};\n\nconst ZOOM_SAFE_AREA = 150;\n\nfunction calculateSafeZoneOnZoom(oldScale: number, matrixData: number[], wrapper: HTMLDivElement | null) {\n const image = wrapper && wrapper.querySelector('.Transition__slide--active img');\n if (!wrapper || !image) {\n return matrixData;\n }\n const wrapperRect = wrapper.getBoundingClientRect();\n const imageRect = image.getBoundingClientRect();\n\n const newImgWidth = (imageRect.width / oldScale) * matrixData[0];\n const newImgHeight = (imageRect.height / oldScale) * matrixData[3];\n const newImgX = (wrapperRect.width - newImgWidth) / 2 + matrixData[4];\n const newImgY = (wrapperRect.height - newImgHeight) / 2 + matrixData[5];\n if (wrapperRect.width && wrapperRect.width - ZOOM_SAFE_AREA < newImgX) {\n matrixData[4] -= newImgX + wrapperRect.width - ZOOM_SAFE_AREA;\n } else if (newImgWidth && newImgWidth + newImgX < ZOOM_SAFE_AREA) {\n matrixData[4] -= newImgWidth + newImgX - ZOOM_SAFE_AREA;\n }\n if (wrapperRect.height && wrapperRect.height - ZOOM_SAFE_AREA < newImgY) {\n matrixData[5] -= newImgY + wrapperRect.height - ZOOM_SAFE_AREA;\n } else if (newImgHeight && newImgHeight + newImgY < ZOOM_SAFE_AREA) {\n matrixData[5] -= newImgHeight + newImgY - ZOOM_SAFE_AREA;\n }\n\n return matrixData;\n}\n\nconst PanZoom: FC<OwnProps> = ({\n children,\n className,\n noWrap,\n canPan,\n zoomLevel,\n panDeltaX,\n panDeltaY,\n onPan,\n}) => {\n const tunedZoomLevel = SCALE_VALUES[zoomLevel as keyof typeof SCALE_VALUES] || zoomLevel;\n const [isDragging, setIsDragging] = useState<boolean>(false);\n const [dragData, setDragData] = useState<IDragData>({\n dx: panDeltaX, dy: panDeltaY, x: 0, y: 0,\n });\n // [zoom, skew, skew, zoom, dx, dy] - see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix()\n const [matrixData, setMatrixData] = useState<number[]>(INITIAL_MATRIX);\n // Used to set cursor while moving.\n // eslint-disable-next-line no-null/no-null\n const panWrapperRef = useRef<HTMLDivElement>(null);\n // Used to set transform for pan.\n // eslint-disable-next-line no-null/no-null\n const panContainerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const newZoomLevel = tunedZoomLevel || matrixData[0];\n const newPandx = panDeltaX || matrixData[4];\n const newPandy = panDeltaY || matrixData[5];\n\n const newMatrixData = [...matrixData];\n if (matrixData[0] !== newZoomLevel) {\n newMatrixData[0] = newZoomLevel || newMatrixData[0];\n newMatrixData[3] = newZoomLevel || newMatrixData[3];\n }\n if (matrixData[4] !== newPandx) {\n newMatrixData[4] = newPandx;\n }\n if (matrixData[5] !== newPandy) {\n newMatrixData[5] = newPandy;\n }\n\n if (!areSortedArraysEqual(matrixData, newMatrixData)) {\n setMatrixData(calculateSafeZoneOnZoom(matrixData[0], newMatrixData, panWrapperRef.current));\n }\n // eslint-disable-next-line\n }, [panDeltaX, panDeltaY, tunedZoomLevel]);\n\n useEffect(() => {\n if (!canPan) {\n setMatrixData(INITIAL_MATRIX);\n }\n }, [canPan]);\n\n useEffect(() => {\n if (panContainerRef.current) {\n panContainerRef.current.style.transform = `matrix(${matrixData.toString()})`;\n }\n }, [noWrap, matrixData]);\n\n const handleMouseDown = (e: React.MouseEvent<EventTarget>) => {\n if (!canPan) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n const offsetX = matrixData[4];\n const offsetY = matrixData[5];\n const newDragData: IDragData = {\n dx: offsetX,\n dy: offsetY,\n x: e.pageX,\n y: e.pageY,\n };\n setDragData(newDragData);\n setIsDragging(true);\n\n if (panWrapperRef.current) {\n panWrapperRef.current.classList.add('move');\n }\n };\n\n const handleMouseUp = () => {\n setIsDragging(false);\n\n if (panWrapperRef.current) {\n panWrapperRef.current.classList.remove('move');\n }\n\n if (onPan) {\n onPan(matrixData[4], matrixData[5]);\n }\n };\n\n function getNewMatrixData(x: number, y: number): number[] {\n const newMatrixData = [...matrixData];\n const deltaX = dragData.x - x;\n const deltaY = dragData.y - y;\n newMatrixData[4] = dragData.dx - deltaX;\n newMatrixData[5] = dragData.dy - deltaY;\n\n return newMatrixData;\n }\n\n const handleMouseMove = (e: React.MouseEvent<EventTarget>) => {\n if (isDragging) {\n const newMatrixData = getNewMatrixData(e.pageX, e.pageY);\n setMatrixData(newMatrixData);\n\n if (panContainerRef.current) {\n panContainerRef.current.style.transform = `matrix(${matrixData.toString()})`;\n }\n }\n };\n\n if (noWrap) {\n return children;\n }\n\n return (\n <div\n ref={panWrapperRef}\n className={`pan-wrapper ${className || ''}`}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseMove={handleMouseMove}\n >\n <div\n ref={panContainerRef}\n className=\"pan-container\"\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default memo(PanZoom);\n","import React, { FC, useCallback } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiChat, ApiMessage, ApiUser } from '../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { getSenderTitle, isUserId } from '../../global/helpers';\nimport { formatMediaDateTime } from '../../util/dateFormat';\nimport renderText from '../common/helpers/renderText';\nimport {\n selectChat,\n selectChatMessage,\n selectSender,\n selectUser,\n} from '../../global/selectors';\nimport useLang from '../../hooks/useLang';\n\nimport Avatar from '../common/Avatar';\n\nimport './SenderInfo.scss';\n\ntype OwnProps = {\n chatId?: string;\n messageId?: number;\n isAvatar?: boolean;\n};\n\ntype StateProps = {\n sender?: ApiUser | ApiChat;\n message?: ApiMessage;\n};\n\nconst ANIMATION_DURATION = 350;\n\nconst SenderInfo: FC<OwnProps & StateProps> = ({\n chatId,\n messageId,\n sender,\n isAvatar,\n message,\n}) => {\n const {\n closeMediaViewer,\n focusMessage,\n toggleChatInfo,\n } = getActions();\n\n const handleFocusMessage = useCallback(() => {\n closeMediaViewer();\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n setTimeout(() => {\n toggleChatInfo(false, { forceSyncOnIOs: true });\n focusMessage({ chatId, messageId });\n }, ANIMATION_DURATION);\n } else {\n focusMessage({ chatId, messageId });\n }\n }, [chatId, focusMessage, toggleChatInfo, messageId, closeMediaViewer]);\n\n const lang = useLang();\n\n if (!sender || (!message && !isAvatar)) {\n return undefined;\n }\n\n const senderTitle = getSenderTitle(lang, sender);\n\n return (\n <div className=\"SenderInfo\" onClick={handleFocusMessage}>\n {isUserId(sender.id) ? (\n <Avatar key={sender.id} size=\"medium\" user={sender as ApiUser} />\n ) : (\n <Avatar key={sender.id} size=\"medium\" chat={sender as ApiChat} />\n )}\n <div className=\"meta\">\n <div className=\"title\" dir=\"auto\">\n {senderTitle && renderText(senderTitle)}\n </div>\n <div className=\"date\" dir=\"auto\">\n {isAvatar\n ? lang('lng_mediaview_profile_photo')\n : formatMediaDateTime(lang, message!.date * 1000, true)}\n </div>\n </div>\n </div>\n );\n};\n\nexport default withGlobal<OwnProps>(\n (global, { chatId, messageId, isAvatar }): StateProps => {\n if (isAvatar && chatId) {\n return {\n sender: isUserId(chatId) ? selectUser(global, chatId) : selectChat(global, chatId),\n };\n }\n\n if (!messageId || !chatId) {\n return {};\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n\n return {\n message,\n sender: message && selectSender(global, message),\n };\n },\n)(SenderInfo);\n","import React, { FC } from '../../lib/teact/teact';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\n\nimport Transition, { ChildrenFn, TransitionProps } from '../ui/Transition';\n\nconst SlideTransition: FC<TransitionProps & { children: ChildrenFn }> = ({ children, ...props }) => {\n if (IS_TOUCH_ENV) return children(true, true, 1);\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <Transition {...props}>{children}</Transition>;\n};\n\nexport default SlideTransition;\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport buildClassName from '../../util/buildClassName';\nimport usePrevious from '../../hooks/usePrevious';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useLang from '../../hooks/useLang';\n\nimport Button from '../ui/Button';\n\nimport './ZoomControls.scss';\n\ntype OwnProps = {\n isShown: boolean;\n onChangeZoom: (level: number, canCloseZoom?: boolean) => void;\n};\n\nexport const MAX_ZOOM_LEVEL = 3;\nexport const MIN_ZOOM_LEVEL = 1;\nconst ONE_STEP_PERCENT = 100 / (MAX_ZOOM_LEVEL - MIN_ZOOM_LEVEL);\nconst RESET_ZOOM_LEVEL = 1.5;\n\nconst ZoomControls: FC<OwnProps> = ({ isShown, onChangeZoom }) => {\n const { transitionClassNames } = useShowTransition(isShown);\n const prevIsShown = usePrevious<boolean>(isShown);\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n const [zoomLevel, setZoomLevel] = useState(1);\n const isSeeking = useRef<boolean>(false);\n\n useEffect(() => {\n if (isShown && !prevIsShown) {\n setZoomLevel(RESET_ZOOM_LEVEL);\n }\n }, [isShown, prevIsShown]);\n\n const handleZoomOut = useCallback(() => {\n if (inputRef.current) {\n setZoomLevel(Math.max(MIN_ZOOM_LEVEL, zoomLevel - 0.5));\n }\n }, [zoomLevel]);\n\n const handleZoomIn = useCallback(() => {\n if (inputRef.current) {\n setZoomLevel(Math.min(MAX_ZOOM_LEVEL, zoomLevel + 0.5));\n }\n }, [zoomLevel]);\n\n const handleStartSeek = useCallback(() => {\n isSeeking.current = true;\n }, []);\n\n const handleStopSeek = useCallback(() => {\n isSeeking.current = false;\n if (zoomLevel === 1) {\n onChangeZoom(zoomLevel, !isSeeking.current);\n }\n }, [onChangeZoom, zoomLevel]);\n\n const handleSeeklineChange = (e:React.ChangeEvent<HTMLInputElement>) => {\n setZoomLevel(Math.min(MAX_ZOOM_LEVEL, Math.max(Number(e.target.value), MIN_ZOOM_LEVEL)));\n };\n\n useEffect(() => {\n onChangeZoom(zoomLevel, !isSeeking.current);\n }, [zoomLevel, onChangeZoom]);\n\n const lang = useLang();\n\n const className = buildClassName(\n 'ZoomControls',\n transitionClassNames,\n );\n\n return (\n <div className={className}>\n <Button\n disabled={zoomLevel === MIN_ZOOM_LEVEL}\n size=\"tiny\"\n color=\"translucent-white\"\n ariaLabel={lang('ZoomOut')}\n className=\"zoom-out\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n onClick={handleZoomOut}\n >\n <i className=\"icon-zoom-out\" />\n </Button>\n <Button\n disabled={zoomLevel === MAX_ZOOM_LEVEL}\n size=\"tiny\"\n color=\"translucent-white\"\n ariaLabel=\"Zoom In\"\n className=\"zoom-in\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n onClick={handleZoomIn}\n >\n <i className=\"icon-zoom-in\" />\n </Button>\n <div className=\"seekline\">\n <div className=\"seekline-track\">\n <div\n className=\"seekline-played\"\n style={`width: ${(zoomLevel - 1) * ONE_STEP_PERCENT}%`}\n />\n <input\n ref={inputRef}\n min={MIN_ZOOM_LEVEL}\n max={MAX_ZOOM_LEVEL}\n step=\"0.5\"\n value={zoomLevel}\n type=\"range\"\n className=\"seekline-input\"\n onChange={handleSeeklineChange}\n onMouseDown={handleStartSeek}\n onMouseUp={handleStopSeek}\n />\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(ZoomControls);\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport {\n ApiChat, ApiDimensions, ApiMediaFormat, ApiMessage, ApiUser,\n} from '../../api/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { ANIMATION_END_DELAY } from '../../config';\nimport { IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport useBlurSync from '../../hooks/useBlurSync';\nimport useForceUpdate from '../../hooks/useForceUpdate';\nimport { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport useLang from '../../hooks/useLang';\nimport useMedia from '../../hooks/useMedia';\nimport useFlag from '../../hooks/useFlag';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport usePrevious from '../../hooks/usePrevious';\nimport {\n getChatAvatarHash,\n getChatMediaMessageIds,\n getMessageDocument,\n getMessageFileName,\n getMessageMediaFormat,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessagePhoto,\n getMessageVideo,\n getMessageWebPagePhoto,\n getMessageWebPageVideo,\n getPhotoFullDimensions,\n getVideoDimensions,\n isMessageDocumentPhoto,\n isMessageDocumentVideo,\n} from '../../global/helpers';\nimport {\n selectChat,\n selectChatMessage,\n selectChatMessages,\n selectCurrentMediaSearch,\n selectIsChatWithSelf,\n selectListedIds,\n selectOutlyingIds,\n selectScheduledMessage,\n selectScheduledMessages,\n selectUser,\n} from '../../global/selectors';\nimport { stopCurrentAudio } from '../../util/audioPlayer';\nimport captureEscKeyListener from '../../util/captureEscKeyListener';\nimport { captureEvents } from '../../util/captureEvents';\nimport windowSize from '../../util/windowSize';\nimport { AVATAR_FULL_DIMENSIONS, MEDIA_VIEWER_MEDIA_QUERY } from '../common/helpers/mediaDimensions';\nimport { renderMessageText } from '../common/helpers/renderMessageText';\nimport { animateClosing, animateOpening } from './helpers/ghostAnimation';\n\nimport Button from '../ui/Button';\nimport ShowTransition from '../ui/ShowTransition';\nimport Transition from '../ui/Transition';\nimport MediaViewerActions from './MediaViewerActions';\nimport MediaViewerSlides from './MediaViewerSlides';\nimport PanZoom from './PanZoom';\nimport SenderInfo from './SenderInfo';\nimport SlideTransition from './SlideTransition';\nimport ZoomControls from './ZoomControls';\nimport ReportModal from '../common/ReportModal';\n\nimport './MediaViewer.scss';\n\ntype StateProps = {\n chatId?: string;\n threadId?: number;\n messageId?: number;\n senderId?: string;\n isChatWithSelf?: boolean;\n origin?: MediaViewerOrigin;\n avatarOwner?: ApiChat | ApiUser;\n profilePhotoIndex?: number;\n message?: ApiMessage;\n chatMessages?: Record<number, ApiMessage>;\n collectionIds?: number[];\n animationLevel: 0 | 1 | 2;\n};\n\nconst ANIMATION_DURATION = 350;\n\nconst MediaViewer: FC<StateProps> = ({\n chatId,\n threadId,\n messageId,\n senderId,\n isChatWithSelf,\n origin,\n avatarOwner,\n profilePhotoIndex,\n message,\n chatMessages,\n collectionIds,\n animationLevel,\n}) => {\n const {\n openMediaViewer,\n closeMediaViewer,\n openForwardMenu,\n focusMessage,\n toggleChatInfo,\n } = getActions();\n\n const isOpen = Boolean(avatarOwner || messageId);\n\n const isFromSharedMedia = origin === MediaViewerOrigin.SharedMedia;\n const isFromSearch = origin === MediaViewerOrigin.SearchResult;\n\n /* Content */\n const photo = message ? getMessagePhoto(message) : undefined;\n const video = message ? getMessageVideo(message) : undefined;\n const webPagePhoto = message ? getMessageWebPagePhoto(message) : undefined;\n const webPageVideo = message ? getMessageWebPageVideo(message) : undefined;\n const isDocumentPhoto = message ? isMessageDocumentPhoto(message) : false;\n const isDocumentVideo = message ? isMessageDocumentVideo(message) : false;\n const isVideo = Boolean(video || webPageVideo || isDocumentVideo);\n const { isGif } = video || webPageVideo || {};\n const isPhoto = Boolean(!isVideo && (photo || webPagePhoto || isDocumentPhoto));\n const isAvatar = Boolean(avatarOwner);\n\n /* Navigation */\n const singleMessageId = webPagePhoto || webPageVideo ? messageId : undefined;\n\n const messageIds = useMemo(() => {\n return singleMessageId\n ? [singleMessageId]\n : getChatMediaMessageIds(chatMessages || {}, collectionIds || [], isFromSharedMedia);\n }, [singleMessageId, chatMessages, collectionIds, isFromSharedMedia]);\n\n const selectedMediaMessageIndex = messageId ? messageIds.indexOf(messageId) : -1;\n const isFirst = selectedMediaMessageIndex === 0 || selectedMediaMessageIndex === -1;\n const isLast = selectedMediaMessageIndex === messageIds.length - 1 || selectedMediaMessageIndex === -1;\n\n /* Animation */\n const animationKey = useRef<number>();\n const prevSenderId = usePrevious<string | undefined>(senderId);\n if (isOpen && (!prevSenderId || prevSenderId !== senderId || !animationKey.current)) {\n animationKey.current = selectedMediaMessageIndex;\n }\n const slideAnimation = animationLevel >= 1 && !IS_TOUCH_ENV ? 'mv-slide' : 'none';\n const headerAnimation = animationLevel === 2 ? 'slide-fade' : 'none';\n const isGhostAnimation = animationLevel === 2;\n\n /* Controls */\n const [isReportModalOpen, openReportModal, closeReportModal] = useFlag();\n const [canPanZoomWrap, setCanPanZoomWrap] = useState(false);\n const [isZoomed, setIsZoomed] = useState<boolean>(false);\n const [zoomLevel, setZoomLevel] = useState<number>(1);\n const [panDelta, setPanDelta] = useState({\n x: 0,\n y: 0,\n });\n\n /* Media data */\n function getMediaHash(isFull?: boolean) {\n if (isAvatar && profilePhotoIndex !== undefined) {\n const { photos } = avatarOwner!;\n return photos && photos[profilePhotoIndex]\n ? `photo${photos[profilePhotoIndex].id}?size=c`\n : getChatAvatarHash(avatarOwner!, isFull ? 'big' : 'normal');\n }\n\n return message && getMessageMediaHash(message, isFull ? 'viewerFull' : 'viewerPreview');\n }\n\n const pictogramBlobUrl = useMedia(\n message && (isFromSharedMedia || isFromSearch) && getMessageMediaHash(message, 'pictogram'),\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const previewMediaHash = getMediaHash();\n const previewBlobUrl = useMedia(\n previewMediaHash,\n undefined,\n ApiMediaFormat.BlobUrl,\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const { mediaData: fullMediaBlobUrl } = useMediaWithLoadProgress(\n getMediaHash(true),\n undefined,\n message && getMessageMediaFormat(message, 'viewerFull'),\n undefined,\n isGhostAnimation && ANIMATION_DURATION,\n );\n const avatarPhoto = avatarOwner?.photos?.[profilePhotoIndex!];\n const canReport = !!avatarPhoto && profilePhotoIndex! > 0 && !isChatWithSelf;\n\n const localBlobUrl = (photo || video) ? (photo || video)!.blobUrl : undefined;\n let bestImageData = (!isVideo && (localBlobUrl || fullMediaBlobUrl)) || previewBlobUrl || pictogramBlobUrl;\n const thumbDataUri = useBlurSync(!bestImageData && message && getMessageMediaThumbDataUri(message));\n if (!bestImageData && origin !== MediaViewerOrigin.SearchResult) {\n bestImageData = thumbDataUri;\n }\n\n const fileName = message\n ? getMessageFileName(message)\n : isAvatar\n ? `avatar${avatarOwner!.id}-${profilePhotoIndex}.jpg`\n : undefined;\n\n let dimensions!: ApiDimensions;\n if (message) {\n if (isDocumentPhoto || isDocumentVideo) {\n dimensions = getMessageDocument(message)!.mediaSize!;\n } else if (photo || webPagePhoto) {\n dimensions = getPhotoFullDimensions((photo || webPagePhoto)!)!;\n } else if (video || webPageVideo) {\n dimensions = getVideoDimensions((video || webPageVideo)!)!;\n }\n } else {\n dimensions = AVATAR_FULL_DIMENSIONS;\n }\n\n useEffect(() => {\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n return;\n }\n\n document.body.classList.toggle('is-media-viewer-open', isOpen);\n }, [isOpen]);\n\n const forceUpdate = useForceUpdate();\n useEffect(() => {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n if (typeof mql.addEventListener === 'function') {\n mql.addEventListener('change', forceUpdate);\n } else if (typeof mql.addListener === 'function') {\n mql.addListener(forceUpdate);\n }\n\n return () => {\n if (typeof mql.removeEventListener === 'function') {\n mql.removeEventListener('change', forceUpdate);\n } else if (typeof mql.removeListener === 'function') {\n mql.removeListener(forceUpdate);\n }\n };\n }, [forceUpdate]);\n\n const prevMessage = usePrevious<ApiMessage | undefined>(message);\n const prevOrigin = usePrevious(origin);\n const prevAvatarOwner = usePrevious<ApiChat | ApiUser | undefined>(avatarOwner);\n const prevBestImageData = usePrevious(bestImageData);\n const textParts = message ? renderMessageText(message) : undefined;\n const hasFooter = Boolean(textParts);\n\n useEffect(() => {\n if (isGhostAnimation && isOpen && !prevMessage && !prevAvatarOwner) {\n dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);\n animateOpening(hasFooter, origin!, bestImageData!, dimensions, isVideo, message);\n }\n\n if (isGhostAnimation && !isOpen && (prevMessage || prevAvatarOwner)) {\n dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);\n animateClosing(prevOrigin!, prevBestImageData!, prevMessage || undefined);\n }\n }, [\n isGhostAnimation, isOpen, origin, prevOrigin, message, prevMessage, prevAvatarOwner,\n bestImageData, prevBestImageData, dimensions, isVideo, hasFooter,\n ]);\n\n useEffect(() => {\n let timer: number | undefined;\n\n if (isZoomed) {\n setCanPanZoomWrap(true);\n } else {\n timer = window.setTimeout(() => {\n setCanPanZoomWrap(false);\n }, ANIMATION_DURATION);\n }\n\n return () => {\n if (timer) {\n window.clearTimeout(timer);\n }\n };\n }, [isZoomed]);\n\n const closeZoom = () => {\n setIsZoomed(false);\n setZoomLevel(1);\n setPanDelta({\n x: 0,\n y: 0,\n });\n };\n\n const handleZoomToggle = useCallback(() => {\n setIsZoomed(!isZoomed);\n setZoomLevel(!isZoomed ? 1.5 : 1);\n if (isZoomed) {\n setPanDelta({\n x: 0,\n y: 0,\n });\n }\n }, [isZoomed]);\n\n const handleZoomValue = useCallback((level: number, canCloseZoom = false) => {\n setZoomLevel(level);\n if (level === 1 && canCloseZoom) {\n closeZoom();\n }\n }, []);\n\n const close = useCallback(() => {\n closeMediaViewer();\n closeZoom();\n }, [closeMediaViewer]);\n\n const handleFooterClick = useCallback(() => {\n close();\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n setTimeout(() => {\n toggleChatInfo(false, { forceSyncOnIOs: true });\n focusMessage({ chatId, threadId, messageId });\n }, ANIMATION_DURATION);\n } else {\n focusMessage({ chatId, threadId, messageId });\n }\n }, [close, chatId, threadId, focusMessage, toggleChatInfo, messageId]);\n\n const handleForward = useCallback(() => {\n openForwardMenu({\n fromChatId: chatId,\n messageIds: [messageId],\n });\n closeZoom();\n }, [openForwardMenu, chatId, messageId]);\n\n const selectMessage = useCallback((id?: number) => openMediaViewer({\n chatId,\n threadId,\n messageId: id,\n origin,\n }, {\n forceOnHeavyAnimation: true,\n }), [chatId, openMediaViewer, origin, threadId]);\n\n useEffect(() => (isOpen ? captureEscKeyListener(() => {\n if (isZoomed) {\n closeZoom();\n } else {\n close();\n }\n }) : undefined), [close, isOpen, isZoomed]);\n\n useEffect(() => {\n if (isVideo && !isGif) {\n stopCurrentAudio();\n }\n }, [isGif, isVideo]);\n\n // Prevent refresh when rotating device to watch a video\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isOpen]);\n\n const getMessageId = useCallback((fromId?: number, direction?: number): number | undefined => {\n if (!fromId) return undefined;\n const index = messageIds.indexOf(fromId);\n if ((direction === -1 && index > 0) || (direction === 1 && index < messageIds.length - 1)) {\n return messageIds[index + direction];\n }\n return undefined;\n }, [messageIds]);\n\n const nextMessageId = getMessageId(messageId, 1);\n const previousMessageId = getMessageId(messageId, -1);\n\n const handlePan = useCallback((x: number, y: number) => {\n setPanDelta({\n x,\n y,\n });\n }, []);\n\n const lang = useLang();\n\n useHistoryBack(isOpen, closeMediaViewer, openMediaViewer, {\n chatId,\n threadId,\n messageId,\n origin,\n avatarOwnerId: avatarOwner && avatarOwner.id,\n });\n\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n function handleKeyDown(e: KeyboardEvent) {\n switch (e.key) {\n case 'Left': // IE/Edge specific value\n case 'ArrowLeft':\n selectMessage(previousMessageId);\n break;\n\n case 'Right': // IE/Edge specific value\n case 'ArrowRight':\n selectMessage(nextMessageId);\n break;\n }\n }\n\n document.addEventListener('keydown', handleKeyDown, false);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown, false);\n };\n }, [isOpen, nextMessageId, previousMessageId, selectMessage]);\n\n useEffect(() => {\n if (isZoomed || IS_TOUCH_ENV) return undefined;\n const element = document.querySelector<HTMLDivElement>('.MediaViewerSlide--active');\n if (!element) {\n return undefined;\n }\n\n const shouldCloseOnVideo = isGif && !IS_IOS;\n\n return captureEvents(element, {\n // eslint-disable-next-line max-len\n excludedClosestSelector: `.backdrop, .navigation, .media-viewer-head, .Spoiler, .media-viewer-footer${!shouldCloseOnVideo ? ', .VideoPlayer' : ''}`,\n onClick: close,\n });\n }, [close, isGif, isZoomed, messageId]);\n\n function renderSenderInfo() {\n return isAvatar ? (\n <SenderInfo\n key={avatarOwner!.id}\n chatId={avatarOwner!.id}\n isAvatar\n />\n ) : (\n <SenderInfo\n key={messageId}\n chatId={chatId}\n messageId={messageId}\n />\n );\n }\n\n return (\n <ShowTransition\n id=\"MediaViewer\"\n className={isZoomed ? 'zoomed' : ''}\n isOpen={isOpen}\n >\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 isZoomed={isZoomed}\n message={message}\n fileName={fileName}\n canReport={canReport}\n onReport={openReportModal}\n onCloseMediaViewer={close}\n onForward={handleForward}\n onZoomToggle={handleZoomToggle}\n isAvatar={isAvatar}\n />\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n subject=\"media\"\n photo={avatarPhoto}\n chatId={avatarOwner?.id}\n />\n </div>\n <PanZoom\n noWrap={!canPanZoomWrap}\n canPan={isZoomed}\n panDeltaX={panDelta.x}\n panDeltaY={panDelta.y}\n zoomLevel={zoomLevel}\n onPan={handlePan}\n >\n <SlideTransition\n activeKey={selectedMediaMessageIndex}\n name={slideAnimation}\n >\n {(isActive: boolean) => (\n <MediaViewerSlides\n messageId={messageId}\n getMessageId={getMessageId}\n chatId={chatId}\n isPhoto={isPhoto}\n isGif={isGif}\n threadId={threadId}\n avatarOwnerId={avatarOwner && avatarOwner.id}\n profilePhotoIndex={profilePhotoIndex}\n origin={origin}\n isOpen={isOpen}\n hasFooter={hasFooter}\n isZoomed={isZoomed}\n isActive={isActive}\n isVideo={isVideo}\n animationLevel={animationLevel}\n onClose={close}\n selectMessage={selectMessage}\n onFooterClick={handleFooterClick}\n />\n )}\n </SlideTransition>\n </PanZoom>\n {!isFirst && !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 onClick={() => selectMessage(previousMessageId)}\n />\n )}\n {!isLast && !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 onClick={() => selectMessage(nextMessageId)}\n />\n )}\n <ZoomControls\n isShown={isZoomed}\n onChangeZoom={handleZoomValue}\n />\n </ShowTransition>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n chatId,\n threadId,\n messageId,\n avatarOwnerId,\n profilePhotoIndex,\n origin,\n } = global.mediaViewer;\n const {\n animationLevel,\n } = global.settings.byKey;\n\n let isChatWithSelf = !!chatId && selectIsChatWithSelf(global, chatId);\n\n if (origin === MediaViewerOrigin.SearchResult) {\n if (!(chatId && messageId)) {\n return { animationLevel };\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n if (!message) {\n return { animationLevel };\n }\n\n return {\n chatId,\n messageId,\n senderId: message.senderId,\n isChatWithSelf,\n origin,\n message,\n animationLevel,\n };\n }\n\n if (avatarOwnerId) {\n const sender = selectUser(global, avatarOwnerId) || selectChat(global, avatarOwnerId);\n isChatWithSelf = selectIsChatWithSelf(global, avatarOwnerId);\n\n return {\n messageId: -1,\n senderId: avatarOwnerId,\n avatarOwner: sender,\n isChatWithSelf,\n profilePhotoIndex: profilePhotoIndex || 0,\n animationLevel,\n origin,\n };\n }\n\n if (!(chatId && threadId && messageId)) {\n return { animationLevel };\n }\n\n let message: ApiMessage | undefined;\n if (origin && [MediaViewerOrigin.ScheduledAlbum, MediaViewerOrigin.ScheduledInline].includes(origin)) {\n message = selectScheduledMessage(global, chatId, messageId);\n } else {\n message = selectChatMessage(global, chatId, messageId);\n }\n\n if (!message) {\n return { animationLevel };\n }\n\n let chatMessages: Record<number, ApiMessage> | undefined;\n\n if (origin && [MediaViewerOrigin.ScheduledAlbum, MediaViewerOrigin.ScheduledInline].includes(origin)) {\n chatMessages = selectScheduledMessages(global, chatId);\n } else {\n chatMessages = selectChatMessages(global, chatId);\n }\n let collectionIds: number[] | undefined;\n\n if (origin === MediaViewerOrigin.Inline || origin === MediaViewerOrigin.Album) {\n collectionIds = selectOutlyingIds(global, chatId, threadId) || selectListedIds(global, chatId, threadId);\n } else if (origin === MediaViewerOrigin.SharedMedia) {\n const currentSearch = selectCurrentMediaSearch(global);\n const { foundIds } = (currentSearch && currentSearch.resultsByType && currentSearch.resultsByType.media) || {};\n collectionIds = foundIds;\n }\n\n return {\n chatId,\n threadId,\n messageId,\n senderId: message.senderId,\n isChatWithSelf,\n origin,\n message,\n chatMessages,\n collectionIds,\n animationLevel,\n };\n },\n)(MediaViewer));\n","import { RefObject } from 'react';\nimport React, {\n FC, memo, useRef, useCallback,\n} from '../../lib/teact/teact';\n\nimport { CHAT_HEIGHT_PX } from '../../config';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport useLang from '../../hooks/useLang';\nimport useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation';\nimport useInputFocusOnOpen from '../../hooks/useInputFocusOnOpen';\nimport { isUserId } from '../../global/helpers';\n\nimport Loading from '../ui/Loading';\nimport Modal from '../ui/Modal';\nimport InputText from '../ui/InputText';\nimport Button from '../ui/Button';\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport ListItem from '../ui/ListItem';\nimport GroupChatInfo from './GroupChatInfo';\nimport PrivateChatInfo from './PrivateChatInfo';\n\nimport './ChatOrUserPicker.scss';\n\nexport type OwnProps = {\n currentUserId?: string;\n chatOrUserIds: string[];\n isOpen: boolean;\n filterRef: RefObject<HTMLInputElement>;\n filterPlaceholder: string;\n filter: string;\n loadMore?: NoneToVoidFunction;\n onFilterChange: (filter: string) => void;\n onSelectChatOrUser: (chatOrUserId: string) => void;\n onClose: NoneToVoidFunction;\n onCloseAnimationEnd?: NoneToVoidFunction;\n};\n\nconst ChatOrUserPicker: FC<OwnProps> = ({\n isOpen,\n currentUserId,\n chatOrUserIds,\n filterRef,\n filter,\n filterPlaceholder,\n loadMore,\n onFilterChange,\n onSelectChatOrUser,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const lang = useLang();\n const [viewportIds, getMore] = useInfiniteScroll(loadMore, chatOrUserIds, Boolean(filter));\n\n const resetFilter = useCallback(() => {\n onFilterChange('');\n }, [onFilterChange]);\n useInputFocusOnOpen(filterRef, isOpen, resetFilter);\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n onFilterChange(e.currentTarget.value);\n }, [onFilterChange]);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isOpen, (index) => {\n if (viewportIds && viewportIds.length > 0) {\n onSelectChatOrUser(viewportIds[index === -1 ? 0 : index]);\n }\n }, '.ListItem-button', true);\n\n const modalHeader = (\n <div className=\"modal-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Close')}\n onClick={onClose}\n >\n <i className=\"icon-close\" />\n </Button>\n <InputText\n ref={filterRef}\n value={filter}\n onChange={handleFilterChange}\n onKeyDown={handleKeyDown}\n placeholder={filterPlaceholder}\n />\n </div>\n );\n\n const viewportOffset = chatOrUserIds!.indexOf(viewportIds![0]);\n\n return (\n <Modal\n isOpen={isOpen}\n className=\"ChatOrUserPicker\"\n header={modalHeader}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n >\n {viewportIds?.length ? (\n <InfiniteScroll\n ref={containerRef}\n className=\"picker-list custom-scroll\"\n items={viewportIds}\n onLoadMore={getMore}\n withAbsolutePositioning\n maxHeight={chatOrUserIds!.length * CHAT_HEIGHT_PX}\n onKeyDown={handleKeyDown}\n >\n {viewportIds.map((id, i) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable force-rounded-corners\"\n style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onSelectChatOrUser(id)}\n >\n {isUserId(id) ? (\n <PrivateChatInfo status={id === currentUserId ? lang('SavedMessagesInfo') : undefined} userId={id} />\n ) : (\n <GroupChatInfo chatId={id} />\n )}\n </ListItem>\n ))}\n </InfiniteScroll>\n ) : viewportIds && !viewportIds.length ? (\n <p className=\"no-results\">{lang('lng_blocked_list_not_found')}</p>\n ) : (\n <Loading />\n )}\n </Modal>\n );\n};\n\nexport default memo(ChatOrUserPicker);\n","import React, {\n FC, useMemo, useState, memo, useRef, useCallback, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport { ApiChat, MAIN_THREAD_ID } from '../../api/types';\nimport { GlobalState } from '../../global/types';\n\nimport {\n filterChatsByName,\n filterUsersByName,\n getCanPostInChat,\n sortChatIds,\n} from '../../global/helpers';\nimport { unique } from '../../util/iteratees';\nimport useLang from '../../hooks/useLang';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\nimport useFlag from '../../hooks/useFlag';\n\nimport ChatOrUserPicker from '../common/ChatOrUserPicker';\n\nexport type OwnProps = {\n isOpen: boolean;\n};\n\ntype StateProps = {\n chatsById: Record<string, ApiChat>;\n activeListIds?: string[];\n archivedListIds?: string[];\n pinnedIds?: string[];\n contactIds?: string[];\n currentUserId?: string;\n switchBotInline?: GlobalState['switchBotInline'];\n};\n\nconst ForwardPicker: FC<OwnProps & StateProps> = ({\n chatsById,\n activeListIds,\n archivedListIds,\n pinnedIds,\n contactIds,\n currentUserId,\n isOpen,\n switchBotInline,\n}) => {\n const {\n setForwardChatId,\n exitForwardMode,\n openChatWithText,\n resetSwitchBotInline,\n } = getActions();\n\n const lang = useLang();\n const [filter, setFilter] = useState('');\n // eslint-disable-next-line no-null/no-null\n const filterRef = useRef<HTMLInputElement>(null);\n\n const [isShown, markIsShown, unmarkIsShown] = useFlag();\n useEffect(() => {\n if (isOpen) {\n markIsShown();\n }\n }, [isOpen, markIsShown]);\n\n const chatAndContactIds = useMemo(() => {\n if (!isOpen) {\n return undefined;\n }\n\n let priorityIds = pinnedIds || [];\n if (currentUserId) {\n priorityIds = unique([currentUserId, ...priorityIds]);\n }\n\n const chatIds = [\n ...(activeListIds || []),\n ...(archivedListIds || []),\n ].filter((id) => {\n const chat = chatsById[id];\n\n return chat && getCanPostInChat(chat, MAIN_THREAD_ID);\n });\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n return sortChatIds(unique([\n ...filterChatsByName(lang, chatIds, chatsById, filter, currentUserId),\n ...(contactIds ? filterUsersByName(contactIds, usersById, filter) : []),\n ]), chatsById, undefined, priorityIds);\n }, [activeListIds, archivedListIds, chatsById, contactIds, currentUserId, filter, isOpen, lang, pinnedIds]);\n\n const handleSelectUser = useCallback((userId: string) => {\n if (switchBotInline) {\n const text = `@${switchBotInline.botUsername} ${switchBotInline.query}`;\n openChatWithText({ chatId: userId, text });\n resetSwitchBotInline();\n } else {\n setForwardChatId({ id: userId });\n }\n }, [openChatWithText, resetSwitchBotInline, setForwardChatId, switchBotInline]);\n\n const renderingChatAndContactIds = useCurrentOrPrev(chatAndContactIds, true)!;\n\n if (!isOpen && !isShown) {\n return undefined;\n }\n\n return (\n <ChatOrUserPicker\n currentUserId={currentUserId}\n isOpen={isOpen}\n chatOrUserIds={renderingChatAndContactIds}\n filterRef={filterRef}\n filterPlaceholder={lang('ForwardTo')}\n filter={filter}\n onFilterChange={setFilter}\n onSelectChatOrUser={handleSelectUser}\n onClose={exitForwardMode}\n onCloseAnimationEnd={unmarkIsShown}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n chats: {\n byId: chatsById,\n listIds,\n orderedPinnedIds,\n },\n currentUserId,\n switchBotInline,\n } = global;\n\n return {\n chatsById,\n activeListIds: listIds.active,\n archivedListIds: listIds.archived,\n pinnedIds: orderedPinnedIds.active,\n contactIds: global.contactList?.userIds,\n currentUserId,\n switchBotInline,\n };\n },\n)(ForwardPicker));\n","import React, { FC, memo, useEffect } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport {\n ApiContact, ApiError, ApiInviteInfo, ApiPhoto,\n} from '../../api/types';\n\nimport getReadableErrorText from '../../util/getReadableErrorText';\nimport { pick } from '../../util/iteratees';\nimport renderText from '../common/helpers/renderText';\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport Avatar from '../common/Avatar';\n\nimport './Dialogs.scss';\n\ntype StateProps = {\n dialogs: (ApiError | ApiInviteInfo)[];\n};\n\nconst Dialogs: FC<StateProps> = ({ dialogs }) => {\n const {\n dismissDialog,\n acceptInviteConfirmation,\n sendMessage,\n showNotification,\n } = getActions();\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n const lang = useLang();\n\n useEffect(() => {\n if (dialogs.length > 0) {\n openModal();\n }\n }, [dialogs, openModal]);\n\n if (!dialogs.length) {\n return undefined;\n }\n\n function renderInviteHeader(title: string, photo?: ApiPhoto) {\n return (\n <div className=\"modal-header\">\n {photo && <Avatar size=\"small\" photo={photo} />}\n <div className=\"modal-title\">\n {renderText(title)}\n </div>\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel={lang('Close')} onClick={closeModal}>\n <i className=\"icon-close\" />\n </Button>\n </div>\n );\n }\n\n const renderInvite = (invite: ApiInviteInfo) => {\n const {\n hash, title, about, participantsCount, isChannel, photo, isRequestNeeded,\n } = invite;\n\n const handleJoinClick = () => {\n acceptInviteConfirmation({\n hash,\n });\n showNotification({\n message: isChannel ? lang('RequestToJoinChannelSentDescription') : lang('RequestToJoinGroupSentDescription'),\n });\n closeModal();\n };\n\n const participantsText = isChannel\n ? lang('Subscribers', participantsCount, 'i')\n : lang('Members', participantsCount, 'i');\n\n const joinText = isChannel ? lang('ChannelJoin') : lang('JoinGroup');\n const requestToJoinText = isChannel\n ? lang('MemberRequests.RequestToJoinChannel') : lang('MemberRequests.RequestToJoinGroup');\n\n return (\n <Modal\n isOpen={isModalOpen}\n onClose={closeModal}\n className=\"error\"\n header={renderInviteHeader(title, photo)}\n onCloseAnimationEnd={dismissDialog}\n >\n {participantsCount !== undefined && <p className=\"modal-help\">{participantsText}</p>}\n {about && <p className=\"modal-about\">{renderText(about, ['br'])}</p>}\n {isRequestNeeded && (\n <p className=\"modal-help\">\n {isChannel\n ? lang('MemberRequests.RequestToJoinDescriptionChannel')\n : lang('MemberRequests.RequestToJoinDescriptionGroup')}\n </p>\n )}\n <Button\n isText\n className=\"confirm-dialog-button\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={handleJoinClick}\n >\n {isRequestNeeded ? requestToJoinText : joinText}\n </Button>\n <Button isText className=\"confirm-dialog-button\" onClick={closeModal}>{lang('Cancel')}</Button>\n </Modal>\n );\n };\n\n const renderContactRequest = (contactRequest: ApiContact) => {\n const handleConfirm = () => {\n sendMessage({\n contact: pick(contactRequest, ['firstName', 'lastName', 'phoneNumber']),\n });\n closeModal();\n };\n\n return (\n <Modal\n isOpen={isModalOpen}\n onClose={closeModal}\n className=\"confirm\"\n title={lang('ShareYouPhoneNumberTitle')}\n onCloseAnimationEnd={dismissDialog}\n >\n {lang('AreYouSureShareMyContactInfoBot')}\n <div>\n <Button\n className=\"confirm-dialog-button\"\n isText\n // eslint-disable-next-line react/jsx-no-bind\n onClick={handleConfirm}\n >\n {lang('OK')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={closeModal}>{lang('Cancel')}</Button>\n </div>\n </Modal>\n );\n };\n\n const renderError = (error: ApiError) => {\n return (\n <Modal\n isOpen={isModalOpen}\n onClose={closeModal}\n onCloseAnimationEnd={dismissDialog}\n className=\"error\"\n title={getErrorHeader(error)}\n >\n {error.hasErrorKey ? getReadableErrorText(error) : renderText(error.message!, ['emoji', 'br'])}\n <div>\n <Button isText onClick={closeModal}>{lang('OK')}</Button>\n </div>\n </Modal>\n );\n };\n\n const renderDialog = (dialog: ApiError | ApiInviteInfo | ApiContact) => {\n if ('hash' in dialog) {\n return renderInvite(dialog);\n }\n\n if ('phoneNumber' in dialog) {\n return renderContactRequest(dialog);\n }\n\n return renderError(dialog);\n };\n\n return (\n <div id=\"Dialogs\">\n {Boolean(dialogs.length) && renderDialog(dialogs[dialogs.length - 1])}\n </div>\n );\n};\n\nfunction getErrorHeader(error: ApiError) {\n if (error.isSlowMode) {\n return 'Slowmode enabled';\n }\n\n if (!error.hasErrorKey) {\n return 'Telegram';\n }\n\n return 'Something went wrong';\n}\n\nexport default memo(withGlobal(\n (global): StateProps => pick(global, ['dialogs']),\n)(Dialogs));\n","import React, { FC, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiNotification } from '../../api/types';\n\nimport { pick } from '../../util/iteratees';\nimport renderText from '../common/helpers/renderText';\n\nimport Notification from '../ui/Notification';\n\ntype StateProps = {\n notifications: ApiNotification[];\n};\n\nconst Notifications: FC<StateProps> = ({ notifications }) => {\n const { dismissNotification } = getActions();\n\n if (!notifications.length) {\n return undefined;\n }\n\n return (\n <div id=\"Notifications\">\n {notifications.map(({ message, localId }) => (\n <Notification\n message={renderText(message, ['emoji', 'br', 'links', 'simple_markdown'])}\n // eslint-disable-next-line react/jsx-no-bind\n onDismiss={() => dismissNotification({ localId })}\n />\n ))}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => pick(global, ['notifications']),\n)(Notifications));\n","import React, { FC, memo, useCallback } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport { ensureProtocol } from '../../util/ensureProtocol';\nimport renderText from '../common/helpers/renderText';\nimport useLang from '../../hooks/useLang';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nexport type OwnProps = {\n url?: string;\n};\n\nconst SafeLinkModal: FC<OwnProps> = ({ url }) => {\n const { toggleSafeLinkModal } = getActions();\n\n const lang = useLang();\n\n const handleOpen = useCallback(() => {\n window.open(ensureProtocol(url));\n toggleSafeLinkModal({ url: undefined });\n }, [toggleSafeLinkModal, url]);\n\n const handleDismiss = useCallback(() => {\n toggleSafeLinkModal({ url: undefined });\n }, [toggleSafeLinkModal]);\n\n const renderingUrl = useCurrentOrPrev(url);\n\n return (\n <ConfirmDialog\n isOpen={Boolean(url)}\n onClose={handleDismiss}\n title={lang('OpenUrlTitle')}\n textParts={renderText(lang('OpenUrlAlert2', renderingUrl), ['links'])}\n confirmLabel={lang('OpenUrlTitle')}\n confirmHandler={handleOpen}\n />\n );\n};\n\nexport default memo(SafeLinkModal);\n","import React, {\n FC, memo, useState, useEffect, useMemo, useCallback,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport { formatTime, formatDateToString, getDayStart } from '../../util/dateFormat';\nimport useLang, { LangFn } 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 React, { FC, 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 React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { 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(lang('NewContact.Phone.Hidden.Text', renderingUser?.firstName), ['emoji', 'simple_markdown'])}\n </p>\n <Checkbox\n checked={shouldSharePhoneNumber}\n tabIndex={0}\n onCheck={setShouldSharePhoneNumber}\n label={lang('lng_new_contact_share')}\n />\n <p className=\"NewContactModal__help-text\">\n {renderText(lang('AddContact.SharedContactExceptionInfo', renderingUser?.firstName))}\n </p>\n </>\n );\n }\n\n function renderCreateContact() {\n return (\n <div className=\"NewContactModal__new-contact\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Avatar size=\"jumbo\" text={`${firstName} ${lastName}`} />\n <div className=\"NewContactModal__new-contact-fieldset\">\n <InputText\n ref={inputRef}\n value={phone}\n inputMode=\"tel\"\n label={lang('lng_contact_phone')}\n tabIndex={0}\n onChange={handlePhoneChange}\n />\n <InputText\n value={firstName}\n label={lang('FirstName')}\n tabIndex={0}\n onChange={handleFirstNameChange}\n />\n <InputText\n value={lastName}\n label={lang('LastName')}\n tabIndex={0}\n onChange={handleLastNameChange}\n />\n </div>\n </div>\n );\n }\n\n return (\n <Modal\n className=\"NewContactModal\"\n title={lang('NewContact')}\n isOpen={isOpen}\n onClose={handleClose}\n onCloseAnimationEnd={unmarkIsShown}\n >\n {renderingUser && renderAddContact()}\n {renderingIsByPhoneNumber && renderCreateContact()}\n <div className=\"dialog-buttons\">\n <Button\n isText\n className=\"confirm-dialog-button\"\n onClick={handleClose}\n >\n {lang('Cancel')}\n </Button>\n <Button\n isText\n className=\"confirm-dialog-button\"\n disabled={!canBeSubmitted}\n onClick={handleSubmit}\n >\n {lang('Done')}\n </Button>\n </div>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n return {\n user: userId ? selectUser(global, userId) : undefined,\n userStatus: userId ? selectUserStatus(global, userId) : undefined,\n serverTimeOffset: global.serverTimeOffset,\n phoneCodeList: global.countryList.phoneCodes,\n };\n },\n)(NewContactModal));\n","import useWindowSize from '../../../hooks/useWindowSize';\nimport { useCallback, useEffect, useRef } from '../../../lib/teact/teact';\nimport { extractCurrentThemeParams } from '../../../util/themeStyle';\n\nexport type WebAppInboundEvent = {\n eventType: 'web_app_data_send';\n eventData: {\n data: string;\n };\n} | {\n eventType: 'web_app_setup_main_button';\n eventData: {\n is_visible: boolean;\n is_active: boolean;\n text: string;\n color: string;\n text_color: string;\n is_progress_visible: boolean;\n };\n} | {\n eventType: 'web_app_request_viewport';\n} | {\n eventType: 'web_app_request_theme';\n} | {\n eventType: 'web_app_ready';\n} | {\n eventType: 'web_app_expand';\n} | {\n eventType: 'web_app_close';\n};\n\ntype WebAppOutboundEvent = {\n eventType: 'viewport_changed';\n eventData: {\n height: number;\n width?: number;\n is_expanded?: boolean;\n };\n} | {\n eventType: 'theme_changed';\n eventData: {\n theme_params: {\n bg_color: string;\n text_color: string;\n hint_color: string;\n link_color: string;\n button_color: string;\n button_text_color: string;\n };\n };\n} | {\n eventType: 'main_button_pressed';\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 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 === '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, 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 FC, memo, useCallback, useEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiChat } from '../../api/types';\nimport { GlobalState } from '../../global/types';\nimport { ThemeKey } from '../../types';\n\nimport windowSize from '../../util/windowSize';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { selectCurrentChat, selectTheme } from '../../global/selectors';\nimport buildClassName from '../../util/buildClassName';\nimport { extractCurrentThemeParams, validateHexColor } from '../../util/themeStyle';\n\nimport useInterval from '../../hooks/useInterval';\nimport useLang from '../../hooks/useLang';\nimport useOnChange from '../../hooks/useOnChange';\nimport useWebAppFrame, { WebAppInboundEvent } from './hooks/useWebAppFrame';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport DropdownMenu from '../ui/DropdownMenu';\nimport MenuItem from '../ui/MenuItem';\nimport Spinner from '../ui/Spinner';\n\nimport './WebAppModal.scss';\n\ntype WebAppButton = {\n isVisible: boolean;\n isActive: boolean;\n text: string;\n color: string;\n textColor: string;\n isProgressVisible: boolean;\n};\n\nexport type OwnProps = {\n webApp?: GlobalState['webApp'];\n};\n\ntype StateProps = {\n isInstalled?: boolean;\n chat?: ApiChat;\n theme?: ThemeKey;\n};\n\nconst MAIN_BUTTON_ANIMATION_TIME = 250;\nconst PROLONG_INTERVAL = 45000; // 45s\nconst ANIMATION_WAIT = 400;\n\nconst WebAppModal: FC<OwnProps & StateProps> = ({\n webApp,\n chat,\n isInstalled,\n theme,\n}) => {\n const {\n closeWebApp, sendWebViewData, prolongWebView, toggleBotInAttachMenu,\n } = getActions();\n const [mainButton, setMainButton] = useState<WebAppButton | undefined>();\n const lang = useLang();\n const {\n url, bot, buttonText, queryId,\n } = webApp || {};\n const isOpen = Boolean(url);\n const isSimple = !queryId;\n\n const handleEvent = useCallback((event: WebAppInboundEvent) => {\n const { eventType } = event;\n if (eventType === 'web_app_close') {\n closeWebApp();\n }\n\n if (eventType === 'web_app_data_send') {\n const { eventData } = event;\n closeWebApp();\n sendWebViewData({\n bot: bot!,\n buttonText: buttonText!,\n data: eventData.data,\n });\n }\n\n if (eventType === 'web_app_setup_main_button') {\n const { eventData } = event;\n const themeParams = extractCurrentThemeParams();\n // Validate colors if they are present\n const color = !eventData.color || validateHexColor(eventData.color) ? eventData.color\n : themeParams.button_color;\n const textColor = !eventData.text_color || validateHexColor(eventData.text_color) ? eventData.text_color\n : themeParams.text_color;\n setMainButton({\n isVisible: eventData.is_visible && Boolean(eventData.text?.trim().length),\n isActive: eventData.is_active,\n text: eventData.text || '',\n color,\n textColor,\n isProgressVisible: eventData.is_progress_visible,\n });\n }\n }, [bot, buttonText, closeWebApp, sendWebViewData]);\n\n const {\n ref, reloadFrame, sendEvent, sendViewport, sendTheme,\n } = useWebAppFrame(isOpen, isSimple, handleEvent);\n\n const shouldShowMainButton = mainButton?.isVisible && mainButton.text.trim().length > 0;\n\n useInterval(() => {\n prolongWebView({\n bot: bot!,\n queryId: queryId!,\n peer: chat!,\n });\n }, queryId ? PROLONG_INTERVAL : undefined, true);\n\n const handleMainButtonClick = useCallback(() => {\n sendEvent({\n eventType: 'main_button_pressed',\n });\n }, [sendEvent]);\n\n const handleRefreshClick = useCallback(() => {\n reloadFrame(webApp!.url);\n }, [reloadFrame, webApp]);\n\n // Notify view that height changed\n useOnChange(() => {\n setTimeout(() => {\n sendViewport();\n }, ANIMATION_WAIT);\n }, [mainButton?.isVisible, sendViewport]);\n\n // Notify view that theme changed\n useOnChange(() => {\n setTimeout(() => {\n sendTheme();\n }, ANIMATION_WAIT);\n }, [theme, sendTheme]);\n\n // Prevent refresh when rotating device\n useEffect(() => {\n if (!isOpen) return undefined;\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isOpen]);\n\n const handleToggleClick = useCallback(() => {\n toggleBotInAttachMenu({\n botId: bot!.id,\n isEnabled: !isInstalled,\n });\n }, [bot, isInstalled, toggleBotInAttachMenu]);\n\n const MoreMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen: isMenuOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isMenuOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"More actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n const header = useMemo(() => {\n return (\n <div className=\"modal-header\">\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Close')}\n onClick={closeWebApp}\n >\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{bot?.firstName}</div>\n <DropdownMenu\n className=\"web-app-more-menu\"\n trigger={MoreMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"reload\" onClick={handleRefreshClick}>{lang('WebApp.ReloadPage')}</MenuItem>\n {bot?.isAttachMenuBot && (\n <MenuItem icon={isInstalled ? 'stop' : 'install'} onClick={handleToggleClick} destructive={isInstalled}>\n {lang(isInstalled ? 'WebApp.RemoveBot' : 'WebApp.AddToAttachmentAdd')}\n </MenuItem>\n )}\n </DropdownMenu>\n </div>\n );\n }, [\n MoreMenuButton, bot, closeWebApp, handleRefreshClick, handleToggleClick, lang, isInstalled,\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) setMainButton(undefined);\n }, [isOpen]);\n\n const [shouldDecreaseWebFrameSize, setShouldDecreaseWebFrameSize] = useState(false);\n const [shouldHideButton, setShouldHideButton] = useState(true);\n\n const buttonChangeTimeout = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n if (buttonChangeTimeout.current) clearTimeout(buttonChangeTimeout.current);\n if (!shouldShowMainButton) {\n setShouldDecreaseWebFrameSize(false);\n buttonChangeTimeout.current = setTimeout(() => {\n setShouldHideButton(true);\n }, MAIN_BUTTON_ANIMATION_TIME);\n } else {\n setShouldHideButton(false);\n buttonChangeTimeout.current = setTimeout(() => {\n setShouldDecreaseWebFrameSize(true);\n }, MAIN_BUTTON_ANIMATION_TIME);\n }\n }, [setShouldDecreaseWebFrameSize, shouldShowMainButton]);\n\n return (\n <Modal\n className=\"WebAppModal\"\n isOpen={isOpen}\n onClose={closeWebApp}\n header={header}\n hasCloseButton\n >\n {isOpen && (\n <>\n <iframe\n ref={ref}\n className={buildClassName('web-app-frame', shouldDecreaseWebFrameSize && 'with-button')}\n src={url}\n title={`${bot?.firstName} Web App`}\n sandbox=\"allow-scripts allow-same-origin allow-popups allow-forms\"\n allow=\"camera; microphone; geolocation;\"\n allowFullScreen\n />\n <Button\n className={buildClassName(\n 'web-app-button',\n shouldShowMainButton && 'visible',\n shouldHideButton && 'hidden',\n )}\n style={`background-color: ${mainButtonCurrentColor}; color: ${mainButtonCurrentTextColor}`}\n disabled={!mainButtonCurrentIsActive}\n onClick={handleMainButtonClick}\n >\n {mainButtonCurrentText}\n {mainButton?.isProgressVisible && <Spinner color=\"white\" />}\n </Button>\n </>\n )}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { webApp }): StateProps => {\n const { bot } = webApp || {};\n const isInstalled = Boolean(bot && global.attachMenu.bots[bot.id]);\n const chat = selectCurrentChat(global);\n const theme = selectTheme(global);\n\n return {\n isInstalled,\n chat,\n theme,\n };\n },\n)(WebAppModal));\n","import React, { FC, memo, useCallback } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport { ApiUser } from '../../api/types';\n\nimport { getUserFullName } from '../../global/helpers';\nimport renderText from '../common/helpers/renderText';\n\nimport useLang from '../../hooks/useLang';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nexport type OwnProps = {\n bot?: ApiUser;\n type?: 'game' | 'webApp';\n};\n\nconst BotTrustModal: FC<OwnProps> = ({ bot, type }) => {\n const { cancelBotTrustRequest, markBotTrusted } = getActions();\n const lang = useLang();\n // Keep props a little bit longer, to show correct text on closing animation\n const previousBot = usePrevious(bot, false);\n const previousType = usePrevious(type, false);\n const currentBot = bot || previousBot;\n const currentType = type || previousType;\n\n const handleBotTrustAccept = useCallback(() => {\n markBotTrusted({ botId: bot!.id });\n }, [markBotTrusted, bot]);\n\n const title = currentType === 'game' ? lang('AppName') : lang('BotOpenPageTitle');\n const text = currentType === 'game' ? lang('BotPermissionGameAlert', getUserFullName(currentBot))\n : lang('BotOpenPageMessage', getUserFullName(currentBot));\n\n return (\n <ConfirmDialog\n isOpen={Boolean(bot)}\n onClose={cancelBotTrustRequest}\n confirmHandler={handleBotTrustAccept}\n title={title}\n textParts={renderText(text, ['br', 'simple_markdown'])}\n />\n );\n};\n\nexport default memo(BotTrustModal);\n","import React, { FC } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport { ApiUser } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nexport type OwnProps = {\n bot?: ApiUser;\n};\n\nconst BotAttachModal: FC<OwnProps> = ({\n bot,\n}) => {\n const { closeBotAttachRequestModal, confirmBotAttachRequest } = getActions();\n\n const lang = useLang();\n\n const name = bot?.firstName;\n\n return (\n <ConfirmDialog\n isOpen={Boolean(bot)}\n onClose={closeBotAttachRequestModal}\n confirmHandler={confirmBotAttachRequest}\n title={name}\n textParts={lang('WebApp.AddToAttachmentText', name)}\n />\n );\n};\n\nexport default BotAttachModal;\n","import React, { FC, useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiMessage } from '../../api/types';\nimport { 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 React, { FC, 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 React, { FC, 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 { useEffect } from '../../../lib/teact/teact';\nimport { IS_MAC_OS } from '../../../util/environment';\nimport getKeyFromEvent from '../../../util/getKeyFromEvent';\n\nconst useCopySelectedMessages = (isActive: boolean, copySelectedMessages: NoneToVoidFunction) => {\n useEffect(() => {\n function handleCopy(e: KeyboardEvent) {\n if (((IS_MAC_OS && e.metaKey) || (!IS_MAC_OS && e.ctrlKey)) && getKeyFromEvent(e) === 'c') {\n e.preventDefault();\n copySelectedMessages();\n }\n }\n\n if (isActive) {\n document.addEventListener('keydown', handleCopy, false);\n }\n\n return () => {\n document.removeEventListener('keydown', handleCopy, false);\n };\n }, [copySelectedMessages, isActive]);\n};\n\nexport default useCopySelectedMessages;\n","import React, {\n FC, useCallback, memo, useEffect,\n} 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 React, {\n FC, memo, useCallback, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { MessageListType } from '../../global/types';\n\nimport {\n selectCanDeleteSelectedMessages,\n selectCanDownloadSelectedMessages,\n selectCanReportSelectedMessages,\n selectCurrentMessageList,\n selectHasProtectedMessage,\n selectSelectedMessagesCount,\n} from '../../global/selectors';\nimport useFlag from '../../hooks/useFlag';\nimport captureKeyboardListeners from '../../util/captureKeyboardListeners';\nimport buildClassName from '../../util/buildClassName';\nimport usePrevious from '../../hooks/usePrevious';\nimport useLang from '../../hooks/useLang';\nimport useCopySelectedMessages from './hooks/useCopySelectedMessages';\n\nimport Button from '../ui/Button';\n\nimport DeleteSelectedMessageModal from './DeleteSelectedMessageModal';\nimport ReportModal from '../common/ReportModal';\n\nimport './MessageSelectToolbar.scss';\n\nexport type OwnProps = {\n isActive?: boolean;\n canPost?: boolean;\n messageListType?: MessageListType;\n};\n\ntype StateProps = {\n isSchedule: boolean;\n selectedMessagesCount?: number;\n canDeleteMessages?: boolean;\n canReportMessages?: boolean;\n canDownloadMessages?: boolean;\n hasProtectedMessage?: boolean;\n selectedMessageIds?: number[];\n};\n\nconst MessageSelectToolbar: FC<OwnProps & StateProps> = ({\n canPost,\n isActive,\n messageListType,\n isSchedule,\n selectedMessagesCount,\n canDeleteMessages,\n canReportMessages,\n canDownloadMessages,\n hasProtectedMessage,\n selectedMessageIds,\n}) => {\n const {\n exitMessageSelectMode,\n openForwardMenuForSelectedMessages,\n downloadSelectedMessages,\n copySelectedMessages,\n } = getActions();\n\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isReportModalOpen, openReportModal, closeReportModal] = useFlag();\n\n useCopySelectedMessages(Boolean(isActive), copySelectedMessages);\n useEffect(() => {\n return isActive && !isDeleteModalOpen && !isReportModalOpen\n ? captureKeyboardListeners({\n onBackspace: openDeleteModal,\n onDelete: openDeleteModal,\n onEsc: exitMessageSelectMode,\n })\n : undefined;\n }, [isActive, isDeleteModalOpen, isReportModalOpen, openDeleteModal, exitMessageSelectMode]);\n\n const handleCopy = useCallback(() => {\n copySelectedMessages();\n exitMessageSelectMode();\n }, [copySelectedMessages, exitMessageSelectMode]);\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 lang = useLang();\n\n const formattedMessagesCount = lang('VoiceOver.Chat.MessagesSelected', renderingSelectedMessagesCount, 'i');\n\n const className = buildClassName(\n 'MessageSelectToolbar',\n canPost && 'with-composer',\n isActive && 'shown',\n );\n\n const renderButton = (\n icon: string, label: string, onClick: AnyToVoidFunction, disabled?: boolean, destructive?: boolean,\n ) => {\n return (\n <div\n role=\"button\"\n tabIndex={0}\n className={buildClassName(\n 'item',\n disabled && 'disabled',\n destructive && 'destructive',\n )}\n onClick={!disabled ? onClick : undefined}\n title={label}\n >\n <i className={`icon-${icon}`} />\n </div>\n );\n };\n\n return (\n <div className={className}>\n <div className=\"MessageSelectToolbar-inner\">\n <Button\n color=\"translucent\"\n round\n onClick={exitMessageSelectMode}\n ariaLabel=\"Exit select mode\"\n >\n <i className=\"icon-close\" />\n </Button>\n <span className=\"MessageSelectToolbar-count\" title={formattedMessagesCount}>\n {formattedMessagesCount}\n </span>\n\n {Boolean(selectedMessagesCount) && (\n <div className=\"MessageSelectToolbar-actions\">\n {messageListType !== 'scheduled' && (\n renderButton(\n 'forward', lang('Chat.ForwardActionHeader'), openForwardMenuForSelectedMessages, hasProtectedMessage,\n )\n )}\n {canReportMessages && (\n renderButton('flag', lang('Conversation.ReportMessages'), openReportModal)\n )}\n {canDownloadMessages && (\n renderButton('download', lang('lng_media_download'), handleDownload, hasProtectedMessage)\n )}\n {renderButton('copy', lang('lng_context_copy_selected_items'), handleCopy, hasProtectedMessage)}\n {renderButton('delete', lang('EditAdminGroupDeleteMessages'), openDeleteModal, !canDeleteMessages, true)}\n </div>\n )}\n </div>\n <DeleteSelectedMessageModal\n isOpen={isDeleteModalOpen}\n isSchedule={isSchedule}\n onClose={closeDeleteModal}\n />\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n messageIds={selectedMessageIds}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { type: messageListType, chatId } = selectCurrentMessageList(global) || {};\n const { canDelete } = selectCanDeleteSelectedMessages(global);\n const canReport = selectCanReportSelectedMessages(global);\n const canDownload = selectCanDownloadSelectedMessages(global);\n const { messageIds: selectedMessageIds } = global.selectedMessages || {};\n const hasProtectedMessage = chatId ? selectHasProtectedMessage(global, chatId, selectedMessageIds) : false;\n\n return {\n isSchedule: messageListType === 'scheduled',\n selectedMessagesCount: selectSelectedMessagesCount(global),\n canDeleteMessages: canDelete,\n canReportMessages: canReport,\n canDownloadMessages: canDownload,\n selectedMessageIds,\n hasProtectedMessage,\n };\n },\n)(MessageSelectToolbar));\n","import React, { FC, 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 React, {\n FC, useCallback, memo, useMemo, useEffect, useState, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport { ApiMessage } from '../../api/types';\nimport { LoadMoreDirection } from '../../types';\n\nimport useLang from '../../hooks/useLang';\nimport { selectChatMessage } from '../../global/selectors';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport { getUserFullName } from '../../global/helpers';\nimport renderText from '../common/helpers/renderText';\nimport useFlag from '../../hooks/useFlag';\nimport buildClassName from '../../util/buildClassName';\nimport { formatIntegerCompact } from '../../util/textFormat';\nimport { unique } from '../../util/iteratees';\n\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport Avatar from '../common/Avatar';\nimport ListItem from '../ui/ListItem';\nimport ReactionStaticEmoji from '../common/ReactionStaticEmoji';\nimport Loading from '../ui/Loading';\n\nimport './ReactorListModal.scss';\n\nconst MIN_REACTIONS_COUNT_FOR_FILTERS = 10;\n\nexport type OwnProps = {\n isOpen: boolean;\n};\n\nexport type StateProps = Pick<ApiMessage, 'reactors' | 'reactions' | 'seenByUserIds'> & {\n chatId?: string;\n messageId?: number;\n};\n\nconst ReactorListModal: FC<OwnProps & StateProps> = ({\n isOpen,\n reactors,\n reactions,\n chatId,\n messageId,\n seenByUserIds,\n}) => {\n const {\n loadReactors,\n closeReactorListModal,\n openChat,\n } = getActions();\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n const lang = useLang();\n const [isClosing, startClosing, stopClosing] = useFlag(false);\n const [chosenTab, setChosenTab] = useState<string | undefined>(undefined);\n const canShowFilters = reactors && reactions && reactors.count >= MIN_REACTIONS_COUNT_FOR_FILTERS\n && reactions.results.length > 1;\n const chatIdRef = useRef<string>();\n\n useEffect(() => {\n if (isClosing && !isOpen) {\n stopClosing();\n setChosenTab(undefined);\n }\n }, [isClosing, isOpen, stopClosing]);\n\n const handleCloseAnimationEnd = useCallback(() => {\n if (chatIdRef.current) {\n openChat({ id: chatIdRef.current });\n }\n closeReactorListModal();\n }, [closeReactorListModal, openChat]);\n\n const handleClose = useCallback(() => {\n startClosing();\n }, [startClosing]);\n\n const handleClick = useCallback((userId: string) => {\n chatIdRef.current = userId;\n handleClose();\n }, [handleClose]);\n\n const handleLoadMore = useCallback(() => {\n loadReactors({\n chatId,\n messageId,\n });\n }, [chatId, loadReactors, messageId]);\n\n const allReactions = useMemo(() => {\n return reactors?.reactions ? unique(reactors.reactions.map((l) => l.reaction)) : [];\n }, [reactors?.reactions]);\n\n const userIds = useMemo(() => {\n if (chosenTab) {\n return reactors?.reactions.filter((l) => l.reaction === chosenTab).map((l) => l.userId);\n }\n return unique(reactors?.reactions.map((l) => l.userId).concat(seenByUserIds || []) || []);\n }, [chosenTab, reactors?.reactions, seenByUserIds]);\n\n const [viewportIds, getMore] = useInfiniteScroll(\n handleLoadMore, userIds, reactors && reactors.nextOffset === undefined,\n );\n\n useEffect(() => {\n getMore?.({ direction: LoadMoreDirection.Backwards });\n }, [getMore]);\n\n return (\n <Modal\n isOpen={isOpen && !isClosing}\n onClose={handleClose}\n className=\"ReactorListModal narrow\"\n title={lang('Reactions')}\n onCloseAnimationEnd={handleCloseAnimationEnd}\n >\n {canShowFilters && (\n <div className=\"Reactions\">\n <Button\n className={buildClassName(!chosenTab && 'chosen')}\n size=\"tiny\"\n ripple\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setChosenTab(undefined)}\n >\n <i className=\"icon-reaction-filled\" />\n {reactors?.count && formatIntegerCompact(reactors.count)}\n </Button>\n {allReactions.map((reaction) => {\n const count = reactions?.results.find((l) => l.reaction === reaction)?.count;\n return (\n <Button\n className={buildClassName(chosenTab === reaction && 'chosen')}\n size=\"tiny\"\n ripple\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setChosenTab(reaction)}\n >\n <ReactionStaticEmoji reaction={reaction} className=\"reaction-filter-emoji\" />\n {count && formatIntegerCompact(count)}\n </Button>\n );\n })}\n </div>\n )}\n\n <div dir={lang.isRtl ? 'rtl' : undefined}>\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"reactor-list custom-scroll\"\n items={viewportIds}\n onLoadMore={getMore}\n >\n {viewportIds?.map(\n (userId) => {\n const user = usersById[userId];\n const fullName = getUserFullName(user);\n const reaction = reactors?.reactions.find((l) => l.userId === userId)?.reaction;\n return (\n <ListItem\n key={userId}\n className=\"chat-item-clickable reactors-list-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleClick(userId)}\n >\n <Avatar user={user} size=\"medium\" />\n <div className=\"title\">\n <h3 dir=\"auto\">{fullName && renderText(fullName)}</h3>\n </div>\n {reaction && <ReactionStaticEmoji className=\"reactors-list-emoji\" reaction={reaction} />}\n </ListItem>\n );\n },\n )}\n </InfiniteScroll>\n ) : <Loading />}\n </div>\n <Button\n className=\"confirm-dialog-button\"\n isText\n onClick={closeReactorListModal}\n >\n {lang('Close')}\n </Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { chatId, messageId } = global.reactorModal || {};\n const message = chatId && messageId ? selectChatMessage(global, chatId, messageId) : undefined;\n\n return {\n chatId,\n messageId,\n reactions: message?.reactions,\n reactors: message?.reactors,\n seenByUserIds: message?.seenByUserIds,\n };\n },\n)(ReactorListModal));\n","import React, {\n FC, memo, useCallback, useEffect, useLayoutEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ActiveEmojiInteraction } from '../../global/types';\nimport { ApiMediaFormat } from '../../api/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 getAnimationData, { ANIMATED_STICKERS_PATHS } from '../common/helpers/animatedAssets';\nimport { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\n\nimport AnimatedSticker from '../common/AnimatedSticker';\n\nimport './EmojiInteractionAnimation.scss';\n\nexport type OwnProps = {\n activeEmojiInteraction: ActiveEmojiInteraction;\n};\n\ntype StateProps = {\n effectAnimationId?: string;\n localEffectAnimation?: string;\n};\n\nconst HIDE_ANIMATION_DURATION = 250;\nconst PLAYING_DURATION = 3000;\nconst EFFECT_SIZE = 240;\n\nconst EmojiInteractionAnimation: FC<OwnProps & StateProps> = ({\n effectAnimationId,\n localEffectAnimation,\n activeEmojiInteraction,\n}) => {\n const { stopActiveEmojiInteraction } = getActions();\n\n const [isHiding, startHiding] = useFlag(false);\n const [isPlaying, startPlaying] = useFlag(false);\n const timeoutRef = useRef<NodeJS.Timeout>();\n\n const stop = useCallback(() => {\n startHiding();\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n setTimeout(() => {\n stopActiveEmojiInteraction({ id: activeEmojiInteraction.id });\n }, HIDE_ANIMATION_DURATION);\n }, [activeEmojiInteraction.id, startHiding, stopActiveEmojiInteraction]);\n\n const handleCancelAnimation = useCallback((e: UIEvent) => {\n if (!(e.target as HTMLElement)?.closest('.AnimatedEmoji')) {\n stop();\n }\n }, [stop]);\n\n useEffect(() => {\n document.addEventListener('touchstart', handleCancelAnimation);\n document.addEventListener('touchmove', handleCancelAnimation);\n document.addEventListener('mousedown', handleCancelAnimation);\n document.addEventListener('wheel', handleCancelAnimation);\n\n return () => {\n document.removeEventListener('touchstart', handleCancelAnimation);\n document.removeEventListener('touchmove', handleCancelAnimation);\n document.removeEventListener('mousedown', handleCancelAnimation);\n document.removeEventListener('wheel', handleCancelAnimation);\n };\n }, [handleCancelAnimation]);\n\n useLayoutEffect(() => {\n const dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();\n\n timeoutRef.current = setTimeout(() => {\n stop();\n dispatchHeavyAnimationStop();\n }, PLAYING_DURATION);\n }, [stop]);\n\n const effectAnimationData = useMedia(`sticker${effectAnimationId}`, !effectAnimationId, ApiMediaFormat.Lottie);\n\n const [localEffectAnimationData, setLocalEffectAnimationData] = useState<string | undefined>();\n useEffect(() => {\n if (localEffectAnimation) {\n getAnimationData(localEffectAnimation as keyof typeof ANIMATED_STICKERS_PATHS).then((data) => {\n setLocalEffectAnimationData(data);\n });\n }\n }, [localEffectAnimation]);\n\n if (!activeEmojiInteraction.startSize) {\n return undefined;\n }\n\n const scale = (activeEmojiInteraction.startSize || 0) / EFFECT_SIZE;\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 id={`effect_${effectAnimationId}`}\n size={EFFECT_SIZE}\n animationData={localEffectAnimationData || effectAnimationData}\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(ANIMATED_STICKERS_PATHS).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 React, {\n FC, memo, useCallback,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport { ApiChat, ApiUser } from '../../../api/types';\n\nimport useChatContextActions from '../../../hooks/useChatContextActions';\nimport useFlag from '../../../hooks/useFlag';\nimport { isUserId, getPrivateChatUserId, selectIsChatMuted } from '../../../global/helpers';\nimport {\n selectChat, selectUser, selectIsChatPinned, selectNotifySettings, selectNotifyExceptions,\n} from '../../../global/selectors';\nimport useSelectWithEnter from '../../../hooks/useSelectWithEnter';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport GroupChatInfo from '../../common/GroupChatInfo';\nimport DeleteChatModal from '../../common/DeleteChatModal';\nimport ListItem from '../../ui/ListItem';\nimport ChatFolderModal from '../ChatFolderModal.async';\n\ntype OwnProps = {\n chatId: string;\n withUsername?: boolean;\n onClick: (id: string) => void;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n user?: ApiUser;\n isPinned?: boolean;\n isMuted?: boolean;\n canChangeFolder?: boolean;\n};\n\nconst LeftSearchResultChat: FC<OwnProps & StateProps> = ({\n chatId,\n withUsername,\n onClick,\n chat,\n user,\n isPinned,\n isMuted,\n canChangeFolder,\n}) => {\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isChatFolderModalOpen, openChatFolderModal, closeChatFolderModal] = useFlag();\n\n const contextActions = useChatContextActions({\n chat,\n user,\n isPinned,\n isMuted,\n canChangeFolder,\n handleDelete: openDeleteModal,\n handleChatFolderChange: openChatFolderModal,\n }, true);\n\n const handleClick = useCallback(() => {\n onClick(chatId);\n }, [chatId, onClick]);\n\n const buttonRef = useSelectWithEnter(handleClick);\n\n if (!chat) {\n return undefined;\n }\n\n return (\n <ListItem\n className=\"chat-item-clickable search-result\"\n onClick={handleClick}\n contextActions={contextActions}\n buttonRef={buttonRef}\n >\n {isUserId(chatId) ? (\n <PrivateChatInfo userId={chatId} withUsername={withUsername} avatarSize=\"large\" />\n ) : (\n <GroupChatInfo chatId={chatId} withUsername={withUsername} avatarSize=\"large\" />\n )}\n <DeleteChatModal\n isOpen={isDeleteModalOpen}\n onClose={closeDeleteModal}\n chat={chat}\n />\n <ChatFolderModal\n isOpen={isChatFolderModalOpen}\n onClose={closeChatFolderModal}\n chatId={chatId}\n />\n </ListItem>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const privateChatUserId = chat && getPrivateChatUserId(chat);\n const user = privateChatUserId ? selectUser(global, privateChatUserId) : undefined;\n const isPinned = selectIsChatPinned(global, chatId);\n const isMuted = chat\n ? selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global))\n : undefined;\n\n return {\n chat,\n user,\n isPinned,\n isMuted,\n canChangeFolder: Boolean(global.chatFolders.orderedIds?.length),\n };\n },\n)(LeftSearchResultChat));\n","import React, {\n FC, useEffect, useCallback, useRef, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiUser } from '../../../api/types';\n\nimport { getUserFirstOrLastName } from '../../../global/helpers';\nimport renderText from '../../common/helpers/renderText';\nimport { throttle } from '../../../util/schedulers';\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useLang from '../../../hooks/useLang';\n\nimport Avatar from '../../common/Avatar';\nimport Button from '../../ui/Button';\nimport LeftSearchResultChat from './LeftSearchResultChat';\n\nimport './RecentContacts.scss';\n\ntype OwnProps = {\n onReset: () => void;\n};\n\ntype StateProps = {\n topUserIds?: string[];\n usersById: Record<string, ApiUser>;\n recentlyFoundChatIds?: string[];\n};\n\nconst SEARCH_CLOSE_TIMEOUT_MS = 250;\nconst NBSP = '\\u00A0';\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst RecentContacts: FC<OwnProps & StateProps> = ({\n topUserIds, usersById, recentlyFoundChatIds,\n onReset,\n}) => {\n const {\n loadTopUsers, loadContactList, 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 // Loading full contact list for quick local search before user enters the query\n loadContactList();\n });\n }, [loadTopUsers, loadContactList]);\n\n useHorizontalScroll(topUsersRef.current, !topUserIds);\n\n const handleClick = useCallback((id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n onReset();\n setTimeout(() => {\n addRecentlyFoundChatId({ id });\n }, SEARCH_CLOSE_TIMEOUT_MS);\n }, [openChat, addRecentlyFoundChatId, onReset]);\n\n const lang = useLang();\n\n return (\n <div className=\"RecentContacts custom-scroll\">\n {topUserIds && (\n <div className=\"top-peers-section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <div ref={topUsersRef} className=\"top-peers no-selection\">\n {topUserIds.map((userId) => (\n <div className=\"top-peer-item\" onClick={() => handleClick(userId)} dir={lang.isRtl ? 'rtl' : undefined}>\n <Avatar user={usersById[userId]} />\n <div className=\"top-peer-name\">{renderText(getUserFirstOrLastName(usersById[userId]) || NBSP)}</div>\n </div>\n ))}\n </div>\n </div>\n )}\n {recentlyFoundChatIds && (\n <div className=\"search-section pt-1\">\n <h3 className=\"section-heading mt-0 recent-chats-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('Recent')}\n\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n ariaLabel=\"Clear recent chats\"\n onClick={clearRecentlyFoundChats}\n isRtl={lang.isRtl}\n >\n <i className=\"icon-close\" />\n </Button>\n </h3>\n {recentlyFoundChatIds.map((id) => (\n <LeftSearchResultChat\n chatId={id}\n onClick={handleClick}\n />\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: topUserIds } = global.topPeers;\n const usersById = global.users.byId;\n const { recentlyFoundChatIds } = global.globalSearch;\n\n return {\n topUserIds,\n usersById,\n recentlyFoundChatIds,\n };\n },\n)(RecentContacts));\n","import React, {\n FC, memo, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport {\n ApiChat, ApiUser, ApiMessage, ApiMessageOutgoingStatus,\n} from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport {\n getChatTitle,\n getPrivateChatUserId,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessageVideo,\n getMessageRoundVideo,\n} from '../../../global/helpers';\nimport { selectChat, selectUser } from '../../../global/selectors';\nimport buildClassName from '../../../util/buildClassName';\nimport renderText from '../../common/helpers/renderText';\nimport { formatPastTimeShort } from '../../../util/dateFormat';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport useMedia from '../../../hooks/useMedia';\nimport useLang, { LangFn } from '../../../hooks/useLang';\nimport useSelectWithEnter from '../../../hooks/useSelectWithEnter';\n\nimport Avatar from '../../common/Avatar';\nimport VerifiedIcon from '../../common/VerifiedIcon';\nimport ListItem from '../../ui/ListItem';\nimport Link from '../../ui/Link';\nimport FakeIcon from '../../common/FakeIcon';\n\nimport './ChatMessage.scss';\n\ntype OwnProps = {\n searchQuery?: string;\n message: ApiMessage;\n chatId: string;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n privateChatUser?: ApiUser;\n lastMessageOutgoingStatus?: ApiMessageOutgoingStatus;\n lastSyncTime?: number;\n};\n\nconst ChatMessage: FC<OwnProps & StateProps> = ({\n message,\n searchQuery,\n chatId,\n chat,\n privateChatUser,\n lastSyncTime,\n}) => {\n const { focusMessage } = getActions();\n\n const mediaThumbnail = getMessageMediaThumbDataUri(message);\n const mediaBlobUrl = useMedia(getMessageMediaHash(message, 'micro'));\n const isRoundVideo = Boolean(getMessageRoundVideo(message));\n\n const handleClick = useCallback(() => {\n focusMessage({ chatId, messageId: message.id });\n }, [chatId, focusMessage, message.id]);\n\n const lang = useLang();\n\n const buttonRef = useSelectWithEnter(handleClick);\n\n if (!chat) {\n return undefined;\n }\n\n return (\n <ListItem\n className=\"ChatMessage chat-item-clickable\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n onClick={handleClick}\n buttonRef={buttonRef}\n >\n <Avatar\n chat={chat}\n user={privateChatUser}\n isSavedMessages={privateChatUser?.isSelf}\n lastSyncTime={lastSyncTime}\n />\n <div className=\"info\">\n <div className=\"info-row\">\n <div className=\"title\">\n <h3 dir=\"auto\">{renderText(getChatTitle(lang, chat, privateChatUser))}</h3>\n {chat.isVerified && <VerifiedIcon />}\n {chat.fakeType && <FakeIcon fakeType={chat.fakeType} />}\n </div>\n <div className=\"message-date\">\n <Link className=\"date\">\n {formatPastTimeShort(lang, message.date * 1000)}\n </Link>\n </div>\n\n </div>\n <div className=\"subtitle\">\n <div className=\"message\" dir=\"auto\">\n {renderSummary(lang, message, mediaBlobUrl || mediaThumbnail, searchQuery, isRoundVideo)}\n </div>\n </div>\n </div>\n </ListItem>\n );\n};\n\nfunction renderSummary(\n lang: LangFn, message: ApiMessage, blobUrl?: string, searchQuery?: string, isRoundVideo?: boolean,\n) {\n if (!blobUrl) {\n return renderMessageSummary(lang, message, undefined, searchQuery);\n }\n\n return (\n <span className=\"media-preview\">\n <img src={blobUrl} alt=\"\" className={buildClassName('media-preview--image', isRoundVideo && 'round')} />\n {getMessageVideo(message) && <i className=\"icon-play\" />}\n {renderMessageSummary(lang, message, true, searchQuery)}\n </span>\n );\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n if (!chat) {\n return {};\n }\n\n const privateChatUserId = getPrivateChatUserId(chat);\n\n return {\n chat,\n lastSyncTime: global.lastSyncTime,\n ...(privateChatUserId && { privateChatUser: selectUser(global, privateChatUserId) }),\n };\n },\n)(ChatMessage));\n","import React, { FC, 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 React, {\n FC, memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport { ApiChat, ApiMessage } from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { unique } from '../../../util/iteratees';\nimport {\n sortChatIds,\n filterUsersByName,\n} from '../../../global/helpers';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport { throttle } from '../../../util/schedulers';\nimport useLang from '../../../hooks/useLang';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport LeftSearchResultChat from './LeftSearchResultChat';\nimport RecentContacts from './RecentContacts';\nimport ChatMessage from './ChatMessage';\nimport DateSuggest from './DateSuggest';\nimport Link from '../../ui/Link';\nimport NothingFound from '../../common/NothingFound';\nimport PickerSelectedItem from '../../common/PickerSelectedItem';\n\nexport type OwnProps = {\n searchQuery?: string;\n dateSearchQuery?: string;\n searchDate?: number;\n onReset: () => void;\n onSearchDateSelect: (value: Date) => void;\n};\n\ntype StateProps = {\n currentUserId?: string;\n localContactIds?: string[];\n localChatIds?: string[];\n localUserIds?: string[];\n globalChatIds?: string[];\n globalUserIds?: string[];\n foundIds?: string[];\n globalMessagesByChatId?: Record<string, { byId: Record<number, ApiMessage> }>;\n chatsById: Record<string, ApiChat>;\n fetchingStatus?: { chats?: boolean; messages?: boolean };\n lastSyncTime?: number;\n};\n\nconst MIN_QUERY_LENGTH_FOR_GLOBAL_SEARCH = 4;\nconst LESS_LIST_ITEMS_AMOUNT = 5;\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst ChatResults: FC<OwnProps & StateProps> = ({\n searchQuery, searchDate, dateSearchQuery, currentUserId,\n localContactIds, localChatIds, localUserIds, globalChatIds, globalUserIds,\n foundIds, globalMessagesByChatId, chatsById, fetchingStatus, lastSyncTime,\n onReset, onSearchDateSelect,\n}) => {\n const {\n openChat, addRecentlyFoundChatId, searchMessagesGlobal, setGlobalSearchChatId,\n } = getActions();\n\n const lang = useLang();\n\n const [shouldShowMoreLocal, setShouldShowMoreLocal] = useState<boolean>(false);\n const [shouldShowMoreGlobal, setShouldShowMoreGlobal] = useState<boolean>(false);\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: 'text',\n query: searchQuery,\n });\n });\n }\n }, [lastSyncTime, searchMessagesGlobal, searchQuery]);\n\n const handleChatClick = useCallback(\n (id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n\n if (id !== currentUserId) {\n addRecentlyFoundChatId({ id });\n }\n\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n onReset();\n }\n },\n [currentUserId, openChat, addRecentlyFoundChatId, onReset],\n );\n\n const handlePickerItemClick = useCallback((id: string) => {\n setGlobalSearchChatId({ id });\n }, [setGlobalSearchChatId]);\n\n const localResults = useMemo(() => {\n if (!searchQuery || (searchQuery.startsWith('@') && searchQuery.length < 2)) {\n return MEMO_EMPTY_ARRAY;\n }\n\n const contactIdsWithMe = [\n ...(currentUserId ? [currentUserId] : []),\n ...(localContactIds || []),\n ];\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const foundContactIds = filterUsersByName(\n contactIdsWithMe, usersById, searchQuery, currentUserId, lang('SavedMessages'),\n );\n\n return [\n ...sortChatIds(unique([\n ...(foundContactIds || []),\n ...(localChatIds || []),\n ...(localUserIds || []),\n ]), chatsById, undefined, currentUserId ? [currentUserId] : undefined),\n ];\n }, [searchQuery, currentUserId, localContactIds, lang, localChatIds, localUserIds, chatsById]);\n\n const globalResults = useMemo(() => {\n if (!searchQuery || searchQuery.length < MIN_QUERY_LENGTH_FOR_GLOBAL_SEARCH || !globalChatIds || !globalUserIds) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return sortChatIds(\n unique([...globalChatIds, ...globalUserIds]),\n chatsById,\n true,\n );\n }, [chatsById, globalChatIds, globalUserIds, searchQuery]);\n\n const foundMessages = useMemo(() => {\n if ((!searchQuery && !searchDate) || !foundIds || foundIds.length === 0) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds\n .map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId?.[chatId]?.byId[Number(messageId)];\n })\n .filter<ApiMessage>(Boolean as any)\n .sort((a, b) => b.date - a.date);\n }, [foundIds, globalMessagesByChatId, searchQuery, searchDate]);\n\n const handleClickShowMoreLocal = useCallback(() => {\n setShouldShowMoreLocal(!shouldShowMoreLocal);\n }, [shouldShowMoreLocal]);\n\n const handleClickShowMoreGlobal = useCallback(() => {\n setShouldShowMoreGlobal(!shouldShowMoreGlobal);\n }, [shouldShowMoreGlobal]);\n\n function renderFoundMessage(message: ApiMessage) {\n const text = renderMessageSummary(lang, message);\n const chat = chatsById[message.chatId];\n\n if (!text || !chat) {\n return undefined;\n }\n\n return (\n <ChatMessage\n chatId={message.chatId}\n message={message}\n searchQuery={searchQuery}\n />\n );\n }\n\n const nothingFound = fetchingStatus && !fetchingStatus.chats && !fetchingStatus.messages\n && !localResults.length && !globalResults.length && !foundMessages.length;\n\n if (!searchQuery && !searchDate) {\n return <RecentContacts onReset={onReset} />;\n }\n\n return (\n <InfiniteScroll\n className=\"LeftSearch custom-scroll\"\n items={foundMessages}\n onLoadMore={handleLoadMore}\n // To prevent scroll jumps caused by delayed local results rendering\n noScrollRestoreOnTop\n noFastList\n >\n {dateSearchQuery && (\n <div className=\"chat-selection no-selection no-scrollbar\">\n <DateSuggest\n searchDate={dateSearchQuery}\n onSelect={onSearchDateSelect}\n />\n </div>\n )}\n {nothingFound && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {Boolean(localResults.length) && (\n <div className=\"chat-selection no-selection no-scrollbar\" dir={lang.isRtl ? 'rtl' : undefined}>\n {localResults.map((id) => (\n <PickerSelectedItem\n chatOrUserId={id}\n onClick={handlePickerItemClick}\n clickArg={id}\n />\n ))}\n </div>\n )}\n {Boolean(localResults.length) && (\n <div className=\"search-section\">\n <h3 className=\"section-heading\" dir={lang.isRtl ? 'auto' : undefined}>\n {localResults.length > LESS_LIST_ITEMS_AMOUNT && (\n <Link onClick={handleClickShowMoreLocal}>\n {lang(shouldShowMoreLocal ? 'ChatList.Search.ShowLess' : 'ChatList.Search.ShowMore')}\n </Link>\n )}\n {lang('DialogList.SearchSectionDialogs')}\n </h3>\n {localResults.map((id, index) => {\n if (!shouldShowMoreLocal && index >= LESS_LIST_ITEMS_AMOUNT) {\n return undefined;\n }\n\n return (\n <LeftSearchResultChat\n chatId={id}\n onClick={handleChatClick}\n />\n );\n })}\n </div>\n )}\n {Boolean(globalResults.length) && (\n <div className=\"search-section\">\n <h3 className=\"section-heading\" dir={lang.isRtl ? 'auto' : undefined}>\n {globalResults.length > LESS_LIST_ITEMS_AMOUNT && (\n <Link onClick={handleClickShowMoreGlobal}>\n {lang(shouldShowMoreGlobal ? 'ChatList.Search.ShowLess' : 'ChatList.Search.ShowMore')}\n </Link>\n )}\n {lang('DialogList.SearchSectionGlobal')}\n </h3>\n {globalResults.map((id, index) => {\n if (!shouldShowMoreGlobal && index >= LESS_LIST_ITEMS_AMOUNT) {\n return undefined;\n }\n\n return (\n <LeftSearchResultChat\n chatId={id}\n withUsername\n onClick={handleChatClick}\n />\n );\n })}\n </div>\n )}\n {Boolean(foundMessages.length) && (\n <div className=\"search-section\">\n <h3 className=\"section-heading\" dir={lang.isRtl ? 'auto' : undefined}>{lang('SearchMessages')}</h3>\n {foundMessages.map(renderFoundMessage)}\n </div>\n )}\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { byId: chatsById } = global.chats;\n\n const { userIds: localContactIds } = global.contactList || {};\n\n if (!localContactIds) {\n return {\n chatsById,\n };\n }\n\n const {\n currentUserId, messages, lastSyncTime,\n } = global;\n const {\n fetchingStatus, globalResults, localResults, resultsByType,\n } = global.globalSearch;\n const { chatIds: globalChatIds, userIds: globalUserIds } = globalResults || {};\n const { chatIds: localChatIds, userIds: localUserIds } = localResults || {};\n const { byChatId: globalMessagesByChatId } = messages;\n const foundIds = resultsByType?.text?.foundIds;\n\n return {\n currentUserId,\n localContactIds,\n localChatIds,\n localUserIds,\n globalChatIds,\n globalUserIds,\n foundIds,\n globalMessagesByChatId,\n chatsById,\n fetchingStatus,\n lastSyncTime,\n };\n },\n)(ChatResults));\n","import React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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 { GlobalState } from '../../../../global/types';\nimport {\n ApiChat, ApiGlobalMessageSearchType, ApiMessage, ApiUser,\n} from '../../../../api/types';\nimport { 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 React, {\n FC, 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 { createMapStateToProps, StateProps } from './helpers/createMapStateToProps';\nimport buildClassName from '../../../util/buildClassName';\nimport { throttle } from '../../../util/schedulers';\nimport useLang from '../../../hooks/useLang';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Media from '../../common/Media';\nimport ChatMessage from './ChatMessage';\nimport NothingFound from '../../common/NothingFound';\nimport Loading from '../../ui/Loading';\n\nexport type OwnProps = {\n searchQuery?: string;\n};\n\nconst CURRENT_TYPE = 'media';\nconst INTERSECTION_THROTTLE = 500;\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst MediaResults: FC<OwnProps & StateProps> = ({\n searchQuery,\n searchChatId,\n isLoading,\n globalMessagesByChatId,\n foundIds,\n lastSyncTime,\n isChatProtected,\n}) => {\n const {\n searchMessagesGlobal,\n openMediaViewer,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const { observe: observeIntersectionForMedia } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n });\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: CURRENT_TYPE,\n query: searchQuery,\n chatId: searchChatId,\n });\n });\n }\n }, [lastSyncTime, searchMessagesGlobal, searchQuery, searchChatId]);\n\n const foundMessages = useMemo(() => {\n if (!foundIds || !globalMessagesByChatId) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds.map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId[chatId]?.byId[Number(messageId)];\n }).filter(Boolean);\n }, [globalMessagesByChatId, foundIds]);\n\n const handleSelectMedia = useCallback((messageId: number, chatId: string) => {\n openMediaViewer({\n chatId,\n messageId,\n origin: MediaViewerOrigin.SearchResult,\n });\n }, [openMediaViewer]);\n\n function renderGallery() {\n return (\n <div className=\"media-list\" dir={lang.isRtl ? 'rtl' : undefined}>\n {foundMessages.map((message) => (\n <Media\n key={message.id}\n idPrefix=\"search-media\"\n message={message}\n isProtected={isChatProtected || message.isProtected}\n observeIntersection={observeIntersectionForMedia}\n onClick={handleSelectMedia}\n />\n ))}\n </div>\n );\n }\n\n function renderSearchResult() {\n return foundMessages.map((message) => (\n <ChatMessage\n key={message.id}\n chatId={message.chatId}\n message={message}\n />\n ));\n }\n\n const canRenderContents = useAsyncRendering([searchQuery], SLIDE_TRANSITION_DURATION) && !isLoading;\n const isMediaGrid = canRenderContents && foundIds && foundIds.length > 0 && !searchQuery;\n const isMessageList = canRenderContents && foundIds && foundIds.length > 0 && searchQuery;\n\n const classNames = buildClassName(\n 'search-content custom-scroll',\n isMessageList && 'chat-list',\n );\n\n return (\n <div ref={containerRef} className=\"LeftSearch\">\n <InfiniteScroll\n className={classNames}\n items={foundMessages}\n itemSelector={!searchQuery ? '.Media' : '.ListItem'}\n onLoadMore={handleLoadMore}\n noFastList\n >\n {!canRenderContents && <Loading />}\n {canRenderContents && (!foundIds || foundIds.length === 0) && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {isMediaGrid && renderGallery()}\n {isMessageList && renderSearchResult()}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n createMapStateToProps(CURRENT_TYPE),\n)(MediaResults));\n","import React, {\n FC, 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 { createMapStateToProps, StateProps } 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 React, {\n FC, memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiMessage } from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport { SLIDE_TRANSITION_DURATION } from '../../../config';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport { createMapStateToProps, StateProps } 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 React, {\n FC, memo, useCallback, useMemo,\n} 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 { createMapStateToProps, StateProps } from './helpers/createMapStateToProps';\nimport { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';\nimport { getSenderName } from './helpers/getSenderName';\nimport { throttle } from '../../../util/schedulers';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport useLang from '../../../hooks/useLang';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Audio from '../../common/Audio';\nimport NothingFound from '../../common/NothingFound';\nimport Loading from '../../ui/Loading';\n\nexport type OwnProps = {\n isVoice?: boolean;\n searchQuery?: string;\n};\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nconst AudioResults: FC<OwnProps & StateProps> = ({\n theme,\n isVoice,\n searchQuery,\n searchChatId,\n isLoading,\n chatsById,\n usersById,\n globalMessagesByChatId,\n foundIds,\n lastSyncTime,\n activeDownloads,\n}) => {\n const {\n searchMessagesGlobal,\n focusMessage,\n openAudioPlayer,\n } = getActions();\n\n const lang = useLang();\n const currentType = isVoice ? 'voice' : 'audio';\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (lastSyncTime && direction === LoadMoreDirection.Backwards) {\n runThrottled(() => {\n searchMessagesGlobal({\n type: currentType,\n query: searchQuery,\n chatId: searchChatId,\n });\n });\n }\n }, [currentType, lastSyncTime, searchMessagesGlobal, searchQuery, searchChatId]);\n\n const foundMessages = useMemo(() => {\n if (!foundIds || !globalMessagesByChatId) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return foundIds.map((id) => {\n const [chatId, messageId] = id.split('_');\n\n return globalMessagesByChatId[chatId]?.byId[Number(messageId)];\n }).filter(Boolean);\n }, [globalMessagesByChatId, foundIds]);\n\n const handleMessageFocus = useCallback((messageId: number, chatId: string) => {\n focusMessage({ chatId, messageId });\n }, [focusMessage]);\n\n const handlePlayAudio = useCallback((messageId: number, chatId: string) => {\n openAudioPlayer({ chatId, messageId });\n }, [openAudioPlayer]);\n\n function renderList() {\n return foundMessages.map((message, index) => {\n const shouldDrawDateDivider = index === 0\n || toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);\n return (\n <div\n className=\"ListItem small-icon\"\n key={message.id}\n >\n {shouldDrawDateDivider && (\n <p className=\"section-heading\" dir={lang.isRtl ? 'rtl' : undefined}>\n {formatMonthAndYear(lang, new Date(message.date * 1000))}\n </p>\n )}\n <Audio\n key={message.id}\n theme={theme}\n message={message}\n origin={AudioOrigin.Search}\n senderTitle={getSenderName(lang, message, chatsById, usersById)}\n date={message.date}\n lastSyncTime={lastSyncTime}\n className=\"scroll-item\"\n onPlay={handlePlayAudio}\n onDateClick={handleMessageFocus}\n isDownloading={activeDownloads[message.chatId]?.includes(message.id)}\n />\n </div>\n );\n });\n }\n\n const canRenderContents = useAsyncRendering([searchQuery], SLIDE_TRANSITION_DURATION) && !isLoading;\n\n return (\n <div className=\"LeftSearch\">\n <InfiniteScroll\n className=\"search-content documents-list custom-scroll\"\n items={foundMessages}\n onLoadMore={handleLoadMore}\n noFastList\n >\n {!canRenderContents && <Loading />}\n {canRenderContents && (!foundIds || foundIds.length === 0) && (\n <NothingFound\n text={lang('ChatList.Search.NoResults')}\n description={lang('ChatList.Search.NoResultsDescription')}\n />\n )}\n {canRenderContents && foundIds && foundIds.length > 0 && renderList()}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n createMapStateToProps('audio'),\n)(AudioResults));\n","import React, {\n FC, 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(isActive, onReset, undefined, undefined, true);\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 useReducer, { StateReducer, Dispatch } 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 React, {\n FC, memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport { SettingsScreens } from '../../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport useLang from '../../../hooks/useLang';\n\nimport DropdownMenu from '../../ui/DropdownMenu';\nimport MenuItem from '../../ui/MenuItem';\nimport Button from '../../ui/Button';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\ntype OwnProps = {\n currentScreen: SettingsScreens;\n editedFolderId?: number;\n onReset: () => void;\n onSaveFilter: () => void;\n onScreenSelect: (screen: SettingsScreens) => void;\n};\n\nconst SettingsHeader: FC<OwnProps> = ({\n currentScreen,\n editedFolderId,\n onReset,\n onSaveFilter,\n onScreenSelect,\n}) => {\n const {\n signOut,\n deleteChatFolder,\n } = getActions();\n\n const [isSignOutDialogOpen, setIsSignOutDialogOpen] = useState(false);\n const [isDeleteFolderDialogOpen, setIsDeleteFolderDialogOpen] = useState(false);\n\n const openSignOutConfirmation = useCallback(() => {\n setIsSignOutDialogOpen(true);\n }, []);\n\n const closeSignOutConfirmation = useCallback(() => {\n setIsSignOutDialogOpen(false);\n }, []);\n\n const openDeleteFolderConfirmation = useCallback(() => {\n setIsDeleteFolderDialogOpen(true);\n }, []);\n\n const closeDeleteFolderConfirmation = useCallback(() => {\n setIsDeleteFolderDialogOpen(false);\n }, []);\n\n const handleSignOutMessage = useCallback(() => {\n closeSignOutConfirmation();\n signOut();\n }, [closeSignOutConfirmation, signOut]);\n\n const handleDeleteFolderMessage = useCallback(() => {\n closeDeleteFolderConfirmation();\n deleteChatFolder({ id: editedFolderId });\n onReset();\n }, [editedFolderId, closeDeleteFolderConfirmation, deleteChatFolder, onReset]);\n\n const SettingsMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"More actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n const lang = useLang();\n\n function renderHeaderContent() {\n switch (currentScreen) {\n case SettingsScreens.EditProfile:\n return <h3>{lang('lng_settings_information')}</h3>;\n case SettingsScreens.General:\n return <h3>{lang('General')}</h3>;\n case SettingsScreens.QuickReaction:\n return <h3>{lang('DoubleTapSetting')}</h3>;\n case SettingsScreens.Notifications:\n return <h3>{lang('Notifications')}</h3>;\n case SettingsScreens.DataStorage:\n return <h3>{lang('DataSettings')}</h3>;\n case SettingsScreens.Privacy:\n return <h3>{lang('PrivacySettings')}</h3>;\n case SettingsScreens.Language:\n return <h3>{lang('Language')}</h3>;\n\n case SettingsScreens.GeneralChatBackground:\n return <h3>{lang('ChatBackground')}</h3>;\n case SettingsScreens.GeneralChatBackgroundColor:\n return <h3>{lang('SetColor')}</h3>;\n\n case SettingsScreens.PrivacyPhoneNumber:\n return <h3>{lang('PrivacyPhone')}</h3>;\n case SettingsScreens.PrivacyLastSeen:\n return <h3>{lang('PrivacyLastSeen')}</h3>;\n case SettingsScreens.PrivacyProfilePhoto:\n return <h3>{lang('Privacy.ProfilePhoto')}</h3>;\n case SettingsScreens.PrivacyForwarding:\n return <h3>{lang('PrivacyForwards')}</h3>;\n case SettingsScreens.PrivacyGroupChats:\n return <h3>{lang('AutodownloadGroupChats')}</h3>;\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return <h3>{lang('AlwaysShareWith')}</h3>;\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return <h3>{lang('NeverShareWith')}</h3>;\n\n case SettingsScreens.ActiveSessions:\n return <h3>{lang('SessionsTitle')}</h3>;\n case SettingsScreens.PrivacyBlockedUsers:\n return <h3>{lang('BlockedUsers')}</h3>;\n\n case SettingsScreens.TwoFaDisabled:\n case SettingsScreens.TwoFaEnabled:\n return <h3>{lang('TwoStepVerification')}</h3>;\n case SettingsScreens.TwoFaNewPassword:\n case SettingsScreens.TwoFaChangePasswordNew:\n case SettingsScreens.TwoFaChangePasswordConfirm:\n return <h3>{lang('PleaseEnterCurrentPassword')}</h3>;\n case SettingsScreens.TwoFaNewPasswordConfirm:\n return <h3>{lang('PleaseReEnterPassword')}</h3>;\n case SettingsScreens.TwoFaNewPasswordHint:\n case SettingsScreens.TwoFaChangePasswordHint:\n return <h3>{lang('PasswordHint')}</h3>;\n case SettingsScreens.TwoFaNewPasswordEmail:\n case SettingsScreens.TwoFaRecoveryEmail:\n return <h3>{lang('RecoveryEmailTitle')}</h3>;\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return <h3>Recovery Email Code</h3>;\n case SettingsScreens.TwoFaCongratulations:\n return <h3>{lang('TwoStepVerificationPasswordSet')}</h3>;\n case SettingsScreens.TwoFaChangePasswordCurrent:\n case SettingsScreens.TwoFaTurnOff:\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n return <h3>{lang('PleaseEnterCurrentPassword')}</h3>;\n\n case SettingsScreens.Folders:\n return <h3>{lang('Filters')}</h3>;\n case SettingsScreens.FoldersCreateFolder:\n return <h3>{lang('FilterNew')}</h3>;\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n return (\n <div className=\"settings-main-header\">\n <h3>{lang('FilterEdit')}</h3>\n\n {editedFolderId && (\n <DropdownMenu\n className=\"settings-more-menu\"\n trigger={SettingsMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"delete\" destructive onClick={openDeleteFolderConfirmation}>\n {lang('Delete')}\n </MenuItem>\n </DropdownMenu>\n )}\n </div>\n );\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <div className=\"settings-main-header\">\n {(currentScreen === SettingsScreens.FoldersIncludedChats\n || currentScreen === SettingsScreens.FoldersIncludedChatsFromChatList) ? (\n <h3>{lang('FilterInclude')}</h3>\n ) : (\n <h3>{lang('FilterExclude')}</h3>\n )}\n\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n className=\"color-primary\"\n onClick={onSaveFilter}\n ariaLabel={lang('AutoDeleteConfirm')}\n >\n <i className=\"icon-check\" />\n </Button>\n </div>\n );\n\n default:\n return (\n <div className=\"settings-main-header\">\n <h3>{lang('SETTINGS')}</h3>\n\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.EditProfile)}\n ariaLabel={lang('lng_settings_information')}\n >\n <i className=\"icon-edit\" />\n </Button>\n <DropdownMenu\n className=\"settings-more-menu\"\n trigger={SettingsMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"logout\" onClick={openSignOutConfirmation}>{lang('LogOutTitle')}</MenuItem>\n </DropdownMenu>\n </div>\n );\n }\n }\n\n return (\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel={lang('AccDescrGoBack')}\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n {renderHeaderContent()}\n <ConfirmDialog\n isOpen={isSignOutDialogOpen}\n onClose={closeSignOutConfirmation}\n text={lang('lng_sure_logout')}\n confirmLabel={lang('AccountSettings.Logout')}\n confirmHandler={handleSignOutMessage}\n confirmIsDestructive\n />\n <ConfirmDialog\n isOpen={isDeleteFolderDialogOpen}\n onClose={closeDeleteFolderConfirmation}\n text={lang('FilterDeleteAlert')}\n confirmLabel={lang('Delete')}\n confirmHandler={handleDeleteFolderMessage}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(SettingsHeader);\n","import React, { FC, memo, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens } from '../../../types';\nimport { ApiUser } from '../../../api/types';\n\nimport { selectUser } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport ProfileInfo from '../../common/ProfileInfo';\nimport ChatExtra from '../../common/ChatExtra';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n sessionCount: number;\n currentUser?: ApiUser;\n lastSyncTime?: number;\n};\n\nconst SettingsMain: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n currentUser,\n sessionCount,\n lastSyncTime,\n}) => {\n const { loadProfilePhotos, loadAuthorizations } = getActions();\n\n const lang = useLang();\n const profileId = currentUser?.id;\n\n useEffect(() => {\n if (profileId && lastSyncTime) {\n loadProfilePhotos({ profileId });\n }\n }, [lastSyncTime, profileId, loadProfilePhotos]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Main);\n\n useEffect(() => {\n if (lastSyncTime) {\n loadAuthorizations();\n }\n }, [lastSyncTime, loadAuthorizations]);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-main-menu\">\n {currentUser && (\n <ProfileInfo\n userId={currentUser.id}\n forceShowSelf\n />\n )}\n {currentUser && (\n <ChatExtra\n chatOrUserId={currentUser.id}\n forceShowSelf\n />\n )}\n <ListItem\n icon=\"settings\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.General)}\n >\n {lang('Telegram.GeneralSettingsViewController')}\n </ListItem>\n <ListItem\n icon=\"unmute\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Notifications)}\n >\n {lang('Notifications')}\n </ListItem>\n <ListItem\n icon=\"data\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.DataStorage)}\n >\n {lang('DataSettings')}\n </ListItem>\n <ListItem\n icon=\"lock\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Privacy)}\n >\n {lang('PrivacySettings')}\n </ListItem>\n <ListItem\n icon=\"folder\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Folders)}\n >\n {lang('Filters')}\n </ListItem>\n <ListItem\n icon=\"active-sessions\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.ActiveSessions)}\n >\n {lang('SessionsTitle')}\n {sessionCount > 0 && (<span className=\"settings-item__current-value\">{sessionCount}</span>)}\n </ListItem>\n <ListItem\n icon=\"language\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Language)}\n >\n {lang('Language')}\n <span className=\"settings-item__current-value\">{lang.langName}</span>\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId, lastSyncTime } = global;\n\n return {\n sessionCount: global.activeSessions.length,\n currentUser: currentUserId ? selectUser(global, currentUserId) : undefined,\n lastSyncTime,\n };\n },\n)(SettingsMain));\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, useState, useCallback, memo, useEffect, useMemo,\n} from '../../lib/teact/teact';\n\nimport { debounce } from '../../util/schedulers';\nimport useLang from '../../hooks/useLang';\n\nimport InputText from '../ui/InputText';\n\ntype OwnProps = {\n currentUsername?: string;\n asLink?: boolean;\n isLoading?: boolean;\n isUsernameAvailable?: boolean;\n checkUsername: AnyToVoidFunction;\n onChange: (value: string | false) => void;\n};\n\nconst MIN_USERNAME_LENGTH = 5;\nconst MAX_USERNAME_LENGTH = 32;\nconst LINK_PREFIX = 'https://t.me/';\nconst LINK_PREFIX_REGEX = /https:\\/\\/t\\.me\\/?/i;\nconst USERNAME_REGEX = /^([a-zA-Z0-9_]+)$/;\n\nconst runDebouncedForCheckUsername = debounce((cb) => cb(), 250, false);\n\nfunction isUsernameValid(username: string) {\n return username.length >= MIN_USERNAME_LENGTH\n && username.length <= MAX_USERNAME_LENGTH\n && USERNAME_REGEX.test(username);\n}\n\nconst SettingsEditProfile: FC<OwnProps> = ({\n currentUsername,\n asLink,\n isLoading,\n isUsernameAvailable,\n checkUsername,\n onChange,\n}) => {\n const [username, setUsername] = useState(currentUsername || '');\n\n const lang = useLang();\n const langPrefix = asLink ? 'SetUrl' : 'Username';\n const label = asLink ? lang('SetUrlPlaceholder') : lang('Username');\n\n const [usernameSuccess, usernameError] = useMemo(() => {\n if (!username.length) {\n return [];\n }\n\n if (username.length < MIN_USERNAME_LENGTH) {\n return [undefined, `${label} is too short`];\n }\n if (username.length > MAX_USERNAME_LENGTH) {\n return [undefined, `${label} is too long`];\n }\n if (!USERNAME_REGEX.test(username)) {\n return [undefined, `${label} contains invalid characters`];\n }\n\n if (isUsernameAvailable === undefined) {\n return [];\n }\n\n // Variable `isUsernameAvailable` is initialized with `undefined`, so a strict false check is required\n return [\n isUsernameAvailable ? lang(`${langPrefix}Available`, 'Username') : undefined,\n isUsernameAvailable === false ? lang(`${langPrefix}InUse`) : undefined,\n ];\n }, [username, isUsernameAvailable, lang, langPrefix, label]);\n\n useEffect(() => {\n setUsername(currentUsername || '');\n }, [asLink, currentUsername]);\n\n const handleUsernameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const newUsername = e.target.value.trim().replace(LINK_PREFIX_REGEX, '');\n setUsername(newUsername);\n e.target.value = `${asLink ? LINK_PREFIX : ''}${newUsername}`;\n\n const isValid = isUsernameValid(newUsername);\n\n if (isValid) {\n runDebouncedForCheckUsername(() => {\n checkUsername({ username: newUsername });\n });\n }\n\n if (onChange) {\n onChange(isValid ? newUsername : false);\n }\n }, [asLink, checkUsername, onChange]);\n\n return (\n <InputText\n value={`${asLink ? LINK_PREFIX : ''}${username}`}\n onChange={handleUsernameChange}\n label={label}\n error={usernameError}\n success={usernameSuccess}\n readOnly={isLoading}\n />\n );\n};\n\nexport default memo(SettingsEditProfile);\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, useState, useCallback, memo, useEffect, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiMediaFormat } from '../../../api/types';\nimport { ProfileEditProgress, SettingsScreens } from '../../../types';\n\nimport { throttle } from '../../../util/schedulers';\nimport { selectUser } from '../../../global/selectors';\nimport { getChatAvatarHash } from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport InputText from '../../ui/InputText';\nimport renderText from '../../common/helpers/renderText';\nimport UsernameInput from '../../common/UsernameInput';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\ntype OwnProps = {\n isActive: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n currentAvatarHash?: string;\n currentFirstName?: string;\n currentLastName?: string;\n currentBio?: string;\n currentUsername?: string;\n progress?: ProfileEditProgress;\n isUsernameAvailable?: boolean;\n};\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst MAX_BIO_LENGTH = 70;\n\nconst ERROR_FIRST_NAME_MISSING = 'Please provide your first name';\nconst ERROR_BIO_TOO_LONG = 'Bio can\\' be longer than 70 characters';\n\nconst SettingsEditProfile: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n currentAvatarHash,\n currentFirstName,\n currentLastName,\n currentBio,\n currentUsername,\n progress,\n isUsernameAvailable,\n}) => {\n const {\n loadCurrentUser,\n updateProfile,\n checkUsername,\n } = getActions();\n\n const lang = useLang();\n\n const [isUsernameTouched, setIsUsernameTouched] = useState(false);\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [error, setError] = useState<string | undefined>();\n\n const [photo, setPhoto] = useState<File | undefined>();\n const [firstName, setFirstName] = useState(currentFirstName || '');\n const [lastName, setLastName] = useState(currentLastName || '');\n const [bio, setBio] = useState(currentBio || '');\n const [username, setUsername] = useState<string | false>(currentUsername || '');\n\n const currentAvatarBlobUrl = useMedia(currentAvatarHash, false, ApiMediaFormat.BlobUrl);\n\n const isLoading = progress === ProfileEditProgress.InProgress;\n const isUsernameError = username === false;\n\n const isSaveButtonShown = useMemo(() => {\n if (isUsernameError) {\n return false;\n }\n\n return Boolean(photo) || isProfileFieldsTouched || isUsernameAvailable === true;\n }, [photo, isProfileFieldsTouched, isUsernameError, isUsernameAvailable]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.EditProfile);\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadCurrentUser();\n });\n }, [loadCurrentUser]);\n\n useEffect(() => {\n setPhoto(undefined);\n }, [currentAvatarBlobUrl]);\n\n useEffect(() => {\n setFirstName(currentFirstName || '');\n setLastName(currentLastName || '');\n setBio(currentBio || '');\n }, [currentFirstName, currentLastName, currentBio]);\n\n useEffect(() => {\n setUsername(currentUsername || '');\n }, [currentUsername]);\n\n useEffect(() => {\n if (progress === ProfileEditProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setIsUsernameTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handlePhotoChange = useCallback((newPhoto: File) => {\n setPhoto(newPhoto);\n }, []);\n\n const handleFirstNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleLastNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleBioChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setBio(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUsernameChange = useCallback((value: string | false) => {\n setUsername(value);\n setIsUsernameTouched(true);\n }, []);\n\n const handleProfileSave = useCallback(() => {\n const trimmedFirstName = firstName.trim();\n const trimmedLastName = lastName.trim();\n const trimmedBio = bio.trim();\n\n if (!trimmedFirstName.length) {\n setError(ERROR_FIRST_NAME_MISSING);\n return;\n }\n\n if (trimmedBio.length > MAX_BIO_LENGTH) {\n setError(ERROR_BIO_TOO_LONG);\n return;\n }\n\n updateProfile({\n photo,\n ...(isProfileFieldsTouched && {\n firstName: trimmedFirstName,\n lastName: trimmedLastName,\n bio: trimmedBio,\n }),\n ...(isUsernameTouched && {\n username,\n }),\n });\n }, [\n photo,\n firstName, lastName, bio, isProfileFieldsTouched,\n username, isUsernameTouched,\n updateProfile,\n ]);\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-edit-profile settings-item\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handlePhotoChange}\n title=\"Edit your profile photo\"\n disabled={isLoading}\n />\n <InputText\n value={firstName}\n onChange={handleFirstNameChange}\n label={lang('FirstName')}\n disabled={isLoading}\n error={error === ERROR_FIRST_NAME_MISSING ? error : undefined}\n />\n <InputText\n value={lastName}\n onChange={handleLastNameChange}\n label={lang('LastName')}\n disabled={isLoading}\n />\n <InputText\n value={bio}\n onChange={handleBioChange}\n label={lang('UserBio')}\n disabled={isLoading}\n error={error === ERROR_BIO_TOO_LONG ? error : undefined}\n />\n\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderText(lang('lng_settings_about_bio'), ['br', 'simple_markdown'])}\n </p>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('Username')}</h4>\n\n <UsernameInput\n currentUsername={username || ''}\n isLoading={isLoading}\n isUsernameAvailable={isUsernameAvailable}\n checkUsername={checkUsername}\n onChange={handleUsernameChange}\n />\n\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderText(lang('UsernameHelp'), ['br', 'simple_markdown'])}\n </p>\n {username && (\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('lng_username_link')}<br />\n <span className=\"username-link\">https://t.me/{username}</span>\n </p>\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isSaveButtonShown}\n onClick={handleProfileSave}\n disabled={isLoading}\n ariaLabel=\"Save changes\"\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId } = global;\n const { progress, isUsernameAvailable } = global.profileEdit || {};\n const currentUser = currentUserId ? selectUser(global, currentUserId) : undefined;\n\n if (!currentUser) {\n return {\n progress,\n isUsernameAvailable,\n };\n }\n\n const {\n firstName: currentFirstName,\n lastName: currentLastName,\n username: currentUsername,\n fullInfo,\n } = currentUser;\n const { bio: currentBio } = fullInfo || {};\n const currentAvatarHash = getChatAvatarHash(currentUser);\n\n return {\n currentAvatarHash,\n currentFirstName,\n currentLastName,\n currentBio,\n currentUsername,\n progress,\n isUsernameAvailable,\n };\n },\n)(SettingsEditProfile));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens, 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 onScreenSelect: (screen: SettingsScreens) => void;\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 onScreenSelect,\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(isActive, onReset, onScreenSelect, SettingsScreens.General);\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 FC, memo, useMemo, useCallback, useState, useEffect,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport { ApiChatFolder } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config';\nimport { throttle } from '../../../../util/schedulers';\nimport getAnimationData from '../../../common/helpers/animatedAssets';\nimport { getFolderDescriptionText } from '../../../../global/helpers';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\nimport { useFolderManagerForChatsCount } from '../../../../hooks/useFolderManager';\n\nimport ListItem from '../../../ui/ListItem';\nimport Button from '../../../ui/Button';\nimport Loading from '../../../ui/Loading';\nimport AnimatedSticker from '../../../common/AnimatedSticker';\n\ntype OwnProps = {\n isActive?: boolean;\n onCreateFolder: () => void;\n onEditFolder: (folder: ApiChatFolder) => void;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n orderedFolderIds?: number[];\n foldersById: Record<number, ApiChatFolder>;\n recommendedChatFolders?: ApiChatFolder[];\n};\n\nconst runThrottledForLoadRecommended = throttle((cb) => cb(), 60000, true);\n\nconst MAX_ALLOWED_FOLDERS = 10;\n\nconst SettingsFoldersMain: FC<OwnProps & StateProps> = ({\n isActive,\n onCreateFolder,\n onEditFolder,\n onScreenSelect,\n onReset,\n orderedFolderIds,\n foldersById,\n recommendedChatFolders,\n}) => {\n const {\n loadRecommendedChatFolders,\n addChatFolder,\n showDialog,\n } = getActions();\n\n const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('FoldersAll').then(setAnimationData);\n }\n }, [animationData]);\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottledForLoadRecommended(() => {\n loadRecommendedChatFolders();\n });\n }, [loadRecommendedChatFolders]);\n\n const handleCreateFolder = useCallback(() => {\n if (Object.keys(foldersById).length >= MAX_ALLOWED_FOLDERS) {\n showDialog({\n data: {\n message: 'DIALOG_FILTERS_TOO_MUCH',\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n onCreateFolder();\n }, [foldersById, showDialog, onCreateFolder]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Folders);\n\n const chatsCountByFolderId = useFolderManagerForChatsCount();\n const userFolders = useMemo(() => {\n if (!orderedFolderIds) {\n return undefined;\n }\n\n return orderedFolderIds.map((id) => {\n const folder = foldersById[id];\n\n return {\n id: folder.id,\n title: folder.title,\n subtitle: getFolderDescriptionText(lang, folder, chatsCountByFolderId[folder.id]),\n };\n });\n }, [orderedFolderIds, foldersById, lang, chatsCountByFolderId]);\n\n const handleCreateFolderFromRecommended = useCallback((folder: ApiChatFolder) => {\n if (Object.keys(foldersById).length >= MAX_ALLOWED_FOLDERS) {\n showDialog({\n data: {\n message: 'DIALOG_FILTERS_TOO_MUCH',\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n addChatFolder({ folder });\n }, [foldersById, addChatFolder, showDialog]);\n\n return (\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-content-header\">\n <div className=\"settings-content-icon\">\n {animationData && (\n <AnimatedSticker\n id=\"settingsFoldersMain\"\n size={STICKER_SIZE_FOLDER_SETTINGS}\n animationData={animationData}\n play={isAnimationLoaded}\n noLoop\n onLoad={handleAnimationLoad}\n />\n )}\n </div>\n\n <p className=\"settings-item-description mb-3\" dir=\"auto\">\n {lang('CreateNewFilterInfo')}\n </p>\n\n <Button\n // TODO: Refactor button component to handle icon placemenet with props\n className=\"with-icon mb-2\"\n color=\"primary\"\n size=\"smaller\"\n pill\n fluid\n onClick={handleCreateFolder}\n isRtl={lang.isRtl}\n >\n <i className=\"icon-add\" />\n {lang('CreateNewFilter')}\n </Button>\n </div>\n\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('Filters')}</h4>\n\n {userFolders?.length ? userFolders.map((folder) => (\n <ListItem\n className=\"mb-2 no-icon\"\n narrow\n multiline\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onEditFolder(foldersById[folder.id])}\n >\n <span className=\"title\">{folder.title}</span>\n <span className=\"subtitle\">{folder.subtitle}</span>\n </ListItem>\n )) : userFolders && !userFolders.length ? (\n <p className=\"settings-item-description my-4\" dir=\"auto\">\n You have no folders yet.\n </p>\n ) : <Loading />}\n </div>\n\n {(recommendedChatFolders && Boolean(recommendedChatFolders.length)) && (\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterRecommended')}\n </h4>\n\n {recommendedChatFolders.map((folder) => (\n <ListItem\n className=\"mb-2\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleCreateFolderFromRecommended(folder)}\n >\n <div className=\"settings-folders-recommended-item\">\n <div className=\"multiline-item\">\n <span className=\"title\">{folder.title}</span>\n <span className=\"subtitle\">{folder.description}</span>\n </div>\n\n <Button\n className=\"px-3\"\n color=\"primary\"\n size=\"tiny\"\n pill\n fluid\n isRtl={lang.isRtl}\n >\n {lang('Add')}\n </Button>\n </div>\n </ListItem>\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n orderedIds: orderedFolderIds,\n byId: foldersById,\n recommended: recommendedChatFolders,\n } = global.chatFolders;\n\n return {\n orderedFolderIds,\n foldersById,\n recommendedChatFolders,\n };\n },\n)(SettingsFoldersMain));\n","import React, { FC } 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 React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config';\nimport { findIntersectionWithSet } from '../../../../util/iteratees';\nimport { isUserId } from '../../../../global/helpers';\nimport getAnimationData from '../../../common/helpers/animatedAssets';\nimport {\n EXCLUDED_CHAT_TYPES,\n FolderEditDispatch,\n FoldersState,\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 AnimatedSticker from '../../../common/AnimatedSticker';\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';\n\ntype OwnProps = {\n state: FoldersState;\n dispatch: FolderEditDispatch;\n onAddIncludedChats: () => void;\n onAddExcludedChats: () => void;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n onBack: () => void;\n};\n\ntype StateProps = {\n loadedActiveChatIds?: string[];\n loadedArchivedChatIds?: string[];\n};\n\nconst SUBMIT_TIMEOUT = 500;\n\nconst INITIAL_CHATS_LIMIT = 5;\n\nconst ERROR_NO_TITLE = 'Please provide a title for this folder.';\nconst ERROR_NO_CHATS = 'ChatList.Filter.Error.Empty';\n\nconst SettingsFoldersEdit: FC<OwnProps & StateProps> = ({\n state,\n dispatch,\n onAddIncludedChats,\n onAddExcludedChats,\n isActive,\n onScreenSelect,\n onReset,\n onBack,\n loadedActiveChatIds,\n loadedArchivedChatIds,\n}) => {\n const {\n editChatFolder,\n addChatFolder,\n } = getActions();\n\n const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n\n const [isIncludedChatsListExpanded, setIsIncludedChatsListExpanded] = useState(false);\n const [isExcludedChatsListExpanded, setIsExcludedChatsListExpanded] = useState(false);\n\n const {\n selectedChatIds: includedChatIds,\n selectedChatTypes: includedChatTypes,\n } = selectChatFilters(state, 'included');\n const {\n selectedChatIds: excludedChatIds,\n selectedChatTypes: excludedChatTypes,\n } = selectChatFilters(state, 'excluded');\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('FoldersNew').then(setAnimationData);\n }\n }, [animationData]);\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(isActive, onBack, onScreenSelect, state.mode === 'edit'\n ? SettingsScreens.FoldersEditFolder\n : SettingsScreens.FoldersCreateFolder);\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 <div className=\"settings-content-icon\">\n {animationData && (\n <AnimatedSticker\n id=\"settingsFoldersEdit\"\n size={STICKER_SIZE_FOLDER_SETTINGS}\n animationData={animationData}\n play={isAnimationLoaded && String(state.folderId)}\n noLoop\n onLoad={handleAnimationLoad}\n />\n )}\n </div>\n\n {state.mode === 'create' && (\n <p className=\"settings-item-description mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterIncludeInfo')}\n </p>\n )}\n\n <InputText\n className=\"mb-0\"\n label={lang('FilterNameHint')}\n value={state.folder.title}\n onChange={handleChange}\n error={state.error && state.error === ERROR_NO_TITLE ? ERROR_NO_TITLE : undefined}\n />\n </div>\n\n <div className=\"settings-item no-border pt-3\">\n {state.error && state.error === ERROR_NO_CHATS && (\n <p className=\"settings-item-description color-danger mb-2\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang(state.error)}\n </p>\n )}\n\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterInclude')}</h4>\n\n <ListItem\n className=\"settings-folders-list-item color-primary mb-0\"\n icon=\"add\"\n onClick={onAddIncludedChats}\n >\n {lang('FilterAddChats')}\n </ListItem>\n\n {renderChats('included')}\n </div>\n\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header mb-3\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterExclude')}</h4>\n\n <ListItem\n className=\"settings-folders-list-item color-primary mb-0\"\n icon=\"add\"\n onClick={onAddExcludedChats}\n >\n {lang('FilterAddChats')}\n </ListItem>\n\n {renderChats('excluded')}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={Boolean(state.isTouched)}\n disabled={state.isLoading}\n onClick={handleSubmit}\n ariaLabel={state.mode === 'edit' ? 'Save changes' : 'Create folder'}\n >\n {state.isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { listIds } = global.chats;\n\n return {\n loadedActiveChatIds: listIds.active,\n loadedArchivedChatIds: listIds.archived,\n };\n },\n)(SettingsFoldersEdit));\n","import React, {\n FC, useCallback, useRef, useEffect, memo,\n} from '../../../../lib/teact/teact';\n\nimport { isUserId } from '../../../../global/helpers';\nimport {\n INCLUDED_CHAT_TYPES,\n EXCLUDED_CHAT_TYPES,\n FolderChatType,\n} from '../../../../hooks/reducers/useFoldersReducer';\nimport useInfiniteScroll from '../../../../hooks/useInfiniteScroll';\nimport useLang from '../../../../hooks/useLang';\n\nimport Checkbox from '../../../ui/Checkbox';\nimport InputText from '../../../ui/InputText';\nimport ListItem from '../../../ui/ListItem';\nimport PrivateChatInfo from '../../../common/PrivateChatInfo';\nimport GroupChatInfo from '../../../common/GroupChatInfo';\nimport PickerSelectedItem from '../../../common/PickerSelectedItem';\nimport InfiniteScroll from '../../../ui/InfiniteScroll';\nimport Loading from '../../../ui/Loading';\n\nimport '../../../common/Picker.scss';\nimport './SettingsFoldersChatsPicker.scss';\n\ntype OwnProps = {\n mode: 'included' | 'excluded';\n chatIds: string[];\n selectedIds: string[];\n selectedChatTypes: string[];\n filterValue?: string;\n onSelectedIdsChange: (ids: string[]) => void;\n onSelectedChatTypesChange: (types: string[]) => void;\n onFilterChange: (value: string) => void;\n};\n\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 500;\n\nconst MAX_CHATS = 100;\nconst MAX_FULL_ITEMS = 10;\nconst ALWAYS_FULL_ITEMS_COUNT = 5;\n\nconst SettingsFoldersChatsPicker: FC<OwnProps> = ({\n mode,\n chatIds,\n selectedIds,\n selectedChatTypes,\n filterValue,\n onSelectedIdsChange,\n onSelectedChatTypesChange,\n onFilterChange,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n const chatTypes = mode === 'included' ? INCLUDED_CHAT_TYPES : EXCLUDED_CHAT_TYPES;\n const shouldMinimize = selectedIds.length + selectedChatTypes.length > MAX_FULL_ITEMS;\n const hasMaxChats = selectedIds.length >= MAX_CHATS;\n\n useEffect(() => {\n setTimeout(() => {\n requestAnimationFrame(() => {\n inputRef.current!.focus();\n });\n }, FOCUS_DELAY_MS);\n }, []);\n\n const handleItemClick = useCallback((id: string) => {\n const newSelectedIds = [...selectedIds];\n if (newSelectedIds.includes(id)) {\n newSelectedIds.splice(newSelectedIds.indexOf(id), 1);\n } else {\n newSelectedIds.push(id);\n }\n onSelectedIdsChange(newSelectedIds);\n }, [selectedIds, onSelectedIdsChange]);\n\n const handleChatTypeClick = useCallback((key: FolderChatType['key']) => {\n const newSelectedChatTypes = [...selectedChatTypes];\n if (newSelectedChatTypes.includes(key)) {\n newSelectedChatTypes.splice(newSelectedChatTypes.indexOf(key), 1);\n } else {\n newSelectedChatTypes.push(key);\n }\n onSelectedChatTypesChange(newSelectedChatTypes);\n }, [selectedChatTypes, onSelectedChatTypesChange]);\n\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { value } = e.currentTarget;\n onFilterChange(value);\n }, [onFilterChange]);\n\n const lang = useLang();\n\n function renderSelectedChatType(key: string) {\n const selectedType = chatTypes.find(({ key: typeKey }) => key === typeKey);\n if (!selectedType) {\n return undefined;\n }\n\n return (\n <PickerSelectedItem\n icon={selectedType.icon}\n title={lang(selectedType.title)}\n isMinimized={shouldMinimize}\n canClose\n onClick={handleChatTypeClick}\n clickArg={selectedType.key}\n />\n );\n }\n\n function renderChatType(type: FolderChatType) {\n return (\n <ListItem\n key={type.key}\n className=\"chat-item-clickable picker-list-item chat-type-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleChatTypeClick(type.key)}\n ripple\n >\n <i className={`icon-${type.icon}`} />\n <h3 className=\"chat-type\" dir=\"auto\">{lang(type.title)}</h3>\n <Checkbox\n label=\"\"\n checked={selectedChatTypes.includes(type.key)}\n round\n />\n </ListItem>\n );\n }\n\n function renderItem(id: string) {\n const isSelected = selectedIds.includes(id);\n\n return (\n <ListItem\n key={id}\n className=\"chat-item-clickable picker-list-item chat-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleItemClick(id)}\n ripple\n disabled={!isSelected && hasMaxChats}\n >\n {isUserId(id) ? (\n <PrivateChatInfo userId={id} />\n ) : (\n <GroupChatInfo chatId={id} withChatType />\n )}\n <Checkbox\n label=\"\"\n checked={isSelected}\n round\n />\n </ListItem>\n );\n }\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, chatIds, Boolean(filterValue));\n\n return (\n <div className=\"Picker SettingsFoldersChatsPicker\">\n <div className=\"picker-header custom-scroll\">\n {selectedChatTypes.map(renderSelectedChatType)}\n {selectedIds.map((id, i) => (\n <PickerSelectedItem\n chatOrUserId={id}\n isMinimized={shouldMinimize && i < selectedIds.length - ALWAYS_FULL_ITEMS_COUNT}\n canClose\n onClick={handleItemClick}\n clickArg={id}\n />\n ))}\n {!hasMaxChats ? (\n <InputText\n ref={inputRef}\n value={filterValue}\n onChange={handleFilterChange}\n placeholder={lang('Search')}\n />\n ) : (\n <p className=\"max-items-reached\" dir=\"auto\">\n {`Sorry, you can't add more than ${MAX_CHATS} chats.`}\n </p>\n )}\n </div>\n <InfiniteScroll\n className=\"picker-list custom-scroll\"\n itemSelector=\".chat-item\"\n items={viewportIds}\n onLoadMore={getMore}\n >\n {(!viewportIds || !viewportIds.length || viewportIds.includes(chatIds[0])) && (\n <>\n <h4 key=\"header1\" className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterChatTypes')}\n </h4>\n {chatTypes.map(renderChatType)}\n <div key=\"divider\" className=\"picker-list-divider\" />\n <h4 key=\"header2\" className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('FilterChats')}\n </h4>\n </>\n )}\n\n {viewportIds?.length ? (\n viewportIds.map(renderItem)\n ) : viewportIds && !viewportIds.length ? (\n <p className=\"no-results\" key=\"no-results\">Sorry, nothing found.</p>\n ) : (\n <Loading key=\"loading\" />\n )}\n </InfiniteScroll>\n </div>\n );\n};\n\nexport default memo(SettingsFoldersChatsPicker);\n","import React, {\n FC, memo, useMemo, useCallback,\n} from '../../../../lib/teact/teact';\nimport { getGlobal } from '../../../../global';\n\nimport { SettingsScreens } from '../../../../types';\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 {\n FoldersState,\n FolderEditDispatch,\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 onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsFoldersChatFilters: FC<OwnProps> = ({\n mode,\n state,\n dispatch,\n isActive,\n onScreenSelect,\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 onReset,\n onScreenSelect,\n mode === 'included' ? SettingsScreens.FoldersIncludedChats : SettingsScreens.FoldersExcludedChats,\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 React, { FC, memo, useCallback } from '../../../../lib/teact/teact';\n\nimport { ApiChatFolder } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { 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 onScreenSelect={onScreenSelect}\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 onScreenSelect={onScreenSelect}\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 onScreenSelect={onScreenSelect}\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 onScreenSelect={onScreenSelect}\n isActive={isActive}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(SettingsFolders);\n","import React, {\n FC, memo, useMemo, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiMediaFormat, ApiStickerSet } from '../../../api/types';\n\nimport { STICKER_SIZE_PICKER_HEADER } from '../../../config';\nimport { ObserveFn, 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, ApiMediaFormat.Lottie);\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 id={mediaHash}\n size={size}\n animationData={lottieData}\n className={transitionClassNames}\n />\n )}\n </div>\n );\n};\n\nexport default memo(StickerSetCoverAnimated);\n","import React, {\n FC, memo, useMemo, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiStickerSet } from '../../../api/types';\n\nimport { IS_WEBM_SUPPORTED } from '../../../util/environment';\nimport { getFirstLetters } from '../../../util/textFormat';\nimport { ObserveFn, useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\n\ntype OwnProps = {\n stickerSet: ApiStickerSet;\n observeIntersection: ObserveFn;\n};\n\nconst StickerSetCover: FC<OwnProps> = ({ stickerSet, observeIntersection }) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const mediaData = useMedia(stickerSet.hasThumbnail && `stickerSet${stickerSet.id}`, !isIntersecting);\n const transitionClassNames = useMediaTransition(mediaData);\n const isVideo = stickerSet.isVideos;\n\n const firstLetters = useMemo(() => {\n if ((isVideo && !IS_WEBM_SUPPORTED) || !mediaData) return getFirstLetters(stickerSet.title, 2);\n return undefined;\n }, [isVideo, mediaData, stickerSet.title]);\n\n return (\n <div ref={ref} className=\"sticker-set-cover\">\n {firstLetters}\n {isVideo ? (\n <video src={mediaData} className={transitionClassNames} loop autoPlay />\n ) : (\n <img src={mediaData} className={transitionClassNames} alt=\"\" />\n )}\n </div>\n );\n};\n\nexport default memo(StickerSetCover);\n","import React, {\n FC, memo,\n} from '../../../lib/teact/teact';\nimport { ApiSticker, ApiStickerSet } from '../../../api/types';\n\nimport { STICKER_SIZE_GENERAL_SETTINGS } from '../../../config';\nimport { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport useLang from '../../../hooks/useLang';\n\nimport ListItem from '../../ui/ListItem';\nimport Button from '../../ui/Button';\nimport StickerSetCoverAnimated from '../../middle/composer/StickerSetCoverAnimated';\nimport StickerSetCover from '../../middle/composer/StickerSetCover';\nimport StickerButton from '../../common/StickerButton';\n\nimport './SettingsStickerSet.scss';\n\ntype OwnProps = {\n stickerSet?: ApiStickerSet;\n observeIntersection: ObserveFn;\n onClick: (value: ApiSticker) => void;\n};\n\nconst SettingsStickerSet: FC<OwnProps> = ({\n stickerSet,\n observeIntersection,\n onClick,\n}) => {\n const lang = useLang();\n\n if (!stickerSet || !stickerSet.stickers) {\n return undefined;\n }\n\n const firstSticker = stickerSet.stickers?.[0];\n\n if (stickerSet.hasThumbnail || !firstSticker) {\n return (\n <ListItem\n narrow\n className=\"SettingsStickerSet\"\n inactive={!firstSticker}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => firstSticker && onClick(firstSticker)}\n >\n <Button\n ariaLabel={stickerSet.title}\n color=\"translucent\"\n isRtl={lang.isRtl}\n >\n {stickerSet.isLottie ? (\n <StickerSetCoverAnimated\n size={STICKER_SIZE_GENERAL_SETTINGS}\n stickerSet={stickerSet}\n observeIntersection={observeIntersection}\n />\n ) : (\n <StickerSetCover\n stickerSet={stickerSet}\n observeIntersection={observeIntersection}\n />\n )}\n </Button>\n <div className=\"multiline-menu-item\">\n <div className=\"title\">{stickerSet.title}</div>\n <div className=\"subtitle\">{lang('StickerPack.StickerCount', stickerSet.count, 'i')}</div>\n </div>\n </ListItem>\n );\n } else {\n return (\n <ListItem\n narrow\n className=\"SettingsStickerSet\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onClick(firstSticker)}\n >\n <StickerButton\n sticker={firstSticker}\n size={STICKER_SIZE_GENERAL_SETTINGS}\n title={stickerSet.title}\n observeIntersection={observeIntersection}\n clickArg={undefined}\n noContextMenu\n />\n <div className=\"multiline-menu-item\">\n <div className=\"title\">{stickerSet.title}</div>\n <div className=\"subtitle\">{lang('StickerPack.StickerCount', stickerSet.count, 'i')}</div>\n </div>\n </ListItem>\n );\n }\n};\n\nexport default memo(SettingsStickerSet);\n","import React, {\n FC, useCallback, memo, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens, ISettings, TimeFormat } from '../../../types';\nimport { ApiSticker, ApiStickerSet } from '../../../api/types';\n\nimport {\n getSystemTheme, IS_IOS, IS_MAC_OS, IS_TOUCH_ENV,\n} from '../../../util/environment';\nimport { pick } from '../../../util/iteratees';\nimport { setTimeFormat } from '../../../util/langProvider';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport RangeSlider from '../../ui/RangeSlider';\nimport Checkbox from '../../ui/Checkbox';\nimport RadioGroup, { IRadioOption } from '../../ui/RadioGroup';\nimport SettingsStickerSet from './SettingsStickerSet';\nimport StickerSetModal from '../../common/StickerSetModal.async';\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport switchTheme from '../../../util/switchTheme';\nimport { ANIMATION_LEVEL_MAX } from '../../../config';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps =\n Pick<ISettings, (\n 'messageTextSize' |\n 'animationLevel' |\n 'messageSendKeyCombo' |\n 'shouldSuggestStickers' |\n 'shouldLoopStickers' |\n 'timeFormat'\n )> & {\n stickerSetIds?: string[];\n stickerSetsById?: Record<string, ApiStickerSet>;\n defaultReaction?: string;\n theme: ISettings['theme'];\n shouldUseSystemTheme: boolean;\n };\n\nconst ANIMATION_LEVEL_OPTIONS = [\n 'Solid and Steady',\n 'Nice and Fast',\n 'Lots of Stuff',\n];\n\nconst TIME_FORMAT_OPTIONS: IRadioOption[] = [{\n label: '12-hour',\n value: '12h',\n}, {\n label: '24-hour',\n value: '24h',\n}];\n\nconst SettingsGeneral: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n stickerSetIds,\n stickerSetsById,\n defaultReaction,\n messageTextSize,\n animationLevel,\n messageSendKeyCombo,\n shouldSuggestStickers,\n shouldLoopStickers,\n timeFormat,\n theme,\n shouldUseSystemTheme,\n}) => {\n const {\n setSettingOption,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const stickerSettingsRef = useRef<HTMLDivElement>(null);\n const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: stickerSettingsRef });\n const [isModalOpen, openModal, closeModal] = useFlag();\n const [sticker, setSticker] = useState<ApiSticker>();\n\n const lang = useLang();\n\n const APPEARANCE_THEME_OPTIONS: IRadioOption[] = [{\n label: lang('EmptyChat.Appearance.Light'),\n value: 'light',\n }, {\n label: lang('EmptyChat.Appearance.Dark'),\n value: 'dark',\n }, {\n label: lang('EmptyChat.Appearance.System'),\n value: 'auto',\n }];\n\n const KEYBOARD_SEND_OPTIONS = !IS_TOUCH_ENV ? [\n { value: 'enter', label: lang('lng_settings_send_enter'), subLabel: 'New line by Shift + Enter' },\n {\n value: 'ctrl-enter',\n label: lang(IS_MAC_OS ? 'lng_settings_send_cmdenter' : 'lng_settings_send_ctrlenter'),\n subLabel: 'New line by Enter',\n },\n ] : undefined;\n\n const handleAnimationLevelChange = useCallback((newLevel: number) => {\n ANIMATION_LEVEL_OPTIONS.forEach((_, i) => {\n document.body.classList.toggle(`animation-level-${i}`, newLevel === i);\n });\n\n setSettingOption({ animationLevel: newLevel });\n }, [setSettingOption]);\n\n const handleMessageTextSizeChange = useCallback((newSize: number) => {\n document.documentElement.style.setProperty(\n '--composer-text-size', `${Math.max(newSize, IS_IOS ? 16 : 15)}px`,\n );\n document.documentElement.style.setProperty('--message-meta-height', `${Math.floor(newSize * 1.3125)}px`);\n document.documentElement.style.setProperty('--message-text-size', `${newSize}px`);\n document.documentElement.setAttribute('data-message-text-size', newSize.toString());\n\n setSettingOption({ messageTextSize: newSize });\n }, [setSettingOption]);\n\n const handleAppearanceThemeChange = useCallback((value: string) => {\n const newTheme = value === 'auto' ? getSystemTheme() : value as ISettings['theme'];\n\n setSettingOption({ theme: newTheme });\n setSettingOption({ shouldUseSystemTheme: value === 'auto' });\n if (newTheme !== theme) {\n switchTheme(newTheme, animationLevel === ANIMATION_LEVEL_MAX);\n }\n }, [animationLevel, setSettingOption, theme]);\n\n const handleTimeFormatChange = useCallback((newTimeFormat: string) => {\n setSettingOption({ timeFormat: newTimeFormat });\n setSettingOption({ wasTimeFormatSetManually: true });\n\n setTimeFormat(newTimeFormat as TimeFormat);\n }, [setSettingOption]);\n\n const handleStickerSetClick = useCallback((value: ApiSticker) => {\n setSticker(value);\n openModal();\n }, [openModal]);\n\n const handleMessageSendComboChange = useCallback((newCombo: string) => {\n setSettingOption({ messageSendKeyCombo: newCombo });\n }, [setSettingOption]);\n\n const handleSuggestStickersChange = useCallback((newValue: boolean) => {\n setSettingOption({ shouldSuggestStickers: newValue });\n }, [setSettingOption]);\n\n const handleShouldLoopStickersChange = useCallback((newValue: boolean) => {\n setSettingOption({ shouldLoopStickers: newValue });\n }, [setSettingOption]);\n\n const stickerSets = stickerSetIds && stickerSetIds.map((id: string) => {\n return stickerSetsById?.[id]?.installedDate ? stickerSetsById[id] : false;\n }).filter<ApiStickerSet>(Boolean as any);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.General);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('SETTINGS')}</h4>\n\n <RangeSlider\n label={lang('TextSize')}\n min={12}\n max={20}\n value={messageTextSize}\n onChange={handleMessageTextSizeChange}\n />\n\n <ListItem\n icon=\"photo\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.GeneralChatBackground)}\n >\n {lang('ChatBackground')}\n </ListItem>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('Theme')}\n </h4>\n <RadioGroup\n name=\"theme\"\n options={APPEARANCE_THEME_OPTIONS}\n selected={shouldUseSystemTheme ? 'auto' : theme}\n onChange={handleAppearanceThemeChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Time Format\n </h4>\n <RadioGroup\n name=\"timeformat\"\n options={TIME_FORMAT_OPTIONS}\n selected={timeFormat}\n onChange={handleTimeFormatChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Animation Level\n </h4>\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n Choose the desired animations amount.\n </p>\n\n <RangeSlider\n options={ANIMATION_LEVEL_OPTIONS}\n value={animationLevel}\n onChange={handleAnimationLevelChange}\n />\n </div>\n\n {KEYBOARD_SEND_OPTIONS && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('VoiceOver.Keyboard')}</h4>\n\n <RadioGroup\n name=\"keyboard-send-settings\"\n options={KEYBOARD_SEND_OPTIONS}\n onChange={handleMessageSendComboChange}\n selected={messageSendKeyCombo}\n />\n </div>\n )}\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('AccDescrStickers')}</h4>\n\n {defaultReaction && (\n <ListItem\n className=\"SettingsDefaultReaction\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.QuickReaction)}\n >\n <ReactionStaticEmoji reaction={defaultReaction} />\n <div className=\"title\">{lang('DoubleTapSetting')}</div>\n </ListItem>\n )}\n\n <Checkbox\n label={lang('SuggestStickers')}\n checked={shouldSuggestStickers}\n onCheck={handleSuggestStickersChange}\n />\n <Checkbox\n label={lang('LoopAnimatedStickers')}\n checked={shouldLoopStickers}\n onCheck={handleShouldLoopStickersChange}\n />\n\n <div className=\"mt-4\" ref={stickerSettingsRef}>\n {stickerSets && stickerSets.map((stickerSet: ApiStickerSet) => (\n <SettingsStickerSet\n key={stickerSet.id}\n stickerSet={stickerSet}\n observeIntersection={observeIntersectionForCovers}\n onClick={handleStickerSetClick}\n />\n ))}\n </div>\n {sticker && (\n <StickerSetModal\n isOpen={isModalOpen}\n fromSticker={sticker}\n onClose={closeModal}\n />\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { theme, shouldUseSystemTheme } = global.settings.byKey;\n\n return {\n ...pick(global.settings.byKey, [\n 'messageTextSize',\n 'animationLevel',\n 'messageSendKeyCombo',\n 'shouldSuggestStickers',\n 'shouldLoopStickers',\n 'isSensitiveEnabled',\n 'canChangeSensitive',\n 'timeFormat',\n ]),\n stickerSetIds: global.stickers.added.setIds,\n stickerSetsById: global.stickers.setsById,\n defaultReaction: global.appConfig?.defaultReaction,\n theme,\n shouldUseSystemTheme,\n };\n },\n)(SettingsGeneral));\n","/* eslint-disable eqeqeq */\n/* eslint-disable prefer-template */\n/* eslint-disable prefer-const */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable one-var */\n/* eslint-disable one-var-declaration-per-line */\n\nimport { preloadImage } from './files';\n\n/**\n * HEX > RGB\n * input: 'xxxxxx' (ex. 'ed15fa') case-insensitive\n * output: [r, g, b] ([0-255, 0-255, 0-255])\n */\nexport function hex2rgb(param: string): [number, number, number] {\n return [\n parseInt(param.substring(0, 2), 16),\n parseInt(param.substring(2, 4), 16),\n parseInt(param.substring(4, 6), 16),\n ];\n}\n\n/**\n * RGB > HEX\n * input: [r, g, b] ([0-255, 0-255, 0-255])\n * output: 'xxxxxx' (ex. 'ff0000')\n */\nexport function rgb2hex(param: [number, number, number]) {\n const p0 = param[0].toString(16);\n const p1 = param[1].toString(16);\n const p2 = param[2].toString(16);\n return (p0.length == 1 ? '0' + p0 : p0) + (p1.length == 1 ? '0' + p1 : p1) + (p2.length == 1 ? '0' + p2 : p2);\n}\n\n/**\n * Converts an RGB color value to HSV. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes r, g, and b are contained in the set [0, 255] and\n * returns h, s, and v in the set [0, 1].\n *\n * @param Number r The red color value\n * @param Number g The green color value\n * @param Number b The blue color value\n * @return Array The HSV representation\n */\nexport function rgb2hsb([r, g, b]: [number, number, number]): [number, number, number] {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h!: number, s: number, v: number = max;\n\n let d = max - min;\n s = max == 0 ? 0 : d / max;\n\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n\n h /= 6;\n }\n\n return [h, s, v];\n}\n\n/**\n * Converts an HSV color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes h, s, and v are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number v The value\n * @return Array The RGB representation\n */\nexport function hsb2rgb([h, s, v]: [number, number, number]): [number, number, number] {\n let r!: number, g!: number, b!: number;\n\n let i = Math.floor(h * 6);\n let f = h * 6 - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n }\n\n return [\n Math.round(r * 255),\n Math.round(g * 255),\n Math.round(b * 255),\n ];\n}\n\nexport async function getAverageColor(url: string): Promise<[number, number, number]> {\n // Only visit every 5 pixels\n const blockSize = 5;\n const defaultRGB: [number, number, number] = [0, 0, 0];\n let data;\n let width;\n let height;\n let i = -4;\n let length;\n let rgb: [number, number, number] = [0, 0, 0];\n let count = 0;\n\n const canvas = document.createElement('canvas');\n const context = canvas.getContext && canvas.getContext('2d');\n if (!context) {\n return defaultRGB;\n }\n\n const image = await preloadImage(url);\n height = image.naturalHeight || image.offsetHeight || image.height;\n width = image.naturalWidth || image.offsetWidth || image.width;\n canvas.height = height;\n canvas.width = width;\n\n context.drawImage(image, 0, 0);\n\n try {\n data = context.getImageData(0, 0, width, height);\n } catch (e) {\n return defaultRGB;\n }\n\n length = data.data.length;\n\n // eslint-disable-next-line no-cond-assign\n while ((i += blockSize * 4) < length) {\n ++count;\n rgb[0] += data.data[i];\n rgb[1] += data.data[i + 1];\n rgb[2] += data.data[i + 2];\n }\n\n rgb[0] = Math.floor(rgb[0] / count);\n rgb[1] = Math.floor(rgb[1] / count);\n rgb[2] = Math.floor(rgb[2] / count);\n\n return rgb;\n}\n\n// eslint-disable-next-line max-len\n// Function was adapted from https://github.com/telegramdesktop/tdesktop/blob/35ff621b5b52f7e3553fb0f990ea13ade7101b8e/Telegram/SourceFiles/data/data_wall_paper.cpp#L518\nexport function getPatternColor(rgbColor: [number, number, number]) {\n let [hue, saturation, value] = rgb2hsb(rgbColor);\n\n saturation = Math.min(1, saturation + 0.05 + 0.1 * (1 - saturation));\n value = value > 0.5\n ? Math.max(0, value * 0.65)\n : Math.max(0, Math.min(1, 1 - value * 0.65));\n\n return `hsla(${hue * 360}, ${saturation * 100}%, ${value * 100}%, .4)`;\n}\n","import React, {\n FC, memo, useCallback, useEffect, useState, useRef,\n} from '../../../lib/teact/teact';\nimport { ApiWallpaper } from '../../../api/types';\nimport { ThemeKey, 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 React, {\n FC, memo, useEffect, useCallback, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens, ThemeKey, UPLOADING_WALLPAPER_SLUG } from '../../../types';\nimport { 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(isActive, onReset, onScreenSelect, SettingsScreens.GeneralChatBackground);\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 { ChangeEvent, MutableRefObject, RefObject } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens, ThemeKey } from '../../../types';\n\nimport { pick } from '../../../util/iteratees';\nimport {\n getPatternColor, hex2rgb, hsb2rgb, rgb2hex, rgb2hsb,\n} from '../../../util/colors';\nimport { captureEvents, RealTouchEvent } 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 onScreenSelect: (screen: SettingsScreens) => void;\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 onScreenSelect,\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(isActive, onReset, onScreenSelect, SettingsScreens.GeneralChatBackgroundColor);\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 { ChangeEvent } from 'react';\nimport useRunDebounced from '../../../hooks/useRunDebounced';\nimport React, {\n FC, memo, useCallback, useEffect,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens } from '../../../types';\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 onScreenSelect: (screen: SettingsScreens) => void;\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 onScreenSelect,\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(isActive, onReset, onScreenSelect, SettingsScreens.Notifications);\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 React, { FC, memo, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { PrivacyVisibility, SettingsScreens } from '../../../types';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n hasPassword?: boolean;\n blockedCount: number;\n isSensitiveEnabled?: boolean;\n canChangeSensitive?: boolean;\n visibilityPrivacyPhoneNumber?: PrivacyVisibility;\n visibilityPrivacyLastSeen?: PrivacyVisibility;\n visibilityPrivacyProfilePhoto?: PrivacyVisibility;\n visibilityPrivacyForwarding?: PrivacyVisibility;\n visibilityPrivacyGroupChats?: PrivacyVisibility;\n};\n\nconst SettingsPrivacy: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n hasPassword,\n blockedCount,\n isSensitiveEnabled,\n canChangeSensitive,\n visibilityPrivacyPhoneNumber,\n visibilityPrivacyLastSeen,\n visibilityPrivacyProfilePhoto,\n visibilityPrivacyForwarding,\n visibilityPrivacyGroupChats,\n\n}) => {\n const {\n loadPrivacySettings,\n loadBlockedContacts,\n loadAuthorizations,\n loadContentSettings,\n updateContentSettings,\n } = getActions();\n\n useEffect(() => {\n loadBlockedContacts();\n loadAuthorizations();\n loadPrivacySettings();\n loadContentSettings();\n }, [loadBlockedContacts, loadAuthorizations, loadPrivacySettings, loadContentSettings]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Privacy);\n\n function getVisibilityValue(visibility?: PrivacyVisibility) {\n switch (visibility) {\n case 'everybody':\n return lang('P2PEverybody');\n\n case 'contacts':\n return lang('P2PContacts');\n\n case 'nobody':\n return lang('P2PNobody');\n }\n\n return undefined;\n }\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <ListItem\n icon=\"delete-user\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyBlockedUsers)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('BlockedUsers')}</span>\n {blockedCount > 0 && (\n <span className=\"subtitle\" dir=\"auto\">\n {lang('Users', blockedCount)}\n </span>\n )}\n </div>\n </ListItem>\n <ListItem\n icon=\"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(visibilityPrivacyPhoneNumber)}\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(visibilityPrivacyLastSeen)}\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(visibilityPrivacyProfilePhoto)}\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(visibilityPrivacyForwarding)}\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(visibilityPrivacyGroupChats)}\n </span>\n </div>\n </ListItem>\n </div>\n\n {canChangeSensitive && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('lng_settings_sensitive_title')}\n </h4>\n <Checkbox\n label={lang('lng_settings_sensitive_disable_filtering')}\n subLabel={lang('lng_settings_sensitive_about')}\n checked={Boolean(isSensitiveEnabled)}\n disabled={!canChangeSensitive}\n onCheck={updateContentSettings}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n settings: {\n byKey: { hasPassword, isSensitiveEnabled, canChangeSensitive },\n privacy,\n },\n blocked,\n } = global;\n\n return {\n hasPassword,\n blockedCount: blocked.totalCount,\n isSensitiveEnabled,\n canChangeSensitive,\n visibilityPrivacyPhoneNumber: privacy.phoneNumber?.visibility,\n visibilityPrivacyLastSeen: privacy.lastSeen?.visibility,\n visibilityPrivacyProfilePhoto: privacy.profilePhoto?.visibility,\n visibilityPrivacyForwarding: privacy.forwards?.visibility,\n visibilityPrivacyGroupChats: privacy.chatInvite?.visibility,\n };\n },\n)(SettingsPrivacy));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ISettings, LangCode, SettingsScreens } from '../../../types';\nimport { 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 onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = Pick<ISettings, 'languages' | 'language'>;\n\nconst SettingsLanguage: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\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(isActive, onReset, onScreenSelect, SettingsScreens.Language);\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 { ApiPrivacyKey, SettingsScreens } from '../../../../types';\n\nexport function getPrivacyKey(screen: SettingsScreens): ApiPrivacyKey | undefined {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n return 'phoneNumber';\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n return 'lastSeen';\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n return 'profilePhoto';\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return 'forwards';\n case SettingsScreens.PrivacyGroupChats:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return 'chatInvite';\n }\n\n return undefined;\n}\n","import React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiChat, ApiUser } from '../../../api/types';\nimport { ApiPrivacySettings, SettingsScreens } from '../../../types';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport RadioGroup from '../../ui/RadioGroup';\nimport { getPrivacyKey } from './helpers/privacy';\n\ntype OwnProps = {\n screen: SettingsScreens;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps =\n Partial<ApiPrivacySettings> & {\n chatsById?: Record<string, ApiChat>;\n usersById?: Record<string, ApiUser>;\n };\n\nconst SettingsPrivacyVisibility: FC<OwnProps & StateProps> = ({\n screen,\n isActive,\n onScreenSelect,\n onReset,\n visibility,\n allowUserIds,\n allowChatIds,\n blockUserIds,\n blockChatIds,\n chatsById,\n}) => {\n const { setPrivacyVisibility } = getActions();\n\n const lang = useLang();\n\n const visibilityOptions = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyGroupChats:\n return [\n { value: 'everybody', label: lang('P2PEverybody') },\n { value: 'contacts', label: lang('P2PContacts') },\n ];\n\n default:\n return [\n { value: 'everybody', label: lang('P2PEverybody') },\n { value: 'contacts', label: lang('P2PContacts') },\n { value: 'nobody', label: lang('P2PNobody') },\n ];\n }\n }, [lang, screen]);\n\n const exceptionLists = {\n shouldShowDenied: visibility !== 'nobody',\n shouldShowAllowed: visibility !== 'everybody',\n };\n\n const privacyKey = getPrivacyKey(screen);\n\n const headerText = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return lang('PrivacyPhoneTitle');\n case SettingsScreens.PrivacyLastSeen:\n return lang('LastSeenTitle');\n case SettingsScreens.PrivacyProfilePhoto:\n return lang('PrivacyProfilePhotoTitle');\n case SettingsScreens.PrivacyForwarding:\n return lang('PrivacyForwardsTitle');\n case SettingsScreens.PrivacyGroupChats:\n return lang('WhoCanAddMe');\n default:\n return undefined;\n }\n }, [lang, screen]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, screen);\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 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 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('AlwaysShareWith')}</span>\n <span className=\"subtitle\">{lang('EditAdminAddUsers')}</span>\n </div>\n </ListItem>\n )}\n {exceptionLists.shouldShowDenied && (\n <ListItem\n narrow\n icon=\"delete-user\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => {\n onScreenSelect(deniedContactsScreen);\n }}\n >\n <div className=\"multiline-menu-item full-size\">\n {blockCount > 0 && <span className=\"date\" dir=\"auto\">&minus;{blockCount}</span>}\n <span className=\"title\">{lang('NeverShareWith')}</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.PrivacyForwarding:\n privacySettings = privacy.forwards;\n break;\n\n case SettingsScreens.PrivacyGroupChats:\n privacySettings = privacy.chatInvite;\n break;\n }\n\n if (!privacySettings) {\n return {};\n }\n\n return {\n ...privacySettings,\n chatsById,\n };\n },\n)(SettingsPrivacyVisibility));\n","import { 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","import React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiSession } from '../../../api/types';\nimport { SettingsScreens } from '../../../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';\n\nimport './SettingsActiveSessions.scss';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n activeSessions: ApiSession[];\n};\n\nconst SettingsActiveSessions: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n activeSessions,\n}) => {\n const {\n terminateAuthorization,\n terminateAllAuthorizations,\n } = getActions();\n\n const [isConfirmTerminateAllDialogOpen, openConfirmTerminateAllDialog, closeConfirmTerminateAllDialog] = useFlag();\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 currentSession = useMemo(() => {\n return activeSessions.find((session) => session.isCurrent);\n }, [activeSessions]);\n\n const otherSessions = useMemo(() => {\n return activeSessions.filter((session) => !session.isCurrent);\n }, [activeSessions]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.ActiveSessions);\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 <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 </div>\n );\n }\n\n function renderOtherSessions(sessions: ApiSession[]) {\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 {sessions.map(renderSession)}\n </div>\n );\n }\n\n function renderSession(session: ApiSession) {\n return (\n <ListItem\n key={session.hash}\n ripple\n narrow\n contextActions={[{\n title: 'Terminate',\n icon: 'stop',\n handler: () => {\n handleTerminateSessionClick(session.hash);\n },\n }]}\n icon={`device-${getSessionIcon(session)} icon-device`}\n >\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 {otherSessions && renderOtherSessions(otherSessions)}\n {otherSessions && (\n <ConfirmDialog\n isOpen={isConfirmTerminateAllDialogOpen}\n onClose={closeConfirmTerminateAllDialog}\n text=\"Are you sure you want to terminate all other sessions?\"\n confirmLabel=\"Terminate All Other Sessions\"\n confirmHandler={handleTerminateAllSessions}\n confirmIsDestructive\n />\n )}\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 => {\n return {\n activeSessions: global.activeSessions,\n };\n },\n)(SettingsActiveSessions));\n","import React, {\n FC, useMemo, useState, memo, useRef, useCallback, useEffect,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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 loadContactList,\n setUserSearchQuery,\n blockContact,\n } = getActions();\n\n const lang = useLang();\n const [filter, setFilter] = useState('');\n // eslint-disable-next-line no-null/no-null\n const filterRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n setUserSearchQuery({ query: filter });\n }, [filter, setUserSearchQuery]);\n\n const filteredContactIds = useMemo(() => {\n const availableContactIds = unique([\n ...(contactIds || []),\n ...(localContactIds || []),\n ].filter((contactId) => {\n return contactId !== currentUserId && !blockedIds.includes(contactId);\n }));\n\n return filterUsersByName(availableContactIds, usersById, filter)\n .sort((firstId, secondId) => {\n const firstName = getUserFullName(usersById[firstId]) || '';\n const secondName = getUserFullName(usersById[secondId]) || '';\n\n return firstName.localeCompare(secondName);\n });\n }, [blockedIds, contactIds, currentUserId, filter, localContactIds, usersById]);\n\n const handleRemoveUser = useCallback((userId: string) => {\n const { id: contactId, accessHash } = usersById[userId] || {};\n if (!contactId || !accessHash) {\n return;\n }\n blockContact({ contactId, accessHash });\n onClose();\n }, [blockContact, onClose, usersById]);\n\n return (\n <ChatOrUserPicker\n isOpen={isOpen}\n chatOrUserIds={filteredContactIds}\n filterRef={filterRef}\n filterPlaceholder={lang('BlockedUsers.BlockUser')}\n filter={filter}\n onFilterChange={setFilter}\n loadMore={loadContactList}\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 React, {\n FC, memo, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiChat, ApiCountryCode, ApiUser } from '../../../api/types';\nimport { SettingsScreens } from '../../../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 onScreenSelect: (screen: SettingsScreens) => void;\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 onScreenSelect,\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(isActive, onReset, onScreenSelect, SettingsScreens.PrivacyBlockedUsers);\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 React, { FC, memo } from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport ListItem from '../../../ui/ListItem';\nimport AnimatedEmoji from '../../../common/AnimatedEmoji';\nimport renderText from '../../../common/helpers/renderText';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst SettingsTwoFaEnabled: FC<OwnProps & StateProps> = ({\n isActive, onReset, animatedEmoji, onScreenSelect,\n}) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.TwoFaEnabled);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedEmoji sticker={animatedEmoji} size=\"large\" />\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(withGlobal<OwnProps>((global) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, '🔐'),\n };\n})(SettingsTwoFaEnabled));\n","import React, {\n FC, memo, useCallback, useState,\n} from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\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 screen: SettingsScreens;\n error?: string;\n isLoading?: 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 onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst EQUAL_PASSWORD_ERROR = 'Passwords Should Be Equal';\n\nconst SettingsTwoFaPassword: FC<OwnProps> = ({\n screen,\n isActive,\n onScreenSelect,\n onReset,\n error,\n isLoading,\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(isActive, onReset, onScreenSelect, screen);\n\n return (\n <div className=\"settings-content two-fa 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 submitLabel={submitLabel || lang('Next')}\n clearError={handleClearError}\n isLoading={isLoading}\n isPasswordVisible={shouldShowPassword}\n onChangePasswordVisibility={setShouldShowPassword}\n onSubmit={handleSubmit}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(SettingsTwoFaPassword);\n","import React, { FC, memo } from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedEmoji from '../../../common/AnimatedEmoji';\n\ntype OwnProps = {\n onStart: NoneToVoidFunction;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst SettingsTwoFaStart: FC<OwnProps & StateProps> = ({\n isActive, onScreenSelect, onReset, animatedEmoji, onStart,\n}) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.TwoFaDisabled);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedEmoji sticker={animatedEmoji} size=\"large\" />\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(withGlobal<OwnProps>((global) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, '🔐'),\n };\n})(SettingsTwoFaStart));\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../../util/environment';\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\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 AnimatedEmoji from '../../../common/AnimatedEmoji';\nimport InputText from '../../../ui/InputText';\nimport renderText from '../../../common/helpers/renderText';\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 onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n screen: SettingsScreens;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\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 onScreenSelect,\n onReset,\n screen,\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(isActive, onReset, onScreenSelect, screen);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedEmoji sticker={animatedEmoji} size=\"large\" />\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 React, { FC, memo, useCallback } from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { selectAnimatedEmoji } from '../../../../global/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedEmoji from '../../../common/AnimatedEmoji';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst SettingsTwoFaCongratulations: FC<OwnProps & StateProps> = ({\n isActive, onReset, animatedEmoji, onScreenSelect,\n}) => {\n const lang = useLang();\n\n const handleClick = useCallback(() => {\n onScreenSelect(SettingsScreens.Privacy);\n }, [onScreenSelect]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.TwoFaCongratulations);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <AnimatedEmoji sticker={animatedEmoji} size=\"large\" />\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(withGlobal<OwnProps>((global) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, '🥳'),\n };\n})(SettingsTwoFaCongratulations));\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../global';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../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 AnimatedEmoji from '../../../common/AnimatedEmoji';\nimport InputText from '../../../ui/InputText';\nimport Loading from '../../../ui/Loading';\n\ntype OwnProps = {\n isLoading?: boolean;\n error?: string;\n clearError: NoneToVoidFunction;\n onSubmit: (hint: string) => void;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n screen: SettingsScreens;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n codeLength: number;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\n\nconst SettingsTwoFaEmailCode: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n codeLength,\n isLoading,\n error,\n clearError,\n onSubmit,\n isActive,\n onScreenSelect,\n onReset,\n screen,\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(isActive, onReset, onScreenSelect, screen);\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 <AnimatedEmoji sticker={animatedEmoji} size=\"large\" />\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 React, {\n FC, memo, useCallback, useEffect,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport { GlobalState } from '../../../../global/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { TwoFaDispatch, TwoFaState } from '../../../../hooks/reducers/useTwoFaReducer';\nimport useLang from '../../../../hooks/useLang';\n\nimport SettingsTwoFaEnabled from './SettingsTwoFaEnabled';\nimport SettingsTwoFaPassword from './SettingsTwoFaPassword';\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 onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n placeholder={lang('PleaseEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPassword}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPasswordConfirm}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleChangePasswordCurrent}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n placeholder={lang('PleaseEnterNewFirstPassword')}\n onSubmit={handleChangePasswordNew}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n onSubmit={handleChangePasswordConfirm}\n onScreenSelect={onScreenSelect}\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 onScreenSelect={onScreenSelect}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n screen={currentScreen}\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 onScreenSelect={onScreenSelect}\n isActive={isActive}\n onReset={onReset}\n screen={currentScreen}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n return (\n <SettingsTwoFaPassword\n screen={currentScreen}\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleRecoveryEmailCurrentPassword}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n icon=\"email\"\n type=\"email\"\n placeholder={lang('RecoveryEmailTitle')}\n onSubmit={handleRecoveryEmail}\n onScreenSelect={onScreenSelect}\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 screen={currentScreen}\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n onScreenSelect={onScreenSelect}\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 React, {\n FC, memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport { GlobalState } from '../../../global/types';\nimport { ApiPrivacySettings, 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(isActive, onReset, onScreenSelect, screen);\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('AlwaysShareWithPlaceholder') : lang('NeverShareWithPlaceholder')}\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('AlwaysShareWithTitle') : lang('NeverShareWithTitle')}\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.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return privacy.forwards;\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return privacy.chatInvite;\n }\n\n return undefined;\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { screen }): StateProps => {\n return {\n currentUserId: global.currentUserId,\n settings: getCurrentPrivacySettings(global, screen),\n };\n },\n)(SettingsPrivacyVisibilityExceptionList));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { SettingsScreens } from '../../../types';\nimport { ApiAvailableReaction } from '../../../api/types';\n\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport RadioGroup from '../../ui/RadioGroup';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n availableReactions?: ApiAvailableReaction[];\n selectedReaction?: string;\n};\n\nconst SettingsQuickReaction: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n onScreenSelect,\n availableReactions,\n selectedReaction,\n}) => {\n const { setDefaultReaction } = getActions();\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.General);\n\n const options = availableReactions?.filter((l) => !l.isInactive).map((l) => {\n return {\n label: <><ReactionStaticEmoji reaction={l.reaction} />{l.title}</>,\n value: l.reaction,\n };\n }) || [];\n\n const handleChange = useCallback((reaction: string) => {\n setDefaultReaction({ reaction });\n }, [setDefaultReaction]);\n\n return (\n <div className=\"settings-content settings-item custom-scroll settings-quick-reaction\">\n <RadioGroup\n name=\"quick-reaction-settings\"\n options={options}\n selected={selectedReaction}\n onChange={handleChange}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global) => {\n const { availableReactions, appConfig } = global;\n\n return {\n availableReactions,\n selectedReaction: appConfig?.defaultReaction,\n };\n },\n)(SettingsQuickReaction));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../types';\nimport { FolderEditDispatch, FoldersState } from '../../../hooks/reducers/useFoldersReducer';\n\nimport { LAYERS_ANIMATION_NAME } from '../../../util/environment';\nimport useTwoFaReducer from '../../../hooks/reducers/useTwoFaReducer';\n\nimport Transition from '../../ui/Transition';\nimport SettingsHeader from './SettingsHeader';\nimport SettingsMain from './SettingsMain';\nimport SettingsEditProfile from './SettingsEditProfile';\nimport SettingsDataStorage from './SettingsDataStorage';\nimport SettingsFolders from './folders/SettingsFolders';\nimport SettingsGeneral from './SettingsGeneral';\nimport SettingsGeneralBackground from './SettingsGeneralBackground';\nimport SettingsGeneralBackgroundColor from './SettingsGeneralBackgroundColor';\nimport SettingsNotifications from './SettingsNotifications';\nimport SettingsPrivacy from './SettingsPrivacy';\nimport SettingsLanguage from './SettingsLanguage';\nimport SettingsPrivacyVisibility from './SettingsPrivacyVisibility';\nimport SettingsActiveSessions from './SettingsActiveSessions';\nimport SettingsPrivacyBlockedUsers from './SettingsPrivacyBlockedUsers';\nimport SettingsTwoFa from './twoFa/SettingsTwoFa';\nimport SettingsPrivacyVisibilityExceptionList from './SettingsPrivacyVisibilityExceptionList';\nimport SettingsQuickReaction from './SettingsQuickReaction';\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 FOLDERS_SCREENS = [\n SettingsScreens.Folders,\n SettingsScreens.FoldersCreateFolder,\n SettingsScreens.FoldersEditFolder,\n SettingsScreens.FoldersEditFolderFromChatList,\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersIncludedChatsFromChatList,\n SettingsScreens.FoldersExcludedChats,\n SettingsScreens.FoldersExcludedChatsFromChatList,\n];\n\nconst PRIVACY_SCREENS = [\n SettingsScreens.PrivacyBlockedUsers,\n SettingsScreens.ActiveSessions,\n];\n\nconst PRIVACY_PHONE_NUMBER_SCREENS = [\n SettingsScreens.PrivacyPhoneNumberAllowedContacts,\n SettingsScreens.PrivacyPhoneNumberDeniedContacts,\n];\n\nconst PRIVACY_LAST_SEEN_PHONE_SCREENS = [\n SettingsScreens.PrivacyLastSeenAllowedContacts,\n SettingsScreens.PrivacyLastSeenDeniedContacts,\n];\n\nconst PRIVACY_PROFILE_PHOTO_SCREENS = [\n SettingsScreens.PrivacyProfilePhotoAllowedContacts,\n SettingsScreens.PrivacyProfilePhotoDeniedContacts,\n];\n\nconst PRIVACY_FORWARDING_SCREENS = [\n SettingsScreens.PrivacyForwardingAllowedContacts,\n SettingsScreens.PrivacyForwardingDeniedContacts,\n];\n\nconst PRIVACY_GROUP_CHATS_SCREENS = [\n SettingsScreens.PrivacyGroupChatsAllowedContacts,\n SettingsScreens.PrivacyGroupChatsDeniedContacts,\n];\n\nexport type OwnProps = {\n isActive: boolean;\n currentScreen: SettingsScreens;\n foldersState: FoldersState;\n foldersDispatch: FolderEditDispatch;\n onScreenSelect: (screen: SettingsScreens) => void;\n shouldSkipTransition?: boolean;\n onReset: () => 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\n const handleReset = useCallback(() => {\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.PrivacyForwarding]: PRIVACY_FORWARDING_SCREENS.includes(screen),\n [SettingsScreens.PrivacyGroupChats]: PRIVACY_GROUP_CHATS_SCREENS.includes(screen),\n };\n\n const isTwoFaScreen = TWO_FA_SCREENS.includes(screen);\n const isFoldersScreen = FOLDERS_SCREENS.includes(screen);\n const isPrivacyScreen = PRIVACY_SCREENS.includes(screen)\n || isTwoFaScreen\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 onScreenSelect={onScreenSelect}\n isActive={isActive && isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.General:\n return (\n <SettingsGeneral\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive\n || screen === SettingsScreens.GeneralChatBackgroundColor\n || screen === SettingsScreens.GeneralChatBackground\n || screen === SettingsScreens.QuickReaction\n || isPrivacyScreen || isFoldersScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.QuickReaction:\n return (\n <SettingsQuickReaction onScreenSelect={onScreenSelect} isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Notifications:\n return (\n <SettingsNotifications onScreenSelect={onScreenSelect} isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.DataStorage:\n return (\n <SettingsDataStorage onScreenSelect={onScreenSelect} isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Privacy:\n return (\n <SettingsPrivacy\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || isPrivacyScreen || isTwoFaScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.Language:\n return (\n <SettingsLanguage onScreenSelect={onScreenSelect} 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 onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.ActiveSessions:\n return (\n <SettingsActiveSessions\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyBlockedUsers:\n return (\n <SettingsPrivacyBlockedUsers\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyGroupChats:\n return (\n <SettingsPrivacyVisibility\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n isAllowList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.Folders:\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <SettingsFolders\n currentScreen={currentScreen}\n shownScreen={screen}\n state={foldersState}\n dispatch={foldersDispatch}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.TwoFaDisabled:\n case SettingsScreens.TwoFaNewPassword:\n case SettingsScreens.TwoFaNewPasswordConfirm:\n case SettingsScreens.TwoFaNewPasswordHint:\n case SettingsScreens.TwoFaNewPasswordEmail:\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n case SettingsScreens.TwoFaCongratulations:\n case SettingsScreens.TwoFaEnabled:\n case SettingsScreens.TwoFaChangePasswordCurrent:\n case SettingsScreens.TwoFaChangePasswordNew:\n case SettingsScreens.TwoFaChangePasswordConfirm:\n case SettingsScreens.TwoFaChangePasswordHint:\n case SettingsScreens.TwoFaTurnOff:\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n case SettingsScreens.TwoFaRecoveryEmail:\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFa\n currentScreen={currentScreen}\n state={twoFaState}\n dispatch={twoFaDispatch}\n shownScreen={screen}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n 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 React, {\n FC, useEffect, useCallback, useMemo, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiUser, ApiUserStatus } from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { throttle } from '../../../util/schedulers';\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 runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst ContactList: FC<OwnProps & StateProps> = ({\n isActive,\n filter,\n usersById,\n userStatusesById,\n contactIds,\n serverTimeOffset,\n onReset,\n}) => {\n const {\n loadContactList,\n openChat,\n openNewContactDialog,\n } = getActions();\n\n const lang = useLang();\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 loadContactList();\n });\n });\n\n useHistoryBack(isActive, onReset);\n\n const handleClick = useCallback((id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n }, [openChat]);\n\n const listIds = useMemo(() => {\n if (!contactIds) {\n return undefined;\n }\n\n const filteredIds = filterUsersByName(contactIds, usersById, filter);\n\n return sortUserIds(filteredIds, usersById, userStatusesById, undefined, serverTimeOffset);\n }, [contactIds, filter, usersById, userStatusesById, serverTimeOffset]);\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, listIds, Boolean(filter));\n\n return (\n <InfiniteScroll items={viewportIds} onLoadMore={getMore} className=\"chat-list custom-scroll\">\n {viewportIds?.length ? (\n viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleClick(id)}\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n >\n <PrivateChatInfo userId={id} forceShowSelf avatarSize=\"large\" />\n </ListItem>\n ))\n ) : viewportIds && !viewportIds.length ? (\n <p className=\"no-results\" key=\"no-results\" dir=\"auto\">\n {filter.length ? 'No contacts matched your search.' : 'Contact list is empty.'}\n </p>\n ) : (\n <Loading key=\"loading\" />\n )}\n <FloatingActionButton\n isShown\n onClick={openNewContactDialog}\n ariaLabel={lang('CreateNewContact')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: contactIds } = global.contactList || {};\n const { byId: usersById, statusesById: userStatusesById } = global.users;\n\n return {\n usersById,\n userStatusesById,\n contactIds,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ContactList));\n","import React, {\n FC, useCallback, useEffect, useMemo, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport { ApiChat } from '../../../api/types';\n\nimport { unique } from '../../../util/iteratees';\nimport { throttle } from '../../../util/schedulers';\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 runThrottled = throttle((cb) => cb(), 60000, true);\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 loadContactList,\n setGlobalSearchQuery,\n } = getActions();\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadContactList();\n });\n });\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset);\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 React, {\n FC, 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(isActive, onReset);\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 React, {\n FC, memo, useCallback, useState,\n} 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 React, { FC, 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 { 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, onContentChange }) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onContentChange, LeftColumnContent.Archived);\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 React, {\n FC, useCallback, memo, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiChatFolder } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport CheckboxGroup from '../ui/CheckboxGroup';\n\nexport type OwnProps = {\n isOpen: boolean;\n chatId: string;\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n};\n\ntype StateProps = {\n foldersById?: Record<number, ApiChatFolder>;\n folderOrderedIds?: number[];\n};\n\nconst ChatFolderModal: FC<OwnProps & StateProps> = ({\n isOpen,\n chatId,\n foldersById,\n folderOrderedIds,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const { editChatFolders } = getActions();\n\n const lang = useLang();\n\n const initialSelectedFolderIds = useMemo(() => {\n if (!foldersById) {\n return [];\n }\n\n return Object.keys(foldersById).reduce((result, folderId) => {\n const { includedChatIds, pinnedChatIds } = foldersById[Number(folderId)];\n if (includedChatIds.includes(chatId) || pinnedChatIds?.includes(chatId)) {\n result.push(folderId);\n }\n\n return result;\n }, [] as string[]);\n }, [chatId, foldersById]);\n\n const [selectedFolderIds, setSelectedFolderIds] = useState<string[]>(initialSelectedFolderIds);\n\n const folders = useMemo(() => {\n return folderOrderedIds?.map((folderId) => ({\n label: foldersById ? foldersById[folderId].title : '',\n value: String(folderId),\n })) || [];\n }, [folderOrderedIds, foldersById]);\n\n const handleSubmit = useCallback(() => {\n const idsToRemove = initialSelectedFolderIds.filter((id) => !selectedFolderIds.includes(id)).map(Number);\n const idsToAdd = selectedFolderIds.filter((id) => !initialSelectedFolderIds.includes(id)).map(Number);\n\n editChatFolders({ chatId, idsToRemove, idsToAdd });\n onClose();\n }, [chatId, editChatFolders, initialSelectedFolderIds, onClose, selectedFolderIds]);\n\n if (!foldersById || !folderOrderedIds) {\n return undefined;\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n onEnter={handleSubmit}\n className=\"delete\"\n title={lang('FilterAddTo')}\n >\n <CheckboxGroup\n options={folders}\n selected={selectedFolderIds}\n onChange={setSelectedFolderIds}\n round\n />\n <Button color=\"primary\" className=\"confirm-dialog-button\" isText onClick={handleSubmit}>\n {lang('FilterAddTo')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Cancel')}</Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { byId: foldersById, orderedIds: folderOrderedIds } = global.chatFolders;\n\n return {\n foldersById,\n folderOrderedIds,\n };\n },\n)(ChatFolderModal));\n","import { ApiMediaFormat, ApiMessage } from '../../../../api/types';\n\nimport * as mediaLoader from '../../../../util/mediaLoader';\nimport {\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): ICopyOptions {\n const options: ICopyOptions = [];\n const text = getMessageText(message);\n const photo = getMessagePhoto(message)\n || (!getMessageWebPageVideo(message) ? getMessageWebPagePhoto(message) : undefined);\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 if (afterEffect) {\n afterEffect();\n }\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 if (afterEffect) {\n afterEffect();\n }\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 if (afterEffect) {\n afterEffect();\n }\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 React, {\n FC, memo, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiAvailableReaction, ApiMediaFormat } from '../../../api/types';\n\nimport useMedia from '../../../hooks/useMedia';\nimport useFlag from '../../../hooks/useFlag';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport { createClassNameBuilder } from '../../../util/buildClassName';\nimport { IS_COMPACT_MENU } from '../../../util/environment';\n\nimport AnimatedSticker from '../../common/AnimatedSticker';\n\nimport './ReactionSelectorReaction.scss';\n\nconst REACTION_SIZE = IS_COMPACT_MENU ? 24 : 32;\n\ntype OwnProps = {\n reaction: ApiAvailableReaction;\n previewIndex: number;\n isReady?: boolean;\n onSendReaction: (reaction: string, x: number, y: number) => void;\n};\n\nconst cn = createClassNameBuilder('ReactionSelectorReaction');\n\nconst ReactionSelectorReaction: FC<OwnProps> = ({\n reaction, previewIndex, onSendReaction, isReady,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const mediaData = useMedia(`document${reaction.selectAnimation?.id}`, !isReady, ApiMediaFormat.Lottie);\n\n const [isActivated, activate, deactivate] = useFlag();\n const [isAnimationLoaded, markAnimationLoaded] = useFlag();\n\n const shouldRenderAnimated = Boolean(isReady && mediaData);\n const { transitionClassNames: animatedClassNames } = useShowTransition(shouldRenderAnimated);\n const { shouldRender: shouldRenderStatic, transitionClassNames: staticClassNames } = useShowTransition(\n !isReady || !isAnimationLoaded, undefined, true,\n );\n\n function handleClick() {\n if (!containerRef.current) return;\n const { x, y } = containerRef.current.getBoundingClientRect();\n\n onSendReaction(reaction.reaction, x, y);\n }\n\n return (\n <div\n className={cn('&', IS_COMPACT_MENU && 'compact')}\n onClick={handleClick}\n ref={containerRef}\n onMouseEnter={isReady ? activate : undefined}\n >\n {shouldRenderStatic && (\n <div\n className={cn(\n 'static',\n isReady ? [staticClassNames] : undefined,\n )}\n style={`background-position-x: ${previewIndex * -REACTION_SIZE}px;`}\n />\n )}\n {shouldRenderAnimated && (\n <AnimatedSticker\n id={`select_${reaction.reaction}`}\n className={cn('animated', [animatedClassNames])}\n animationData={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 React, {\n FC, memo, useLayoutEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiAvailableReaction } from '../../../api/types';\n\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useFlag from '../../../hooks/useFlag';\nimport { getTouchY } from '../../../util/scrollLock';\nimport { createClassNameBuilder } from '../../../util/buildClassName';\nimport { IS_COMPACT_MENU } from '../../../util/environment';\n\nimport ReactionSelectorReaction from './ReactionSelectorReaction';\n\nimport './ReactionSelector.scss';\n\ntype OwnProps = {\n enabledReactions?: string[];\n onSendReaction: (reaction: string, x: number, y: number) => void;\n isPrivate?: boolean;\n availableReactions?: ApiAvailableReaction[];\n isReady?: boolean;\n};\n\nconst cn = createClassNameBuilder('ReactionSelector');\n\nconst ReactionSelector: FC<OwnProps> = ({\n availableReactions,\n enabledReactions,\n onSendReaction,\n isPrivate,\n isReady,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const itemsScrollRef = useRef<HTMLDivElement>(null);\n const [isHorizontalScrollEnabled, enableHorizontalScroll] = useFlag(false);\n useHorizontalScroll(itemsScrollRef.current, !isHorizontalScrollEnabled);\n\n useLayoutEffect(() => {\n enableHorizontalScroll();\n }, [enableHorizontalScroll]);\n\n const handleWheel = (e: React.WheelEvent | React.TouchEvent) => {\n if (!itemsScrollRef) return;\n const deltaY = 'deltaY' in e ? e.deltaY : getTouchY(e);\n\n if (deltaY) {\n e.preventDefault();\n }\n };\n\n if ((!isPrivate && !enabledReactions?.length) || !availableReactions) return undefined;\n\n return (\n <div className={cn('&', IS_COMPACT_MENU && 'compact')} onWheelCapture={handleWheel} onTouchMove={handleWheel}>\n <div className={cn('bubble-big')} />\n <div className={cn('bubble-small')} />\n <div className={cn('items-wrapper')}>\n <div className={cn('items', ['no-scrollbar'])} ref={itemsScrollRef}>\n {availableReactions?.map((reaction, i) => {\n if (reaction.isInactive\n || (!isPrivate && (!enabledReactions || !enabledReactions.includes(reaction.reaction)))) return undefined;\n return (\n <ReactionSelectorReaction\n key={reaction.reaction}\n previewIndex={i}\n isReady={isReady}\n onSendReaction={onSendReaction}\n reaction={reaction}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(ReactionSelector);\n","import React, {\n FC, memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiAvailableReaction, ApiMessage, ApiUser } from '../../../api/types';\nimport { IAnchorPosition } from '../../../types';\n\nimport { getMessageCopyOptions } from './helpers/copyOptions';\nimport { disableScrolling, enableScrolling } from '../../../util/scrollLock';\nimport { getUserFullName } from '../../../global/helpers';\nimport useContextMenuPosition from '../../../hooks/useContextMenuPosition';\nimport useLang from '../../../hooks/useLang';\nimport buildClassName from '../../../util/buildClassName';\nimport useFlag from '../../../hooks/useFlag';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\n\nimport Menu from '../../ui/Menu';\nimport MenuItem from '../../ui/MenuItem';\nimport Avatar from '../../common/Avatar';\nimport ReactionSelector from './ReactionSelector';\n\nimport './MessageContextMenu.scss';\n\ntype OwnProps = {\n availableReactions?: ApiAvailableReaction[];\n isOpen: boolean;\n anchor: IAnchorPosition;\n message: ApiMessage;\n canSendNow?: boolean;\n enabledReactions?: string[];\n canReschedule?: boolean;\n canReply?: boolean;\n canPin?: boolean;\n canUnpin?: boolean;\n canDelete?: boolean;\n canReport?: boolean;\n canShowReactionsCount?: boolean;\n canShowReactionList?: boolean;\n canRemoveReaction?: boolean;\n canEdit?: boolean;\n canForward?: boolean;\n canFaveSticker?: boolean;\n canUnfaveSticker?: boolean;\n canCopy?: boolean;\n canCopyLink?: boolean;\n canSelect?: boolean;\n isPrivate?: boolean;\n canDownload?: boolean;\n canSaveGif?: boolean;\n isDownloading?: boolean;\n canShowSeenBy?: boolean;\n seenByRecentUsers?: ApiUser[];\n onReply: () => void;\n onEdit: () => void;\n onPin: () => void;\n onUnpin: () => void;\n onForward: () => void;\n onDelete: () => void;\n onReport: () => void;\n onFaveSticker: () => void;\n onUnfaveSticker: () => void;\n onSelect: () => void;\n onSend: () => void;\n onReschedule: () => void;\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n onCopyLink?: () => void;\n onCopyMessages?: (messageIds: number[]) => void;\n onDownload?: () => void;\n onSaveGif?: () => void;\n onShowSeenBy?: () => void;\n onShowReactors?: () => void;\n onSendReaction: (reaction: string | undefined, x: number, y: number) => void;\n};\n\nconst SCROLLBAR_WIDTH = 10;\nconst REACTION_BUBBLE_EXTRA_WIDTH = 32;\nconst ANIMATION_DURATION = 200;\n\nconst MessageContextMenu: FC<OwnProps> = ({\n availableReactions,\n isOpen,\n message,\n isPrivate,\n enabledReactions,\n anchor,\n canSendNow,\n canReschedule,\n canReply,\n canEdit,\n canPin,\n canUnpin,\n canDelete,\n canReport,\n canForward,\n canFaveSticker,\n canUnfaveSticker,\n canCopy,\n canCopyLink,\n canSelect,\n canDownload,\n canSaveGif,\n isDownloading,\n canShowSeenBy,\n canShowReactionsCount,\n canRemoveReaction,\n canShowReactionList,\n seenByRecentUsers,\n onReply,\n onEdit,\n onPin,\n onUnpin,\n onForward,\n onDelete,\n onReport,\n onFaveSticker,\n onUnfaveSticker,\n onSelect,\n onSend,\n onReschedule,\n onClose,\n onCloseAnimationEnd,\n onCopyLink,\n onDownload,\n onSaveGif,\n onShowSeenBy,\n onShowReactors,\n onSendReaction,\n onCopyMessages,\n}) => {\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 copyOptions = getMessageCopyOptions(message, onClose, canCopyLink ? onCopyLink : undefined, onCopyMessages);\n const noReactions = !isPrivate && !enabledReactions?.length;\n const withReactions = canShowReactionList && !noReactions;\n\n const [isReady, markIsReady, unmarkIsReady] = useFlag();\n\n const getTriggerElement = useCallback(() => {\n return document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id=\"${message.id}\"]`);\n }, [message.id]);\n\n const getRootElement = useCallback(\n () => document.querySelector('.Transition__slide--active > .MessageList'),\n [],\n );\n\n const getMenuElement = useCallback(\n () => document.querySelector('.MessageContextMenu .bubble'),\n [],\n );\n\n const getLayout = useCallback(() => {\n const extraHeightAudioPlayer = (IS_SINGLE_COLUMN_LAYOUT\n && (document.querySelector<HTMLElement>('.AudioPlayer-content'))?.offsetHeight) || 0;\n const pinnedElement = document.querySelector<HTMLElement>('.HeaderPinnedMessage-wrapper');\n const extraHeightPinned = (((IS_SINGLE_COLUMN_LAYOUT && !extraHeightAudioPlayer)\n || (!IS_SINGLE_COLUMN_LAYOUT && pinnedElement?.classList.contains('full-width')))\n && pinnedElement?.offsetHeight) || 0;\n\n return {\n extraPaddingX: SCROLLBAR_WIDTH,\n extraTopPadding: (document.querySelector<HTMLElement>('.MiddleHeader')!).offsetHeight,\n marginSides: withReactions ? REACTION_BUBBLE_EXTRA_WIDTH : undefined,\n extraMarginTop: extraHeightPinned + extraHeightAudioPlayer,\n };\n }, [withReactions]);\n\n const handleRemoveReaction = useCallback(() => {\n onSendReaction(undefined, 0, 0);\n }, [onSendReaction]);\n\n useEffect(() => {\n if (!isOpen) {\n unmarkIsReady();\n return;\n }\n\n setTimeout(() => {\n markIsReady();\n }, ANIMATION_DURATION);\n }, [isOpen, markIsReady, unmarkIsReady]);\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style, menuStyle, withScroll,\n } = useContextMenuPosition(anchor, getTriggerElement, getRootElement, getMenuElement, getLayout);\n\n useEffect(() => {\n disableScrolling(withScroll ? scrollableRef.current : undefined, '.ReactionSelector');\n\n return enableScrolling;\n }, [withScroll]);\n\n const lang = useLang();\n\n return (\n <Menu\n ref={menuRef}\n isOpen={isOpen}\n transformOriginX={transformOriginX}\n transformOriginY={transformOriginY}\n positionX={positionX}\n positionY={positionY}\n style={style}\n bubbleStyle={menuStyle}\n className={buildClassName(\n 'MessageContextMenu', 'fluid', withReactions && 'with-reactions',\n )}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n >\n {canShowReactionList && (\n <ReactionSelector\n enabledReactions={enabledReactions}\n onSendReaction={onSendReaction}\n isPrivate={isPrivate}\n availableReactions={availableReactions}\n isReady={isReady}\n />\n )}\n\n <div\n className=\"scrollable-content custom-scroll\"\n style={menuStyle}\n ref={scrollableRef}\n >\n {canRemoveReaction && <MenuItem icon=\"reactions\" onClick={handleRemoveReaction}>Remove Reaction</MenuItem>}\n {canSendNow && <MenuItem icon=\"send-outline\" onClick={onSend}>{lang('MessageScheduleSend')}</MenuItem>}\n {canReschedule && (\n <MenuItem icon=\"schedule\" onClick={onReschedule}>{lang('MessageScheduleEditTime')}</MenuItem>\n )}\n {canReply && <MenuItem icon=\"reply\" onClick={onReply}>{lang('Reply')}</MenuItem>}\n {canEdit && <MenuItem icon=\"edit\" onClick={onEdit}>{lang('Edit')}</MenuItem>}\n {canFaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onFaveSticker}>{lang('AddToFavorites')}</MenuItem>\n )}\n {canUnfaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onUnfaveSticker}>{lang('Stickers.RemoveFromFavorites')}</MenuItem>\n )}\n {canCopy && copyOptions.map((option) => (\n <MenuItem key={option.label} icon={option.icon} onClick={option.handler}>{lang(option.label)}</MenuItem>\n ))}\n {canPin && <MenuItem icon=\"pin\" onClick={onPin}>{lang('DialogPin')}</MenuItem>}\n {canUnpin && <MenuItem icon=\"unpin\" onClick={onUnpin}>{lang('DialogUnpin')}</MenuItem>}\n {canSaveGif && <MenuItem icon=\"gifs\" onClick={onSaveGif}>{lang('lng_context_save_gif')}</MenuItem>}\n {canDownload && (\n <MenuItem icon=\"download\" onClick={onDownload}>\n {isDownloading ? lang('lng_context_cancel_download') : lang('lng_media_download')}\n </MenuItem>\n )}\n {canForward && <MenuItem icon=\"forward\" onClick={onForward}>{lang('Forward')}</MenuItem>}\n {canSelect && <MenuItem icon=\"select\" onClick={onSelect}>{lang('Common.Select')}</MenuItem>}\n {canReport && <MenuItem icon=\"flag\" onClick={onReport}>{lang('lng_context_report_msg')}</MenuItem>}\n {(canShowSeenBy || canShowReactionsCount) && (\n <MenuItem\n className=\"MessageContextMenu--seen-by\"\n icon={canShowReactionsCount ? 'reactions' : 'group'}\n onClick={canShowReactionsCount ? onShowReactors : onShowSeenBy}\n disabled={!canShowReactionsCount && !message.seenByUserIds?.length}\n >\n <span className=\"MessageContextMenu--seen-by-label\">\n {canShowReactionsCount && message.reactors?.count ? (\n canShowSeenBy && message.seenByUserIds?.length\n ? lang(\n 'Chat.OutgoingContextMixedReactionCount',\n [message.reactors.count, message.seenByUserIds.length],\n )\n : lang('Chat.ContextReactionCount', message.reactors.count, 'i')\n ) : (\n message.seenByUserIds?.length === 1 && seenByRecentUsers\n ? getUserFullName(seenByRecentUsers[0])\n : (message.seenByUserIds?.length\n ? lang('Conversation.ContextMenuSeen', message.seenByUserIds.length, 'i')\n : lang('Conversation.ContextMenuNoViews')\n )\n )}\n </span>\n <div className=\"avatars\">\n {seenByRecentUsers?.map((user) => (\n <Avatar\n size=\"micro\"\n user={user}\n />\n ))}\n </div>\n </MenuItem>\n )}\n {canDelete && <MenuItem destructive icon=\"delete\" onClick={onDelete}>{lang('Delete')}</MenuItem>}\n </div>\n </Menu>\n );\n};\n\nexport default memo(MessageContextMenu);\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport { MessageListType } from '../../../global/types';\nimport { ApiAvailableReaction, ApiMessage } from '../../../api/types';\nimport { IAlbum, IAnchorPosition } from '../../../types';\nimport {\n selectActiveDownloadIds,\n selectAllowedMessageActions,\n selectChat,\n selectCurrentMessageList,\n selectIsMessageProtected,\n} from '../../../global/selectors';\nimport {\n isActionMessage, isChatChannel,\n isChatGroup, isOwnMessage, areReactionsEmpty, isUserId, isMessageLocal, getMessageVideo,\n} from '../../../global/helpers';\nimport { SERVICE_NOTIFICATIONS_USER_ID } from '../../../config';\nimport { getDayStartAt } from '../../../util/dateFormat';\nimport { copyTextToClipboard } from '../../../util/clipboard';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useFlag from '../../../hooks/useFlag';\nimport { REM } from '../../common/helpers/mediaDimensions';\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 buildClassName from '../../../util/buildClassName';\n\nconst START_SIZE = 2 * REM;\n\nexport type OwnProps = {\n isOpen: boolean;\n chatUsername?: string;\n message: ApiMessage;\n album?: IAlbum;\n anchor: IAnchorPosition;\n messageListType: MessageListType;\n onClose: () => void;\n onCloseAnimationEnd: () => void;\n};\n\ntype StateProps = {\n availableReactions?: ApiAvailableReaction[];\n noOptions?: boolean;\n canSendNow?: boolean;\n canReschedule?: boolean;\n canReply?: boolean;\n canPin?: boolean;\n canShowReactionsCount?: boolean;\n canShowReactionList?: boolean;\n canRemoveReaction?: boolean;\n canUnpin?: boolean;\n canDelete?: boolean;\n canReport?: boolean;\n canEdit?: boolean;\n canForward?: boolean;\n canFaveSticker?: boolean;\n canUnfaveSticker?: boolean;\n canCopy?: boolean;\n isPrivate?: boolean;\n hasFullInfo?: boolean;\n canCopyLink?: boolean;\n canSelect?: boolean;\n canDownload?: boolean;\n canSaveGif?: boolean;\n activeDownloads: number[];\n canShowSeenBy?: boolean;\n enabledReactions?: string[];\n};\n\nconst ContextMenuContainer: FC<OwnProps & StateProps> = ({\n availableReactions,\n isOpen,\n messageListType,\n chatUsername,\n message,\n album,\n anchor,\n onClose,\n onCloseAnimationEnd,\n noOptions,\n canSendNow,\n hasFullInfo,\n canReschedule,\n canReply,\n canPin,\n canUnpin,\n canDelete,\n canReport,\n canShowReactionsCount,\n canShowReactionList,\n canRemoveReaction,\n canEdit,\n enabledReactions,\n isPrivate,\n canForward,\n canFaveSticker,\n canUnfaveSticker,\n canCopy,\n canCopyLink,\n canSelect,\n canDownload,\n canSaveGif,\n activeDownloads,\n canShowSeenBy,\n}) => {\n const {\n setReplyingToId,\n setEditingId,\n pinMessage,\n openForwardMenu,\n faveSticker,\n unfaveSticker,\n toggleMessageSelection,\n sendScheduledMessages,\n rescheduleMessage,\n downloadMessageMedia,\n cancelMessageMediaDownload,\n loadSeenBy,\n openSeenByModal,\n sendReaction,\n openReactorListModal,\n loadFullChat,\n loadReactors,\n copyMessagesByIds,\n saveGif,\n } = getActions();\n\n const { transitionClassNames } = useShowTransition(isOpen, onCloseAnimationEnd, undefined, false);\n const [isMenuOpen, setIsMenuOpen] = useState(true);\n const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);\n const [isReportModalOpen, setIsReportModalOpen] = useState(false);\n const [isPinModalOpen, setIsPinModalOpen] = useState(false);\n const [isCalendarOpen, openCalendar, closeCalendar] = useFlag();\n\n useEffect(() => {\n if (canShowSeenBy && isOpen) {\n loadSeenBy({ chatId: message.chatId, messageId: message.id });\n }\n }, [loadSeenBy, isOpen, message.chatId, message.id, canShowSeenBy]);\n\n useEffect(() => {\n if (canShowReactionsCount && isOpen) {\n loadReactors({ chatId: message.chatId, messageId: message.id });\n }\n }, [canShowReactionsCount, isOpen, loadReactors, message.chatId, message.id]);\n\n useEffect(() => {\n if (!hasFullInfo && !isPrivate && isOpen) {\n loadFullChat({ chatId: message.chatId });\n }\n }, [hasFullInfo, isOpen, isPrivate, loadFullChat, message.chatId]);\n\n const seenByRecentUsers = useMemo(() => {\n if (message.reactions?.recentReactions?.length) {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n return message.reactions?.recentReactions?.slice(0, 3).map(({ userId }) => usersById[userId]).filter(Boolean);\n }\n\n if (!message.seenByUserIds) {\n return undefined;\n }\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n return message.seenByUserIds?.slice(0, 3).map((id) => usersById[id]).filter(Boolean);\n }, [message.reactions?.recentReactions, message.seenByUserIds]);\n\n const isDownloading = album ? album.messages.some((msg) => activeDownloads.includes(msg.id))\n : activeDownloads.includes(message.id);\n\n const handleDelete = useCallback(() => {\n setIsMenuOpen(false);\n setIsDeleteModalOpen(true);\n }, []);\n\n const handleReport = useCallback(() => {\n setIsMenuOpen(false);\n setIsReportModalOpen(true);\n }, []);\n\n const closeMenu = useCallback(() => {\n setIsMenuOpen(false);\n onClose();\n }, [onClose]);\n\n const closeDeleteModal = useCallback(() => {\n setIsDeleteModalOpen(false);\n onClose();\n }, [onClose]);\n\n const closeReportModal = useCallback(() => {\n setIsReportModalOpen(false);\n onClose();\n }, [onClose]);\n\n const closePinModal = useCallback(() => {\n setIsPinModalOpen(false);\n onClose();\n }, [onClose]);\n\n const handleCloseCalendar = useCallback(() => {\n closeCalendar();\n onClose();\n }, [closeCalendar, onClose]);\n\n const handleReply = useCallback(() => {\n setReplyingToId({ messageId: message.id });\n closeMenu();\n }, [setReplyingToId, message.id, closeMenu]);\n\n const handleEdit = useCallback(() => {\n setEditingId({ messageId: message.id });\n closeMenu();\n }, [setEditingId, message.id, closeMenu]);\n\n const handlePin = useCallback(() => {\n setIsMenuOpen(false);\n setIsPinModalOpen(true);\n }, []);\n\n const handleUnpin = useCallback(() => {\n pinMessage({ messageId: message.id, isUnpin: true });\n closeMenu();\n }, [pinMessage, message.id, closeMenu]);\n\n const handleForward = useCallback(() => {\n closeMenu();\n if (album?.messages) {\n const messageIds = album.messages.map(({ id }) => id);\n openForwardMenu({ fromChatId: message.chatId, messageIds });\n } else {\n openForwardMenu({ fromChatId: message.chatId, messageIds: [message.id] });\n }\n }, [openForwardMenu, message, closeMenu, album]);\n\n const handleFaveSticker = useCallback(() => {\n closeMenu();\n faveSticker({ sticker: message.content.sticker });\n }, [closeMenu, message.content.sticker, faveSticker]);\n\n const handleUnfaveSticker = useCallback(() => {\n closeMenu();\n unfaveSticker({ sticker: message.content.sticker });\n }, [closeMenu, message.content.sticker, unfaveSticker]);\n\n const handleSelectMessage = useCallback(() => {\n const params = album?.messages\n ? {\n messageId: message.id,\n childMessageIds: album.messages.map(({ id }) => id),\n withShift: false,\n }\n : { messageId: message.id, withShift: false };\n\n toggleMessageSelection(params);\n closeMenu();\n }, [closeMenu, message.id, toggleMessageSelection, album]);\n\n const handleScheduledMessageSend = useCallback(() => {\n sendScheduledMessages({ chatId: message.chatId, id: message.id });\n closeMenu();\n }, [closeMenu, message.chatId, message.id, sendScheduledMessages]);\n\n const handleOpenCalendar = useCallback(() => {\n setIsMenuOpen(false);\n openCalendar();\n }, [openCalendar]);\n\n const handleOpenSeenByModal = useCallback(() => {\n closeMenu();\n openSeenByModal({ chatId: message.chatId, messageId: message.id });\n }, [closeMenu, message.chatId, message.id, openSeenByModal]);\n\n const handleOpenReactorListModal = useCallback(() => {\n closeMenu();\n openReactorListModal({ chatId: message.chatId, messageId: message.id });\n }, [closeMenu, openReactorListModal, message.chatId, message.id]);\n\n const handleRescheduleMessage = useCallback((date: Date) => {\n rescheduleMessage({\n chatId: message.chatId,\n messageId: message.id,\n scheduledAt: Math.round(date.getTime() / 1000),\n });\n }, [message.chatId, message.id, rescheduleMessage]);\n\n const handleCopyMessages = useCallback((messageIds: number[]) => {\n copyMessagesByIds({ messageIds });\n closeMenu();\n }, [closeMenu, copyMessagesByIds]);\n\n const handleCopyLink = useCallback(() => {\n copyTextToClipboard(`https://t.me/${chatUsername || `c/${message.chatId.replace('-', '')}`}/${message.id}`);\n closeMenu();\n }, [chatUsername, closeMenu, message.chatId, message.id]);\n\n const handleDownloadClick = useCallback(() => {\n (album?.messages || [message]).forEach((msg) => {\n if (isDownloading) {\n cancelMessageMediaDownload({ message: msg });\n } else {\n downloadMessageMedia({ message: msg });\n }\n });\n closeMenu();\n }, [album, message, closeMenu, isDownloading, cancelMessageMediaDownload, downloadMessageMedia]);\n\n const handleSaveGif = useCallback(() => {\n const video = getMessageVideo(message);\n saveGif({ gif: video });\n closeMenu();\n }, [closeMenu, message, saveGif]);\n\n const handleSendReaction = useCallback((reaction: string | undefined, x: number, y: number) => {\n sendReaction({\n chatId: message.chatId, messageId: message.id, reaction, x, y, startSize: START_SIZE,\n });\n closeMenu();\n }, [closeMenu, message.chatId, message.id, sendReaction]);\n\n const reportMessageIds = useMemo(() => (album ? album.messages : [message]).map(({ id }) => id), [album, message]);\n\n if (noOptions) {\n closeMenu();\n\n return undefined;\n }\n\n const scheduledMaxDate = new Date();\n scheduledMaxDate.setFullYear(scheduledMaxDate.getFullYear() + 1);\n\n return (\n <div className={buildClassName('ContextMenuContainer', transitionClassNames)}>\n <MessageContextMenu\n availableReactions={availableReactions}\n message={message}\n isPrivate={isPrivate}\n isOpen={isMenuOpen}\n enabledReactions={enabledReactions}\n anchor={anchor}\n canShowReactionsCount={canShowReactionsCount}\n canShowReactionList={canShowReactionList}\n canRemoveReaction={canRemoveReaction}\n canSendNow={canSendNow}\n canReschedule={canReschedule}\n canReply={canReply}\n canDelete={canDelete}\n canReport={canReport}\n canPin={canPin}\n canUnpin={canUnpin}\n canEdit={canEdit}\n canForward={canForward}\n canFaveSticker={canFaveSticker}\n canUnfaveSticker={canUnfaveSticker}\n canCopy={canCopy}\n canCopyLink={canCopyLink}\n canSelect={canSelect}\n canDownload={canDownload}\n canSaveGif={canSaveGif}\n canShowSeenBy={canShowSeenBy}\n isDownloading={isDownloading}\n seenByRecentUsers={seenByRecentUsers}\n onReply={handleReply}\n onEdit={handleEdit}\n onPin={handlePin}\n onUnpin={handleUnpin}\n onForward={handleForward}\n onDelete={handleDelete}\n onReport={handleReport}\n onFaveSticker={handleFaveSticker}\n onUnfaveSticker={handleUnfaveSticker}\n onSelect={handleSelectMessage}\n onSend={handleScheduledMessageSend}\n onReschedule={handleOpenCalendar}\n onClose={closeMenu}\n onCopyLink={handleCopyLink}\n onCopyMessages={handleCopyMessages}\n onDownload={handleDownloadClick}\n onSaveGif={handleSaveGif}\n onShowSeenBy={handleOpenSeenByModal}\n onSendReaction={handleSendReaction}\n onShowReactors={handleOpenReactorListModal}\n />\n <DeleteMessageModal\n isOpen={isDeleteModalOpen}\n isSchedule={messageListType === 'scheduled'}\n onClose={closeDeleteModal}\n album={album}\n message={message}\n />\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n messageIds={reportMessageIds}\n />\n <PinMessageModal\n isOpen={isPinModalOpen}\n messageId={message.id}\n chatId={message.chatId}\n onClose={closePinModal}\n />\n {canReschedule && (\n <CalendarModal\n isOpen={isCalendarOpen}\n withTimePicker\n selectedAt={message.date * 1000}\n maxAt={getDayStartAt(scheduledMaxDate)}\n isFutureMode\n onClose={handleCloseCalendar}\n onSubmit={handleRescheduleMessage}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { message, messageListType }): StateProps => {\n const { threadId } = selectCurrentMessageList(global) || {};\n const activeDownloads = selectActiveDownloadIds(global, message.chatId);\n const chat = selectChat(global, message.chatId);\n const { seenByExpiresAt, seenByMaxChatMembers } = global.appConfig || {};\n const {\n noOptions,\n canReply,\n canPin,\n canUnpin,\n canDelete,\n canReport,\n canEdit,\n canForward,\n canFaveSticker,\n canUnfaveSticker,\n canCopy,\n canCopyLink,\n canSelect,\n canDownload,\n canSaveGif,\n } = (threadId && selectAllowedMessageActions(global, message, threadId)) || {};\n const isPinned = messageListType === 'pinned';\n const isScheduled = messageListType === 'scheduled';\n const isChannel = chat && isChatChannel(chat);\n const isLocal = isMessageLocal(message);\n const canShowSeenBy = Boolean(chat\n && seenByMaxChatMembers\n && seenByExpiresAt\n && isChatGroup(chat)\n && isOwnMessage(message)\n && !isScheduled\n && chat.membersCount\n && chat.membersCount <= seenByMaxChatMembers\n && message.date > Date.now() / 1000 - seenByExpiresAt);\n const isPrivate = chat && isUserId(chat.id);\n const isAction = isActionMessage(message);\n const canShowReactionsCount = !isLocal && !isChannel && !isScheduled && !isAction && !isPrivate && message.reactions\n && !areReactionsEmpty(message.reactions) && message.reactions.canSeeList;\n const canRemoveReaction = isPrivate && message.reactions?.results?.some((l) => l.isChosen);\n const isProtected = selectIsMessageProtected(global, message);\n\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: !isProtected && canCopy,\n canCopyLink: !isProtected && !isScheduled && canCopyLink,\n canSelect,\n canDownload: !isProtected && canDownload,\n canSaveGif: !isProtected && canSaveGif,\n activeDownloads,\n canShowSeenBy,\n enabledReactions: chat?.isForbidden ? undefined : chat?.fullInfo?.enabledReactions,\n isPrivate,\n hasFullInfo: Boolean(chat?.fullInfo),\n canShowReactionsCount,\n canShowReactionList: !isLocal && !isAction && !isScheduled && chat?.id !== SERVICE_NOTIFICATIONS_USER_ID,\n canRemoveReaction,\n };\n },\n)(ContextMenuContainer));\n","import React, {\n FC, memo, useCallback, useEffect, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiSticker, ApiStickerSet } from '../../api/types';\n\nimport { STICKER_SIZE_MODAL } from '../../config';\nimport {\n selectCanScheduleUntilOnline,\n selectChat,\n selectCurrentMessageList,\n selectIsChatWithSelf,\n selectShouldSchedule,\n selectStickerSet,\n selectStickerSetByShortName,\n} from '../../global/selectors';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport renderText from './helpers/renderText';\nimport { getAllowedAttachmentOptions, getCanPostInChat } from '../../global/helpers';\nimport useSchedule from '../../hooks/useSchedule';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport Loading from '../ui/Loading';\nimport StickerButton from './StickerButton';\n\nimport './StickerSetModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n fromSticker?: ApiSticker;\n stickerSetShortName?: string;\n onClose: () => void;\n};\n\ntype StateProps = {\n canSendStickers?: boolean;\n stickerSet?: ApiStickerSet;\n canScheduleUntilOnline?: boolean;\n shouldSchedule?: boolean;\n isSavedMessages?: boolean;\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst StickerSetModal: FC<OwnProps & StateProps> = ({\n isOpen,\n fromSticker,\n stickerSetShortName,\n stickerSet,\n canSendStickers,\n canScheduleUntilOnline,\n shouldSchedule,\n isSavedMessages,\n onClose,\n}) => {\n const {\n loadStickers,\n toggleStickerSet,\n sendMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const lang = useLang();\n\n const [requestCalendar, calendar] = useSchedule(canScheduleUntilOnline);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE, isDisabled: !isOpen });\n\n useEffect(() => {\n if (isOpen) {\n if (fromSticker) {\n const { stickerSetId, stickerSetAccessHash } = fromSticker;\n loadStickers({\n stickerSetId,\n stickerSetAccessHash,\n });\n } else if (stickerSetShortName) {\n loadStickers({\n stickerSetShortName,\n });\n }\n }\n }, [isOpen, fromSticker, loadStickers, stickerSetShortName]);\n\n const handleSelect = useCallback((sticker: ApiSticker, isSilent?: boolean, isScheduleRequested?: boolean) => {\n sticker = {\n ...sticker,\n isPreloadedGlobally: true,\n };\n\n if (shouldSchedule || isScheduleRequested) {\n requestCalendar((scheduledAt) => {\n sendMessage({ sticker, isSilent, scheduledAt });\n onClose();\n });\n } else {\n sendMessage({ sticker, isSilent });\n onClose();\n }\n }, [onClose, requestCalendar, sendMessage, shouldSchedule]);\n\n const handleButtonClick = useCallback(() => {\n if (stickerSet) {\n toggleStickerSet({ stickerSetId: stickerSet.id });\n onClose();\n }\n }, [onClose, stickerSet, toggleStickerSet]);\n\n return (\n <Modal\n className=\"StickerSetModal\"\n isOpen={isOpen}\n onClose={onClose}\n hasCloseButton\n title={stickerSet ? renderText(stickerSet.title, ['emoji', 'links']) : lang('AccDescrStickerSet')}\n >\n {stickerSet?.stickers ? (\n <>\n <div ref={containerRef} className=\"stickers custom-scroll\">\n {stickerSet.stickers.map((sticker) => (\n <StickerButton\n sticker={sticker}\n size={STICKER_SIZE_MODAL}\n observeIntersection={observeIntersection}\n onClick={canSendStickers ? handleSelect : undefined}\n clickArg={sticker}\n isSavedMessages={isSavedMessages}\n />\n ))}\n </div>\n <div className=\"button-wrapper\">\n <Button\n size=\"smaller\"\n fluid\n color={stickerSet.installedDate ? 'danger' : 'primary'}\n onClick={handleButtonClick}\n >\n {lang(\n stickerSet.installedDate ? 'StickerPack.RemoveStickerCount' : 'StickerPack.AddStickerCount',\n stickerSet.count,\n 'i',\n )}\n </Button>\n </div>\n </>\n ) : (\n <Loading />\n )}\n {calendar}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { fromSticker, stickerSetShortName }): StateProps => {\n const currentMessageList = selectCurrentMessageList(global);\n const { chatId, threadId } = currentMessageList || {};\n const chat = chatId && selectChat(global, chatId);\n const sendOptions = chat ? getAllowedAttachmentOptions(chat) : undefined;\n const canSendStickers = Boolean(\n chat && threadId && getCanPostInChat(chat, threadId) && sendOptions?.canSendStickers,\n );\n const isSavedMessages = Boolean(chatId) && selectIsChatWithSelf(global, chatId);\n\n return {\n canScheduleUntilOnline: Boolean(chatId) && selectCanScheduleUntilOnline(global, chatId),\n canSendStickers,\n isSavedMessages,\n shouldSchedule: selectShouldSchedule(global),\n stickerSet: fromSticker\n ? selectStickerSet(global, fromSticker.stickerSetId)\n : stickerSetShortName\n ? selectStickerSetByShortName(global, stickerSetShortName)\n : undefined,\n };\n },\n)(StickerSetModal));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiBotCommand, ApiChat } from '../../api/types';\nimport { IAnchorPosition } from '../../types';\n\nimport { REPLIES_USER_ID } from '../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { disableScrolling, enableScrolling } from '../../util/scrollLock';\nimport {\n selectChat, selectNotifySettings, selectNotifyExceptions, selectUser, selectChatBot,\n} from '../../global/selectors';\nimport {\n isUserId, getCanDeleteChat, selectIsChatMuted, getCanAddContact, isChatChannel, isChatGroup,\n} from '../../global/helpers';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useLang from '../../hooks/useLang';\n\nimport Portal from '../ui/Portal';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\nimport DeleteChatModal from '../common/DeleteChatModal';\nimport ReportModal from '../common/ReportModal';\n\nimport './HeaderMenuContainer.scss';\n\nconst BOT_BUTTONS: Record<string, { icon: string; label: string }> = {\n settings: {\n icon: 'bots',\n label: 'BotSettings',\n },\n privacy: {\n icon: 'info',\n label: 'Privacy',\n },\n help: {\n icon: 'help',\n label: 'BotHelp',\n },\n};\n\nexport type OwnProps = {\n chatId: string;\n threadId: number;\n isOpen: boolean;\n withExtraActions: boolean;\n anchor: IAnchorPosition;\n isChannel?: boolean;\n canStartBot?: boolean;\n canRestartBot?: boolean;\n canSubscribe?: boolean;\n canSearch?: boolean;\n canCall?: boolean;\n canMute?: boolean;\n canViewStatistics?: boolean;\n canLeave?: boolean;\n canEnterVoiceChat?: boolean;\n canCreateVoiceChat?: boolean;\n onSubscribeChannel: () => void;\n onSearchClick: () => void;\n onClose: () => void;\n onCloseAnimationEnd: () => void;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n botCommands?: ApiBotCommand[];\n isPrivate?: boolean;\n isMuted?: boolean;\n canAddContact?: boolean;\n canReportChat?: boolean;\n canDeleteChat?: boolean;\n hasLinkedChat?: boolean;\n};\n\nconst HeaderMenuContainer: FC<OwnProps & StateProps> = ({\n chatId,\n isOpen,\n withExtraActions,\n anchor,\n isChannel,\n botCommands,\n canStartBot,\n canRestartBot,\n canSubscribe,\n canSearch,\n canCall,\n canMute,\n canViewStatistics,\n canLeave,\n canEnterVoiceChat,\n canCreateVoiceChat,\n chat,\n isPrivate,\n isMuted,\n canReportChat,\n canDeleteChat,\n hasLinkedChat,\n canAddContact,\n onSubscribeChannel,\n onSearchClick,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const {\n updateChatMutedState,\n enterMessageSelectMode,\n sendBotCommand,\n restartBot,\n joinGroupCall,\n createGroupCall,\n openLinkedChat,\n openAddContactDialog,\n requestCall,\n toggleStatistics,\n } = getActions();\n const [isMenuOpen, setIsMenuOpen] = useState(true);\n const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);\n const [isReportModalOpen, setIsReportModalOpen] = useState(false);\n const { x, y } = anchor;\n\n useShowTransition(isOpen, onCloseAnimationEnd, undefined, false);\n\n const handleReport = useCallback(() => {\n setIsMenuOpen(false);\n setIsReportModalOpen(true);\n }, []);\n\n const closeReportModal = useCallback(() => {\n setIsReportModalOpen(false);\n onClose();\n }, [onClose]);\n\n const handleDelete = useCallback(() => {\n setIsMenuOpen(false);\n setIsDeleteModalOpen(true);\n }, []);\n\n const closeMenu = useCallback(() => {\n setIsMenuOpen(false);\n onClose();\n }, [onClose]);\n\n const closeDeleteModal = useCallback(() => {\n setIsDeleteModalOpen(false);\n onClose();\n }, [onClose]);\n\n const handleStartBot = useCallback(() => {\n sendBotCommand({ command: '/start' });\n }, [sendBotCommand]);\n\n const handleRestartBot = useCallback(() => {\n restartBot({ chatId });\n }, [chatId, restartBot]);\n\n const handleToggleMuteClick = useCallback(() => {\n updateChatMutedState({ chatId, isMuted: !isMuted });\n closeMenu();\n }, [chatId, closeMenu, isMuted, updateChatMutedState]);\n\n const handleEnterVoiceChatClick = useCallback(() => {\n if (canCreateVoiceChat) {\n // TODO show popup to schedule\n createGroupCall({\n chatId,\n });\n } else {\n joinGroupCall({\n chatId,\n });\n }\n closeMenu();\n }, [closeMenu, canCreateVoiceChat, chatId, joinGroupCall, createGroupCall]);\n\n const handleLinkedChatClick = useCallback(() => {\n openLinkedChat({ id: chatId });\n closeMenu();\n }, [chatId, closeMenu, openLinkedChat]);\n\n const handleAddContactClick = useCallback(() => {\n openAddContactDialog({ userId: chatId });\n closeMenu();\n }, [openAddContactDialog, chatId, closeMenu]);\n\n const handleSubscribe = useCallback(() => {\n onSubscribeChannel();\n closeMenu();\n }, [closeMenu, onSubscribeChannel]);\n\n const handleVideoCall = useCallback(() => {\n requestCall({ userId: chatId, isVideo: true });\n closeMenu();\n }, [chatId, closeMenu, requestCall]);\n\n const handleCall = useCallback(() => {\n requestCall({ userId: chatId });\n closeMenu();\n }, [chatId, closeMenu, requestCall]);\n\n const handleSearch = useCallback(() => {\n onSearchClick();\n closeMenu();\n }, [closeMenu, onSearchClick]);\n\n const handleStatisticsClick = useCallback(() => {\n toggleStatistics();\n closeMenu();\n }, [closeMenu, toggleStatistics]);\n\n const handleSelectMessages = useCallback(() => {\n enterMessageSelectMode();\n closeMenu();\n }, [closeMenu, enterMessageSelectMode]);\n\n useEffect(() => {\n disableScrolling();\n\n return enableScrolling;\n }, []);\n\n const lang = useLang();\n\n const botButtons = useMemo(() => {\n return botCommands?.map(({ command }) => {\n const cmd = BOT_BUTTONS[command];\n if (!cmd) return undefined;\n const handleClick = () => {\n sendBotCommand({ command: `/${command}` });\n closeMenu();\n };\n\n return (\n <MenuItem\n key={command}\n icon={cmd.icon}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={handleClick}\n >\n {lang(cmd.label)}\n </MenuItem>\n );\n });\n }, [botCommands, closeMenu, lang, sendBotCommand]);\n\n return (\n <Portal>\n <div className=\"HeaderMenuContainer\">\n <Menu\n isOpen={isMenuOpen}\n positionX=\"right\"\n style={`left: ${x}px;top: ${y}px;`}\n onClose={closeMenu}\n >\n {withExtraActions && canStartBot && (\n <MenuItem\n icon=\"bots\"\n onClick={handleStartBot}\n >\n {lang('BotStart')}\n </MenuItem>\n )}\n {withExtraActions && canRestartBot && (\n <MenuItem\n icon=\"bots\"\n onClick={handleRestartBot}\n >\n {lang('BotRestart')}\n </MenuItem>\n )}\n {withExtraActions && canSubscribe && (\n <MenuItem\n icon={isChannel ? 'channel' : 'group'}\n onClick={handleSubscribe}\n >\n {lang(isChannel ? 'ProfileJoinChannel' : 'ProfileJoinGroup')}\n </MenuItem>\n )}\n {canAddContact && (\n <MenuItem\n icon=\"add-user\"\n onClick={handleAddContactClick}\n >\n {lang('AddContact')}\n </MenuItem>\n )}\n {IS_SINGLE_COLUMN_LAYOUT && canCall && (\n <MenuItem\n icon=\"phone\"\n onClick={handleCall}\n >\n {lang('Call')}\n </MenuItem>\n )}\n {canCall && (\n <MenuItem\n icon=\"video-outlined\"\n onClick={handleVideoCall}\n >\n {lang('VideoCall')}\n </MenuItem>\n )}\n {IS_SINGLE_COLUMN_LAYOUT && canSearch && (\n <MenuItem\n icon=\"search\"\n onClick={handleSearch}\n >\n {lang('Search')}\n </MenuItem>\n )}\n {canMute && (\n <MenuItem\n icon={isMuted ? 'unmute' : 'mute'}\n onClick={handleToggleMuteClick}\n >\n {lang(isMuted ? 'ChatsUnmute' : 'ChatsMute')}\n </MenuItem>\n )}\n {(canEnterVoiceChat || canCreateVoiceChat) && (\n <MenuItem\n icon=\"voice-chat\"\n onClick={handleEnterVoiceChatClick}\n >\n {lang(canCreateVoiceChat ? 'StartVoipChat' : 'VoipGroupJoinCall')}\n </MenuItem>\n )}\n {hasLinkedChat && (\n <MenuItem\n icon={isChannel ? 'comments' : 'channel'}\n onClick={handleLinkedChatClick}\n >\n {lang(isChannel ? 'ViewDiscussion' : 'lng_profile_view_channel')}\n </MenuItem>\n )}\n <MenuItem\n icon=\"select\"\n onClick={handleSelectMessages}\n >\n {lang('ReportSelectMessages')}\n </MenuItem>\n {canViewStatistics && (\n <MenuItem\n icon=\"stats\"\n onClick={handleStatisticsClick}\n >\n {lang('Statistics')}\n </MenuItem>\n )}\n {canReportChat && (\n <MenuItem\n icon=\"flag\"\n onClick={handleReport}\n >\n {lang('ReportPeer.Report')}\n </MenuItem>\n )}\n {botButtons}\n {canLeave && (\n <MenuItem\n destructive\n icon=\"delete\"\n onClick={handleDelete}\n >\n {lang(isPrivate\n ? 'DeleteChatUser'\n : (canDeleteChat ? 'GroupInfo.DeleteAndExit' : (isChannel ? 'LeaveChannel' : 'Group.LeaveGroup')))}\n </MenuItem>\n )}\n </Menu>\n {chat && (\n <DeleteChatModal\n isOpen={isDeleteModalOpen}\n onClose={closeDeleteModal}\n chat={chat}\n />\n )}\n {canReportChat && chat?.id && (\n <ReportModal\n isOpen={isReportModalOpen}\n onClose={closeReportModal}\n subject=\"peer\"\n chatId={chat.id}\n />\n )}\n </div>\n </Portal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n if (!chat || chat.isRestricted) {\n return {};\n }\n const isPrivate = isUserId(chat.id);\n const user = isPrivate ? selectUser(global, chatId) : undefined;\n const canAddContact = user && getCanAddContact(user);\n const canReportChat = isChatChannel(chat) || isChatGroup(chat) || (user && !user.isSelf);\n\n const chatBot = chatId !== REPLIES_USER_ID ? selectChatBot(global, chatId) : undefined;\n\n return {\n chat,\n isMuted: selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)),\n isPrivate,\n canAddContact,\n canReportChat,\n canDeleteChat: getCanDeleteChat(chat),\n hasLinkedChat: Boolean(chat?.fullInfo?.linkedChatId),\n botCommands: chatBot?.fullInfo?.botInfo?.commands,\n };\n },\n)(HeaderMenuContainer));\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState, useLayoutEffect,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { 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 React, {\n FC, useCallback, useEffect, useRef, memo,\n} from '../../../lib/teact/teact';\nimport { getGlobal } from '../../../global';\n\nimport { 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 FC, memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiAttachment, ApiChatMember } from '../../../api/types';\n\nimport {\n CONTENT_TYPES_WITH_PREVIEW,\n EDITABLE_INPUT_MODAL_ID,\n SUPPORTED_AUDIO_CONTENT_TYPES,\n SUPPORTED_IMAGE_CONTENT_TYPES,\n SUPPORTED_VIDEO_CONTENT_TYPES,\n} from '../../../config';\nimport { getFileExtension } from '../../common/helpers/documentInfo';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\n\nimport usePrevious from '../../../hooks/usePrevious';\nimport useMentionTooltip from './hooks/useMentionTooltip';\nimport useEmojiTooltip from './hooks/useEmojiTooltip';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';\nimport { useStateRef } from '../../../hooks/useStateRef';\n\nimport Button from '../../ui/Button';\nimport Modal from '../../ui/Modal';\nimport File from '../../common/File';\nimport MessageInput from './MessageInput';\nimport MentionTooltip from './MentionTooltip';\nimport EmojiTooltip from './EmojiTooltip.async';\nimport CustomSendMenu from './CustomSendMenu.async';\n\nimport './AttachmentModal.scss';\n\nexport type OwnProps = {\n chatId: string;\n threadId: number;\n attachments: ApiAttachment[];\n caption: string;\n canShowCustomSendMenu?: boolean;\n isReady?: boolean;\n isChatWithSelf?: boolean;\n currentUserId?: string;\n groupChatMembers?: ApiChatMember[];\n recentEmojis: string[];\n baseEmojiKeywords?: Record<string, string[]>;\n emojiKeywords?: Record<string, string[]>;\n shouldSchedule?: boolean;\n addRecentEmoji: AnyToVoidFunction;\n onCaptionUpdate: (html: string) => void;\n onSend: () => void;\n onFileAppend: (files: File[], isQuick: boolean) => void;\n onClear: () => void;\n onSendSilent: () => void;\n onSendScheduled: () => void;\n};\n\nconst DROP_LEAVE_TIMEOUT_MS = 150;\n\nconst AttachmentModal: FC<OwnProps> = ({\n chatId,\n threadId,\n attachments,\n caption,\n canShowCustomSendMenu,\n isReady,\n isChatWithSelf,\n currentUserId,\n groupChatMembers,\n recentEmojis,\n baseEmojiKeywords,\n emojiKeywords,\n shouldSchedule,\n addRecentEmoji,\n onCaptionUpdate,\n onSend,\n onFileAppend,\n onClear,\n onSendSilent,\n onSendScheduled,\n}) => {\n const captionRef = useStateRef(caption);\n // eslint-disable-next-line no-null/no-null\n const mainButtonRef = useStateRef<HTMLButtonElement | null>(null);\n const hideTimeoutRef = useRef<number>();\n const prevAttachments = usePrevious(attachments);\n const renderingAttachments = attachments.length ? attachments : prevAttachments;\n const isOpen = Boolean(attachments.length);\n const [isHovered, markHovered, unmarkHovered] = useFlag();\n const isQuick = Boolean(renderingAttachments && renderingAttachments.every((a) => a.quick));\n const lang = useLang();\n\n const {\n isMentionTooltipOpen, closeMentionTooltip, insertMention, mentionFilteredUsers,\n } = useMentionTooltip(\n isOpen,\n captionRef,\n onCaptionUpdate,\n EDITABLE_INPUT_MODAL_ID,\n groupChatMembers,\n undefined,\n currentUserId,\n );\n const {\n isEmojiTooltipOpen, closeEmojiTooltip, filteredEmojis, insertEmoji,\n } = useEmojiTooltip(\n isOpen,\n captionRef,\n recentEmojis,\n EDITABLE_INPUT_MODAL_ID,\n onCaptionUpdate,\n baseEmojiKeywords,\n emojiKeywords,\n !isReady,\n );\n\n useEffect(() => (isOpen ? captureEscKeyListener(onClear) : undefined), [isOpen, onClear]);\n\n const {\n isContextMenuOpen: isCustomSendMenuOpen,\n handleContextMenu,\n handleContextMenuClose,\n handleContextMenuHide,\n } = useContextMenuHandlers(mainButtonRef, !canShowCustomSendMenu || !isOpen);\n\n const sendAttachments = useCallback(() => {\n if (isOpen) {\n if (shouldSchedule) {\n onSendScheduled();\n } else {\n onSend();\n }\n }\n }, [isOpen, onSendScheduled, onSend, shouldSchedule]);\n\n const handleDragLeave = (e: React.DragEvent<HTMLElement>) => {\n const { relatedTarget: toTarget, target: fromTarget } = e;\n\n // Esc button pressed during drag event\n if ((fromTarget as HTMLDivElement).matches('.drop-target') && !toTarget) {\n hideTimeoutRef.current = window.setTimeout(unmarkHovered, DROP_LEAVE_TIMEOUT_MS);\n }\n\n // Prevent DragLeave event from firing when the pointer moves inside the AttachmentModal drop target\n if (fromTarget && (fromTarget as HTMLElement).closest('.AttachmentModal.hovered')) {\n return;\n }\n\n if (toTarget) {\n e.stopPropagation();\n }\n\n unmarkHovered();\n };\n\n const handleFilesDrop = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n unmarkHovered();\n\n const { dataTransfer: { files } } = e;\n\n if (files?.length) {\n const newFiles = isQuick\n ? Array.from(files).filter((file) => {\n return file.type && CONTENT_TYPES_WITH_PREVIEW.has(file.type);\n })\n : Array.from(files);\n\n onFileAppend(newFiles, isQuick);\n }\n }, [isQuick, onFileAppend, unmarkHovered]);\n\n function handleDragOver(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n e.preventDefault();\n e.stopPropagation();\n\n if (hideTimeoutRef.current) {\n window.clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = undefined;\n }\n }\n\n if (!renderingAttachments) {\n return undefined;\n }\n\n const areAllPhotos = renderingAttachments.every((a) => SUPPORTED_IMAGE_CONTENT_TYPES.has(a.mimeType));\n const areAllVideos = renderingAttachments.every((a) => SUPPORTED_VIDEO_CONTENT_TYPES.has(a.mimeType));\n const areAllAudios = renderingAttachments.every((a) => SUPPORTED_AUDIO_CONTENT_TYPES.has(a.mimeType));\n\n let title = '';\n if (areAllPhotos) {\n title = lang('PreviewSender.SendPhoto', renderingAttachments.length, 'i');\n } else if (areAllVideos) {\n title = lang('PreviewSender.SendVideo', renderingAttachments.length, 'i');\n } else if (areAllAudios) {\n title = lang('PreviewSender.SendAudio', renderingAttachments.length, 'i');\n } else {\n title = lang('PreviewSender.SendFile', renderingAttachments.length, 'i');\n }\n\n function renderHeader() {\n if (!renderingAttachments) {\n return undefined;\n }\n\n return (\n <div className=\"modal-header-condensed\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel=\"Cancel attachments\" onClick={onClear}>\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{title}</div>\n <div className=\"AttachmentModal--send-wrapper\">\n <Button\n ref={mainButtonRef}\n color=\"primary\"\n size=\"smaller\"\n className=\"modal-action-button\"\n onClick={sendAttachments}\n onContextMenu={canShowCustomSendMenu ? handleContextMenu : undefined}\n >\n {lang('Send')}\n </Button>\n {canShowCustomSendMenu && (\n <CustomSendMenu\n isOpen={isCustomSendMenuOpen}\n isOpenToBottom\n onSendSilent={!isChatWithSelf ? onSendSilent : undefined}\n onSendSchedule={onSendScheduled}\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n isSavedMessages={isChatWithSelf}\n />\n )}\n </div>\n </div>\n );\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClear}\n header={renderHeader()}\n className={`AttachmentModal ${isHovered ? 'hovered' : ''}`}\n >\n <div\n className=\"drop-target\"\n onDragEnter={markHovered}\n onDrop={handleFilesDrop}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n data-attach-description={lang('Preview.Dragging.AddItems', 10)}\n >\n {isQuick ? (\n <div className=\"media-wrapper custom-scroll\">\n {renderingAttachments.map((attachment) => (\n attachment.mimeType.startsWith('image/')\n ? <img src={attachment.blobUrl} alt=\"\" />\n : <video src={attachment.blobUrl} autoPlay muted loop />\n ))}\n </div>\n ) : (\n <div className=\"document-wrapper custom-scroll\">\n {renderingAttachments.map((attachment) => (\n <File\n name={attachment.filename}\n extension={getFileExtension(attachment.filename, attachment.mimeType)}\n previewData={attachment.previewBlobUrl}\n size={attachment.size}\n smaller\n />\n ))}\n </div>\n )}\n\n <div className=\"attachment-caption-wrapper\">\n <MentionTooltip\n isOpen={isMentionTooltipOpen}\n onClose={closeMentionTooltip}\n onInsertUserName={insertMention}\n filteredUsers={mentionFilteredUsers}\n />\n <EmojiTooltip\n isOpen={isEmojiTooltipOpen}\n emojis={filteredEmojis}\n onClose={closeEmojiTooltip}\n onEmojiSelect={insertEmoji}\n addRecentEmoji={addRecentEmoji}\n />\n <MessageInput\n id=\"caption-input-text\"\n chatId={chatId}\n threadId={threadId}\n isAttachmentModalInput\n html={caption}\n editableInputId={EDITABLE_INPUT_MODAL_ID}\n placeholder={lang('Caption')}\n onUpdate={onCaptionUpdate}\n onSend={sendAttachments}\n canAutoFocus={Boolean(isReady && attachments.length)}\n />\n </div>\n </div>\n </Modal>\n );\n};\n\nexport default memo(AttachmentModal);\n","import { ChangeEvent, RefObject } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useLayoutEffect, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport { ApiNewPoll } from '../../../api/types';\n\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport parseMessageInput from '../../../util/parseMessageInput';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport Modal from '../../ui/Modal';\nimport InputText from '../../ui/InputText';\nimport Checkbox from '../../ui/Checkbox';\nimport RadioGroup from '../../ui/RadioGroup';\n\nimport './PollModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n shouldBeAnonimous?: boolean;\n isQuiz?: boolean;\n onSend: (pollSummary: ApiNewPoll) => void;\n onClear: () => void;\n};\n\nconst MAX_LIST_HEIGHT = 320;\nconst MAX_OPTIONS_COUNT = 10;\nconst MAX_OPTION_LENGTH = 100;\nconst MAX_QUESTION_LENGTH = 255;\nconst MAX_SOLUTION_LENGTH = 200;\n\nconst PollModal: FC<OwnProps> = ({\n isOpen, isQuiz, shouldBeAnonimous, onSend, onClear,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const questionInputRef = useRef<HTMLInputElement>(null);\n // eslint-disable-next-line no-null/no-null\n const optionsListRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const solutionRef = useRef<HTMLDivElement>(null);\n\n const [question, setQuestion] = useState<string>('');\n const [options, setOptions] = useState<string[]>(['']);\n const [isAnonymous, setIsAnonymous] = useState(true);\n const [isMultipleAnswers, setIsMultipleAnswers] = useState(false);\n const [isQuizMode, setIsQuizMode] = useState(isQuiz || false);\n const [solution, setSolution] = useState<string>('');\n const [correctOption, setCorrectOption] = useState<string>();\n const [hasErrors, setHasErrors] = useState<boolean>(false);\n\n const lang = useLang();\n\n const focusInput = useCallback((ref: RefObject<HTMLInputElement>) => {\n if (isOpen && ref.current) {\n ref.current.focus();\n }\n }, [isOpen]);\n\n useEffect(() => (isOpen ? captureEscKeyListener(onClear) : undefined), [isOpen, onClear]);\n useEffect(() => {\n if (!isOpen) {\n setQuestion('');\n setOptions(['']);\n setIsAnonymous(true);\n setIsMultipleAnswers(false);\n setIsQuizMode(isQuiz || false);\n setSolution('');\n setCorrectOption('');\n setHasErrors(false);\n }\n }, [isQuiz, isOpen]);\n\n useEffect(() => focusInput(questionInputRef), [focusInput, isOpen]);\n\n useLayoutEffect(() => {\n const solutionEl = solutionRef.current;\n\n if (solutionEl && solution !== solutionEl.innerHTML) {\n solutionEl.innerHTML = solution;\n }\n }, [solution]);\n\n const addNewOption = useCallback((newOptions: string[] = []) => {\n setOptions([...newOptions, '']);\n requestAnimationFrame(() => {\n const list = optionsListRef.current;\n if (!list) {\n return;\n }\n\n list.classList.toggle('overflown', list.scrollHeight > MAX_LIST_HEIGHT);\n list.scrollTo({ top: list.scrollHeight, behavior: 'smooth' });\n });\n }, []);\n\n const handleCreate = useCallback(() => {\n setHasErrors(false);\n if (!isOpen) {\n return;\n }\n\n const questionTrimmed = question.trim().substring(0, MAX_QUESTION_LENGTH);\n const optionsTrimmed = options.map((o) => o.trim().substring(0, MAX_OPTION_LENGTH)).filter((o) => o.length);\n\n if (!questionTrimmed || optionsTrimmed.length < 2) {\n setQuestion(questionTrimmed);\n if (optionsTrimmed.length) {\n if (optionsTrimmed.length < 2) {\n addNewOption(optionsTrimmed);\n } else {\n setOptions(optionsTrimmed);\n }\n } else {\n addNewOption();\n }\n setHasErrors(true);\n return;\n }\n\n if (isQuizMode && (!correctOption || !optionsTrimmed[Number(correctOption)])) {\n setHasErrors(true);\n return;\n }\n\n const answers = optionsTrimmed\n .map((text, index) => ({\n text: text.trim(),\n option: String(index),\n ...(String(index) === correctOption && { correct: true }),\n }));\n\n const payload: ApiNewPoll = {\n summary: {\n question: questionTrimmed,\n answers,\n ...(!isAnonymous && { isPublic: true }),\n ...(isMultipleAnswers && { multipleChoice: true }),\n ...(isQuizMode && { quiz: true }),\n },\n };\n\n if (isQuizMode) {\n const { text, entities } = (solution && parseMessageInput(solution.substring(0, MAX_SOLUTION_LENGTH))) || {};\n\n payload.quiz = {\n correctAnswers: [correctOption],\n ...(text && { solution: text }),\n ...(entities && { solutionEntities: entities }),\n };\n }\n\n onSend(payload);\n }, [\n isOpen,\n question,\n options,\n isQuizMode,\n correctOption,\n isAnonymous,\n isMultipleAnswers,\n onSend,\n addNewOption,\n solution,\n ]);\n\n const updateOption = useCallback((index: number, text: string) => {\n const newOptions = [...options];\n newOptions[index] = text;\n if (newOptions[newOptions.length - 1].trim().length && newOptions.length < MAX_OPTIONS_COUNT) {\n addNewOption(newOptions);\n } else {\n setOptions(newOptions);\n }\n }, [options, addNewOption]);\n\n const removeOption = useCallback((index: number) => {\n const newOptions = [...options];\n newOptions.splice(index, 1);\n setOptions(newOptions);\n requestAnimationFrame(() => {\n if (!optionsListRef.current) {\n return;\n }\n\n optionsListRef.current.classList.toggle('overflown', optionsListRef.current.scrollHeight > MAX_LIST_HEIGHT);\n });\n }, [options]);\n\n const handleCorrectOptionChange = useCallback((newValue: string) => {\n setCorrectOption(newValue);\n }, [setCorrectOption]);\n\n const handleIsAnonymousChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsAnonymous(e.target.checked);\n }, []);\n\n const handleMultipleAnswersChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsMultipleAnswers(e.target.checked);\n }, []);\n\n const handleQuizModeChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsQuizMode(e.target.checked);\n }, []);\n\n const handleKeyPress = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.keyCode === 13) {\n handleCreate();\n }\n }, [handleCreate]);\n\n const handleQuestionChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setQuestion(e.target.value);\n }, []);\n\n const getQuestionError = useCallback(() => {\n if (hasErrors && !question.trim().length) {\n return lang('lng_polls_choose_question');\n }\n\n return undefined;\n }, [hasErrors, lang, question]);\n\n const getOptionsError = useCallback((index: number) => {\n const optionsTrimmed = options.map((o) => o.trim()).filter((o) => o.length);\n if (hasErrors && optionsTrimmed.length < 2 && !options[index].trim().length) {\n return lang('lng_polls_choose_answers');\n }\n return undefined;\n }, [hasErrors, lang, options]);\n\n function renderHeader() {\n return (\n <div className=\"modal-header-condensed\">\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel=\"Cancel poll creation\" onClick={onClear}>\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{lang('NewPoll')}</div>\n <Button\n color=\"primary\"\n size=\"smaller\"\n className=\"modal-action-button\"\n onClick={handleCreate}\n >\n {lang('Create')}\n </Button>\n </div>\n );\n }\n\n function renderOptions() {\n return options.map((option, index) => (\n <div className=\"option-wrapper\">\n <InputText\n label={index !== options.length - 1 || options.length === MAX_OPTIONS_COUNT\n ? lang('OptionHint')\n : lang('CreatePoll.AddOption')}\n error={getOptionsError(index)}\n value={option}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={(e) => updateOption(index, e.currentTarget.value)}\n onKeyPress={handleKeyPress}\n />\n {index !== options.length - 1 && (\n <Button\n className=\"option-remove-button\"\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Delete')}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => removeOption(index)}\n >\n <i className=\"icon-close\" />\n </Button>\n )}\n </div>\n ));\n }\n\n function renderRadioOptions() {\n return renderOptions()\n .map((label, index) => ({ value: String(index), label, hidden: index === options.length - 1 }));\n }\n\n function renderQuizNoOptionError() {\n const optionsTrimmed = options.map((o) => o.trim()).filter((o) => o.length);\n\n return isQuizMode && (!correctOption || !optionsTrimmed[Number(correctOption)]) && (\n <p className=\"error\">{lang('lng_polls_choose_correct')}</p>\n );\n }\n\n return (\n <Modal isOpen={isOpen} onClose={onClear} header={renderHeader()} className=\"PollModal\">\n <InputText\n ref={questionInputRef}\n label={lang('AskAQuestion')}\n value={question}\n error={getQuestionError()}\n onChange={handleQuestionChange}\n onKeyPress={handleKeyPress}\n />\n <div className=\"options-divider\" />\n\n <div className=\"options-list custom-scroll\" ref={optionsListRef}>\n <h3 className=\"options-header\">{lang('PollOptions')}</h3>\n\n {hasErrors && renderQuizNoOptionError()}\n {isQuizMode ? (\n <RadioGroup\n name=\"correctOption\"\n options={renderRadioOptions()}\n onChange={handleCorrectOptionChange}\n />\n ) : (\n renderOptions()\n )}\n\n </div>\n\n <div className=\"options-divider\" />\n\n <div className=\"quiz-mode\">\n {!shouldBeAnonimous && (\n <Checkbox\n label={lang('PollAnonymous')}\n checked={isAnonymous}\n onChange={handleIsAnonymousChange}\n />\n )}\n <Checkbox\n label={lang('PollMultiple')}\n checked={isMultipleAnswers}\n disabled={isQuizMode}\n onChange={handleMultipleAnswersChange}\n />\n <Checkbox\n label={lang('PollQuiz')}\n checked={isQuizMode}\n disabled={isMultipleAnswers || isQuiz !== undefined}\n onChange={handleQuizModeChange}\n />\n {isQuizMode && (\n <>\n <h3 className=\"options-header\">{lang('lng_polls_solution_title')}</h3>\n <div\n ref={solutionRef}\n className=\"form-control\"\n contentEditable\n dir=\"auto\"\n onChange={(e) => setSolution(e.currentTarget.innerHTML)}\n />\n <div className=\"note\">{lang('CreatePoll.ExplanationInfo')}</div>\n </>\n )}\n </div>\n </Modal>\n );\n};\n\nexport default memo(PollModal);\n","import React, {\n FC, memo, useCallback,\n} 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 React, { FC, memo, useRef } from '../../../lib/teact/teact';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport buildClassName from '../../../util/buildClassName';\nimport windowSize from '../../../util/windowSize';\nimport { ObserveFn, useOnIntersect } from '../../../hooks/useIntersectionObserver';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport useLang from '../../../hooks/useLang';\n\nimport EmojiButton from './EmojiButton';\n\nconst EMOJIS_PER_ROW_ON_DESKTOP = 9;\nconst EMOJI_MARGIN = 4;\nconst MOBILE_CONTAINER_PADDING = 8;\nconst EMOJI_SIZE = 40;\n\ntype OwnProps = {\n category: EmojiCategory;\n index: number;\n allEmojis: AllEmojis;\n observeIntersection: ObserveFn;\n shouldRender: boolean;\n onEmojiSelect: (emoji: string, name: string) => void;\n};\n\nconst EmojiCategory: FC<OwnProps> = ({\n category, index, allEmojis, observeIntersection, shouldRender, onEmojiSelect,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n useOnIntersect(ref, observeIntersection);\n\n const transitionClassNames = useMediaTransition(shouldRender);\n\n const lang = useLang();\n\n const emojisPerRow = IS_SINGLE_COLUMN_LAYOUT\n ? Math.floor((windowSize.get().width - MOBILE_CONTAINER_PADDING) / (EMOJI_SIZE + EMOJI_MARGIN))\n : EMOJIS_PER_ROW_ON_DESKTOP;\n const height = Math.ceil(category.emojis.length / emojisPerRow) * (EMOJI_SIZE + EMOJI_MARGIN);\n\n return (\n <div\n ref={ref}\n key={category.id}\n id={`emoji-category-${index}`}\n className=\"symbol-set\"\n >\n <p className=\"symbol-set-name\" dir=\"auto\">\n {lang(category.id === 'recent' ? 'RecentStickers' : `Emoji${index}`)}\n </p>\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 React, {\n FC, useState, useEffect, memo, useRef, useMemo, useCallback,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport { GlobalState } from '../../../global/types';\n\nimport { MENU_TRANSITION_DURATION } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport {\n EmojiModule,\n EmojiRawData,\n EmojiData,\n uncompressEmoji,\n} from '../../../util/emoji';\nimport fastSmoothScroll from '../../../util/fastSmoothScroll';\nimport buildClassName from '../../../util/buildClassName';\nimport { pick } from '../../../util/iteratees';\nimport fastSmoothScrollHorizontal from '../../../util/fastSmoothScrollHorizontal';\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport Loading from '../../ui/Loading';\nimport EmojiCategory from './EmojiCategory';\n\nimport './EmojiPicker.scss';\n\ntype OwnProps = {\n className?: string;\n onEmojiSelect: (emoji: string, name: string) => void;\n};\n\ntype StateProps = Pick<GlobalState, 'recentEmojis'>;\ntype EmojiCategoryData = { id: string; name: string; emojis: string[] };\n\nconst ICONS_BY_CATEGORY: Record<string, string> = {\n recent: 'icon-recent',\n people: 'icon-smile',\n nature: 'icon-animals',\n foods: 'icon-eats',\n activity: 'icon-sport',\n places: 'icon-car',\n objects: 'icon-lamp',\n symbols: 'icon-language',\n flags: 'icon-flag',\n};\n\nconst OPEN_ANIMATION_DELAY = 200;\n// Only a few categories are above this height.\nconst SMOOTH_SCROLL_DISTANCE = 800;\nconst FOCUS_MARGIN = 50;\nconst HEADER_BUTTON_WIDTH = 42; // px. Includes margins\nconst INTERSECTION_THROTTLE = 200;\n\nconst categoryIntersections: boolean[] = [];\n\nlet emojiDataPromise: Promise<EmojiModule>;\nlet emojiRawData: EmojiRawData;\nlet emojiData: EmojiData;\n\nconst EmojiPicker: FC<OwnProps & StateProps> = ({\n className, onEmojiSelect, recentEmojis,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const headerRef = useRef<HTMLDivElement>(null);\n\n const [categories, setCategories] = useState<EmojiCategoryData[]>();\n const [emojis, setEmojis] = useState<AllEmojis>();\n const [activeCategoryIndex, setActiveCategoryIndex] = useState(0);\n\n const { observe: observeIntersection } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n }, (entries) => {\n entries.forEach((entry) => {\n const { id } = entry.target as HTMLDivElement;\n if (!id || !id.startsWith('emoji-category-')) {\n return;\n }\n\n const index = Number(id.replace('emoji-category-', ''));\n categoryIntersections[index] = entry.isIntersecting;\n });\n\n const intersectingWithIndexes = categoryIntersections\n .map((isIntersecting, index) => ({ index, isIntersecting }))\n .filter(({ isIntersecting }) => isIntersecting);\n\n if (!intersectingWithIndexes.length) {\n return;\n }\n\n setActiveCategoryIndex(intersectingWithIndexes[Math.floor(intersectingWithIndexes.length / 2)].index);\n });\n\n useHorizontalScroll(headerRef.current, !IS_SINGLE_COLUMN_LAYOUT);\n\n // Scroll header when active set updates\n useEffect(() => {\n if (!categories) {\n return;\n }\n\n const header = headerRef.current;\n if (!header) {\n return;\n }\n\n const newLeft = activeCategoryIndex * HEADER_BUTTON_WIDTH - header.offsetWidth / 2 + HEADER_BUTTON_WIDTH / 2;\n\n fastSmoothScrollHorizontal(header, newLeft);\n }, [categories, activeCategoryIndex]);\n\n const lang = useLang();\n\n const allCategories = useMemo(() => {\n if (!categories) {\n return MEMO_EMPTY_ARRAY;\n }\n const themeCategories = [...categories];\n if (recentEmojis?.length) {\n themeCategories.unshift({\n id: 'recent',\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 FC, memo, useMemo, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiSticker } from '../../../api/types';\nimport { StickerSetOrRecent } from '../../../types';\nimport { ObserveFn, useOnIntersect } from '../../../hooks/useIntersectionObserver';\n\nimport { STICKER_SIZE_PICKER } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport windowSize from '../../../util/windowSize';\nimport buildClassName from '../../../util/buildClassName';\n\nimport useMediaTransition from '../../../hooks/useMediaTransition';\n\nimport StickerButton from '../../common/StickerButton';\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};\n\nconst STICKERS_PER_ROW_ON_DESKTOP = 5;\nconst STICKER_MARGIN = IS_SINGLE_COLUMN_LAYOUT ? 8 : 16;\nconst MOBILE_CONTAINER_PADDING = 8;\n\nconst StickerSet: FC<OwnProps> = ({\n stickerSet,\n loadAndPlay,\n index,\n shouldRender,\n favoriteStickers,\n isSavedMessages,\n observeIntersection,\n onStickerSelect,\n onStickerUnfave,\n onStickerFave,\n}) => {\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 stickersPerRow = IS_SINGLE_COLUMN_LAYOUT\n ? Math.floor((windowSize.get().width - MOBILE_CONTAINER_PADDING) / (STICKER_SIZE_PICKER + STICKER_MARGIN))\n : STICKERS_PER_ROW_ON_DESKTOP;\n const height = Math.ceil(stickerSet.count / stickersPerRow) * (STICKER_SIZE_PICKER + STICKER_MARGIN);\n\n const favoriteStickerIdsSet = useMemo(() => (\n favoriteStickers ? new Set(favoriteStickers.map(({ id }) => id)) : undefined\n ), [favoriteStickers]);\n\n return (\n <div\n ref={ref}\n key={stickerSet.id}\n id={`sticker-set-${index}`}\n className=\"symbol-set\"\n >\n <p className=\"symbol-set-name\">{stickerSet.title}</p>\n <div\n className={buildClassName('symbol-set-container', transitionClassNames)}\n style={`height: ${height}px;`}\n >\n {shouldRender && stickerSet.stickers && stickerSet.stickers.map((sticker) => (\n <StickerButton\n key={sticker.id}\n sticker={sticker}\n size={STICKER_SIZE_PICKER}\n observeIntersection={observeIntersection}\n noAnimate={!loadAndPlay}\n onClick={onStickerSelect}\n clickArg={sticker}\n onUnfaveClick={favoriteStickerIdsSet?.has(sticker.id) ? onStickerUnfave : undefined}\n onFaveClick={!favoriteStickerIdsSet?.has(sticker.id) ? onStickerFave : undefined}\n isSavedMessages={isSavedMessages}\n />\n ))}\n </div>\n </div>\n );\n};\n\nexport default memo(StickerSet);\n","import React, {\n FC, useState, useEffect, memo, useRef, useMemo, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiStickerSet, ApiSticker } from '../../../api/types';\nimport { StickerSetOrRecent } from '../../../types';\n\nimport { SLIDE_TRANSITION_DURATION, STICKER_SIZE_PICKER_HEADER } 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 { selectIsChatWithSelf } from '../../../global/selectors';\n\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useHorizontalScroll from '../../../hooks/useHorizontalScroll';\nimport useLang from '../../../hooks/useLang';\nimport useSendMessageAction from '../../../hooks/useSendMessageAction';\n\nimport Loading from '../../ui/Loading';\nimport Button from '../../ui/Button';\nimport StickerButton from '../../common/StickerButton';\nimport StickerSet from './StickerSet';\nimport StickerSetCover from './StickerSetCover';\nimport StickerSetCoverAnimated from './StickerSetCoverAnimated';\n\nimport './StickerPicker.scss';\n\ntype OwnProps = {\n chatId: string;\n threadId?: number;\n className: string;\n loadAndPlay: boolean;\n canSendStickers: boolean;\n onStickerSelect: (sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\ntype StateProps = {\n recentStickers: ApiSticker[];\n favoriteStickers: ApiSticker[];\n stickerSetsById: Record<string, ApiStickerSet>;\n addedSetIds?: string[];\n shouldPlay?: boolean;\n isSavedMessages?: boolean;\n};\n\nconst SMOOTH_SCROLL_DISTANCE = 500;\nconst HEADER_BUTTON_WIDTH = 52; // px (including margin)\nconst STICKER_INTERSECTION_THROTTLE = 200;\n\nconst stickerSetIntersections: boolean[] = [];\n\nconst StickerPicker: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n className,\n loadAndPlay,\n canSendStickers,\n recentStickers,\n favoriteStickers,\n addedSetIds,\n stickerSetsById,\n shouldPlay,\n isSavedMessages,\n onStickerSelect,\n}) => {\n const {\n loadRecentStickers,\n addRecentSticker,\n unfaveSticker,\n faveSticker,\n } = 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 const sendMessageAction = useSendMessageAction(chatId, 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 return [\n {\n id: 'recent',\n title: lang('RecentStickers'),\n stickers: recentStickers,\n count: recentStickers.length,\n },\n {\n id: 'favorite',\n title: lang('FavoriteStickers'),\n stickers: favoriteStickers,\n count: favoriteStickers.length,\n },\n ...addedSetIds.map((id) => stickerSetsById[id]).filter(Boolean),\n ];\n }, [addedSetIds, lang, recentStickers, favoriteStickers, stickerSetsById]);\n\n const noPopulatedSets = useMemo(() => (\n areAddedLoaded\n && allSets.filter((set) => set.stickers?.length).length === 0\n ), [allSets, areAddedLoaded]);\n\n useEffect(() => {\n if (loadAndPlay) {\n loadRecentStickers();\n sendMessageAction({ type: 'chooseSticker' });\n }\n }, [loadAndPlay, loadRecentStickers, sendMessageAction]);\n\n useHorizontalScroll(headerRef.current);\n\n // Scroll container and header when active set changes\n useEffect(() => {\n if (!areAddedLoaded) {\n return;\n }\n\n const header = headerRef.current;\n if (!header) {\n return;\n }\n\n const newLeft = activeSetIndex * HEADER_BUTTON_WIDTH - (header.offsetWidth / 2 - HEADER_BUTTON_WIDTH / 2);\n\n fastSmoothScrollHorizontal(header, newLeft);\n }, [areAddedLoaded, activeSetIndex]);\n\n const selectStickerSet = useCallback((index: number) => {\n setActiveSetIndex(index);\n const stickerSetEl = document.getElementById(`sticker-set-${index}`)!;\n fastSmoothScroll(containerRef.current!, stickerSetEl, 'start', undefined, SMOOTH_SCROLL_DISTANCE);\n }, []);\n\n const handleStickerSelect = useCallback((sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => {\n onStickerSelect(sticker, isSilent, shouldSchedule);\n addRecentSticker({ sticker });\n }, [addRecentSticker, onStickerSelect]);\n\n const handleStickerUnfave = useCallback((sticker: ApiSticker) => {\n unfaveSticker({ sticker });\n }, [unfaveSticker]);\n\n const handleStickerFave = useCallback((sticker: ApiSticker) => {\n faveSticker({ sticker });\n }, [faveSticker]);\n\n const handleMouseMove = useCallback(() => {\n sendMessageAction({ type: 'chooseSticker' });\n }, [sendMessageAction]);\n\n const 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' || stickerSet.id === 'favorite' || stickerSet.hasThumbnail || !firstSticker) {\n return (\n <Button\n key={stickerSet.id}\n className={buttonClassName}\n ariaLabel={stickerSet.title}\n round\n faded={stickerSet.id === 'recent' || stickerSet.id === 'favorite'}\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => selectStickerSet(index)}\n >\n {stickerSet.id === 'recent' ? (\n <i className=\"icon-recent\" />\n ) : stickerSet.id === 'favorite' ? (\n <i className=\"icon-favorite\" />\n ) : stickerSet.isLottie ? (\n <StickerSetCoverAnimated\n stickerSet={stickerSet as ApiStickerSet}\n observeIntersection={observeIntersectionForCovers}\n />\n ) : (\n <StickerSetCover\n stickerSet={stickerSet as ApiStickerSet}\n observeIntersection={observeIntersectionForCovers}\n />\n )}\n </Button>\n );\n } else {\n return (\n <StickerButton\n key={stickerSet.id}\n sticker={firstSticker}\n size={STICKER_SIZE_PICKER_HEADER}\n title={stickerSet.title}\n className={buttonClassName}\n observeIntersection={observeIntersectionForCovers}\n onClick={selectStickerSet}\n clickArg={index}\n noContextMenu\n />\n );\n }\n }\n\n const fullClassName = buildClassName('StickerPicker', className);\n\n if (!areAddedLoaded || !canRenderContents || noPopulatedSets || !canSendStickers) {\n return (\n <div className={fullClassName}>\n {!canSendStickers ? (\n <div className=\"picker-disabled\">{lang('ErrorSendRestrictedStickersAll')}</div>\n ) : noPopulatedSets ? (\n <div className=\"picker-disabled\">{lang('NoStickers')}</div>\n ) : (\n <Loading />\n )}\n </div>\n );\n }\n\n return (\n <div className={fullClassName}>\n <div\n ref={headerRef}\n className=\"StickerPicker-header no-selection no-scrollbar\"\n >\n {allSets.map(renderCover)}\n </div>\n <div\n ref={containerRef}\n onMouseMove={handleMouseMove}\n className={buildClassName('StickerPicker-main no-selection', IS_TOUCH_ENV ? 'no-scrollbar' : 'custom-scroll')}\n >\n {allSets.map((stickerSet, i) => (\n <StickerSet\n key={stickerSet.id}\n stickerSet={stickerSet}\n loadAndPlay={Boolean(shouldPlay && loadAndPlay)}\n index={i}\n observeIntersection={observeIntersection}\n shouldRender={activeSetIndex >= i - 1 && activeSetIndex <= i + 1}\n onStickerSelect={handleStickerSelect}\n onStickerUnfave={handleStickerUnfave}\n onStickerFave={handleStickerFave}\n favoriteStickers={favoriteStickers}\n isSavedMessages={isSavedMessages}\n />\n ))}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const {\n setsById,\n added,\n recent,\n favorite,\n } = global.stickers;\n\n const isSavedMessages = selectIsChatWithSelf(global, chatId);\n\n return {\n recentStickers: recent.stickers,\n favoriteStickers: favorite.stickers,\n stickerSetsById: setsById,\n addedSetIds: added.setIds,\n shouldPlay: global.settings.byKey.shouldLoopStickers,\n isSavedMessages,\n };\n },\n)(StickerPicker));\n","import React, {\n FC, memo, useCallback, useEffect, useRef,\n} from '../../lib/teact/teact';\n\nimport { ApiMediaFormat, ApiVideo } from '../../api/types';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport buildClassName from '../../util/buildClassName';\nimport { ObserveFn, useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur';\n\nimport useMedia from '../../hooks/useMedia';\nimport useVideoCleanup from '../../hooks/useVideoCleanup';\nimport useBuffering from '../../hooks/useBuffering';\nimport useCanvasBlur from '../../hooks/useCanvasBlur';\nimport useLang from '../../hooks/useLang';\nimport useContextMenuPosition from '../../hooks/useContextMenuPosition';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\n\nimport Spinner from '../ui/Spinner';\nimport Button from '../ui/Button';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\n\nimport './GifButton.scss';\n\ntype OwnProps = {\n gif: ApiVideo;\n observeIntersection: ObserveFn;\n isDisabled?: boolean;\n className?: string;\n onClick?: (gif: ApiVideo, isSilent?: boolean, shouldSchedule?: boolean) => void;\n onUnsaveClick?: (gif: ApiVideo) => void;\n isSavedMessages?: boolean;\n};\n\nconst GifButton: FC<OwnProps> = ({\n gif,\n isDisabled,\n className,\n observeIntersection,\n onClick,\n onUnsaveClick,\n isSavedMessages,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef<HTMLVideoElement>(null);\n\n const lang = useLang();\n\n const hasThumbnail = Boolean(gif.thumbnail?.dataUri);\n const localMediaHash = `gif${gif.id}`;\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n const loadAndPlay = isIntersecting && !isDisabled;\n const previewBlobUrl = useMedia(`${localMediaHash}?size=m`, !loadAndPlay, ApiMediaFormat.BlobUrl);\n const thumbRef = useCanvasBlur(gif.thumbnail?.dataUri, Boolean(previewBlobUrl));\n const videoData = useMedia(localMediaHash, !loadAndPlay, ApiMediaFormat.BlobUrl);\n const shouldRenderVideo = Boolean(loadAndPlay && videoData);\n const { isBuffered, bufferingHandlers } = useBuffering(true);\n const shouldRenderSpinner = loadAndPlay && !isBuffered;\n const isVideoReady = loadAndPlay && isBuffered;\n\n useVideoCleanup(videoRef, [shouldRenderVideo]);\n\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(ref);\n\n const getTriggerElement = useCallback(() => ref.current, []);\n\n const getRootElement = useCallback(\n () => ref.current!.closest('.custom-scroll, .no-scrollbar'),\n [],\n );\n\n const getMenuElement = useCallback(\n () => ref.current!.querySelector('.gif-context-menu .bubble'),\n [],\n );\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style: menuStyle,\n } = useContextMenuPosition(\n contextMenuPosition,\n getTriggerElement,\n getRootElement,\n getMenuElement,\n );\n\n const handleClick = useCallback(() => {\n if (isContextMenuOpen || !onClick) return;\n onClick({\n ...gif,\n blobUrl: videoData,\n });\n }, [isContextMenuOpen, onClick, gif, videoData]);\n\n const handleUnsaveClick = useCallback((e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n onUnsaveClick!(gif);\n }, [onUnsaveClick, gif]);\n\n const handleContextDelete = useCallback(() => {\n onUnsaveClick?.(gif);\n }, [gif, onUnsaveClick]);\n\n const handleSendQuiet = useCallback(() => {\n onClick!({\n ...gif,\n blobUrl: videoData,\n }, true);\n }, [gif, onClick, videoData]);\n\n const handleSendScheduled = useCallback(() => {\n onClick!({\n ...gif,\n blobUrl: videoData,\n }, undefined, true);\n }, [gif, onClick, videoData]);\n\n const handleMouseDown = useCallback((e: React.MouseEvent<HTMLElement>) => {\n preventMessageInputBlurWithBubbling(e);\n handleBeforeContextMenu(e);\n }, [handleBeforeContextMenu]);\n\n useEffect(() => {\n if (isDisabled) handleContextMenuClose();\n }, [handleContextMenuClose, isDisabled]);\n\n const fullClassName = buildClassName(\n 'GifButton',\n gif.width && gif.height && gif.width < gif.height ? 'vertical' : 'horizontal',\n onClick && 'interactive',\n localMediaHash,\n className,\n );\n\n return (\n <div\n ref={ref}\n className={fullClassName}\n onMouseDown={handleMouseDown}\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n >\n {!IS_TOUCH_ENV && onUnsaveClick && (\n <Button\n className=\"gif-unsave-button\"\n color=\"dark\"\n pill\n onClick={handleUnsaveClick}\n >\n <i className=\"icon-close gif-unsave-button-icon\" />\n </Button>\n )}\n {hasThumbnail && (\n <canvas\n ref={thumbRef}\n className=\"thumbnail\"\n // We need to always render to avoid blur re-calculation\n style={isVideoReady ? 'display: none;' : undefined}\n />\n )}\n {previewBlobUrl && !isVideoReady && (\n <img\n src={previewBlobUrl}\n alt=\"\"\n className=\"preview\"\n />\n )}\n {shouldRenderVideo && (\n <video\n ref={videoRef}\n autoPlay\n loop\n muted\n playsInline\n preload=\"none\"\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...bufferingHandlers}\n >\n <source src={videoData} />\n </video>\n )}\n {shouldRenderSpinner && (\n <Spinner color={previewBlobUrl || hasThumbnail ? 'white' : 'black'} />\n )}\n {onClick && contextMenuPosition !== undefined && (\n <Menu\n isOpen={isContextMenuOpen}\n transformOriginX={transformOriginX}\n transformOriginY={transformOriginY}\n positionX={positionX}\n positionY={positionY}\n style={menuStyle}\n className=\"gif-context-menu\"\n autoClose\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n >\n {!isSavedMessages && <MenuItem onClick={handleSendQuiet} icon=\"mute\">{lang('SendWithoutSound')}</MenuItem>}\n <MenuItem onClick={handleSendScheduled} icon=\"calendar\">\n {lang(isSavedMessages ? 'SetReminder' : 'ScheduleMessage')}\n </MenuItem>\n {onUnsaveClick && (\n <MenuItem destructive icon=\"delete\" onClick={handleContextDelete}>{lang('Delete')}</MenuItem>\n )}\n </Menu>\n )}\n </div>\n );\n};\n\nexport default memo(GifButton);\n","import React, {\n FC, useEffect, memo, useRef, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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 React, { FC, memo, useCallback } from '../../../lib/teact/teact';\n\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\n\ntype OwnProps = {\n activeTab: SymbolMenuTabs;\n onSwitchTab: (tab: SymbolMenuTabs) => void;\n onRemoveSymbol: () => void;\n onSearchOpen: (type: 'stickers' | 'gifs') => void;\n};\n\nexport enum SymbolMenuTabs {\n 'Emoji',\n 'Stickers',\n 'GIFs',\n}\n\n// Getting enum string values for display in Tabs.\n// See: https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings\nexport const SYMBOL_MENU_TAB_TITLES = Object.values(SymbolMenuTabs)\n .filter((value): value is string => typeof value === 'string');\n\nconst SYMBOL_MENU_TAB_ICONS = {\n [SymbolMenuTabs.Emoji]: 'icon-smile',\n [SymbolMenuTabs.Stickers]: 'icon-stickers',\n [SymbolMenuTabs.GIFs]: 'icon-gifs',\n};\n\nconst SymbolMenuFooter: FC<OwnProps> = ({\n activeTab, onSwitchTab, onRemoveSymbol, onSearchOpen,\n}) => {\n const lang = useLang();\n\n function renderTabButton(tab: SymbolMenuTabs) {\n return (\n <Button\n className={`symbol-tab-button ${activeTab === tab ? 'activated' : ''}`}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onSwitchTab(tab)}\n ariaLabel={SYMBOL_MENU_TAB_TITLES[tab]}\n round\n faded\n color=\"translucent\"\n >\n <i className={SYMBOL_MENU_TAB_ICONS[tab]} />\n </Button>\n );\n }\n\n const handleSearchOpen = useCallback(() => {\n onSearchOpen(activeTab === SymbolMenuTabs.Stickers ? 'stickers' : 'gifs');\n }, [activeTab, onSearchOpen]);\n\n function stopPropagation(event: any) {\n event.stopPropagation();\n }\n\n return (\n <div className=\"SymbolMenu-footer\" onClick={stopPropagation} dir={lang.isRtl ? 'rtl' : undefined}>\n {activeTab !== SymbolMenuTabs.Emoji && (\n <Button\n className=\"symbol-search-button\"\n ariaLabel={activeTab === SymbolMenuTabs.Stickers ? 'Search Stickers' : 'Search GIFs'}\n round\n faded\n color=\"translucent\"\n onClick={handleSearchOpen}\n >\n <i className=\"icon-search\" />\n </Button>\n )}\n\n {renderTabButton(SymbolMenuTabs.Emoji)}\n {renderTabButton(SymbolMenuTabs.Stickers)}\n {renderTabButton(SymbolMenuTabs.GIFs)}\n\n {activeTab === SymbolMenuTabs.Emoji && (\n <Button\n className=\"symbol-delete-button\"\n onClick={onRemoveSymbol}\n ariaLabel=\"Remove Symbol\"\n round\n faded\n color=\"translucent\"\n >\n <i className=\"icon-delete-left\" />\n </Button>\n )}\n </div>\n );\n};\n\nexport default memo(SymbolMenuFooter);\n","import React, {\n FC, memo, useCallback, useEffect, useLayoutEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport { ApiSticker, ApiVideo } from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport { fastRaf } from '../../../util/schedulers';\nimport buildClassName from '../../../util/buildClassName';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport Menu from '../../ui/Menu';\nimport Transition from '../../ui/Transition';\nimport EmojiPicker from './EmojiPicker';\nimport StickerPicker from './StickerPicker';\nimport GifPicker from './GifPicker';\nimport SymbolMenuFooter, { SYMBOL_MENU_TAB_TITLES, SymbolMenuTabs } from './SymbolMenuFooter';\nimport Portal from '../../ui/Portal';\n\nimport './SymbolMenu.scss';\n\nconst ANIMATION_DURATION = 350;\n\nexport type OwnProps = {\n chatId: string;\n threadId?: number;\n isOpen: boolean;\n canSendStickers: boolean;\n canSendGifs: boolean;\n onLoad: () => void;\n onClose: () => void;\n onEmojiSelect: (emoji: string) => void;\n onStickerSelect: (\n sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean, shouldPreserveInput?: boolean\n ) => void;\n onGifSelect: (gif: ApiVideo, isSilent?: boolean, shouldSchedule?: boolean) => void;\n onRemoveSymbol: () => void;\n onSearchOpen: (type: 'stickers' | 'gifs') => void;\n addRecentEmoji: AnyToVoidFunction;\n};\n\ntype StateProps = {\n isLeftColumnShown: boolean;\n};\n\nlet isActivated = false;\n\nconst SymbolMenu: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n isOpen,\n canSendStickers,\n canSendGifs,\n isLeftColumnShown,\n onLoad,\n onClose,\n onEmojiSelect,\n onStickerSelect,\n onGifSelect,\n onRemoveSymbol,\n onSearchOpen,\n addRecentEmoji,\n}) => {\n const [activeTab, setActiveTab] = useState<number>(0);\n const [recentEmojis, setRecentEmojis] = useState<string[]>([]);\n\n const [handleMouseEnter, handleMouseLeave] = useMouseInside(isOpen, onClose, undefined, IS_SINGLE_COLUMN_LAYOUT);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, onClose, false, false);\n\n if (!isActivated && isOpen) {\n isActivated = true;\n }\n\n useEffect(() => {\n onLoad();\n }, [onLoad]);\n\n useLayoutEffect(() => {\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n return undefined;\n }\n\n if (isOpen) {\n document.body.classList.add('enable-symbol-menu-transforms');\n document.body.classList.add('is-symbol-menu-open');\n }\n\n return () => {\n if (isOpen) {\n fastRaf(() => {\n document.body.classList.remove('is-symbol-menu-open');\n setTimeout(() => {\n document.body.classList.remove('enable-symbol-menu-transforms');\n }, ANIMATION_DURATION);\n });\n }\n };\n }, [isOpen]);\n\n const recentEmojisRef = useRef(recentEmojis);\n recentEmojisRef.current = recentEmojis;\n useEffect(() => {\n if (!recentEmojisRef.current.length) {\n return;\n }\n\n recentEmojisRef.current.forEach((name) => {\n addRecentEmoji({ emoji: name });\n });\n\n setRecentEmojis([]);\n }, [isOpen, activeTab, addRecentEmoji]);\n\n const handleEmojiSelect = useCallback((emoji: string, name: string) => {\n setRecentEmojis((emojis) => {\n return [...emojis, name];\n });\n\n onEmojiSelect(emoji);\n }, [onEmojiSelect]);\n\n const handleSearch = useCallback((type: 'stickers' | 'gifs') => {\n onClose();\n onSearchOpen(type);\n }, [onClose, onSearchOpen]);\n\n const handleStickerSelect = useCallback((sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => {\n onStickerSelect(sticker, isSilent, shouldSchedule, true);\n }, [onStickerSelect]);\n\n const lang = useLang();\n\n function renderContent(isActive: boolean, isFrom: boolean) {\n switch (activeTab) {\n case SymbolMenuTabs.Emoji:\n return (\n <EmojiPicker\n className=\"picker-tab\"\n onEmojiSelect={handleEmojiSelect}\n />\n );\n case SymbolMenuTabs.Stickers:\n return (\n <StickerPicker\n className=\"picker-tab\"\n loadAndPlay={canSendStickers ? isOpen && (isActive || isFrom) : false}\n canSendStickers={canSendStickers}\n onStickerSelect={handleStickerSelect}\n chatId={chatId}\n threadId={threadId}\n />\n );\n case SymbolMenuTabs.GIFs:\n return (\n <GifPicker\n className=\"picker-tab\"\n loadAndPlay={canSendGifs ? isOpen && (isActive || isFrom) : false}\n canSendGifs={canSendGifs}\n onGifSelect={onGifSelect}\n />\n );\n }\n\n return undefined;\n }\n\n function stopPropagation(event: any) {\n event.stopPropagation();\n }\n\n const content = (\n <>\n <div className=\"SymbolMenu-main\" onClick={stopPropagation}>\n {isActivated && (\n <Transition name=\"slide\" activeKey={activeTab} renderCount={SYMBOL_MENU_TAB_TITLES.length}>\n {renderContent}\n </Transition>\n )}\n </div>\n {IS_SINGLE_COLUMN_LAYOUT && (\n <Button\n round\n faded\n color=\"translucent\"\n ariaLabel={lang('Close')}\n className=\"symbol-close-button\"\n size=\"tiny\"\n onClick={onClose}\n >\n <i className=\"icon-close\" />\n </Button>\n )}\n <SymbolMenuFooter\n activeTab={activeTab}\n onSwitchTab={setActiveTab}\n onRemoveSymbol={onRemoveSymbol}\n onSearchOpen={handleSearch}\n />\n </>\n );\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n if (!shouldRender) {\n return undefined;\n }\n\n const className = buildClassName(\n 'SymbolMenu mobile-menu',\n transitionClassNames,\n isLeftColumnShown && 'left-column-open',\n );\n\n return (\n <Portal>\n <div className={className}>\n {content}\n </div>\n </Portal>\n );\n }\n\n return (\n <Menu\n isOpen={isOpen}\n positionX=\"left\"\n positionY=\"bottom\"\n onClose={onClose}\n className=\"SymbolMenu\"\n onCloseAnimationEnd={onClose}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCloseOnBackdrop={!IS_TOUCH_ENV}\n noCompact\n >\n {content}\n </Menu>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n isLeftColumnShown: global.isLeftColumnShown,\n };\n },\n)(SymbolMenu));\n","import React, { FC, memo } from '../../../lib/teact/teact';\n\nimport { 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 React, {\n FC, useCallback, useEffect, useRef, memo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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 React, { FC, memo, useCallback } from '../../../lib/teact/teact';\n\nimport { 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 React, {\n FC, memo, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiSticker } from '../../../api/types';\n\nimport { STICKER_SIZE_PICKER } from '../../../config';\nimport buildClassName from '../../../util/buildClassName';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useSendMessageAction from '../../../hooks/useSendMessageAction';\nimport { selectIsChatWithSelf } from '../../../global/selectors';\n\nimport Loading from '../../ui/Loading';\nimport StickerButton from '../../common/StickerButton';\n\nimport './StickerTooltip.scss';\n\nexport type OwnProps = {\n chatId: string;\n threadId?: number;\n isOpen: boolean;\n onStickerSelect: (sticker: ApiSticker, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\ntype StateProps = {\n stickers?: ApiSticker[];\n isSavedMessages?: boolean;\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst StickerTooltip: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n isOpen,\n stickers,\n isSavedMessages,\n onStickerSelect,\n}) => {\n const { clearStickersForEmoji } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, undefined, undefined, false);\n const prevStickers = usePrevious(stickers, true);\n const displayedStickers = stickers || prevStickers;\n const sendMessageAction = useSendMessageAction(chatId, threadId);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE });\n\n useEffect(() => (isOpen ? captureEscKeyListener(clearStickersForEmoji) : undefined), [isOpen, clearStickersForEmoji]);\n\n const handleMouseMove = () => {\n sendMessageAction({ type: 'chooseSticker' });\n };\n\n const className = buildClassName(\n 'StickerTooltip composer-tooltip custom-scroll',\n transitionClassNames,\n !(displayedStickers?.length) && 'hidden',\n );\n\n return (\n <div\n ref={containerRef}\n className={className}\n onMouseMove={handleMouseMove}\n >\n {shouldRender && displayedStickers ? (\n displayedStickers.map((sticker) => (\n <StickerButton\n key={sticker.id}\n sticker={sticker}\n size={STICKER_SIZE_PICKER}\n observeIntersection={observeIntersection}\n onClick={onStickerSelect}\n clickArg={sticker}\n isSavedMessages={isSavedMessages}\n />\n ))\n ) : shouldRender ? (\n <Loading />\n ) : undefined}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { stickers } = global.stickers.forEmoji;\n const isSavedMessages = selectIsChatWithSelf(global, chatId);\n\n return { stickers, isSavedMessages };\n },\n)(StickerTooltip));\n","import React, { FC, 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 React, {\n FC, 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 React, { FC, memo } from '../../../../lib/teact/teact';\n\nimport { ApiWebDocument } from '../../../../api/types';\n\nimport { getFirstLetters } from '../../../../util/textFormat';\nimport renderText from '../../../common/helpers/renderText';\nimport useMedia from '../../../../hooks/useMedia';\n\nimport ListItem from '../../../ui/ListItem';\n\nimport './BaseResult.scss';\nimport { preventMessageInputBlurWithBubbling } from '../../helpers/preventMessageInputBlur';\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: string | 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 React, { FC, memo, useCallback } from '../../../../lib/teact/teact';\n\nimport {\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 React, { FC, memo, useCallback } from '../../../../lib/teact/teact';\n\nimport { 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 React, {\n FC, memo, useCallback,\n} from '../../../../lib/teact/teact';\n\nimport { ApiBotInlineMediaResult, ApiBotInlineResult, ApiVideo } from '../../../../api/types';\n\nimport { 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 React, { FC, memo } from '../../../../lib/teact/teact';\n\nimport { ApiBotInlineMediaResult, ApiBotInlineResult } from '../../../../api/types';\n\nimport { STICKER_SIZE_INLINE_BOT_RESULT } from '../../../../config';\nimport { ObserveFn } from '../../../../hooks/useIntersectionObserver';\n\nimport StickerButton from '../../../common/StickerButton';\n\ntype OwnProps = {\n inlineResult: ApiBotInlineMediaResult;\n isSavedMessages?: boolean;\n observeIntersection: ObserveFn;\n onClick: (result: ApiBotInlineResult, isSilent?: boolean, shouldSchedule?: boolean) => void;\n};\n\nconst StickerResult: FC<OwnProps> = ({\n inlineResult,\n isSavedMessages,\n observeIntersection,\n onClick,\n}) => {\n const { sticker } = inlineResult;\n\n if (!sticker) {\n return undefined;\n }\n\n return (\n <StickerButton\n sticker={sticker}\n size={STICKER_SIZE_INLINE_BOT_RESULT}\n observeIntersection={observeIntersection}\n title={sticker.emoji}\n className=\"chat-item-clickable\"\n onClick={onClick}\n clickArg={inlineResult}\n isSavedMessages={isSavedMessages}\n />\n );\n};\n\nexport default memo(StickerResult);\n","import React, {\n FC, memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport { ApiBotInlineMediaResult, ApiBotInlineResult, ApiBotInlineSwitchPm } from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport setTooltipItemVisible from '../../../util/setTooltipItemVisible';\nimport buildClassName from '../../../util/buildClassName';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport { throttle } from '../../../util/schedulers';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport usePrevious from '../../../hooks/usePrevious';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation';\n\nimport MediaResult from './inlineResults/MediaResult';\nimport ArticleResult from './inlineResults/ArticleResult';\nimport GifResult from './inlineResults/GifResult';\nimport StickerResult from './inlineResults/StickerResult';\nimport ListItem from '../../ui/ListItem';\nimport InfiniteScroll from '../../ui/InfiniteScroll';\n\nimport './InlineBotTooltip.scss';\n\nconst INTERSECTION_DEBOUNCE_MS = 200;\nconst runThrottled = throttle((cb) => cb(), 500, true);\n\nexport type OwnProps = {\n isOpen: boolean;\n botId?: string;\n isGallery?: boolean;\n inlineBotResults?: (ApiBotInlineResult | ApiBotInlineMediaResult)[];\n switchPm?: ApiBotInlineSwitchPm;\n isSavedMessages?: boolean;\n canSendGifs?: boolean;\n onSelectResult: (\n inlineResult: ApiBotInlineMediaResult | ApiBotInlineResult, isSilent?: boolean, shouldSchedule?: boolean\n ) => void;\n loadMore: NoneToVoidFunction;\n onClose: NoneToVoidFunction;\n};\n\nconst InlineBotTooltip: FC<OwnProps> = ({\n isOpen,\n botId,\n isGallery,\n inlineBotResults,\n switchPm,\n isSavedMessages,\n canSendGifs,\n loadMore,\n onClose,\n onSelectResult,\n}) => {\n const {\n openChat,\n startBot,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen, undefined, undefined, false);\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({\n rootRef: containerRef,\n debounceMs: INTERSECTION_DEBOUNCE_MS,\n isDisabled: !isOpen,\n });\n\n const handleLoadMore = useCallback(({ direction }: { direction: LoadMoreDirection }) => {\n if (direction === LoadMoreDirection.Backwards) {\n runThrottled(loadMore);\n }\n }, [loadMore]);\n\n const selectedIndex = useKeyboardNavigation({\n isActive: isOpen,\n shouldRemoveSelectionOnReset: isGallery,\n noArrowNavigation: isGallery,\n items: inlineBotResults,\n onSelect: onSelectResult,\n onClose,\n });\n\n useEffect(() => {\n setTooltipItemVisible('.chat-item-clickable', selectedIndex, containerRef);\n }, [selectedIndex]);\n\n const handleSendPm = useCallback(() => {\n openChat({ id: botId });\n startBot({ botId, param: switchPm!.startParam });\n }, [botId, openChat, startBot, switchPm]);\n\n const prevInlineBotResults = usePrevious(\n inlineBotResults?.length\n ? inlineBotResults\n : undefined,\n shouldRender,\n );\n const renderedInlineBotResults = inlineBotResults && !inlineBotResults.length\n ? prevInlineBotResults\n : inlineBotResults;\n\n if (!shouldRender || !(renderedInlineBotResults?.length || switchPm)) {\n return undefined;\n }\n\n const className = buildClassName(\n 'InlineBotTooltip composer-tooltip',\n IS_TOUCH_ENV ? 'no-scrollbar' : 'custom-scroll',\n isGallery && 'gallery',\n transitionClassNames,\n );\n\n function renderSwitchPm() {\n return (\n <ListItem ripple className=\"switch-pm scroll-item\" onClick={handleSendPm}>\n <span className=\"title\">{switchPm!.text}</span>\n </ListItem>\n );\n }\n\n function renderContent() {\n return renderedInlineBotResults!.map((inlineBotResult, index) => {\n switch (inlineBotResult.type) {\n case 'gif':\n return (\n <GifResult\n key={inlineBotResult.id}\n inlineResult={inlineBotResult}\n observeIntersection={observeIntersection}\n onClick={onSelectResult}\n isSavedMessages={isSavedMessages}\n canSendGifs={canSendGifs}\n />\n );\n\n case 'photo':\n return (\n <MediaResult\n key={inlineBotResult.id}\n isForGallery={isGallery}\n inlineResult={inlineBotResult}\n onClick={onSelectResult}\n />\n );\n\n case 'sticker':\n return (\n <StickerResult\n key={inlineBotResult.id}\n inlineResult={inlineBotResult}\n observeIntersection={observeIntersection}\n onClick={onSelectResult}\n isSavedMessages={isSavedMessages}\n />\n );\n\n case 'video':\n case 'file':\n case 'game':\n return (\n <MediaResult\n key={inlineBotResult.id}\n focus={selectedIndex === index}\n inlineResult={inlineBotResult}\n onClick={onSelectResult}\n />\n );\n case 'article':\n case 'audio':\n return (\n <ArticleResult\n key={inlineBotResult.id}\n focus={selectedIndex === index}\n inlineResult={inlineBotResult}\n onClick={onSelectResult}\n />\n );\n\n default:\n return undefined;\n }\n });\n }\n\n return (\n <InfiniteScroll\n ref={containerRef}\n className={className}\n items={renderedInlineBotResults}\n itemSelector=\".chat-item-clickable\"\n noFastList\n onLoadMore={handleLoadMore}\n sensitiveArea={160}\n >\n {switchPm && renderSwitchPm()}\n {renderedInlineBotResults?.length && renderContent()}\n </InfiniteScroll>\n );\n};\n\nexport default memo(InlineBotTooltip);\n","import React, {\n FC, 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, {\n FC, useMemo, memo, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport { ApiMessage, ApiUser, ApiChat } from '../../api/types';\n\nimport { MEMO_EMPTY_ARRAY } from '../../util/memo';\nimport {\n selectUser,\n selectChatMessages,\n selectChat,\n selectCurrentTextSearch,\n} from '../../global/selectors';\nimport {\n getChatTitle,\n getUserFullName,\n isChatChannel,\n} from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport { renderMessageSummary } from '../common/helpers/renderMessageText';\nimport renderText from '../common/helpers/renderText';\n\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport ListItem from '../ui/ListItem';\nimport LastMessageMeta from '../common/LastMessageMeta';\nimport Avatar from '../common/Avatar';\n\nimport './RightSearch.scss';\n\nexport type OwnProps = {\n chatId: string;\n threadId: number;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n messagesById?: Record<number, ApiMessage>;\n query?: string;\n totalCount?: number;\n foundIds?: number[];\n};\n\nconst RightSearch: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n onClose,\n isActive,\n chat,\n messagesById,\n query,\n totalCount,\n foundIds,\n}) => {\n const {\n searchTextMessagesLocal,\n focusMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n useHistoryBack(isActive, onClose);\n\n const [viewportIds, getMore] = useInfiniteScroll(searchTextMessagesLocal, foundIds);\n\n const viewportResults = useMemo(() => {\n if (!query || !viewportIds?.length || !messagesById) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return viewportIds.map((id) => {\n const message = messagesById[id];\n if (!message) {\n return undefined;\n }\n\n const senderUser = message.senderId ? selectUser(getGlobal(), message.senderId) : undefined;\n\n let senderChat;\n if (chat && isChatChannel(chat)) {\n senderChat = chat;\n } else if (message.forwardInfo) {\n const { isChannelPost, fromChatId } = message.forwardInfo;\n senderChat = isChannelPost && fromChatId ? selectChat(getGlobal(), fromChatId) : undefined;\n } else {\n senderChat = message.senderId ? selectChat(getGlobal(), message.senderId) : undefined;\n }\n\n return {\n message,\n senderUser,\n senderChat,\n onClick: () => focusMessage({ chatId, threadId, messageId: id }),\n };\n }).filter(Boolean);\n }, [query, viewportIds, messagesById, chat, focusMessage, chatId, threadId]);\n\n const handleKeyDown = useKeyboardListNavigation(containerRef, true, (index) => {\n const foundResult = viewportResults?.[index === -1 ? 0 : index];\n if (foundResult) {\n foundResult.onClick();\n }\n }, '.ListItem-button', true);\n\n const renderSearchResult = ({\n message, senderUser, senderChat, onClick,\n }: {\n message: ApiMessage;\n senderUser?: ApiUser;\n senderChat?: ApiChat;\n onClick: NoneToVoidFunction;\n }) => {\n const title = senderChat ? getChatTitle(lang, senderChat) : getUserFullName(senderUser);\n const text = renderMessageSummary(lang, message, undefined, query);\n\n return (\n <ListItem\n key={message.id}\n teactOrderKey={-message.date}\n className=\"chat-item-clickable search-result-message m-0\"\n onClick={onClick}\n >\n <Avatar chat={senderChat} user={senderUser} />\n <div className=\"info\">\n <div className=\"title\">\n <h3 dir=\"auto\">{title && renderText(title)}</h3>\n <LastMessageMeta message={message} />\n </div>\n <div className=\"subtitle\" dir=\"auto\">\n {text}\n </div>\n </div>\n </ListItem>\n );\n };\n\n const isOnTop = viewportIds?.[0] === foundIds?.[0];\n\n return (\n <InfiniteScroll\n ref={containerRef}\n className=\"RightSearch custom-scroll\"\n items={viewportResults}\n preloadBackwards={0}\n onLoadMore={getMore}\n onKeyDown={handleKeyDown}\n >\n {isOnTop && (\n <p key=\"helper-text\" className=\"helper-text\" dir=\"auto\">\n {!query ? (\n lang('lng_dlg_search_for_messages')\n ) : (totalCount === 0 || !viewportResults.length) ? (\n lang('lng_search_no_results')\n ) : totalCount === 1 ? (\n '1 message found'\n ) : (\n `${(viewportResults.length && (totalCount || viewportResults.length))} messages found`\n )}\n </p>\n )}\n {viewportResults.map(renderSearchResult)}\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const messagesById = chat && selectChatMessages(global, chat.id);\n if (!chat || !messagesById) {\n return {};\n }\n\n const { query, results } = selectCurrentTextSearch(global) || {};\n const { totalCount, foundIds } = results || {};\n\n return {\n chat,\n messagesById,\n query,\n totalCount,\n foundIds,\n };\n },\n)(RightSearch));\n","import React, {\n FC, useEffect, memo, useMemo, useCallback,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ApiStickerSet } from '../../api/types';\nimport { ObserveFn } from '../../hooks/useIntersectionObserver';\n\nimport { STICKER_SIZE_SEARCH } from '../../config';\nimport { selectShouldLoopStickers, selectStickerSet } from '../../global/selectors';\nimport useFlag from '../../hooks/useFlag';\nimport useOnChange from '../../hooks/useOnChange';\nimport useLang from '../../hooks/useLang';\n\nimport Button from '../ui/Button';\nimport StickerButton from '../common/StickerButton';\nimport StickerSetModal from '../common/StickerSetModal.async';\nimport Spinner from '../ui/Spinner';\n\ntype OwnProps = {\n stickerSetId: string;\n observeIntersection: ObserveFn;\n isSomeModalOpen: boolean;\n onModalToggle: (isOpen: boolean) => void;\n};\n\ntype StateProps = {\n set?: ApiStickerSet;\n shouldPlay?: boolean;\n};\n\nconst STICKERS_TO_DISPLAY = 5;\n\nconst StickerSetResult: FC<OwnProps & StateProps> = ({\n stickerSetId, observeIntersection, set, shouldPlay,\n isSomeModalOpen, onModalToggle,\n}) => {\n const { loadStickers, toggleStickerSet } = getActions();\n\n const lang = useLang();\n const isAdded = set && Boolean(set.installedDate);\n const areStickersLoaded = Boolean(set?.stickers);\n\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n useOnChange(() => {\n onModalToggle(isModalOpen);\n }, [isModalOpen, onModalToggle]);\n\n const displayedStickers = useMemo(() => {\n if (!set) {\n return [];\n }\n\n const coverStickerIds = (set.covers || []).map(({ id }) => id);\n const otherStickers = set.stickers ? set.stickers.filter(({ id }) => !coverStickerIds.includes(id)) : [];\n\n return [...(set.covers || []), ...otherStickers].slice(0, STICKERS_TO_DISPLAY);\n }, [set]);\n\n useEffect(() => {\n // Featured stickers are initialized with one sticker in collection (cover of SickerSet)\n if (!areStickersLoaded && displayedStickers.length < STICKERS_TO_DISPLAY) {\n loadStickers({ stickerSetId });\n }\n }, [areStickersLoaded, displayedStickers.length, loadStickers, stickerSetId]);\n\n const handleAddClick = useCallback(() => {\n toggleStickerSet({ stickerSetId });\n }, [toggleStickerSet, stickerSetId]);\n\n if (!set) {\n return undefined;\n }\n\n const canRenderStickers = displayedStickers.length > 0;\n\n return (\n <div key={set.id} className=\"sticker-set\" dir={lang.isRtl ? 'rtl' : undefined}>\n <div className=\"sticker-set-header\">\n <div className=\"title-wrapper\">\n <h3 className=\"title\" dir=\"auto\">{set.title}</h3>\n <p className=\"count\" dir=\"auto\">{lang('Stickers', set.count, 'i')}</p>\n </div>\n <Button\n className={isAdded ? 'is-added' : undefined}\n color=\"primary\"\n size=\"tiny\"\n pill\n fluid\n onClick={handleAddClick}\n >\n {lang(isAdded ? 'Stickers.Installed' : 'Stickers.Install')}\n </Button>\n </div>\n <div className=\"sticker-set-main\">\n {!canRenderStickers && <Spinner />}\n {canRenderStickers && displayedStickers.map((sticker) => (\n <StickerButton\n sticker={sticker}\n size={STICKER_SIZE_SEARCH}\n observeIntersection={observeIntersection}\n noAnimate={!shouldPlay || isModalOpen || isSomeModalOpen}\n clickArg={undefined}\n onClick={openModal}\n noContextMenu\n />\n ))}\n </div>\n {canRenderStickers && (\n <StickerSetModal\n isOpen={isModalOpen}\n fromSticker={displayedStickers[0]}\n onClose={closeModal}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { stickerSetId }): StateProps => {\n return {\n set: selectStickerSet(global, stickerSetId),\n shouldPlay: selectShouldLoopStickers(global),\n };\n },\n)(StickerSetResult));\n","import React, {\n FC, memo, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { throttle } from '../../util/schedulers';\nimport { selectCurrentStickerSearch } from '../../global/selectors';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\n\nimport Loading from '../ui/Loading';\nimport StickerSetResult from './StickerSetResult';\n\nimport './StickerSearch.scss';\n\ntype OwnProps = {\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n query?: string;\n featuredIds?: string[];\n resultIds?: string[];\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst StickerSearch: FC<OwnProps & StateProps> = ({\n onClose,\n isActive,\n query,\n featuredIds,\n resultIds,\n}) => {\n const { loadFeaturedStickers } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE });\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadFeaturedStickers();\n });\n });\n\n useHistoryBack(isActive, onClose);\n\n function renderContent() {\n if (query === undefined) {\n return undefined;\n }\n\n if (!query && featuredIds) {\n return featuredIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n if (resultIds) {\n if (!resultIds.length) {\n return <p className=\"helper-text\" dir=\"auto\">Nothing found.</p>;\n }\n\n return resultIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n return <Loading />;\n }\n\n return (\n <div ref={containerRef} className=\"StickerSearch custom-scroll\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderContent()}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const currentSearch = selectCurrentStickerSearch(global);\n const { query, resultIds } = currentSearch || {};\n const { featured } = global.stickers;\n\n return {\n query,\n featuredIds: featured.setIds,\n resultIds,\n };\n },\n)(StickerSearch));\n","import React, {\n FC, memo, useRef, useCallback,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { 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(isActive, onClose);\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 React, { FC, memo } from '../../../lib/teact/teact';\n\nimport {\n ApiChannelStatistics, ApiGroupStatistics, ApiMessageStatistics, StatisticsOverviewItem,\n} from '../../../api/types';\n\nimport { 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: 'StatisticViews', isPlain: true },\n {\n name: 'forwards', title: 'PrivateShares', isPlain: true, isApproximate: true,\n },\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\">{cell.isApproximate ? `≈${field}` : field}</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 React, { FC, memo, useCallback } from '../../../lib/teact/teact';\n\nimport useLang, { LangFn } from '../../../hooks/useLang';\nimport { getActions } from '../../../global';\n\nimport { 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)}\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 React, {\n FC, memo, useState, useEffect, useRef, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { callApi } from '../../../api/gramjs';\nimport {\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 isActive: boolean;\n};\n\nexport type StateProps = {\n statistics: ApiChannelStatistics | ApiGroupStatistics;\n dcId?: number;\n isGroup: boolean;\n messageId?: number;\n};\n\nconst Statistics: FC<OwnProps & StateProps> = ({\n chatId,\n isActive,\n statistics,\n dcId,\n isGroup,\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 { loadStatistics, loadStatisticsAsyncGraph } = getActions();\n const forceUpdate = useForceUpdate();\n\n useEffect(() => {\n loadStatistics({ chatId, isGroup });\n }, [chatId, loadStatistics, isGroup]);\n\n useEffect(() => {\n if (!isActive) {\n loadedCharts.current = [];\n setIsReady(false);\n }\n }, [isActive]);\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\n forceUpdate();\n })();\n }, [\n graphs, graphTitles, isReady, statistics, lang, chatId, 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} isGroup={isGroup} />\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 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 // Show Loading component if message was already selected for improving transition animation\n const messageId = global.statistics.currentMessageId;\n\n return {\n statistics, dcId, isGroup, messageId,\n };\n },\n)(Statistics));\n","import React, {\n FC, memo, useState, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { callApi } from '../../../api/gramjs';\nimport { ApiMessageStatistics, 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';\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 </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 React, {\n FC, useCallback, useState, memo, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport {\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 React, { FC, memo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport { 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(isActive, onClose);\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 { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ManagementScreens, ManagementProgress } from '../../../types';\nimport {\n ApiChat, ApiChatBannedRights, ApiExportedInvite, ApiMediaFormat,\n} from '../../../api/types';\n\nimport { getChatAvatarHash, getHasAdminRight, isChatBasicGroup } from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport { selectChat } from '../../../global/selectors';\nimport { formatInteger } from '../../../util/textFormat';\nimport renderText from '../../common/helpers/renderText';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport InputText from '../../ui/InputText';\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport Spinner from '../../ui/Spinner';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\nimport './Management.scss';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n progress?: ManagementProgress;\n isBasicGroup: boolean;\n hasLinkedChannel: boolean;\n canChangeInfo?: boolean;\n canBanUsers?: boolean;\n canInvite?: boolean;\n exportedInvites?: ApiExportedInvite[];\n lastSyncTime?: number;\n availableReactionsCount?: number;\n};\n\nconst GROUP_TITLE_EMPTY = 'Group title can\\'t be empty';\n\n// Some checkboxes control multiple rights, and some rights are not controlled from Permissions screen,\n// so we need to define the amount manually\nconst TOTAL_PERMISSIONS_COUNT = 8;\n\nconst ManageGroup: FC<OwnProps & StateProps> = ({\n chatId,\n chat,\n progress,\n isBasicGroup,\n hasLinkedChannel,\n canChangeInfo,\n canBanUsers,\n canInvite,\n onScreenSelect,\n onClose,\n isActive,\n exportedInvites,\n lastSyncTime,\n availableReactionsCount,\n}) => {\n const {\n togglePreHistoryHidden,\n updateChat,\n deleteChat,\n leaveChannel,\n deleteChannel,\n closeManagement,\n openChat,\n loadExportedChatInvites,\n loadChatJoinRequests,\n } = getActions();\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const currentTitle = chat.title;\n const currentAbout = chat.fullInfo ? (chat.fullInfo.about || '') : '';\n\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [title, setTitle] = useState(currentTitle || '');\n const [about, setAbout] = useState(currentAbout);\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n const imageHash = getChatAvatarHash(chat);\n const currentAvatarBlobUrl = useMedia(imageHash, false, ApiMediaFormat.BlobUrl);\n const isPublicGroup = chat.username || hasLinkedChannel;\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n if (lastSyncTime && canInvite) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, canInvite, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handleClickEditType = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatPrivacyType);\n }, [onScreenSelect]);\n\n const handleClickDiscussion = useCallback(() => {\n onScreenSelect(ManagementScreens.Discussion);\n }, [onScreenSelect]);\n\n const handleClickReactions = useCallback(() => {\n onScreenSelect(ManagementScreens.Reactions);\n }, [onScreenSelect]);\n\n const handleClickPermissions = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupPermissions);\n }, [onScreenSelect]);\n\n const handleClickAdministrators = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }, [onScreenSelect]);\n\n const handleClickInvites = useCallback(() => {\n onScreenSelect(ManagementScreens.Invites);\n }, [onScreenSelect]);\n\n const handleClickRequests = useCallback(() => {\n onScreenSelect(ManagementScreens.JoinRequests);\n }, [onScreenSelect]);\n\n const handleSetPhoto = useCallback((file: File) => {\n setPhoto(file);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleAboutChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setAbout(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUpdateGroup = useCallback(() => {\n const trimmedTitle = title.trim();\n const trimmedAbout = about.trim();\n\n if (!trimmedTitle.length) {\n setError(GROUP_TITLE_EMPTY);\n return;\n }\n\n updateChat({\n chatId,\n title: trimmedTitle,\n about: trimmedAbout,\n photo,\n });\n }, [about, chatId, photo, title, updateChat]);\n\n const handleClickMembers = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupMembers);\n }, [onScreenSelect]);\n\n const handleTogglePreHistory = useCallback(() => {\n if (!chat.fullInfo) {\n return;\n }\n\n const { isPreHistoryHidden } = chat.fullInfo;\n\n togglePreHistoryHidden({ chatId: chat.id, isEnabled: !isPreHistoryHidden });\n }, [chat, togglePreHistoryHidden]);\n\n const enabledReactionsCount = chat.fullInfo?.enabledReactions?.length || 0;\n\n const enabledPermissionsCount = useMemo(() => {\n if (!chat.defaultBannedRights) {\n return 0;\n }\n\n let totalCount = [\n 'sendMessages',\n 'sendMedia',\n 'embedLinks',\n 'sendPolls',\n 'changeInfo',\n 'inviteUsers',\n 'pinMessages',\n ].filter(\n (key) => !chat.defaultBannedRights![key as keyof ApiChatBannedRights],\n ).length;\n\n const { sendStickers, sendGifs } = chat.defaultBannedRights;\n\n // These two rights are controlled with a single checkbox\n if (!sendStickers && !sendGifs) {\n totalCount += 1;\n }\n\n return totalCount;\n }, [chat]);\n\n const adminsCount = (chat.fullInfo?.adminMembers?.length) || 0;\n\n const handleDeleteGroup = useCallback(() => {\n if (isBasicGroup) {\n deleteChat({ chatId: chat.id });\n } else if (!chat.isCreator) {\n leaveChannel({ chatId: chat.id });\n } else {\n deleteChannel({ chatId: chat.id });\n }\n closeDeleteDialog();\n closeManagement();\n openChat({ id: undefined });\n }, [\n isBasicGroup, chat.isCreator, chat.id,\n closeDeleteDialog, closeManagement, leaveChannel, deleteChannel, deleteChat, openChat,\n ]);\n\n if (chat.isRestricted || chat.isForbidden) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handleSetPhoto}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-title\"\n label={lang('GroupName')}\n onChange={handleTitleChange}\n value={title}\n error={error === GROUP_TITLE_EMPTY ? error : undefined}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n disabled={!canChangeInfo}\n />\n {chat.isCreator && (\n <ListItem icon=\"lock\" multiline onClick={handleClickEditType}>\n <span className=\"title\">{lang('GroupType')}</span>\n <span className=\"subtitle\">{chat.username ? lang('TypePublic') : lang('TypePrivate')}</span>\n </ListItem>\n )}\n {hasLinkedChannel && (\n <ListItem\n icon=\"message\"\n multiline\n onClick={handleClickDiscussion}\n >\n <span className=\"title\">{lang('LinkedChannel')}</span>\n <span className=\"subtitle\">{lang('DiscussionUnlink')}</span>\n </ListItem>\n )}\n <ListItem\n icon=\"permissions\"\n multiline\n onClick={handleClickPermissions}\n disabled={!canBanUsers}\n >\n <span className=\"title\">{lang('ChannelPermissions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledPermissionsCount}/{TOTAL_PERMISSIONS_COUNT}\n </span>\n </ListItem>\n\n <ListItem\n icon=\"reactions\"\n multiline\n onClick={handleClickReactions}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Reactions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledReactionsCount}/{availableReactionsCount}\n </span>\n </ListItem>\n <ListItem\n icon=\"admin\"\n multiline\n onClick={handleClickAdministrators}\n >\n <span className=\"title\">{lang('ChannelAdministrators')}</span>\n <span className=\"subtitle\">{formatInteger(adminsCount)}</span>\n </ListItem>\n {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('MemberRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n </div>\n <div className=\"section\">\n <ListItem icon=\"group\" multiline onClick={handleClickMembers}>\n <span className=\"title\">{lang('GroupMembers')}</span>\n <span className=\"subtitle\">{formatInteger(chat.membersCount ?? 0)}</span>\n </ListItem>\n\n {!isPublicGroup && chat.fullInfo && (\n <div className=\"ListItem narrow no-selection\">\n <Checkbox\n checked={!chat.fullInfo.isPreHistoryHidden}\n label={lang('ChatHistory')}\n onChange={handleTogglePreHistory}\n disabled={!canBanUsers}\n />\n </div>\n )}\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {lang('DeleteMega')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleUpdateGroup}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n textParts={renderText(\n isBasicGroup || !chat.isCreator\n ? lang('AreYouSureDeleteAndExit')\n : lang('AreYouSureDeleteThisChatWithGroup', chat.title),\n ['br', 'simple_markdown'],\n )}\n confirmLabel={isBasicGroup || !chat.isCreator ? lang('DeleteMega') : lang('DeleteGroupForAll')}\n confirmHandler={handleDeleteGroup}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { progress } = global.management;\n const hasLinkedChannel = Boolean(chat.fullInfo?.linkedChatId);\n const isBasicGroup = isChatBasicGroup(chat);\n const { invites } = global.management.byChatId[chatId] || {};\n\n return {\n chat,\n progress,\n isBasicGroup,\n hasLinkedChannel,\n canChangeInfo: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'changeInfo'),\n canBanUsers: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'banUsers'),\n canInvite: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'inviteUsers'),\n exportedInvites: invites,\n lastSyncTime: global.lastSyncTime,\n availableReactionsCount: global.availableReactions?.filter((l) => !l.isInactive).length,\n };\n },\n)(ManageGroup));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ManagementScreens } from '../../../types';\nimport { 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(isActive, onClose);\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 React, {\n FC, useMemo, useState, memo, useRef, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport { ApiChat } from '../../../api/types';\n\nimport { filterUsersByName } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\n\nimport ChatOrUserPicker from '../../common/ChatOrUserPicker';\n\nexport type OwnProps = {\n chat: ApiChat;\n isOpen: boolean;\n onClose: NoneToVoidFunction;\n};\n\ntype StateProps = {\n currentUserId?: string;\n};\n\nconst RemoveGroupUserModal: FC<OwnProps & StateProps> = ({\n chat,\n currentUserId,\n isOpen,\n onClose,\n}) => {\n const {\n loadMoreMembers,\n deleteChatMember,\n } = getActions();\n\n const lang = useLang();\n const [filter, setFilter] = useState('');\n // eslint-disable-next-line no-null/no-null\n const filterRef = useRef<HTMLInputElement>(null);\n\n const usersId = useMemo(() => {\n const availableMemberIds = (chat.fullInfo?.members || [])\n .reduce((acc: string[], member) => {\n if (!member.isAdmin && !member.isOwner && member.userId !== currentUserId) {\n acc.push(member.userId);\n }\n return acc;\n }, []);\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n return filterUsersByName(availableMemberIds, usersById, filter);\n }, [chat.fullInfo?.members, currentUserId, filter]);\n\n const handleRemoveUser = useCallback((userId: string) => {\n deleteChatMember({ chatId: chat.id, userId });\n onClose();\n }, [chat.id, deleteChatMember, onClose]);\n\n return (\n <ChatOrUserPicker\n isOpen={isOpen}\n chatOrUserIds={usersId}\n filterRef={filterRef}\n filterPlaceholder={lang('ChannelBlockUser')}\n filter={filter}\n onFilterChange={setFilter}\n loadMore={loadMoreMembers}\n onSelectChatOrUser={handleRemoveUser}\n onClose={onClose}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId } = global;\n\n return { currentUserId };\n },\n)(RemoveGroupUserModal));\n","import React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ManagementScreens, ManagementProgress } from '../../../types';\nimport { ApiChat, ApiExportedInvite, ApiMediaFormat } from '../../../api/types';\n\nimport { getChatAvatarHash, getHasAdminRight } from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\nimport { selectChat } from '../../../global/selectors';\nimport useFlag from '../../../hooks/useFlag';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { formatInteger } from '../../../util/textFormat';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport InputText from '../../ui/InputText';\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport Spinner from '../../ui/Spinner';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\nimport './Management.scss';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n progress?: ManagementProgress;\n isSignaturesShown: boolean;\n canChangeInfo?: boolean;\n canInvite?: boolean;\n exportedInvites?: ApiExportedInvite[];\n lastSyncTime?: number;\n availableReactionsCount?: number;\n};\n\nconst CHANNEL_TITLE_EMPTY = 'Channel title can\\'t be empty';\n\nconst ManageChannel: FC<OwnProps & StateProps> = ({\n chatId,\n chat,\n progress,\n isSignaturesShown,\n canChangeInfo,\n canInvite,\n exportedInvites,\n lastSyncTime,\n availableReactionsCount,\n onScreenSelect,\n onClose,\n isActive,\n}) => {\n const {\n updateChat,\n toggleSignatures,\n closeManagement,\n leaveChannel,\n deleteChannel,\n openChat,\n loadExportedChatInvites,\n loadChatJoinRequests,\n } = getActions();\n\n const currentTitle = chat ? (chat.title || '') : '';\n const currentAbout = chat?.fullInfo ? (chat.fullInfo.about || '') : '';\n const hasLinkedChat = chat?.fullInfo?.linkedChatId;\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [title, setTitle] = useState(currentTitle);\n const [about, setAbout] = useState(currentAbout);\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n const imageHash = chat && getChatAvatarHash(chat);\n const currentAvatarBlobUrl = useMedia(imageHash, false, ApiMediaFormat.BlobUrl);\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n if (lastSyncTime) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const adminsCount = (chat?.fullInfo?.adminMembers?.length) || 0;\n const removedUsersCount = (chat?.fullInfo?.kickedMembers?.length) || 0;\n\n const handleClickEditType = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatPrivacyType);\n }, [onScreenSelect]);\n\n const handleClickDiscussion = useCallback(() => {\n onScreenSelect(ManagementScreens.Discussion);\n }, [onScreenSelect]);\n\n const handleClickReactions = useCallback(() => {\n onScreenSelect(ManagementScreens.Reactions);\n }, [onScreenSelect]);\n\n const handleClickAdministrators = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }, [onScreenSelect]);\n\n const handleClickInvites = useCallback(() => {\n onScreenSelect(ManagementScreens.Invites);\n }, [onScreenSelect]);\n\n const handleClickRequests = useCallback(() => {\n onScreenSelect(ManagementScreens.JoinRequests);\n }, [onScreenSelect]);\n\n const handleSetPhoto = useCallback((file: File) => {\n setPhoto(file);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleAboutChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setAbout(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUpdateChannel = useCallback(() => {\n const trimmedTitle = title.trim();\n const trimmedAbout = about.trim();\n\n if (!trimmedTitle.length) {\n setError(CHANNEL_TITLE_EMPTY);\n return;\n }\n\n updateChat({\n chatId,\n title: trimmedTitle,\n about: trimmedAbout,\n photo,\n });\n }, [about, chatId, photo, title, updateChat]);\n\n const handleToggleSignatures = useCallback(() => {\n toggleSignatures({ chatId, isEnabled: !isSignaturesShown });\n }, [chatId, isSignaturesShown, toggleSignatures]);\n\n const handleClickSubscribers = useCallback(() => {\n onScreenSelect(ManagementScreens.ChannelSubscribers);\n }, [onScreenSelect]);\n\n const handleRemovedUsersClick = useCallback(() => {\n onScreenSelect(ManagementScreens.ChannelRemovedUsers);\n }, [onScreenSelect]);\n\n const handleDeleteChannel = useCallback(() => {\n if (chat.isCreator) {\n deleteChannel({ chatId: chat.id });\n } else {\n leaveChannel({ chatId: chat.id });\n }\n\n closeDeleteDialog();\n closeManagement();\n openChat({ id: undefined });\n }, [chat.isCreator, chat.id, closeDeleteDialog, closeManagement, leaveChannel, deleteChannel, openChat]);\n\n const enabledReactionsCount = chat.fullInfo?.enabledReactions?.length || 0;\n\n if (chat.isRestricted || chat.isForbidden) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handleSetPhoto}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"channel-title\"\n label={lang('EnterChannelName')}\n onChange={handleTitleChange}\n value={title}\n error={error === CHANNEL_TITLE_EMPTY ? error : undefined}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"channel-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n disabled={!canChangeInfo}\n />\n {chat.isCreator && (\n <ListItem icon=\"lock\" multiline onClick={handleClickEditType}>\n <span className=\"title\">{lang('ChannelType')}</span>\n <span className=\"subtitle\">{chat.username ? lang('TypePublic') : lang('TypePrivate')}</span>\n </ListItem>\n )}\n <ListItem\n icon=\"message\"\n multiline\n onClick={handleClickDiscussion}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Discussion')}</span>\n <span className=\"subtitle\">{hasLinkedChat ? lang('DiscussionUnlink') : lang('Add')}</span>\n </ListItem>\n {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('SubscribeRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n <ListItem\n icon=\"reactions\"\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 React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiChat } from '../../../api/types';\nimport { ManagementProgress } from '../../../types';\n\nimport { selectChat, selectManagement } from '../../../global/selectors';\nimport { isChatChannel } from '../../../global/helpers';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport SafeLink from '../../common/SafeLink';\nimport ListItem from '../../ui/ListItem';\nimport RadioGroup from '../../ui/RadioGroup';\nimport Loading from '../../ui/Loading';\nimport Spinner from '../../ui/Spinner';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport UsernameInput from '../../common/UsernameInput';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\ntype PrivacyType = 'private' | 'public';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n isChannel: boolean;\n progress?: ManagementProgress;\n isUsernameAvailable?: boolean;\n isProtected?: boolean;\n};\n\nconst ManageChatPrivacyType: FC<OwnProps & StateProps> = ({\n chat,\n onClose,\n isActive,\n isChannel,\n progress,\n isUsernameAvailable,\n isProtected,\n}) => {\n const {\n checkPublicLink,\n updatePublicLink,\n updatePrivateLink,\n toggleIsProtected,\n } = getActions();\n\n const isPublic = Boolean(chat.username);\n const privateLink = chat.fullInfo?.inviteLink;\n\n const [privacyType, setPrivacyType] = useState<PrivacyType>(isPublic ? 'public' : 'private');\n const [username, setUsername] = useState();\n const [isRevokeConfirmDialogOpen, openRevokeConfirmDialog, closeRevokeConfirmDialog] = useFlag();\n\n const canUpdate = Boolean(\n (privacyType === 'public' && username && isUsernameAvailable)\n || (privacyType === 'private' && isPublic),\n );\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n if (privacyType && !privateLink) {\n updatePrivateLink();\n }\n }, [privacyType, privateLink, updatePrivateLink]);\n\n const handleOptionChange = useCallback((value: string) => {\n setPrivacyType(value as PrivacyType);\n }, []);\n\n const handleForwardingOptionChange = useCallback((value: string) => {\n toggleIsProtected({\n chatId: chat.id,\n isProtected: value === 'protected',\n });\n }, [chat.id, toggleIsProtected]);\n\n const handleSave = useCallback(() => {\n updatePublicLink({ username: privacyType === 'public' ? username : '' });\n }, [privacyType, updatePublicLink, username]);\n\n const handleRevokePrivateLink = useCallback(() => {\n closeRevokeConfirmDialog();\n updatePrivateLink();\n }, [closeRevokeConfirmDialog, updatePrivateLink]);\n\n const lang = useLang();\n const langPrefix1 = isChannel ? 'Channel' : 'Mega';\n const langPrefix2 = isChannel ? 'Channel' : 'Group';\n\n const options = [\n { value: 'private', label: lang(`${langPrefix1}Private`), subLabel: lang(`${langPrefix1}PrivateInfo`) },\n { value: 'public', label: lang(`${langPrefix1}Public`), subLabel: lang(`${langPrefix1}PublicInfo`) },\n ];\n\n const forwardingOptions = [{\n value: 'allowed',\n label: lang('ChannelVisibility.Forwarding.Enabled'),\n }, {\n value: 'protected',\n label: lang('ChannelVisibility.Forwarding.Disabled'),\n }];\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">{lang(`${langPrefix2}Type`)}</h3>\n <RadioGroup\n selected={privacyType}\n name=\"channel-type\"\n options={options}\n onChange={handleOptionChange}\n />\n </div>\n {privacyType === 'private' ? (\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n {privateLink ? (\n <>\n <SafeLink url={privateLink} className=\"group-link\" text={privateLink} />\n <p className=\"section-info\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang(`${langPrefix1}PrivateLinkHelp`)}\n </p>\n\n <ListItem icon=\"delete\" ripple destructive onClick={openRevokeConfirmDialog}>\n {lang('RevokeLink')}\n </ListItem>\n <ConfirmDialog\n isOpen={isRevokeConfirmDialogOpen}\n onClose={closeRevokeConfirmDialog}\n text={lang('RevokeAlert')}\n confirmLabel={lang('RevokeButton')}\n confirmHandler={handleRevokePrivateLink}\n confirmIsDestructive\n />\n </>\n ) : (\n <Loading />\n )}\n </div>\n ) : (\n <div className=\"section no-border\">\n <UsernameInput\n asLink\n currentUsername={chat.username}\n isLoading={isLoading}\n isUsernameAvailable={isUsernameAvailable}\n checkUsername={checkPublicLink}\n onChange={setUsername}\n />\n <p className=\"section-info\" dir=\"auto\">\n {lang(`${langPrefix2}.Username.CreatePublicLinkHelp`)}\n </p>\n </div>\n )}\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">\n {lang(isChannel ? 'ChannelVisibility.Forwarding.ChannelTitle' : 'ChannelVisibility.Forwarding.GroupTitle')}\n </h3>\n <RadioGroup\n selected={isProtected ? 'protected' : 'allowed'}\n name=\"forwarding-type\"\n options={forwardingOptions}\n onChange={handleForwardingOptionChange}\n />\n <p className=\"section-info\">\n {isChannel\n ? lang('ChannelVisibility.Forwarding.ChannelInfo')\n : lang('ChannelVisibility.Forwarding.GroupInfo')}\n </p>\n </div>\n </div>\n <FloatingActionButton\n isShown={canUpdate}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n onClick={handleSave}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { isUsernameAvailable } = selectManagement(global, chatId)!;\n\n return {\n chat,\n isChannel: isChatChannel(chat),\n progress: global.management.progress,\n isUsernameAvailable,\n isProtected: chat?.isProtected,\n };\n },\n)(ManageChatPrivacyType));\n","import React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiChat } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { STICKER_SIZE_DISCUSSION_GROUPS } from '../../../config';\nimport { selectChat } from '../../../global/selectors';\nimport getAnimationData from '../../common/helpers/animatedAssets';\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 AnimatedSticker from '../../common/AnimatedSticker';\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';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n chatsByIds: Record<string, ApiChat>;\n linkedChat?: ApiChat;\n forDiscussionIds?: string[];\n isChannel?: boolean;\n};\n\nconst ManageDiscussion: FC<OwnProps & StateProps> = ({\n chat,\n onClose,\n isActive,\n chatId,\n chatsByIds,\n linkedChat,\n forDiscussionIds,\n isChannel,\n onScreenSelect,\n}) => {\n const {\n loadGroupsForDiscussion,\n linkDiscussionGroup,\n unlinkDiscussionGroup,\n } = getActions();\n\n const [linkedGroupId, setLinkedGroupId] = useState<string>();\n const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n const [isConfirmUnlinkGroupDialogOpen, openConfirmUnlinkGroupDialog, closeConfirmUnlinkGroupDialog] = useFlag();\n const [isConfirmLinkGroupDialogOpen, openConfirmLinkGroupDialog, closeConfirmLinkGroupDialog] = useFlag();\n const lang = useLang();\n const linkedChatId = linkedChat?.id;\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n loadGroupsForDiscussion();\n }, [loadGroupsForDiscussion]);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('DiscussionGroups').then(setAnimationData);\n }\n }, [animationData]);\n\n const handleUnlinkGroupSessions = useCallback(() => {\n closeConfirmUnlinkGroupDialog();\n unlinkDiscussionGroup({ channelId: isChannel ? chatId : linkedChatId });\n if (!isChannel) {\n onScreenSelect(ManagementScreens.Initial);\n }\n }, [closeConfirmUnlinkGroupDialog, unlinkDiscussionGroup, isChannel, chatId, linkedChatId, onScreenSelect]);\n\n const handleLinkGroupSessions = useCallback(() => {\n closeConfirmLinkGroupDialog();\n linkDiscussionGroup({ channelId: chatId, chatId: linkedGroupId });\n }, [closeConfirmLinkGroupDialog, linkDiscussionGroup, chatId, linkedGroupId]);\n\n const onDiscussionClick = (groupId: string) => {\n setLinkedGroupId(groupId);\n openConfirmLinkGroupDialog();\n };\n\n function renderUnlinkGroupHeader() {\n return (\n <div className=\"modal-header\">\n <Avatar\n size=\"tiny\"\n chat={linkedChat}\n />\n <div className=\"modal-title\">\n {lang(isChannel ? 'DiscussionUnlinkGroup' : 'DiscussionUnlinkChannel')}\n </div>\n </div>\n );\n }\n\n function renderLinkGroupHeader() {\n const linkedGroup = chatsByIds[linkedGroupId];\n\n if (!linkedGroup) {\n return undefined;\n }\n\n return (\n <div className=\"modal-header\">\n <Avatar\n size=\"tiny\"\n chat={linkedGroup}\n />\n <div className=\"modal-title\">\n {lang('Channel.DiscussionGroup.LinkGroup')}\n </div>\n </div>\n );\n }\n\n function renderLinkGroupConfirmText() {\n const linkedGroup = chatsByIds[linkedGroupId];\n\n if (!linkedGroup) {\n return undefined;\n }\n\n if (linkedGroup.hasPrivateLink) {\n return renderText(\n `Do you want to make **${linkedGroup.title}** the discussion board for **${chat!.title}**?`,\n ['br', 'simple_markdown'],\n );\n // return renderText(\n // lang('DiscussionLinkGroupPublicAlert', linkedChat.title, 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 // return renderText(\n // lang('DiscussionLinkGroupPrivateAlert', linkedChat.title, chat!.title),\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 <div className=\"section-icon\">\n {animationData && (\n <AnimatedSticker\n id=\"discussionGroupsDucks\"\n size={STICKER_SIZE_DISCUSSION_GROUPS}\n animationData={animationData}\n play={isAnimationLoaded}\n noLoop\n onLoad={handleAnimationLoad}\n />\n )}\n </div>\n {linkedChat && renderLinkedGroup()}\n {!linkedChat && renderDiscussionGroups()}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { forDiscussionIds, byId: chatsByIds } = global.chats;\n const linkedChat = chat?.fullInfo?.linkedChatId\n ? selectChat(global, chat.fullInfo.linkedChatId)\n : undefined;\n\n return {\n chat,\n chatsByIds,\n forDiscussionIds,\n linkedChat,\n isChannel: chat && isChatChannel(chat),\n };\n },\n)(ManageDiscussion));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { getGlobal, withGlobal } from '../../../global';\n\nimport { ManagementScreens } from '../../../types';\nimport { 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(isActive, onClose);\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 React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 React, {\n FC, memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport { ApiChatMember, ApiUserStatus } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { unique } from '../../../util/iteratees';\nimport { selectChat } from '../../../global/selectors';\nimport {\n sortUserIds, isChatChannel, filterUsersByName, sortChatIds, isUserBot,\n} from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useInfiniteScroll from '../../../hooks/useInfiniteScroll';\nimport useKeyboardListNavigation from '../../../hooks/useKeyboardListNavigation';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport NothingFound from '../../common/NothingFound';\nimport ListItem from '../../ui/ListItem';\nimport InputText from '../../ui/InputText';\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Loading from '../../ui/Loading';\n\ntype OwnProps = {\n chatId: string;\n isActive: boolean;\n noAdmins?: boolean;\n onClose: NoneToVoidFunction;\n onScreenSelect?: (screen: ManagementScreens) => void;\n onChatMemberSelect?: (memberId: string, isPromotedByCurrentUser?: boolean) => void;\n};\n\ntype StateProps = {\n userStatusesById: Record<string, ApiUserStatus>;\n members?: ApiChatMember[];\n adminMembers?: ApiChatMember[];\n isChannel?: boolean;\n localContactIds?: string[];\n searchQuery?: string;\n isSearching?: boolean;\n localUserIds?: string[];\n globalUserIds?: string[];\n serverTimeOffset: number;\n};\n\nconst ManageGroupMembers: FC<OwnProps & StateProps> = ({\n noAdmins,\n members,\n adminMembers,\n userStatusesById,\n isChannel,\n isActive,\n globalUserIds,\n localContactIds,\n localUserIds,\n isSearching,\n searchQuery,\n serverTimeOffset,\n onClose,\n onScreenSelect,\n onChatMemberSelect,\n}) => {\n const { openChat, setUserSearchQuery, loadContactList } = getActions();\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const adminIds = useMemo(() => {\n return noAdmins ? adminMembers?.map(({ userId }) => userId) || [] : [];\n }, [adminMembers, noAdmins]);\n\n const memberIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n if (!members || !usersById) {\n return [];\n }\n\n const userIds = sortUserIds(\n members.map(({ userId }) => userId),\n usersById,\n userStatusesById,\n undefined,\n serverTimeOffset,\n );\n\n return noAdmins ? userIds.filter((userId) => !adminIds.includes(userId)) : userIds;\n }, [members, userStatusesById, serverTimeOffset, noAdmins, adminIds]);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const chatsById = getGlobal().chats.byId;\n const shouldUseSearchResults = Boolean(searchQuery);\n const listedIds = !shouldUseSearchResults\n ? memberIds\n : (localContactIds ? filterUsersByName(localContactIds, usersById, searchQuery) : []);\n\n return sortChatIds(\n unique([\n ...listedIds,\n ...(shouldUseSearchResults ? localUserIds || [] : []),\n ...(shouldUseSearchResults ? globalUserIds || [] : []),\n ]).filter((contactId) => {\n const user = usersById[contactId];\n if (!user) {\n return true;\n }\n\n return (isChannel || user.canBeInvitedToGroup || !isUserBot(user))\n && (!noAdmins || !adminIds.includes(contactId));\n }),\n chatsById,\n true,\n );\n }, [memberIds, localContactIds, searchQuery, localUserIds, globalUserIds, isChannel, noAdmins, adminIds]);\n\n const [viewportIds, getMore] = useInfiniteScroll(loadContactList, displayedIds, Boolean(searchQuery));\n\n const handleMemberClick = useCallback((id: string) => {\n if (noAdmins) {\n onChatMemberSelect!(id, false);\n onScreenSelect!(ManagementScreens.ChatNewAdminRights);\n } else {\n openChat({ id });\n }\n }, [noAdmins, onChatMemberSelect, onScreenSelect, openChat]);\n\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setUserSearchQuery({ query: e.target.value });\n }, [setUserSearchQuery]);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isActive, (index) => {\n if (viewportIds && viewportIds.length > 0) {\n handleMemberClick(viewportIds[index === -1 ? 0 : index]);\n }\n }, '.ListItem-button', true);\n\n useHistoryBack(isActive, onClose);\n\n function renderSearchField() {\n return (\n <div className=\"Management__filter\" dir={lang.isRtl ? 'rtl' : undefined}>\n <InputText\n ref={inputRef}\n value={searchQuery}\n onChange={handleFilterChange}\n placeholder={lang('Search')}\n />\n </div>\n );\n }\n\n return (\n <div className=\"Management\">\n {noAdmins && renderSearchField()}\n <div className=\"custom-scroll\">\n <div className=\"section\">\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"picker-list custom-scroll\"\n items={displayedIds}\n onLoadMore={getMore}\n noScrollRestore={Boolean(searchQuery)}\n ref={containerRef}\n onKeyDown={handleKeyDown}\n >\n {viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable scroll-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleMemberClick(id)}\n >\n <PrivateChatInfo userId={id} forceShowSelf />\n </ListItem>\n ))}\n </InfiniteScroll>\n ) : !isSearching && viewportIds && !viewportIds.length ? (\n <NothingFound\n teactOrderKey={0}\n key=\"nothing-found\"\n text={isChannel ? 'No subscribers found' : 'No members found'}\n />\n ) : (\n <Loading />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { statusesById: userStatusesById } = global.users;\n const members = chat?.fullInfo?.members;\n const adminMembers = chat?.fullInfo?.adminMembers;\n const isChannel = chat && isChatChannel(chat);\n const { userIds: localContactIds } = global.contactList || {};\n\n const {\n query: searchQuery,\n fetchingStatus,\n globalUserIds,\n localUserIds,\n } = global.userSearch;\n\n return {\n members,\n adminMembers,\n userStatusesById,\n isChannel,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus,\n globalUserIds,\n localUserIds,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageGroupMembers));\n","import React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiChat, ApiExportedInvite } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { STICKER_SIZE_INVITES } from '../../../config';\nimport getAnimationData 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 AnimatedSticker from '../../common/AnimatedSticker';\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 const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('Invite').then(setAnimationData);\n }\n }, [animationData]);\n\n useHistoryBack(isActive, onClose);\n\n const hasDetailedCountdown = useMemo(() => {\n if (!exportedInvites) return undefined;\n return exportedInvites\n .some(({ expireDate }) => (\n expireDate && (expireDate - getServerTime(serverTimeOffset) < MILLISECONDS_IN_DAY / 1000)\n ));\n }, [exportedInvites, serverTimeOffset]);\n const forceUpdate = useForceUpdate();\n useInterval(() => {\n forceUpdate();\n }, hasDetailedCountdown ? 1000 : undefined);\n\n const primaryInvite = exportedInvites?.find(({ isPermanent }) => isPermanent);\n const primaryInviteLink = chat?.username ? `t.me/${chat.username}` : primaryInvite?.link;\n const temporalInvites = useMemo(() => {\n const invites = chat?.username ? exportedInvites : exportedInvites?.filter(({ isPermanent }) => !isPermanent);\n return invites?.sort(inviteComparator);\n }, [chat?.username, exportedInvites]);\n\n const editInvite = (invite: ApiExportedInvite) => {\n setEditingExportedInvite({ chatId, invite });\n onScreenSelect(ManagementScreens.EditInvite);\n };\n\n const revokeInvite = useCallback((invite: ApiExportedInvite) => {\n const {\n link, title, isRequestNeeded, expireDate, usageLimit,\n } = invite;\n editExportedChatInvite({\n chatId,\n link,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n isRevoked: true,\n });\n }, [chatId, editExportedChatInvite]);\n\n const askToRevoke = useCallback((invite: ApiExportedInvite) => {\n setRevokingInvite(invite);\n openRevokeDialog();\n }, [openRevokeDialog]);\n\n const handleRevoke = useCallback(() => {\n if (!revokingInvite) return;\n revokeInvite(revokingInvite);\n setRevokingInvite(undefined);\n closeRevokeDialog();\n }, [closeRevokeDialog, revokeInvite, revokingInvite]);\n\n const handleCreateNewClick = useCallback(() => {\n onScreenSelect(ManagementScreens.EditInvite);\n }, [onScreenSelect]);\n\n const handlePrimaryRevoke = useCallback(() => {\n if (primaryInvite) {\n askToRevoke(primaryInvite);\n }\n }, [askToRevoke, primaryInvite]);\n\n const handleDeleteAllRevoked = useCallback(() => {\n deleteRevokedExportedChatInvites({ chatId });\n closeDeleteRevokeAllDialog();\n }, [chatId, closeDeleteRevokeAllDialog, deleteRevokedExportedChatInvites]);\n\n const showInviteInfo = useCallback((invite: ApiExportedInvite) => {\n setOpenedInviteInfo({ chatId, invite });\n onScreenSelect(ManagementScreens.InviteInfo);\n }, [chatId, onScreenSelect, setOpenedInviteInfo]);\n\n const deleteInvite = useCallback((invite: ApiExportedInvite) => {\n deleteExportedChatInvite({ chatId, link: invite.link });\n }, [chatId, deleteExportedChatInvite]);\n\n const askToDelete = useCallback((invite: ApiExportedInvite) => {\n setDeletingInvite(invite);\n openDeleteDialog();\n }, [openDeleteDialog]);\n\n const handleDelete = useCallback(() => {\n if (!deletingInvite) return;\n deleteInvite(deletingInvite);\n setDeletingInvite(undefined);\n closeDeleteDialog();\n }, [closeDeleteDialog, deleteInvite, deletingInvite]);\n\n const copyLink = useCallback((link: string) => {\n copyTextToClipboard(link);\n showNotification({\n message: lang('LinkCopied'),\n });\n }, [lang, showNotification]);\n\n const handleCopyPrimaryClicked = useCallback(() => {\n copyLink(primaryInviteLink!);\n }, [copyLink, primaryInviteLink]);\n\n const prepareUsageText = (invite: ApiExportedInvite) => {\n const {\n usage = 0, usageLimit, expireDate, isPermanent, requested, isRevoked,\n } = invite;\n let text = '';\n if (!isRevoked && usageLimit && usage < usageLimit) {\n text = lang('CanJoin', usageLimit - usage);\n } else if (usage) {\n text = lang('PeopleJoined', usage);\n } else {\n text = lang('NoOneJoined');\n }\n\n if (isRevoked) {\n text += ` ${BULLET} ${lang('Revoked')}`;\n return text;\n }\n\n if (requested) {\n text += ` ${BULLET} ${lang('JoinRequests', requested)}`;\n }\n\n if (usageLimit !== undefined && usage === usageLimit) {\n text += ` ${BULLET} ${lang('LinkLimitReached')}`;\n } else if (expireDate) {\n const diff = (expireDate - getServerTime(serverTimeOffset)) * 1000;\n text += ` ${BULLET} `;\n if (diff > 0) {\n text += lang('InviteLink.ExpiresIn', formatCountdown(lang, diff));\n } else {\n text += lang('InviteLink.Expired');\n }\n } else if (isPermanent) {\n text += ` ${BULLET} ${lang('Permanent')}`;\n }\n\n return text;\n };\n\n const prepareContextActions = (invite: ApiExportedInvite) => {\n const actions = [];\n actions.push({\n title: lang('Copy'),\n icon: 'copy',\n handler: () => copyLink(invite.link),\n });\n\n if (!invite.isPermanent && !invite.isRevoked) {\n actions.push({\n title: lang('Edit'),\n icon: 'edit',\n handler: () => editInvite(invite),\n });\n }\n\n if (!invite.isRevoked) {\n actions.push({\n title: lang('RevokeButton'),\n icon: 'delete',\n handler: () => askToRevoke(invite),\n destructive: true,\n });\n } else {\n actions.push({\n title: lang('DeleteLink'),\n icon: 'delete',\n handler: () => askToDelete(invite),\n destructive: true,\n });\n }\n return actions;\n };\n\n const PrimaryLinkMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"Actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n return (\n <div className=\"Management ManageInvites\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <div className=\"section-icon\">\n {animationData && (\n <AnimatedSticker\n id=\"inviteDuck\"\n size={STICKER_SIZE_INVITES}\n animationData={animationData}\n play={isAnimationLoaded}\n onLoad={handleAnimationLoad}\n />\n )}\n </div>\n <p className=\"text-muted\">{isChannel ? lang('PrimaryLinkHelpChannel') : lang('PrimaryLinkHelp')}</p>\n </div>\n {primaryInviteLink && (\n <div className=\"section\">\n <p className=\"text-muted\">\n {chat?.username ? lang('PublicLink') : lang('lng_create_permanent_link_title')}\n </p>\n <div className=\"primary-link\">\n <input\n className=\"form-control primary-link-input\"\n value={primaryInviteLink}\n readOnly\n onClick={handleCopyPrimaryClicked}\n />\n <DropdownMenu\n className=\"primary-link-more-menu\"\n trigger={PrimaryLinkMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"copy\" onClick={handleCopyPrimaryClicked}>{lang('Copy')}</MenuItem>\n {!chat?.username && (\n <MenuItem icon=\"delete\" onClick={handlePrimaryRevoke} destructive>{lang('RevokeButton')}</MenuItem>\n )}\n </DropdownMenu>\n </div>\n <Button onClick={handleCopyPrimaryClicked}>{lang('CopyLink')}</Button>\n </div>\n )}\n <div className=\"section\" teactFastList>\n <Button isText key=\"create\" className=\"create-link\" onClick={handleCreateNewClick}>\n {lang('CreateNewLink')}\n </Button>\n {(!temporalInvites || !temporalInvites.length) && <NothingFound text=\"No links found\" key=\"nothing\" />}\n {temporalInvites?.map((invite) => (\n <ListItem\n icon=\"link\"\n secondaryIcon=\"more\"\n multiline\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => showInviteInfo(invite)}\n contextActions={prepareContextActions(invite)}\n key={invite.link}\n >\n <span className=\"title invite-title\">{invite.title || invite.link}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {prepareUsageText(invite)}\n </span>\n </ListItem>\n ))}\n <p className=\"text-muted hint\" key=\"links-hint\">{lang('ManageLinksInfoHelp')}</p>\n </div>\n {revokedExportedInvites && Boolean(revokedExportedInvites.length) && (\n <div className=\"section\" teactFastList>\n <p className=\"text-muted\" key=\"title\">{lang('RevokedLinks')}</p>\n <ListItem\n icon=\"delete\"\n destructive\n key=\"delete\"\n onClick={openDeleteRevokeAllDialog}\n >\n <span className=\"title\">{lang('DeleteAllRevokedLinks')}</span>\n </ListItem>\n {revokedExportedInvites?.map((invite) => (\n <ListItem\n icon=\"link\"\n secondaryIcon=\"more\"\n multiline\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => showInviteInfo(invite)}\n contextActions={prepareContextActions(invite)}\n key={invite.link}\n >\n <span className=\"title\">{invite.title || invite.link}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {prepareUsageText(invite)}\n </span>\n </ListItem>\n ))}\n </div>\n )}\n </div>\n <ConfirmDialog\n isOpen={isDeleteRevokeAllDialogOpen}\n onClose={closeDeleteRevokeAllDialog}\n title={lang('DeleteAllRevokedLinks')}\n text={lang('DeleteAllRevokedLinkHelp')}\n confirmIsDestructive\n confirmLabel={lang('DeleteAll')}\n confirmHandler={handleDeleteAllRevoked}\n />\n <ConfirmDialog\n isOpen={isRevokeDialogOpen}\n onClose={closeRevokeDialog}\n title={lang('RevokeLink')}\n text={lang('RevokeAlert')}\n confirmIsDestructive\n confirmLabel={lang('RevokeButton')}\n confirmHandler={handleRevoke}\n />\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n title={lang('DeleteLink')}\n text={lang('DeleteLinkHelp')}\n confirmIsDestructive\n confirmLabel={lang('Delete')}\n confirmHandler={handleDelete}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { invites, revokedInvites } = global.management.byChatId[chatId];\n const chat = selectChat(global, chatId);\n const isChannel = chat && isChatChannel(chat);\n\n return {\n exportedInvites: invites,\n revokedExportedInvites: revokedInvites,\n chat,\n serverTimeOffset: global.serverTimeOffset,\n isChannel,\n };\n },\n)(ManageInvites));\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useCallback, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 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 React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\n\n const handleSaveReactions = useCallback(() => {\n if (!chat) return;\n setIsLoading(true);\n\n setChatEnabledReactions({\n chatId: chat.id,\n enabledReactions: localEnabledReactions,\n });\n }, [chat, localEnabledReactions, setChatEnabledReactions]);\n\n useEffect(() => {\n if (enabledReactions) {\n setIsLoading(false);\n setIsTouched(false);\n setLocalEnabledReactions(enabledReactions);\n }\n }, [enabledReactions]);\n\n const handleReactionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (!chat || !availableReactions) return;\n\n const { name, checked } = e.currentTarget;\n const newEnabledReactions = name === 'all' ? (checked ? availableReactions.map((l) => l.reaction) : [])\n : (!checked\n ? localEnabledReactions.filter((l) => l !== name)\n : [...localEnabledReactions, name]);\n\n setLocalEnabledReactions(newEnabledReactions);\n setIsTouched(true);\n }, [availableReactions, chat, localEnabledReactions]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"all\"\n checked={!localEnabledReactions || localEnabledReactions.length > 0}\n label={lang('EnableReactions')}\n onChange={handleReactionChange}\n />\n </div>\n {availableReactions?.filter((l) => !l.isInactive).map(({ reaction, title }) => (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name={reaction}\n checked={!localEnabledReactions || localEnabledReactions?.includes(reaction)}\n disabled={localEnabledReactions?.length === 0}\n label={(\n <div className=\"Reaction\">\n <ReactionStaticEmoji reaction={reaction} />\n {title}\n </div>\n )}\n onChange={handleReactionChange}\n />\n </div>\n ))}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isTouched}\n onClick={handleSaveReactions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n\n return {\n enabledReactions: chat.fullInfo?.enabledReactions,\n availableReactions: global.availableReactions,\n chat,\n };\n },\n)(ManageReactions));\n","import React, {\n FC, memo, useCallback, useEffect,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { 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(isActive, onClose);\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 React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiUser } from '../../../api/types';\n\nimport useLang from '../../../hooks/useLang';\nimport { getUserFullName } from '../../../global/helpers';\nimport { selectUser } from '../../../global/selectors';\nimport { formatHumanDate, formatTime, isToday } from '../../../util/dateFormat';\nimport { getServerTime } from '../../../util/serverTime';\nimport { createClassNameBuilder } from '../../../util/buildClassName';\n\nimport Avatar from '../../common/Avatar';\nimport Button from '../../ui/Button';\n\nimport './JoinRequest.scss';\n\ntype OwnProps = {\n userId: string;\n about?: string;\n isChannel?: boolean;\n date: number;\n chatId: string;\n};\n\ntype StateProps = {\n user?: ApiUser;\n isSavedMessages?: boolean;\n serverTimeOffset: number;\n};\n\nconst JoinRequest: FC<OwnProps & StateProps> = ({\n userId,\n about,\n date,\n isChannel,\n user,\n serverTimeOffset,\n chatId,\n}) => {\n const { openChat, hideChatJoinRequest } = getActions();\n\n const buildClassName = createClassNameBuilder('JoinRequest');\n const lang = useLang();\n\n const fullName = getUserFullName(user);\n const fixedDate = (date - getServerTime(serverTimeOffset)) * 1000 + Date.now();\n\n const dateString = isToday(new Date(fixedDate))\n ? formatTime(lang, fixedDate) : formatHumanDate(lang, fixedDate, true, false, true);\n\n const handleUserClick = () => {\n openChat({ id: userId });\n };\n\n const handleAcceptRequest = useCallback(() => {\n hideChatJoinRequest({ chatId, userId, isApproved: true });\n }, [chatId, hideChatJoinRequest, userId]);\n\n const handleRejectRequest = useCallback(() => {\n hideChatJoinRequest({ chatId, userId, isApproved: false });\n }, [chatId, hideChatJoinRequest, userId]);\n\n return (\n <div className={buildClassName('&')}>\n <div className={buildClassName('top')}>\n <div className={buildClassName('user')} onClick={handleUserClick}>\n <Avatar\n key={userId}\n size=\"medium\"\n user={user}\n />\n <div className={buildClassName('user-info')}>\n <div className={buildClassName('user-name')}>{fullName}</div>\n <div className={buildClassName('user-subtitle')}>{about}</div>\n </div>\n </div>\n <div className={buildClassName('date')}>{dateString}</div>\n </div>\n <div className={buildClassName('buttons')}>\n <Button className={buildClassName('button')} onClick={handleAcceptRequest}>\n {isChannel ? lang('ChannelAddToChannel') : lang('ChannelAddToGroup')}\n </Button>\n <Button className={buildClassName('button')} isText onClick={handleRejectRequest}>\n {lang('DismissRequest')}\n </Button>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n const user = selectUser(global, userId);\n\n return {\n user,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(JoinRequest));\n","import React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiChat } from '../../../api/types';\n\nimport { STICKER_SIZE_JOIN_REQUESTS } from '../../../config';\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';\nimport getAnimationData from '../../common/helpers/animatedAssets';\n\nimport JoinRequest from './JoinRequest';\nimport Button from '../../ui/Button';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport AnimatedSticker from '../../common/AnimatedSticker';\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 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 const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('JoinRequest').then(setAnimationData);\n }\n }, [animationData]);\n\n useHistoryBack(isActive, onClose);\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=\"section\">\n <div className=\"section-icon\">\n {animationData && (\n <AnimatedSticker\n id=\"joinRequestDucks\"\n size={STICKER_SIZE_JOIN_REQUESTS}\n animationData={animationData}\n play={isAnimationLoaded}\n onLoad={handleAnimationLoad}\n />\n )}\n </div>\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\">\n <div className=\"custom-scroll\" 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 React, { FC, memo } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport { ManagementScreens, ManagementType } from '../../../types';\n\nimport { selectCurrentManagementType } from '../../../global/selectors';\n\nimport ManageUser from './ManageUser';\nimport ManageGroup from './ManageGroup';\nimport ManageGroupPermissions from './ManageGroupPermissions';\nimport ManageChatRemovedUsers from './ManageChatRemovedUsers';\nimport ManageChannel from './ManageChannel';\nimport ManageChatPrivacyType from './ManageChatPrivacyType';\nimport ManageDiscussion from './ManageDiscussion';\nimport ManageGroupUserPermissions from './ManageGroupUserPermissions';\nimport ManageChatAdministrators from './ManageChatAdministrators';\nimport ManageGroupRecentActions from './ManageGroupRecentActions';\nimport ManageGroupAdminRights from './ManageGroupAdminRights';\nimport ManageGroupMembers from './ManageGroupMembers';\nimport ManageGroupUserPermissionsCreate from './ManageGroupUserPermissionsCreate';\nimport ManageInvites from './ManageInvites';\nimport ManageInvite from './ManageInvite';\nimport ManageReactions from './ManageReactions';\nimport ManageInviteInfo from './ManageInviteInfo';\nimport ManageJoinRequests from './ManageJoinRequests';\n\nexport type OwnProps = {\n chatId: string;\n currentScreen: ManagementScreens;\n selectedChatMemberId?: string;\n isPromotedByCurrentUser?: boolean;\n onScreenSelect: (screen: ManagementScreens) => void;\n onChatMemberSelect: (memberId: string, isPromotedByCurrentUser?: boolean) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n managementType?: ManagementType;\n};\n\nconst Management: FC<OwnProps & StateProps> = ({\n chatId,\n currentScreen,\n selectedChatMemberId,\n isPromotedByCurrentUser,\n onScreenSelect,\n onChatMemberSelect,\n onClose,\n isActive,\n managementType,\n}) => {\n switch (currentScreen) {\n case ManagementScreens.Initial: {\n switch (managementType) {\n case 'user':\n return (\n <ManageUser\n key={chatId}\n userId={chatId}\n onClose={onClose}\n isActive={isActive}\n />\n );\n case 'group':\n return (\n <ManageGroup\n key={chatId}\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onClose={onClose}\n isActive={isActive || [\n ManagementScreens.ChatPrivacyType,\n ManagementScreens.Discussion,\n ManagementScreens.GroupPermissions,\n ManagementScreens.ChatAdministrators,\n ManagementScreens.GroupRemovedUsers,\n ManagementScreens.GroupUserPermissionsCreate,\n ManagementScreens.GroupUserPermissions,\n ManagementScreens.ChatAdminRights,\n ManagementScreens.ChatNewAdminRights,\n ManagementScreens.GroupRecentActions,\n ].includes(currentScreen)}\n />\n );\n case 'channel':\n return (\n <ManageChannel\n key={chatId}\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onClose={onClose}\n isActive={isActive || [\n ManagementScreens.ChannelSubscribers,\n ManagementScreens.ChatAdministrators,\n ManagementScreens.ChannelRemovedUsers,\n ManagementScreens.Discussion,\n ManagementScreens.ChatPrivacyType,\n ManagementScreens.ChatAdminRights,\n ManagementScreens.ChatNewAdminRights,\n ManagementScreens.GroupRecentActions,\n ].includes(currentScreen)}\n />\n );\n }\n\n break;\n }\n\n case ManagementScreens.ChatPrivacyType:\n return (\n <ManageChatPrivacyType\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.Discussion:\n return (\n <ManageDiscussion\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupPermissions:\n return (\n <ManageGroupPermissions\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onChatMemberSelect={onChatMemberSelect}\n isActive={isActive || [\n ManagementScreens.GroupRemovedUsers,\n ManagementScreens.GroupUserPermissionsCreate,\n ManagementScreens.GroupUserPermissions,\n ].includes(currentScreen)}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChannelRemovedUsers:\n case ManagementScreens.GroupRemovedUsers:\n return (\n <ManageChatRemovedUsers\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupUserPermissionsCreate:\n return (\n <ManageGroupUserPermissionsCreate\n chatId={chatId}\n onChatMemberSelect={onChatMemberSelect}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n ManagementScreens.GroupUserPermissions,\n ].includes(currentScreen)}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupUserPermissions:\n return (\n <ManageGroupUserPermissions\n chatId={chatId}\n selectedChatMemberId={selectedChatMemberId}\n isPromotedByCurrentUser={isPromotedByCurrentUser}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChatAdministrators:\n return (\n <ManageChatAdministrators\n chatId={chatId}\n onScreenSelect={onScreenSelect}\n onChatMemberSelect={onChatMemberSelect}\n isActive={isActive || [\n ManagementScreens.ChatAdminRights,\n ManagementScreens.ChatNewAdminRights,\n ManagementScreens.GroupRecentActions,\n ].includes(currentScreen)}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.GroupRecentActions:\n return (\n <ManageGroupRecentActions\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChatNewAdminRights:\n case ManagementScreens.ChatAdminRights:\n return (\n <ManageGroupAdminRights\n chatId={chatId}\n isNewAdmin={currentScreen === ManagementScreens.ChatNewAdminRights}\n selectedUserId={selectedChatMemberId}\n isPromotedByCurrentUser={isPromotedByCurrentUser}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onClose={onClose}\n />\n );\n\n case ManagementScreens.ChannelSubscribers:\n case ManagementScreens.GroupMembers:\n return (\n <ManageGroupMembers\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n case ManagementScreens.Invites:\n return (\n <ManageInvites\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n onScreenSelect={onScreenSelect}\n />\n );\n case ManagementScreens.EditInvite:\n return (\n <ManageInvite\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n onScreenSelect={onScreenSelect}\n />\n );\n case ManagementScreens.GroupAddAdmins:\n return (\n <ManageGroupMembers\n chatId={chatId}\n noAdmins\n isActive={isActive}\n onClose={onClose}\n onScreenSelect={onScreenSelect}\n onChatMemberSelect={onChatMemberSelect}\n />\n );\n\n case ManagementScreens.Reactions:\n return (\n <ManageReactions\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n case ManagementScreens.InviteInfo:\n return (\n <ManageInviteInfo\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n case ManagementScreens.JoinRequests:\n return (\n <ManageJoinRequests\n chatId={chatId}\n isActive={isActive}\n onClose={onClose}\n />\n );\n }\n\n return undefined; // Never reached\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const managementType = selectCurrentManagementType(global);\n\n return {\n managementType,\n };\n },\n)(Management));\n","const VISA = /^4[0-9]{12}(?:[0-9]{1,3})?$/;\nconst MASTERCARD1 = /^5[1-5][0-9]{11,14}$/;\nconst MASTERCARD2 = /^2[2-7][0-9]{11,14}$/;\n\nexport enum CardType {\n Default,\n Visa,\n Mastercard,\n}\n\nconst cards: Record<number, string> = {\n [CardType.Default]: '',\n [CardType.Visa]: 'visa',\n [CardType.Mastercard]: 'mastercard',\n};\n\nexport function detectCardType(cardNumber: string): number {\n cardNumber = cardNumber.replace(/\\s/g, '');\n if (VISA.test(cardNumber)) {\n return CardType.Visa;\n }\n if (MASTERCARD1.test(cardNumber) || MASTERCARD2.test(cardNumber)) {\n return CardType.Mastercard;\n }\n return CardType.Default;\n}\n\nexport function detectCardTypeText(cardNumber: string): string {\n const cardType = detectCardType(cardNumber);\n return cards[cardType as number] || '';\n}\n","// This data was received from Telegram Desktop (Telegram/Resources/numbers.txt)\nconst DATA = `AF🇦🇫93Afghanistan333\nAO🇦🇴244Angola333\nAL🇦🇱355Albania234\nAD🇦🇩376Andorra222\nAE🇦🇪971United Arab Emirates234\nAI🇦🇮1264Anguilla34\nAR🇦🇷54Argentina\nAM🇦🇲374Armenia233\nAG🇦🇬1268Antigua and Barbuda34\nAU🇦🇺61Australia333\nAS🇦🇸1684American Samoa34\nAT🇦🇹43Austria\nAW🇦🇼297Aruba34\nAZ🇦🇿994Azerbaijan2322\nBI🇧🇮257Burundi224\nBE🇧🇪32Belgium3222\nBJ🇧🇯229Benin233\nBF🇧🇫226Burkina Faso2222\nBD🇧🇩880Bangladesh\nBG🇧🇬359Bulgaria\nBH🇧🇭973Bahrain44\nBS🇧🇸1242Bahamas34\nBA🇧🇦387Bosnia and Herzegovina\nBY🇧🇾375Belarus2322\nBZ🇧🇿501Belize\nBO🇧🇴591Bolivia134\nBR🇧🇷55Brazil254\nBB🇧🇧1246Barbados34\nBM🇧🇲1441Bermuda34\nBN🇧🇳673Brunei34\nBQ🇧🇶599Bonaire, Sint Eustatius and Saba\nBT🇧🇹975Bhutan\nBW🇧🇼267Botswana233\nCF🇨🇫236Central African Republic2222\nCA🇨🇦1Canada334\nCH🇨🇭41Switzerland234\nCK🇨🇰682Cook Islands\nCL🇨🇱56Chile144\nCN🇨🇳86China344\nCI🇨🇮225Côte d\\`Ivoire233\nCM🇨🇲237Cameroon44\nCD🇨🇩243DR Congo234\nCG🇨🇬242Republic of the Congo234\nCO🇨🇴57Colombia334\nKM🇰🇲269Comoros34\nCV🇨🇻238Cape Verde34\nCR🇨🇷506Costa Rica\nCU🇨🇺53Cuba44\nCY🇨🇾357Cyprus44\nCW🇨🇼599Curaçao\nCZ🇨🇿420Czech Republic\nDE🇩🇪49Germany38\nDJ🇩🇯253Djibouti2222\nDM🇩🇲1767Dominica34\nDK🇩🇰45Denmark44\nDO🇩🇴1Dominican Republic334\nDZ🇩🇿213Algeria3222\nEC🇪🇨593Ecuador\nEG🇪🇬20Egypt234\nER🇪🇷291Eritrea133\nES🇪🇸34Spain333\nEE🇪🇪372Estonia\nET🇪🇹251Ethiopia234\nFI🇫🇮358Finland\nFJ🇫🇯679Fiji\nFK🇫🇰500Falkland Islands\nFM🇫🇲691Micronesia\nFO🇫🇴298Faroe Islands33\nFR🇫🇷33France12222\nGA🇬🇦241Gabon1222\nGB🇬🇧44United Kingdom46\nGE🇬🇪995Georgia\nGF🇬🇫594French Guiana\nGH🇬🇭233Ghana\nGI🇬🇮350Gibraltar44\nGL🇬🇱299Greenland33\nGN🇬🇳224Guinea333\nGM🇬🇲220Gambia34\nGP🇬🇵590Guadeloupe\nGU🇬🇺1671Guam34\nGW🇬🇼245Guinea-Bissau34\nGQ🇬🇶240Equatorial Guinea333\nGR🇬🇷30Greece244\nGD🇬🇩1473Grenada34\nGT🇬🇹502Guatemala134\nGY🇬🇾592Guyana\nHK🇭🇰852Hong Kong\nHN🇭🇳504Honduras44\nHR🇭🇷385Croatia\nHT🇭🇹509Haiti\nHU🇭🇺36Hungary234\nID🇮🇩62Indonesia\nIN🇮🇳91India55\nIO🇩🇬246Diego Garcia34\nIE🇮🇪353Ireland234\nIR🇮🇷98Iran334\nIQ🇮🇶964Iraq334\nIS🇮🇸354Iceland34\nIL🇮🇱972Israel234\nIT🇮🇹39Italy334\nJM🇯🇲1876Jamaica34\nJO🇯🇴962Jordan144\nJP🇯🇵81Japan244\nKZ🇰🇿7Kazakhstan3322\nKE🇰🇪254Kenya333\nKG🇰🇬996Kyrgyzstan\nKH🇰🇭855Cambodia\nKI🇰🇮686Kiribati\nKN🇰🇳1869Saint Kitts and Nevis34\nKR🇰🇷82South Korea\nKW🇰🇼965Kuwait44\nKY🇰🇾1345Cayman Islands34\nLA🇱🇦856Laos\nLB🇱🇧961Lebanon\nLR🇱🇷231Liberia\nLY🇱🇾218Libya234\nLC🇱🇨1758Saint Lucia34\nLI🇱🇮423Liechtenstein\nLK🇱🇰94Sri Lanka234\nLS🇱🇸266Lesotho233\nLT🇱🇹370Lithuania35\nLU🇱🇺352Luxembourg\nLV🇱🇻371Latvia35\nMA🇲🇦212Morocco234\nMC🇲🇨377Monaco44\nMD🇲🇩373Moldova233\nMG🇲🇬261Madagascar2232\nMP🇲🇵1670Northern Mariana Islands34\nMO🇲🇴853Macau\nMS🇲🇸1664Montserrat34\nMV🇲🇻960Maldives\nMX🇲🇽52Mexico\nMH🇲🇭692Marshall Islands\nMK🇲🇰389Macedonia\nML🇲🇱223Mali44\nMT🇲🇹356Malta2222\nMM🇲🇲95Myanmar\nME🇲🇪382Montenegro\nMN🇲🇳976Mongolia\nMZ🇲🇿258Mozambique234\nMQ🇲🇶596Martinique\nMR🇲🇷222Mauritania44\nMU🇲🇺230Mauritius\nMW🇲🇼265Malawi\nMY🇲🇾60Malaysia\nNA🇳🇦264Namibia234\nNC🇳🇨687New Caledonia6\nNE🇳🇪227Niger2222\nNF🇳🇫672Norfolk Island\nNG🇳🇬234Nigeria\nNI🇳🇮505Nicaragua44\nNL🇳🇱31Netherlands12222\nNO🇳🇴47Norway44\nNP🇳🇵977Nepal\nNU🇳🇺683Niue\nNR🇳🇷674Nauru\nNZ🇳🇿64New Zealand\nOM🇴🇲968Oman44\nPK🇵🇰92Pakistan334\nPA🇵🇦507Panama44\nPE🇵🇪51Peru333\nPF🇵🇫689French Polynesia\nPH🇵🇭63Philippines334\nPM🇵🇲508Saint Pierre and Miquelon\nPR🇵🇷1Puerto Rico334\nPS🇵🇸970Palestine324\nPW🇵🇼680Palau\nPG🇵🇬675Papua New Guinea\nPL🇵🇱48Poland333\nKP🇰🇵850North Korea\nPT🇵🇹351Portugal144\nPY🇵🇾595Paraguay333\nQA🇶🇦974Qatar\nRE🇷🇪262Réunion333\nRO🇷🇴40Romania333\nRU🇷🇺7Russia3322\nRW🇷🇼250Rwanda333\nSA🇸🇦966Saudi Arabia\nSD🇸🇩249Sudan234\nSN🇸🇳221Senegal234\nSG🇸🇬65Singapore44\nSH🇸🇭290Saint Helena23\nSH🇸🇭247Saint Helena4\nSB🇸🇧677Solomon Islands\nSL🇸🇱232Sierra Leone233\nSV🇸🇻503El Salvador44\nSM🇸🇲378San Marino334\nSO🇸🇴252Somalia233\nRS🇷🇸381Serbia234\nSS🇸🇸211South Sudan234\nST🇸🇹239São Tomé and Príncipe25\nSR🇸🇷597Suriname34\nSK🇸🇰421Slovakia\nSI🇸🇮386Slovenia\nSE🇸🇪46Sweden234\nSZ🇸🇿268Swaziland44\nSC🇸🇨248Seychelles1222\nSX🇸🇽1721Sint Maarten34\nSY🇸🇾963Syria\nTC🇹🇨1649Turks and Caicos Islands34\nTD🇹🇩235Chad2222\nTG🇹🇬228Togo233\nTH🇹🇭66Thailand144\nTJ🇹🇯992Tajikistan\nTK🇹🇰690Tokelau\nTM🇹🇲993Turkmenistan26\nTL🇹🇱670Timor-Leste\nTO🇹🇴676Tonga\nTT🇹🇹1868Trinidad and Tobago34\nTN🇹🇳216Tunisia233\nTR🇹🇷90Turkey334\nTV🇹🇻688Tuvalu\nTW🇹🇼886Taiwan\nTZ🇹🇿255Tanzania234\nUG🇺🇬256Uganda234\nUA🇺🇦380Ukraine2322\nUY🇺🇾598Uruguay44\nUS🇺🇸1United States334\nUZ🇺🇿998Uzbekistan27\nVA🇻🇦3Vatican City\nVC🇻🇨1784Saint Vincent and the Grenadines34\nVE🇻🇪58Venezuela334\nVG🇻🇬1284British Virgin Islands34\nVI🇻🇮1340US Virgin Islands34\nVN🇻🇳84Vietnam\nVU🇻🇺678Vanuatu\nWF🇼🇫681Wallis and Futuna\nWS🇼🇸685Samoa\nXK🇽🇰383Kosovo44\nYE🇾🇪967Yemen333\nZA🇿🇦27South Africa234\nZM🇿🇲260Zambia234\nZW🇿🇼263Zimbabwe234`;\n\nconst formatsCache: Record<string, RegExp> = {};\nexport const defaultPhoneNumberFormat = /(\\d{1,3})(\\d{1,3})?(\\d{1,3})?(\\d{1,3})?(\\d{1,3})?/;\n\nconst parsed = DATA\n .split('\\n')\n .map((str) => {\n const id = str.substr(0, 2);\n const flag = str.substr(2, 4);\n const code = `+${str.match(/\\d+/)![0]}`;\n const name = str.split(/\\d+/)[1];\n const format = str.match(/\\d+$/);\n const phoneFormat = getPhoneNumberFormat(format);\n\n return {\n id, flag, code, name, phoneFormat,\n };\n });\n\nfunction getPhoneNumberFormat(format: RegExpMatchArray | null) {\n if (!format) {\n return defaultPhoneNumberFormat;\n }\n\n const formatValue = format[0] as string;\n let phoneNumberFormat;\n\n if (!formatsCache[formatValue]) {\n const phoneNumberGroups = formatValue.split('').map(Number);\n phoneNumberFormat = phoneNumberGroups.reduce((result, count, i) => {\n return `${result}(\\\\d{1,${count}})${i > 0 ? '?' : ''}`;\n }, '');\n formatsCache[formatValue] = new RegExp(`${phoneNumberFormat}${'()?'.repeat(5 - phoneNumberGroups.length)}`);\n }\n\n return formatsCache[formatValue];\n}\n\nexport default parsed;\n","import useReducer, { StateReducer, Dispatch } from '../useReducer';\nimport countryList from '../../util/countries';\n\nexport type FormState = {\n streetLine1: string;\n streetLine2: string;\n city: string;\n state: string;\n countryIso2: string;\n postCode: string;\n fullName: string;\n email: string;\n phone: string;\n shipping: string;\n cardNumber: string;\n cardholder: string;\n expiry: string;\n cvv: string;\n billingCountry: string;\n billingZip: string;\n saveInfo: boolean;\n saveCredentials: boolean;\n formErrors: Record<string, string>;\n};\n\nexport type FormActions = (\n 'changeAddress1' | 'changeAddress2' | 'changeCity' | 'changeState' | 'changeCountry' |\n 'changePostCode' | 'changeFullName' | 'changeEmail' | 'changePhone' | 'changeShipping' | 'updateUserInfo' |\n 'changeCardNumber' | 'changeCardholder' | 'changeExpiryDate' | 'changeCvvCode' | 'changeBillingCountry' |\n 'changeBillingZip' | 'changeSaveInfo' | 'changeSaveCredentials' | 'setFormErrors'\n);\nexport type FormEditDispatch = Dispatch<FormActions>;\n\nconst INITIAL_STATE: FormState = {\n streetLine1: '',\n streetLine2: '',\n city: '',\n state: '',\n countryIso2: '',\n postCode: '',\n fullName: '',\n email: '',\n phone: '',\n shipping: '',\n cardNumber: '',\n cardholder: '',\n expiry: '',\n cvv: '',\n billingCountry: '',\n billingZip: '',\n saveInfo: true,\n saveCredentials: false,\n formErrors: {},\n};\n\nconst reducer: StateReducer<FormState, FormActions> = (state, action) => {\n switch (action.type) {\n case 'changeAddress1':\n return {\n ...state,\n streetLine1: action.payload,\n formErrors: {\n ...state.formErrors,\n streetLine1: undefined,\n },\n };\n case 'changeAddress2':\n return {\n ...state,\n streetLine2: action.payload,\n formErrors: {\n ...state.formErrors,\n streetLine2: undefined,\n },\n };\n case 'changeCity':\n return {\n ...state,\n city: action.payload,\n formErrors: {\n ...state.formErrors,\n city: undefined,\n },\n };\n case 'changeState':\n return {\n ...state,\n state: action.payload,\n formErrors: {\n ...state.formErrors,\n state: undefined,\n },\n };\n case 'changeCountry':\n return {\n ...state,\n countryIso2: action.payload,\n billingCountry: getBillingCountry(action.payload),\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.countryIso2) {\n return {\n ...state,\n ...action.payload,\n billingCountry: getBillingCountry(action.payload.countryIso2),\n };\n }\n return { ...state, ...action.payload };\n case 'setFormErrors':\n return {\n ...state,\n formErrors: {\n ...state.formErrors,\n ...action.payload,\n },\n };\n default:\n return state;\n }\n};\n\nfunction getBillingCountry(countryCode: string) {\n const country = countryList.find(({ id }) => id === countryCode);\n return country ? country.name : '';\n}\n\nconst usePaymentReducer = () => {\n return useReducer(reducer, INITIAL_STATE);\n};\n\nexport default usePaymentReducer;\n","import { 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 { ChangeEvent, RefObject } from 'react';\nimport React, { FC, memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\ntype OwnProps = {\n id?: string;\n value?: string;\n label?: string;\n error?: string;\n ref?: RefObject<HTMLSelectElement>;\n hasArrow?: boolean;\n placeholder?: string;\n onChange?: (e: ChangeEvent<HTMLSelectElement>) => void;\n children: React.ReactNode;\n};\n\nconst Select: FC<OwnProps> = (props) => {\n const {\n id,\n value,\n label,\n hasArrow,\n error,\n ref,\n placeholder,\n onChange,\n children,\n } = props;\n const labelText = error || label;\n const fullClassName = buildClassName(\n 'input-group',\n value && 'touched',\n error && 'error',\n labelText && 'with-label',\n hasArrow && 'with-arrow',\n 'input-group',\n );\n\n return (\n <div className={fullClassName}>\n <select\n className=\"form-control\"\n id={id}\n value={value || ''}\n onChange={onChange}\n placeholder={placeholder || label}\n ref={ref}\n >\n {children}\n </select>\n {labelText && id && (\n <label htmlFor={id}>{labelText}</label>\n )}\n </div>\n );\n};\n\nexport default memo(Select);\n","import React, {\n FC, useRef, useCallback, useEffect, memo,\n} from '../../lib/teact/teact';\n\nimport { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer';\nimport useFocusAfterAnimation from '../../hooks/useFocusAfterAnimation';\nimport useLang from '../../hooks/useLang';\nimport countryList from '../../util/countries';\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 dispatch: FormEditDispatch;\n};\n\nconst ShippingInfo: FC<OwnProps> = ({\n state,\n needEmail,\n needPhone,\n needName,\n needAddress,\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: e.target.value });\n }, [dispatch]);\n\n const handlePostCodeChange = useCallback((e) => {\n dispatch({ type: 'changePostCode', payload: e.target.value });\n }, [dispatch]);\n\n const handleFullNameChange = useCallback((e) => {\n dispatch({ type: 'changeFullName', payload: e.target.value });\n }, [dispatch]);\n\n const handleEmailChange = useCallback((e) => {\n dispatch({ type: 'changeEmail', payload: e.target.value });\n }, [dispatch]);\n\n const handlePhoneChange = useCallback((e) => {\n let { value } = e.target;\n value = `+${value.replace(/\\D/g, '')}`;\n if (phoneRef.current) {\n phoneRef.current.value = value;\n }\n dispatch({ type: 'changePhone', payload: value });\n }, [dispatch]);\n\n const handleSaveInfoChange = useCallback((e) => {\n dispatch({ type: 'changeSaveInfo', payload: e.target.value });\n }, [dispatch]);\n\n const { formErrors } = state;\n return (\n <div className=\"ShippingInfo\">\n <form>\n {needAddress ? (\n <div>\n <h5>{lang('PaymentShippingAddress')}</h5>\n <InputText\n ref={inputRef}\n label={lang('PaymentShippingAddress1Placeholder')}\n onChange={handleAddress1Change}\n value={state.streetLine1}\n inputMode=\"text\"\n error={formErrors.streetLine1}\n />\n <InputText\n label={lang('PaymentShippingAddress2Placeholder')}\n onChange={handleAddress2Change}\n value={state.streetLine2}\n inputMode=\"text\"\n error={formErrors.streetLine2}\n />\n <InputText\n label={lang('PaymentShippingCityPlaceholder')}\n onChange={handleCityChange}\n value={state.city}\n inputMode=\"text\"\n error={formErrors.city}\n />\n <InputText\n label={lang('PaymentShippingStatePlaceholder')}\n onChange={handleStateChange}\n value={state.state}\n inputMode=\"text\"\n error={formErrors.state}\n />\n <Select\n label={lang('PaymentShippingCountry')}\n placeholder={lang('PaymentShippingCountry')}\n onChange={handleCountryChange}\n value={state.countryIso2}\n hasArrow={Boolean(true)}\n id=\"shipping-country\"\n error={formErrors.countryIso2}\n ref={selectCountryRef}\n >\n {countryList.map(({ name, id }) => (\n <option\n value={id}\n className=\"county-item\"\n >\n {name}\n </option>\n ))}\n </Select>\n\n <InputText\n label={lang('PaymentShippingZipPlaceholder')}\n onChange={handlePostCodeChange}\n value={state.postCode}\n inputMode=\"text\"\n error={formErrors.postCode}\n />\n </div>\n ) : undefined}\n { needName || needEmail || needPhone ? (\n <h5>{lang('PaymentShippingReceiver')}</h5>\n ) : undefined }\n { needName && (\n <InputText\n label={lang('PaymentShippingName')}\n onChange={handleFullNameChange}\n value={state.fullName}\n inputMode=\"text\"\n error={formErrors.fullName}\n />\n ) }\n { needEmail && (\n <InputText\n label={lang('PaymentShippingEmailPlaceholder')}\n onChange={handleEmailChange}\n value={state.email}\n inputMode=\"email\"\n error={formErrors.email}\n />\n ) }\n { needPhone && (\n <InputText\n label={lang('PaymentShippingPhoneNumber')}\n onChange={handlePhoneChange}\n value={state.phone}\n inputMode=\"tel\"\n error={formErrors.phone}\n ref={phoneRef}\n />\n ) }\n <Checkbox\n label={lang('PaymentShippingSave')}\n subLabel={lang('PaymentShippingSaveInfo')}\n checked={Boolean(state.saveInfo)}\n onChange={handleSaveInfoChange}\n />\n </form>\n </div>\n );\n};\n\nexport default memo(ShippingInfo);\n","import React, {\n FC, useCallback, memo, useMemo, useEffect,\n} from '../../lib/teact/teact';\n\nimport { ShippingOption } from '../../types';\n\nimport { formatCurrency } from '../../util/formatCurrency';\nimport { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer';\nimport useLang from '../../hooks/useLang';\n\nimport RadioGroup from '../ui/RadioGroup';\n\nimport './Shipping.scss';\n\nexport type OwnProps = {\n state: FormState;\n shippingOptions: ShippingOption[];\n currency?: string;\n dispatch: FormEditDispatch;\n};\n\nconst Shipping: FC<OwnProps> = ({\n state,\n shippingOptions,\n currency,\n dispatch,\n}) => {\n const lang = useLang();\n\n useEffect(() => {\n if (!shippingOptions || state.shipping) {\n return;\n }\n dispatch({ type: 'changeShipping', payload: shippingOptions[0].id });\n }, [shippingOptions, state.shipping, dispatch]);\n\n const handleShippingSelect = useCallback((value) => {\n dispatch({ type: 'changeShipping', payload: value });\n }, [dispatch]);\n\n const options = useMemo(() => (shippingOptions.map(({ id: value, title: label, amount }) => ({\n label,\n subLabel: formatCurrency(amount, currency, lang.code),\n value,\n }))), [shippingOptions, currency, lang.code]);\n\n return (\n <div className=\"Shipping\">\n <form>\n <p>{lang('PaymentShippingMethod')}</p>\n <RadioGroup\n name=\"shipping-options\"\n options={options}\n onChange={handleShippingSelect}\n selected={state.shipping}\n />\n </form>\n </div>\n );\n};\n\nexport default memo(Shipping);\n","import React, {\n FC, memo,\n} from '../../lib/teact/teact';\n\nimport { LangCode, Price } from '../../types';\n\nimport { formatCurrency } from '../../util/formatCurrency';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport './Checkout.scss';\n\nexport type OwnProps = {\n invoiceContent?: {\n title?: string;\n text?: string;\n photoUrl?: string;\n };\n checkoutInfo?: {\n paymentMethod?: string;\n paymentProvider?: string;\n shippingAddress?: string;\n name?: string;\n phone?: string;\n shippingMethod?: string;\n };\n prices?: Price[];\n totalPrice?: number;\n shippingPrices?: Price[];\n currency?: string;\n};\n\nconst Checkout: FC<OwnProps> = ({\n invoiceContent,\n prices,\n shippingPrices,\n checkoutInfo,\n currency,\n totalPrice,\n}) => {\n const lang = useLang();\n\n const { photoUrl, title, text } = invoiceContent || {};\n const {\n paymentMethod,\n paymentProvider,\n shippingAddress,\n name,\n phone,\n shippingMethod,\n } = (checkoutInfo || {});\n\n return (\n <div className=\"Checkout\">\n <div className=\"description has-image\">\n {photoUrl && <img src={photoUrl} alt=\"\" />}\n <div className=\"text\">\n <h5>{title}</h5>\n <p>{text}</p>\n </div>\n </div>\n <div className=\"price-info\">\n { prices && prices.map((item) => (\n renderPaymentItem(lang.code, item.label, item.amount, currency)\n )) }\n { shippingPrices && shippingPrices.map((item) => (\n renderPaymentItem(lang.code, item.label, item.amount, currency)\n )) }\n { totalPrice !== undefined && (\n renderPaymentItem(lang.code, lang('Checkout.TotalAmount'), totalPrice, currency, true)\n ) }\n </div>\n <div className=\"invoice-info\">\n {paymentMethod && renderCheckoutItem('icon-card', paymentMethod, lang('PaymentCheckoutMethod'))}\n {paymentProvider && renderCheckoutItem(\n buildClassName('provider', paymentProvider.toLowerCase()),\n paymentProvider,\n lang('PaymentCheckoutProvider'),\n )}\n {shippingAddress && renderCheckoutItem('icon-location', shippingAddress, lang('PaymentShippingAddress'))}\n {name && renderCheckoutItem('icon-user', name, lang('PaymentCheckoutName'))}\n {phone && renderCheckoutItem('icon-phone', phone, lang('PaymentCheckoutPhoneNumber'))}\n {shippingMethod && renderCheckoutItem('icon-truck', shippingMethod, lang('PaymentCheckoutShippingMethod'))}\n </div>\n </div>\n );\n};\n\nfunction renderPaymentItem(\n langCode: LangCode | undefined, title: string, value: number, currency?: string, main = false,\n) {\n return (\n <div className={`price-info-item ${main ? 'price-info-item-main' : ''}`}>\n <div className=\"title\">\n { title }\n </div>\n <div className=\"value\">\n {formatCurrency(value, currency, langCode)}\n </div>\n </div>\n );\n}\n\nfunction renderCheckoutItem(icon: string, title: string, data: string) {\n return (\n <div className=\"checkout-info-item\">\n <i className={icon}> </i>\n <div className=\"info\">\n <div className=\"title\">\n { title }\n </div>\n <p className=\"data\">\n { data }\n </p>\n </div>\n </div>\n );\n}\n\nexport default memo(Checkout);\n","import React, {\n FC, memo, useCallback, useRef,\n} from '../../lib/teact/teact';\n\nimport { formatCardExpiry } from '../middle/helpers/inputFormatters';\n\nimport InputText from '../ui/InputText';\nimport useLang from '../../hooks/useLang';\n\nconst MAX_FIELD_LENGTH = 5;\n\nexport type OwnProps = {\n value: string;\n error?: string;\n onChange: (value: string) => void;\n};\n\nconst ExpiryInput : FC<OwnProps> = ({ value, error, onChange }) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const expiryInputRef = useRef<HTMLInputElement>(null);\n\n const handleKeyDown = useCallback((e) => {\n if (e.key === 'Backspace' && value.charAt(value.length - 1) === '/') {\n const newValue = value.slice(0, value.length - 1);\n if (expiryInputRef.current) {\n expiryInputRef.current.value = newValue;\n }\n }\n }, [value]);\n\n const handleChange = useCallback((e) => {\n onChange(formatCardExpiry(e.target.value));\n }, [onChange]);\n\n return (\n <InputText\n label={lang('PaymentCardExpireDate')}\n ref={expiryInputRef}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n value={value}\n error={error}\n inputMode=\"numeric\"\n maxLength={MAX_FIELD_LENGTH}\n />\n );\n};\n\nexport default memo(ExpiryInput);\n","export function formatCardExpiry(input: string) {\n input = input.replace(/[^\\d]/g, '').slice(0, 4);\n const parts = input.match(/.{1,2}/g);\n if (parts?.[0] && Number(parts[0]) > 12) {\n parts[0] = '12';\n }\n if (parts?.[0] && parts[0].length === 2 && !parts[1]) {\n parts[1] = '';\n }\n return parts ? parts.join('/') : '';\n}\n\nexport function formatCardNumber(input: string) {\n input = input.replace(/[^\\d]/g, '');\n const parts = input.match(/.{1,4}/g);\n return parts ? parts.join(' ') : '';\n}\n","import React, {\n FC, memo, useCallback, useState, useRef, useEffect,\n} from '../../lib/teact/teact';\n\nimport { formatCardNumber } from '../middle/helpers/inputFormatters';\nimport { detectCardType, CardType } from '../common/helpers/detectCardType';\nimport useFocusAfterAnimation from '../../hooks/useFocusAfterAnimation';\nimport useLang from '../../hooks/useLang';\n\nimport InputText from '../ui/InputText';\n\nimport './CardInput.scss';\n\nimport mastercardIconPath from '../../assets/mastercard.svg';\nimport visaIconPath from '../../assets/visa.svg';\n\nconst CARD_NUMBER_MAX_LENGTH = 23;\n\nexport type OwnProps = {\n value: string;\n error?: string;\n onChange: (value: string) => void;\n};\n\nconst CardInput : FC<OwnProps> = ({ value, error, onChange }) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const cardNumberRef = useRef<HTMLInputElement>(null);\n\n useFocusAfterAnimation(cardNumberRef);\n\n const [cardType, setCardType] = useState<number>(CardType.Default);\n useEffect(() => {\n const newCardType = detectCardType(value);\n setCardType(newCardType);\n // eslint-disable-next-line\n }, []);\n\n const handleChange = useCallback((e) => {\n const newValue = formatCardNumber(e.target.value);\n const newCardType = detectCardType(e.target.value);\n setCardType(newCardType);\n onChange(newValue);\n if (cardNumberRef.current) {\n cardNumberRef.current.value = newValue;\n }\n }, [onChange, cardNumberRef]);\n\n const cardIcon = getCardIcon(cardType);\n\n return (\n <div className=\"CardInput\">\n <span className=\"left-addon\">{cardIcon}</span>\n <InputText\n ref={cardNumberRef}\n label={lang('PaymentCardNumber')}\n onChange={handleChange}\n value={value}\n inputMode=\"numeric\"\n className={cardType ? 'has-left-addon' : ''}\n error={error}\n maxLength={CARD_NUMBER_MAX_LENGTH}\n />\n </div>\n );\n};\n\nexport default memo(CardInput);\n\nfunction getCardIcon(cardType: CardType) {\n switch (cardType) {\n case CardType.Mastercard:\n return <img src={mastercardIconPath} alt=\"\" />;\n case CardType.Visa:\n return <img src={visaIconPath} alt=\"\" />;\n default:\n return undefined;\n }\n}\n","import React, {\n FC, useCallback, memo, useRef, useEffect,\n} from '../../lib/teact/teact';\n\nimport { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer';\nimport useLang from '../../hooks/useLang';\nimport countryList from '../../util/countries';\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 dispatch: FormEditDispatch;\n};\n\nconst PaymentInfo: FC<OwnProps> = ({\n state,\n canSaveCredentials,\n needCardholderName,\n needCountry,\n needZip,\n dispatch,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const selectCountryRef = useRef<HTMLSelectElement>(null);\n\n useEffect(() => {\n if (selectCountryRef.current\n && selectCountryRef.current.value !== state.billingCountry) {\n selectCountryRef.current.value = state.billingCountry;\n }\n }, [state.billingCountry]);\n\n const handleCardNumberChange = useCallback((value) => {\n dispatch({ type: 'changeCardNumber', payload: value });\n }, [dispatch]);\n\n const handleCardholderChange = useCallback((e) => {\n dispatch({ type: 'changeCardholder', payload: e.target.value.toUpperCase() });\n }, [dispatch]);\n\n const handleExpiryChange = useCallback((value) => {\n dispatch({ type: 'changeExpiryDate', payload: value });\n }, [dispatch]);\n\n const handleCvvChange = useCallback((e) => {\n dispatch({ type: 'changeCvvCode', payload: e.target.value });\n }, [dispatch]);\n\n const handleCountryChange = useCallback((e) => {\n dispatch({ type: 'changeBillingCountry', payload: e.target.value });\n }, [dispatch]);\n\n const handleBillingPostCodeChange = useCallback((e) => {\n dispatch({ type: 'changeBillingZip', payload: e.target.value });\n }, [dispatch]);\n\n const handleChangeSaveCredentials = useCallback((e) => {\n dispatch({ type: 'changeSaveCredentials', payload: e.target.value });\n }, [dispatch]);\n\n const lang = useLang();\n\n const { formErrors = {} } = state;\n\n return (\n <div className=\"PaymentInfo\">\n <form>\n <h5>{lang('PaymentCardTitle')}</h5>\n <CardInput\n onChange={handleCardNumberChange}\n value={state.cardNumber}\n error={formErrors.cardNumber}\n />\n { needCardholderName && (\n <InputText\n label={lang('PaymentCardName')}\n onChange={handleCardholderChange}\n value={state.cardholder}\n inputMode=\"text\"\n error={formErrors.cardholder}\n />\n )}\n <section className=\"inline-inputs\">\n <ExpiryInput\n value={state.expiry}\n onChange={handleExpiryChange}\n error={formErrors.expiry}\n />\n <InputText\n label={lang('lng_payments_card_cvc')}\n onChange={handleCvvChange}\n value={state.cvv}\n inputMode=\"numeric\"\n maxLength={3}\n error={formErrors.cvv}\n />\n </section>\n { needCountry || needZip ? (\n <h5>{lang('PaymentBillingAddress')}</h5>\n ) : undefined }\n { needCountry && (\n <Select\n label={lang('PaymentShippingCountry')}\n placeholder={lang('PaymentShippingCountry')}\n onChange={handleCountryChange}\n value={state.billingCountry}\n hasArrow={Boolean(true)}\n id=\"billing-country\"\n error={formErrors.billingCountry}\n ref={selectCountryRef}\n >\n {\n countryList.map(({ name }) => (\n <option\n value={name}\n className=\"county-item\"\n >\n {name}\n </option>\n ))\n }\n </Select>\n ) }\n { needZip && (\n <InputText\n label={lang('PaymentShippingZipPlaceholder')}\n onChange={handleBillingPostCodeChange}\n value={state.billingZip}\n inputMode=\"text\"\n error={formErrors.billingZip}\n />\n )}\n { canSaveCredentials && (\n <Checkbox\n label={lang('PaymentCardSavePaymentInformation')}\n checked={state.saveCredentials}\n onChange={handleChangeSaveCredentials}\n />\n ) }\n </form>\n </div>\n );\n};\n\nexport default memo(PaymentInfo);\n","import React, { FC, memo } from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\n\nimport './ConfirmPayment.scss';\n\nexport type OwnProps = {\n url: string;\n};\n\nconst ConfirmPayment: FC<OwnProps> = ({ url }) => {\n const lang = useLang();\n\n return (\n <div className=\"ConfirmPayment\">\n <iframe\n src={url}\n title={lang('Checkout.WebConfirmation.Title')}\n allow=\"payment\"\n sandbox=\"allow-forms allow-scripts allow-same-origin allow-top-navigation\"\n className=\"ConfirmPayment__content\"\n />\n </div>\n );\n};\n\nexport default memo(ConfirmPayment);\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { GlobalState } from '../../global/types';\nimport { PaymentStep, ShippingOption, Price } from '../../types';\n\nimport { formatCurrency } from '../../util/formatCurrency';\nimport { detectCardTypeText } from '../common/helpers/detectCardType';\nimport usePaymentReducer, { FormState } from '../../hooks/reducers/usePaymentReducer';\nimport useLang from '../../hooks/useLang';\n\nimport ShippingInfo from './ShippingInfo';\nimport Shipping from './Shipping';\nimport Checkout from './Checkout';\nimport PaymentInfo from './PaymentInfo';\nimport Button from '../ui/Button';\nimport Modal from '../ui/Modal';\nimport Transition from '../ui/Transition';\nimport Spinner from '../ui/Spinner';\nimport ConfirmPayment from './ConfirmPayment';\n\nimport './PaymentModal.scss';\n\nconst DEFAULT_PROVIDER = 'stripe';\nconst DONATE_PROVIDER = 'smartglocal';\nconst SUPPORTED_PROVIDERS = new Set([DEFAULT_PROVIDER, DONATE_PROVIDER]);\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n};\n\ntype StateProps = {\n nameRequested?: boolean;\n shippingAddressRequested?: boolean;\n phoneRequested?: boolean;\n emailRequested?: boolean;\n flexible?: boolean;\n phoneToProvider?: boolean;\n emailToProvider?: boolean;\n currency?: string;\n prices?: Price[];\n isProviderError: boolean;\n needCardholderName?: boolean;\n needCountry?: boolean;\n needZip?: boolean;\n confirmPaymentUrl?: string;\n};\n\ntype GlobalStateProps = Pick<GlobalState['payment'], (\n 'step' | 'shippingOptions' |\n 'savedInfo' | 'canSaveCredentials' | 'nativeProvider' | 'passwordMissing' | 'invoiceContent' |\n 'error'\n)>;\n\nconst Invoice: FC<OwnProps & StateProps & GlobalStateProps> = ({\n isOpen,\n onClose,\n step,\n shippingOptions,\n savedInfo,\n canSaveCredentials,\n nameRequested,\n shippingAddressRequested,\n phoneRequested,\n emailRequested,\n phoneToProvider,\n emailToProvider,\n currency,\n passwordMissing,\n isProviderError,\n invoiceContent,\n nativeProvider,\n prices,\n needCardholderName,\n needCountry,\n needZip,\n confirmPaymentUrl,\n error,\n}) => {\n const {\n validateRequestedInfo,\n sendPaymentForm,\n setPaymentStep,\n sendCredentialsInfo,\n clearPaymentError,\n } = getActions();\n\n const [paymentState, paymentDispatch] = usePaymentReducer();\n const [isLoading, setIsLoading] = useState(false);\n const lang = useLang();\n const canRenderFooter = step !== PaymentStep.ConfirmPayment;\n\n useEffect(() => {\n if (step || error) {\n setIsLoading(false);\n }\n }, [step, error]);\n\n useEffect(() => {\n if (error?.field) {\n paymentDispatch({\n type: 'setFormErrors',\n payload: {\n [error.field]: error.message,\n },\n });\n }\n }, [error, paymentDispatch]);\n\n useEffect(() => {\n if (savedInfo) {\n const {\n name: fullName, phone, email, shippingAddress,\n } = savedInfo;\n paymentDispatch({\n type: 'updateUserInfo',\n payload: {\n fullName,\n phone: phone && phone.charAt(0) !== '+'\n ? `+${phone}`\n : phone,\n email,\n ...(shippingAddress || {}),\n },\n });\n }\n }, [savedInfo, paymentDispatch]);\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 />\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 />\n );\n case PaymentStep.Checkout:\n return (\n <Checkout\n prices={prices}\n shippingPrices={paymentState.shipping && shippingOptions\n ? getShippingPrices(shippingOptions, paymentState.shipping)\n : undefined}\n totalPrice={totalPrice}\n invoiceContent={invoiceContent}\n checkoutInfo={checkoutInfo}\n currency={currency}\n />\n );\n case PaymentStep.ConfirmPayment:\n return (\n <ConfirmPayment\n url={confirmPaymentUrl!}\n />\n );\n default:\n return undefined;\n }\n }\n\n const validateRequest = useCallback(() => {\n const { saveInfo } = paymentState;\n const requestInfo = getRequestInfo(paymentState);\n validateRequestedInfo({ requestInfo, saveInfo });\n }, [validateRequestedInfo, paymentState]);\n\n const sendCredentials = useCallback(() => {\n const credentials = getCredentials(paymentState);\n sendCredentialsInfo({\n credentials,\n });\n }, [sendCredentialsInfo, paymentState]);\n\n const sendForm = useCallback(() => {\n sendPaymentForm({\n shippingOptionId: paymentState.shipping,\n saveCredentials: paymentState.saveCredentials,\n });\n }, [sendPaymentForm, paymentState]);\n\n const setStep = useCallback((nextStep) => {\n setPaymentStep({ step: nextStep });\n }, [setPaymentStep]);\n\n const handleButtonClick = useCallback(() => {\n setIsLoading(true);\n switch (step) {\n case PaymentStep.ShippingInfo:\n return validateRequest();\n case PaymentStep.Shipping:\n return setStep(PaymentStep.PaymentInfo);\n case PaymentStep.PaymentInfo:\n return sendCredentials();\n case PaymentStep.Checkout:\n return sendForm();\n default:\n return () => {\n };\n }\n }, [step, validateRequest, setStep, sendCredentials, sendForm]);\n\n const modalHeader = useMemo(() => {\n switch (step) {\n case PaymentStep.ShippingInfo:\n return lang('PaymentShippingInfo');\n case PaymentStep.Shipping:\n return lang('PaymentShippingMethod');\n case PaymentStep.PaymentInfo:\n return lang('PaymentCardInfo');\n case PaymentStep.Checkout:\n return lang('PaymentCheckout');\n case PaymentStep.ConfirmPayment:\n return lang('Checkout.WebConfirmation.Title');\n default:\n return '';\n }\n }, [step, lang]);\n\n const buttonText = useMemo(() => {\n switch (step) {\n case PaymentStep.Checkout:\n return lang('Checkout.PayPrice', formatCurrency(totalPrice, currency, lang.code));\n default:\n return lang('Next');\n }\n }, [step, lang, currency, totalPrice]);\n\n if (isProviderError) {\n return (\n <Modal\n className=\"error\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <p>\n Sorry, Telegram WebZ doesn&apos;t support payments with this provider yet. <br />\n Please use one of our mobile apps to do this.\n </p>\n <Button\n isText\n onClick={onClose}\n >\n {lang('OK')}\n </Button>\n </Modal>\n );\n }\n\n return (\n <Modal\n className=\"PaymentModal\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <div className=\"header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n className=\"close-button\"\n color=\"translucent\"\n round\n size=\"smaller\"\n onClick={onClose}\n ariaLabel=\"Close\"\n >\n <i className=\"icon-close\" />\n </Button>\n <h3>{modalHeader}</h3>\n </div>\n {step !== undefined ? (\n <Transition name=\"slide\" activeKey={step}>\n <div className=\"content custom-scroll\">\n {renderModalContent(step)}\n </div>\n </Transition>\n ) : (\n <div className=\"empty-content\">\n <Spinner color=\"gray\" />\n </div>\n )}\n {canRenderFooter && (\n <div className=\"footer\">\n <Button\n type=\"submit\"\n onClick={handleButtonClick}\n disabled={isLoading}\n isLoading={isLoading}\n >\n {buttonText}\n </Button>\n </div>\n )}\n {error && !error.field && renderError()}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps & GlobalStateProps => {\n const {\n step,\n shippingOptions,\n savedInfo,\n canSaveCredentials,\n invoice,\n invoiceContent,\n nativeProvider,\n nativeParams,\n passwordMissing,\n error,\n confirmPaymentUrl,\n } = global.payment;\n\n const isProviderError = Boolean(invoice && (!nativeProvider || !SUPPORTED_PROVIDERS.has(nativeProvider)));\n const { needCardholderName, needCountry, needZip } = (nativeParams || {});\n const {\n nameRequested,\n phoneRequested,\n emailRequested,\n shippingAddressRequested,\n flexible,\n phoneToProvider,\n emailToProvider,\n currency,\n prices,\n } = (invoice || {});\n\n return {\n step,\n shippingOptions,\n savedInfo,\n canSaveCredentials,\n nativeProvider,\n passwordMissing,\n nameRequested,\n shippingAddressRequested,\n phoneRequested,\n emailRequested,\n flexible,\n phoneToProvider,\n emailToProvider,\n currency,\n prices,\n isProviderError,\n invoiceContent,\n needCardholderName,\n needCountry,\n needZip,\n error,\n confirmPaymentUrl,\n };\n },\n)(Invoice));\n\nfunction findShippingOption(shippingOptions: ShippingOption[], optionId: string) {\n return shippingOptions.find(({ id }) => id === optionId);\n}\n\nfunction getShippingPrices(shippingOptions: ShippingOption[], shippingOption: string) {\n const option = findShippingOption(shippingOptions, shippingOption);\n return option?.prices;\n}\n\nfunction getTotalPrice(prices: Price[] = [], shippingOptions: ShippingOption[] | undefined, shippingOption: string) {\n const shippingPrices = shippingOptions\n ? getShippingPrices(shippingOptions, shippingOption)\n : [];\n let total = 0;\n const totalPrices = prices.concat(shippingPrices || []);\n total = totalPrices.reduce((acc, cur) => {\n return acc + cur.amount;\n }, total);\n return total;\n}\n\nfunction getCheckoutInfo(state: FormState, shippingOptions: ShippingOption[] | undefined, paymentProvider: string) {\n const cardTypeText = detectCardTypeText(state.cardNumber);\n const paymentMethod = `${cardTypeText} *${state.cardNumber.slice(-4)}`;\n const shippingAddress = state.streetLine1\n ? `${state.streetLine1}, ${state.city}, ${state.countryIso2}`\n : undefined;\n const { phone, fullName: name } = state;\n const shippingOption = shippingOptions ? findShippingOption(shippingOptions, state.shipping) : undefined;\n const shippingMethod = shippingOption?.title;\n return {\n paymentMethod,\n paymentProvider,\n shippingAddress,\n name,\n phone,\n shippingMethod,\n };\n}\n\nfunction getRequestInfo(paymentState: FormState) {\n const {\n streetLine1,\n streetLine2,\n city,\n state,\n countryIso2,\n postCode,\n fullName: name,\n phone,\n email,\n } = paymentState;\n\n const shippingAddress = {\n streetLine1,\n streetLine2,\n city,\n state,\n countryIso2,\n postCode,\n };\n\n return {\n name,\n phone,\n email,\n shippingAddress,\n };\n}\n\nfunction getCredentials(paymentState: FormState) {\n const {\n cardNumber, cardholder, expiry, cvv, billingCountry, billingZip,\n } = paymentState;\n const [expiryMonth, expiryYear] = expiry.split('/');\n const data = {\n cardNumber,\n cardholder,\n expiryMonth,\n expiryYear,\n cvv,\n country: billingCountry,\n zip: billingZip,\n };\n\n return {\n data,\n };\n}\n","import React, {\n FC, memo, useMemo,\n} from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport { Price } from '../../types';\nimport { ApiShippingAddress } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport Checkout from './Checkout';\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nimport './PaymentModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n};\n\ntype StateProps = {\n prices?: Price[];\n shippingPrices: any;\n totalAmount?: number;\n currency?: string;\n info?: {\n shippingAddress?: ApiShippingAddress;\n phone?: string;\n name?: string;\n };\n photoUrl?: string;\n text?: string;\n title?: string;\n credentialsTitle?: string;\n shippingMethod?: string;\n};\n\nconst ReceiptModal: FC<OwnProps & StateProps> = ({\n isOpen,\n onClose,\n prices,\n shippingPrices,\n totalAmount,\n currency,\n info,\n photoUrl,\n text,\n title,\n credentialsTitle,\n shippingMethod,\n}) => {\n const lang = useLang();\n const checkoutInfo = useMemo(() => {\n return getCheckoutInfo(credentialsTitle, info, shippingMethod);\n }, [info, shippingMethod, credentialsTitle]);\n\n return (\n <Modal\n className=\"PaymentModal PaymentModal-receipt\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <div>\n <div className=\"header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n className=\"close-button\"\n color=\"translucent\"\n round\n size=\"smaller\"\n onClick={onClose}\n ariaLabel=\"Close\"\n >\n <i className=\"icon-close\" />\n </Button>\n <h3> {lang('PaymentReceipt')} </h3>\n </div>\n <div className=\"receipt-content custom-scroll\">\n <Checkout\n prices={prices}\n shippingPrices={shippingPrices}\n totalPrice={totalAmount}\n invoiceContent={{\n photoUrl,\n text,\n title,\n }}\n checkoutInfo={checkoutInfo}\n currency={currency}\n />\n </div>\n </div>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { receipt } = global.payment;\n const {\n currency,\n prices,\n info,\n totalAmount,\n credentialsTitle,\n shippingPrices,\n shippingMethod,\n photoUrl,\n text,\n title,\n } = (receipt || {});\n\n return {\n currency,\n prices,\n info,\n totalAmount,\n credentialsTitle,\n shippingPrices,\n shippingMethod,\n photoUrl,\n text,\n title,\n };\n },\n)(ReceiptModal));\n\nfunction getCheckoutInfo(paymentMethod?: string,\n info?:\n { phone?: string;\n name?: string;\n shippingAddress?: ApiShippingAddress;\n },\n shippingMethod?: string) {\n if (!info) {\n return { paymentMethod };\n }\n const { shippingAddress } = info;\n const fullAddress = shippingAddress?.streetLine1\n ? `${shippingAddress.streetLine1}, ${shippingAddress.city}, ${shippingAddress.countryIso2}`\n : undefined;\n const { phone, name } = info;\n return {\n paymentMethod,\n paymentProvider: 'Stripe',\n shippingAddress: fullAddress,\n name,\n phone,\n shippingMethod,\n };\n}\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport { MIN_PASSWORD_LENGTH } from '../../config';\nimport { IS_TOUCH_ENV, IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport Button from '../ui/Button';\n\ntype OwnProps = {\n submitLabel?: string;\n error?: string;\n hint?: string;\n placeholder?: string;\n isLoading?: boolean;\n isPasswordVisible?: boolean;\n clearError: NoneToVoidFunction;\n onChangePasswordVisibility: (state: boolean) => void;\n onInputChange?: (password: string) => void;\n onSubmit: (password: string) => void;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\n\nconst PasswordForm: FC<OwnProps> = ({\n isLoading = false,\n isPasswordVisible,\n error,\n hint,\n placeholder = 'Password',\n submitLabel = 'Next',\n clearError,\n onChangePasswordVisibility,\n onInputChange,\n onSubmit,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n const lang = useLang();\n\n const [password, setPassword] = useState('');\n const [canSubmit, setCanSubmit] = useState(false);\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n useEffect(() => {\n if (error) {\n requestAnimationFrame(() => {\n inputRef.current!.focus();\n inputRef.current!.select();\n });\n }\n }, [error]);\n\n function onPasswordChange(e: ChangeEvent<HTMLInputElement>) {\n if (error) {\n clearError();\n }\n\n const { target } = e;\n setPassword(target.value);\n setCanSubmit(target.value.length >= MIN_PASSWORD_LENGTH);\n if (onInputChange) {\n onInputChange(target.value);\n }\n }\n\n function togglePasswordVisibility() {\n onChangePasswordVisibility(!isPasswordVisible);\n }\n\n function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n\n if (isLoading) {\n return;\n }\n\n if (canSubmit) {\n onSubmit(password);\n }\n }\n\n return (\n <form action=\"\" onSubmit={handleSubmit} autoComplete=\"off\">\n <div\n className={buildClassName('input-group password-input', password && 'touched', error && 'error')}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n <input\n ref={inputRef}\n className=\"form-control\"\n type={isPasswordVisible ? 'text' : 'password'}\n id=\"sign-in-password\"\n value={password || ''}\n autoComplete=\"current-password\"\n onChange={onPasswordChange}\n dir=\"auto\"\n />\n <label>{error || hint || placeholder}</label>\n <div\n className=\"toggle-password\"\n onClick={togglePasswordVisibility}\n role=\"button\"\n tabIndex={0}\n title=\"Toggle password visibility\"\n >\n <i className={isPasswordVisible ? 'icon-eye' : 'icon-eye-closed'} />\n </div>\n </div>\n {canSubmit && (\n <Button type=\"submit\" ripple isLoading={isLoading}>\n {submitLabel}\n </Button>\n )}\n </form>\n );\n};\n\nexport default memo(PasswordForm);\n","import React, {\n FC, useState, useEffect, useCallback, memo,\n} 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 getAnimationData from './helpers/animatedAssets';\n\nimport AnimatedSticker from './AnimatedSticker';\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 [closeMonkeyData, setCloseMonkeyData] = useState<string>();\n const [peekMonkeyData, setPeekMonkeyData] = useState<string>();\n const [isFirstMonkeyLoaded, setIsFirstMonkeyLoaded] = useState(false);\n const [isPeekShown, setIsPeekShown] = useState(false);\n\n useEffect(() => {\n if (!closeMonkeyData) {\n getAnimationData('MonkeyClose').then(setCloseMonkeyData);\n } else {\n setTimeout(() => setIsPeekShown(true), PEEK_MONKEY_SHOW_DELAY);\n }\n }, [closeMonkeyData]);\n\n useEffect(() => {\n if (!peekMonkeyData) {\n getAnimationData('MonkeyPeek').then(setPeekMonkeyData);\n }\n }, [peekMonkeyData]);\n\n const handleFirstMonkeyLoad = useCallback(() => setIsFirstMonkeyLoaded(true), []);\n\n return (\n <div id=\"monkey\" className={isBig ? 'big' : ''}>\n {!isFirstMonkeyLoaded && (\n <div className=\"monkey-preview\" />\n )}\n {closeMonkeyData && (\n <AnimatedSticker\n id=\"closeMonkey\"\n size={isBig ? STICKER_SIZE_TWO_FA : STICKER_SIZE}\n className={isPeekShown ? 'hidden' : 'shown'}\n animationData={closeMonkeyData}\n playSegment={SEGMENT_COVER_EYES}\n noLoop\n onLoad={handleFirstMonkeyLoad}\n />\n )}\n {peekMonkeyData && (\n <AnimatedSticker\n id=\"peekMonkey\"\n size={isBig ? STICKER_SIZE_TWO_FA : STICKER_SIZE}\n className={isPeekShown ? 'shown' : 'hidden'}\n animationData={peekMonkeyData}\n playSegment={isPasswordVisible ? SEGMENT_UNCOVER_EYE : SEGMENT_COVER_EYE}\n noLoop\n />\n )}\n </div>\n );\n};\n\nexport default memo(PasswordMonkey);\n","import React, {\n FC, 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 { ChangeEvent } from 'react';\nimport React, {\n FC, 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":["cache","Map","useBlurSync","dataUri","blurredRef","useRef","isChanged","useOnChange","current","undefined","img","Image","src","width","canvas","imgToCanvas","fastBlur","getContext","height","toDataURL","blurredAsync","isDisabled","delay","get","timeoutRef","forceUpdate","useForceUpdate","clearTimeout","useEffect","onload","blurredDataUri","size","clear","set","window","setTimeout","useBlur","Boolean","createGhost","source","origin","ghost","document","createElement","classList","add","draggable","oncontextmenu","stopEvent","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","memo","withGlobal","global","isDownloading","selectIsDownloading","isProtected","selectIsMessageProtected","mediaData","isVideo","isZoomed","fileName","isAvatar","canReport","onReport","onCloseMediaViewer","onForward","onZoomToggle","downloadMessageMedia","cancelMessageMediaDownload","getActions","loadProgress","downloadProgress","useMediaWithLoadProgress","getMessageMediaHash","handleDownloadClick","useCallback","lang","useLang","MenuButton","useMemo","onTrigger","isOpen","Button","round","color","className","onClick","ariaLabel","IS_SINGLE_COLUMN_LAYOUT","DropdownMenu","trigger","positionX","MenuItem","icon","Math","href","download","ProgressSpinner","progress","noCross","renderDownloadButton","text","isHidden","isForVideo","isMultiline","setIsMultiline","useState","footerContent","checkIsMultiline","clientHeight","REM","handleResize","throttle","addEventListener","removeEventListener","classNames","buildClassName","e","stopPropagation","dir","prop","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","units","bytes","number","floor","log","toFixed","PLAYBACK_RATES","bufferedRanges","bufferedProgress","currentTime","duration","fileSize","isForceMobileVersion","isPlayed","isFullscreenSupported","isFullscreen","isVisible","isBuffered","volume","isMuted","playbackRate","onChangeFullscreen","onVolumeClick","onVolumeChange","onPlaybackRateChange","onPlayPause","setVisibility","onSeek","isPlaybackMenuOpen","openPlaybackMenu","closePlaybackMenu","useFlag","seekerRef","isSeekingRef","isSeeking","timeout","body","remove","handleSeek","left","getBoundingClientRect","clientX","MouseEvent","targetTouches","max","min","handleStartSeek","handleStopSeek","captureEvents","onCapture","onRelease","onDrag","volumeIcon","percentagePlayed","ref","map","start","end","renderSeekLine","ripple","IS_IOS","RangeSlider","bold","value","onChange","formatMediaDuration","renderTime","loadedPercent","totalSize","formatFileSize","Menu","positionY","autoClose","onClose","rate","disabled","url","isGif","posterData","posterSize","isMediaViewerOpen","noPlay","toggleControls","areControlsVisible","setMediaViewerVolume","setMediaViewerMuted","setMediaViewerPlaybackRate","videoRef","setIsPlayed","IS_TOUCH_ENV","setCurrentTime","setFullscreen","exitFullscreen","elRef","setIsFullscreen","useLayoutEffect","listener","listenerEnter","listenerExit","video","PLATFORM_ENV","requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","mozRequestFullScreen","mozCancelFullScreen","webkitCancelFullScreen","webkitExitFullscreen","useFullscreenStatus","bufferingHandlers","useBuffering","shouldRender","shouldRenderSpinner","transitionClassNames","spinnerClassNames","useShowTransition","shouldRenderPlayButton","playButtonClassNames","pause","safePlay","togglePlayState","useVideoCleanup","handleMouseMove","handleMouseOut","target","handleTimeUpdate","currentTarget","handleEnded","handleFullscreenChange","position","handleVolumeChange","newVolume","handleVolumeMuted","handlePlaybackRateChange","newPlaybackRate","togglePayingStateBySpace","key","preventDefault","wrapperStyle","videoStyle","onMouseMove","onMouseOut","autoPlay","playsInline","loop","muted","onPlay","onEnded","onDoubleClick","onTimeUpdate","join","square","ownProps","chatId","threadId","messageId","avatarOwnerId","profilePhotoIndex","mediaViewer","selectChatMessage","senderId","avatarOwner","selectUser","selectChat","selectScheduledMessage","props","isActive","animationLevel","isFooterHidden","onFooterClick","setIsFooterHidden","photo","getMessagePhoto","getMessageVideo","webPagePhoto","getMessageWebPagePhoto","webPageVideo","getMessageWebPageVideo","isDocumentPhoto","isMessageDocumentPhoto","isDocumentVideo","isMessageDocumentVideo","isPhoto","isFromSharedMedia","isFromSearch","isGhostAnimation","getMediaHash","isFull","photos","getChatAvatarHash","pictogramBlobUrl","useMedia","ApiMediaFormat","previewMediaHash","previewBlobUrl","fullMediaBlobUrl","getMessageMediaFormat","localBlobUrl","blobUrl","bestImageData","thumbDataUri","getMessageMediaThumbDataUri","videoSize","getMessageFileSize","dimensions","getMessageDocument","mediaSize","getPhotoFullDimensions","getVideoDimensions","AVATAR_FULL_DIMENSIONS","renderPhoto","calculateMediaViewerDimensions","textParts","renderMessageText","hasFooter","onContextMenu","imageSize","canDrag","Spinner","renderVideoPreview","alt","ANIMATION_DURATION","cancelAnimation","SwipeDirection","getMessageId","selectMessage","rest","containerRef","activeSlideRef","transformRef","x","y","scale","swipeDirectionRef","isActiveRef","activeMessageId","setActiveMessageId","setTransform","selectMessageDebounced","useDebouncedCallback","clearSwipeDirectionDebounced","setIsActiveDebounced","handleToggleFooterVisibility","isFooter","innerHeight","pageY","pageX","innerWidth","useTimeout","lastTransform","lastDragOffset","lastZoomCenter","panDelta","initialContentRect","content","lastGestureTime","Date","now","setLastGestureTime","debounce","changeSlide","direction","mId","offset","animateNumber","from","to","timing","timingFunctions","onUpdate","isNotPassive","excludedClosestSelector","checkIfControlTarget","arePropsShallowEqual","event","captureEvent","dragOffsetX","dragOffsetY","touches","IOS_SCREEN_EDGE_THRESHOLD","absOffsetX","abs","absOffsetY","h","Vertical","Horizontal","onZoom","zoomFactor","initialCenterX","initialCenterY","currentCenterX","currentCenterY","MAX_ZOOM","scaleFactor","scaledCenterX","scaledCenterY","scaleOffsetX","scaleOffsetY","centerX","centerY","absX","absY","boundaries","s1","x1","y1","k","Vx","Vy","minOffsetX","maxOffsetX","right","minOffsetY","top","maxOffsetY","bottom","dirX","nextMessageId","previousMessageId","offsetX","offsetY","getAnimationStyle","checkIfInsideSelector","selector","matches","INITIAL_MATRIX","SCALE_VALUES","ZOOM_SAFE_AREA","children","noWrap","canPan","zoomLevel","panDeltaX","panDeltaY","onPan","tunedZoomLevel","isDragging","setIsDragging","dragData","setDragData","dx","dy","matrixData","setMatrixData","panWrapperRef","panContainerRef","newZoomLevel","newPandx","newPandy","newMatrixData","areSortedArraysEqual","oldScale","wrapper","image","wrapperRect","imageRect","newImgWidth","newImgHeight","newImgX","newImgY","calculateSafeZoneOnZoom","transform","toString","onMouseDown","newDragData","onMouseUp","deltaX","deltaY","getNewMatrixData","sender","isUserId","selectSender","closeMediaViewer","focusMessage","toggleChatInfo","handleFocusMessage","forceSyncOnIOs","senderTitle","getSenderTitle","Avatar","user","chat","renderText","formatMediaDateTime","date","Transition","isShown","onChangeZoom","prevIsShown","usePrevious","inputRef","setZoomLevel","handleZoomOut","handleZoomIn","step","type","Number","settings","byKey","chatMessages","collectionIds","isChatWithSelf","selectIsChatWithSelf","selectScheduledMessages","selectChatMessages","selectOutlyingIds","selectListedIds","currentSearch","selectCurrentMediaSearch","foundIds","resultsByType","media","openMediaViewer","openForwardMenu","singleMessageId","messageIds","getChatMediaMessageIds","selectedMediaMessageIndex","indexOf","isFirst","isLast","animationKey","prevSenderId","slideAnimation","headerAnimation","isReportModalOpen","openReportModal","closeReportModal","canPanZoomWrap","setCanPanZoomWrap","setIsZoomed","setPanDelta","avatarPhoto","getMessageFileName","toggle","mql","matchMedia","MEDIA_VIEWER_MEDIA_QUERY","addListener","removeListener","prevMessage","prevOrigin","prevAvatarOwner","prevBestImageData","dispatchHeavyAnimationEvent","ANIMATION_END_DELAY","fromImage","windowWidth","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","el","display","rect","windowHeight","isElementInViewport","shouldFadeOut","existingGhost","getElementsByClassName","transition","transformOrigin","opacity","animateClosing","timer","closeZoom","handleZoomToggle","handleZoomValue","level","canCloseZoom","close","handleFooterClick","handleForward","fromChatId","forceOnHeavyAnimation","captureEscKeyListener","stopCurrentAudio","fromId","index","handlePan","useHistoryBack","handleKeyDown","shouldCloseOnVideo","ShowTransition","isRtl","activeKey","name","ReportModal","subject","currentUserId","chatOrUserIds","filterRef","filter","filterPlaceholder","loadMore","onFilterChange","onSelectChatOrUser","onCloseAnimationEnd","viewportIds","getMore","useInfiniteScroll","resetFilter","useInputFocusOnOpen","handleFilterChange","useKeyboardListNavigation","modalHeader","InputText","onKeyDown","placeholder","viewportOffset","Modal","header","InfiniteScroll","items","onLoadMore","withAbsolutePositioning","maxHeight","CHAT_HEIGHT_PX","i","ListItem","PrivateChatInfo","status","userId","GroupChatInfo","Loading","chats","byId","chatsById","listIds","orderedPinnedIds","switchBotInline","activeListIds","active","archivedListIds","archived","pinnedIds","contactIds","contactList","userIds","setForwardChatId","exitForwardMode","openChatWithText","resetSwitchBotInline","setFilter","markIsShown","unmarkIsShown","chatAndContactIds","priorityIds","unique","chatIds","getCanPostInChat","MAIN_THREAD_ID","usersById","getGlobal","users","sortChatIds","filterChatsByName","filterUsersByName","handleSelectUser","botUsername","query","renderingChatAndContactIds","useCurrentOrPrev","getErrorHeader","error","isSlowMode","hasErrorKey","pick","dialogs","dismissDialog","acceptInviteConfirmation","sendMessage","showNotification","isModalOpen","openModal","closeModal","dialog","contactRequest","invite","hash","title","about","participantsCount","isChannel","isRequestNeeded","participantsText","joinText","requestToJoinText","renderInviteHeader","isText","renderInvite","contact","getReadableErrorText","notifications","dismissNotification","localId","Notification","onDismiss","toggleSafeLinkModal","handleOpen","open","ensureProtocol","handleDismiss","renderingUrl","ConfirmDialog","confirmLabel","confirmHandler","MAX_SAFE_DATE","WEEKDAY_LETTERS","isDisabledDay","year","month","day","minDate","maxDate","selectedDay","fixedMinDate","getDayStart","fixedMaxDate","formatInputTime","String","padStart","formatDay","selectedAt","minAt","maxAt","isFutureMode","isPastMode","withTimePicker","submitButtonLabel","secondButtonLabel","onSubmit","onSecondButtonClick","passedSelectedDate","prevIsOpen","isTimeInputFocused","markTimeInputAsFocused","unmarkTimeInputAsFocused","selectedDate","setSelectedDate","currentMonthAndYear","setCurrentMonthAndYear","getFullYear","getMonth","selectedHours","setSelectedHours","getHours","selectedMinutes","setSelectedMinutes","getMinutes","getDate","currentYear","currentMonth","getTime","newSelectedDate","shouldDisableNextMonth","shouldDisablePrevMonth","prevMonthGrid","currentMonthGrid","nextMonthGrid","setDate","setMonth","setFullYear","firstDay","getDay","totalDaysInPrevMonth","push","gridDate","lastRowDaysCount","buildCalendarGrid","submitLabel","formatDateToString","code","formatTime","formatSubmitLabel","handleSubmit","handleChangeHours","replace","hours","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","firstName","setFirstName","lastName","setLastName","phone","setPhone","phoneNumber","shouldSharePhoneNumber","setShouldSharePhoneNumber","canBeSubmitted","focus","handleFirstNameChange","handlePhoneChange","formatPhoneNumberWithCode","handleLastNameChange","handleClose","getUserStatus","label","Checkbox","checked","onCheck","webApp","bot","isInstalled","attachMenu","bots","selectCurrentChat","theme","selectTheme","closeWebApp","sendWebViewData","prolongWebView","toggleBotInAttachMenu","mainButton","setMainButton","buttonText","queryId","isSimple","handleEvent","eventType","eventData","data","themeParams","extractCurrentThemeParams","validateHexColor","button_color","textColor","text_color","is_visible","trim","is_active","isProgressVisible","is_progress_visible","reloadFrame","sendEvent","sendViewport","sendTheme","isSimpleView","onEvent","ignoreEventsRef","useWindowSize","frame","once","contentWindow","postMessage","JSON","stringify","is_expanded","theme_params","handleMessage","parse","err","useWebAppFrame","shouldShowMainButton","useInterval","peer","handleMainButtonClick","handleRefreshClick","handleToggleClick","botId","isEnabled","MoreMenuButton","isMenuOpen","isAttachMenuBot","destructive","prevMainButtonColor","prevMainButtonTextColor","prevMainButtonIsActive","prevMainButtonText","mainButtonCurrentColor","mainButtonCurrentTextColor","mainButtonCurrentIsActive","mainButtonCurrentText","shouldDecreaseWebFrameSize","setShouldDecreaseWebFrameSize","shouldHideButton","setShouldHideButton","buttonChangeTimeout","hasCloseButton","sandbox","allow","allowFullScreen","cancelBotTrustRequest","markBotTrusted","previousBot","previousType","currentBot","currentType","handleBotTrustAccept","getUserFullName","closeBotAttachRequestModal","confirmBotAttachRequest","isSchedule","selectCurrentMessageList","canDeleteForAll","selectAllowedMessageActions","contactName","getUserFirstOrLastName","getPrivateChatUserId","willDeleteForCurrentUserOnly","isChatBasicGroup","willDeleteForAll","isChatSuperGroup","album","deleteMessages","deleteScheduledMessages","handleDeleteMessageForAll","messages","shouldDeleteForAll","handleDeleteMessageForSelf","onEnter","isPrivateChat","isChatChannel","isGroup","isSuperGroup","canPinForAll","pinMessage","handlePinMessageForAll","isUnpin","handlePinMessage","isOneSide","isSilent","pinnedMessagesCount","onUnpin","selectedMessageIds","selectedMessages","selectCanDeleteSelectedMessages","exitMessageSelectMode","messageListType","canDelete","selectCanReportSelectedMessages","canDownload","selectCanDownloadSelectedMessages","hasProtectedMessage","selectHasProtectedMessage","selectedMessagesCount","selectSelectedMessagesCount","canDeleteMessages","canReportMessages","canDownloadMessages","canPost","openForwardMenuForSelectedMessages","downloadSelectedMessages","copySelectedMessages","isDeleteModalOpen","openDeleteModal","closeDeleteModal","handleCopy","IS_MAC_OS","metaKey","ctrlKey","getKeyFromEvent","useCopySelectedMessages","captureKeyboardListeners","onBackspace","onDelete","onEsc","handleDownload","prevSelectedMessagesCount","renderingSelectedMessagesCount","formattedMessagesCount","renderButton","seenByModal","memberIds","seenByUserIds","openChat","closeSeenByModal","handleClick","renderingMemberIds","noStatusOrTyping","reactorModal","reactions","reactors","loadReactors","closeReactorListModal","isClosing","startClosing","stopClosing","chosenTab","setChosenTab","canShowFilters","count","results","chatIdRef","handleCloseAnimationEnd","handleLoadMore","allReactions","l","reaction","concat","nextOffset","LoadMoreDirection","formatIntegerCompact","find","ReactionStaticEmoji","fullName","activeEmojiInteraction","animatedEffect","selectAnimatedEmojiEffect","effectAnimationId","localEffectAnimation","keys","ANIMATED_STICKERS_PATHS","stopActiveEmojiInteraction","isHiding","startHiding","isPlaying","startPlaying","stop","handleCancelAnimation","dispatchHeavyAnimationStop","effectAnimationData","localEffectAnimationData","setLocalEffectAnimationData","getAnimationData","then","startSize","isReversed","AnimatedSticker","animationData","play","quality","IS_ANDROID","noLoop","onLoad","onSelect","buttonRef","activeElement","privateChatUserId","isPinned","selectIsChatPinned","selectIsChatMuted","selectNotifySettings","selectNotifyExceptions","canChangeFolder","chatFolders","orderedIds","withUsername","isChatFolderModalOpen","openChatFolderModal","closeChatFolderModal","contextActions","useChatContextActions","handleDelete","handleChatFolderChange","useSelectWithEnter","avatarSize","DeleteChatModal","runThrottled","cb","topUserIds","topPeers","recentlyFoundChatIds","globalSearch","onReset","loadTopUsers","loadContactList","addRecentlyFoundChatId","clearRecentlyFoundChats","topUsersRef","useHorizontalScroll","shouldReplaceHistory","lastSyncTime","privateChatUser","searchQuery","mediaThumbnail","mediaBlobUrl","isRoundVideo","getMessageRoundVideo","isSavedMessages","isSelf","getChatTitle","isVerified","VerifiedIcon","fakeType","FakeIcon","Link","formatPastTimeShort","renderMessageSummary","renderSummary","searchDate","suggestions","match","suggestion","currentDate","latestYear","getSuggestionsFromDate","localContactIds","fetchingStatus","globalResults","localResults","globalChatIds","globalUserIds","localChatIds","localUserIds","byChatId","globalMessagesByChatId","dateSearchQuery","onSearchDateSelect","searchMessagesGlobal","setGlobalSearchChatId","shouldShowMoreLocal","setShouldShowMoreLocal","shouldShowMoreGlobal","setShouldShowMoreGlobal","handleChatClick","handlePickerItemClick","startsWith","MEMO_EMPTY_ARRAY","contactIdsWithMe","foundContactIds","foundMessages","split","sort","a","b","handleClickShowMoreLocal","handleClickShowMoreGlobal","nothingFound","noScrollRestoreOnTop","noFastList","NothingFound","description","PickerSelectedItem","chatOrUserId","clickArg","createMapStateToProps","isVoice","activeDownloads","isLoading","searchChatId","isChatProtected","CURRENT_TYPE","observe","observeIntersectionForMedia","useIntersectionObserver","rootRef","throttleMs","handleSelectMedia","canRenderContents","useAsyncRendering","SLIDE_TRANSITION_DURATION","isMediaGrid","isMessageList","itemSelector","Media","idPrefix","observeIntersection","handleMessageFocus","shouldDrawDateDivider","toYearMonth","formatMonthAndYear","WebLink","getSenderName","onMessageClick","Document","withDate","datetime","smaller","onDateClick","openAudioPlayer","handlePlayAudio","Audio","AudioOrigin","TABS","GlobalSearchContent","CHAT_TABS","slice","TRANSITION_RENDER_COUNT","currentContent","setGlobalSearchContent","setGlobalSearchDate","activeTab","setActiveTab","parseDateString","handleSwitchTab","tab","handleSearchDateSelect","TabList","tabs","onSwitchTab","renderCount","INITIAL_STATE","currentPassword","password","hint","email","twoFaReducer","state","action","payload","currentScreen","editedFolderId","onSaveFilter","onScreenSelect","signOut","deleteChatFolder","isSignOutDialogOpen","setIsSignOutDialogOpen","isDeleteFolderDialogOpen","setIsDeleteFolderDialogOpen","openSignOutConfirmation","closeSignOutConfirmation","openDeleteFolderConfirmation","closeDeleteFolderConfirmation","handleSignOutMessage","handleDeleteFolderMessage","SettingsMenuButton","SettingsScreens","renderHeaderContent","confirmIsDestructive","sessionCount","activeSessions","currentUser","loadProfilePhotos","loadAuthorizations","profileId","ProfileInfo","forceShowSelf","ChatExtra","langName","LINK_PREFIX","LINK_PREFIX_REGEX","USERNAME_REGEX","runDebouncedForCheckUsername","currentUsername","asLink","isUsernameAvailable","checkUsername","username","setUsername","langPrefix","usernameSuccess","usernameError","test","handleUsernameChange","newUsername","isValid","isUsernameValid","success","readOnly","ERROR_FIRST_NAME_MISSING","ERROR_BIO_TOO_LONG","profileEdit","currentFirstName","currentLastName","fullInfo","bio","currentBio","currentAvatarHash","loadCurrentUser","updateProfile","isUsernameTouched","setIsUsernameTouched","isProfileFieldsTouched","setIsProfileFieldsTouched","setError","setPhoto","setBio","currentAvatarBlobUrl","ProfileEditProgress","isUsernameError","isSaveButtonShown","handlePhotoChange","newPhoto","handleBioChange","handleProfileSave","trimmedFirstName","trimmedLastName","trimmedBio","AvatarEditable","UsernameInput","FloatingActionButton","canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb","setSettingOption","renderFileSizeCallback","AUTODOWNLOAD_FILESIZE_MB_LIMITS","handleFileSizeChange","handleCanAutoPlayGifsChange","handleCanAutoPlayVideosChange","renderAutoDownloadBlock","canAutoLoadFromContacts","canAutoLoadInPrivateChats","canAutoLoadInGroups","canAutoLoadInChannels","isChecked","renderValue","renderContentSizeSlider","runThrottledForLoadRecommended","orderedFolderIds","foldersById","recommended","recommendedChatFolders","onCreateFolder","onEditFolder","loadRecommendedChatFolders","addChatFolder","showDialog","setAnimationData","isAnimationLoaded","setIsAnimationLoaded","handleAnimationLoad","handleCreateFolder","chatsCountByFolderId","useFolderManagerForChatsCount","userFolders","folder","subtitle","getFolderDescriptionText","handleCreateFolderFromRecommended","STICKER_SIZE_FOLDER_SETTINGS","pill","fluid","narrow","multiline","itemName","itemPluralName","ERROR_NO_TITLE","ERROR_NO_CHATS","loadedActiveChatIds","loadedArchivedChatIds","dispatch","onAddIncludedChats","onAddExcludedChats","onBack","editChatFolder","isIncludedChatsListExpanded","setIsIncludedChatsListExpanded","isExcludedChatsListExpanded","setIsExcludedChatsListExpanded","selectedChatIds","includedChatIds","selectedChatTypes","includedChatTypes","selectChatFilters","excludedChatIds","excludedChatTypes","folderId","visibleIncludedChatIds","visibleExcludedChatIds","allLoadedChatsSet","Set","loadedIncludedChatIds","findIntersectionWithSet","loadedExcludedChatIds","mode","handleChange","folderUpdate","renderChats","visibleChatIds","isExpanded","leftChatsCount","clickHandler","chatType","INCLUDED_CHAT_TYPES","typeKey","EXCLUDED_CHAT_TYPES","inactive","renderChatType","isTouched","selectedIds","filterValue","onSelectedIdsChange","onSelectedChatTypesChange","chatTypes","shouldMinimize","hasMaxChats","handleItemClick","newSelectedIds","splice","handleChatTypeClick","newSelectedChatTypes","selectedType","isMinimized","canClose","isSelected","withChatType","chatFilter","folderAllOrderedIds","useFolderManagerForOrderedIds","ALL_FOLDER_ID","folderArchivedOrderedIds","ARCHIVED_FOLDER_ID","displayedIds","newFilter","handleSelectedIdsChange","ids","includeFilters","excludeFilters","handleSelectedChatTypesChange","newFilters","forEach","shownScreen","handleReset","handleEditFolder","handleAddIncludedChats","handleAddExcludedChats","STICKER_SIZE_PICKER_HEADER","stickerSet","isIntersecting","useIsIntersecting","mediaHash","lottieData","useMediaTransition","firstLetters","getFirstLetters","hasThumbnail","isVideos","IS_WEBM_SUPPORTED","stickers","firstSticker","isLottie","STICKER_SIZE_GENERAL_SETTINGS","StickerButton","sticker","noContextMenu","ANIMATION_LEVEL_OPTIONS","TIME_FORMAT_OPTIONS","shouldUseSystemTheme","stickerSetIds","added","setIds","stickerSetsById","setsById","defaultReaction","appConfig","messageTextSize","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","timeFormat","stickerSettingsRef","observeIntersectionForCovers","setSticker","APPEARANCE_THEME_OPTIONS","KEYBOARD_SEND_OPTIONS","subLabel","handleAnimationLevelChange","newLevel","_","handleMessageTextSizeChange","newSize","documentElement","setProperty","setAttribute","handleAppearanceThemeChange","newTheme","getSystemTheme","switchTheme","ANIMATION_LEVEL_MAX","handleTimeFormatChange","newTimeFormat","wasTimeFormatSetManually","setTimeFormat","handleStickerSetClick","handleMessageSendComboChange","newCombo","handleSuggestStickersChange","newValue","handleShouldLoopStickersChange","stickerSets","installedDate","RadioGroup","options","selected","fromSticker","hex2rgb","param","parseInt","substring","rgb2hex","p0","p1","p2","rgb2hsb","r","g","s","v","hsb2rgb","f","p","q","t","getPatternColor","rgbColor","hue","saturation","wallpaper","slug","localMediaHash","thumbRef","useCanvasBlur","thumbnail","isLoadAllowed","setIsLoadAllowed","fullMedia","wasLoadDisabled","UPLOADING_WALLPAPER_SLUG","cacheKeyRef","handleSelect","blob","fetchBlob","cacheApi","save","CUSTOM_BG_CACHE_NAME","isAllowed","background","isBlurred","themes","loadedWallpapers","loadWallpapers","uploadWallpaper","setThemeSettings","themeRef","handleFileSelect","files","handleUploadWallpaper","openSystemFilesDialog","handleSetColor","handleResetToDefault","backgroundColor","patternColor","DARK_THEME_PATTERN_COLOR","DEFAULT_PATTERN_COLOR","handleWallPaperSelect","currentWallpaper","async","defaultRGB","rgb","context","preloadImage","naturalHeight","naturalWidth","offsetWidth","drawImage","getImageData","blockSize","getAverageColor","handleWallPaperBlurChange","isUploading","DEFAULT_HSB","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","hueHex","w","ctx","imgData","createImageData","pixels","col","perY","st","ed","perX","putImageData","drawColor","drawHue","handleRgbChange","rgbValue","channel","handleHexChange","hexValue","handlePredefinedColorClick","dataset","hasPrivateChatsNotifications","hasPrivateChatsMessagePreview","hasGroupNotifications","hasGroupMessagePreview","hasBroadcastNotifications","hasBroadcastMessagePreview","hasContactJoinedNotifications","hasWebNotifications","hasPushNotifications","notificationSoundVolume","loadNotificationSettings","updateContactSignUpNotification","updateNotificationSettings","updateWebNotificationSettings","runDebounced","useRunDebounced","handleSettingsChange","peerType","setting","currentIsSilent","currentShouldShowPreviews","shouldShowPreviews","handleWebNotificationsChange","handlePushNotificationsChange","handlePrivateChatsNotificationsChange","handlePrivateChatsPreviewChange","handleGroupsNotificationsChange","handleGroupsPreviewChange","handleChannelsNotificationsChange","handleChannelsPreviewChange","handleContactNotificationChange","playNotifySound","hasPassword","isSensitiveEnabled","canChangeSensitive","privacy","blocked","blockedCount","totalCount","visibilityPrivacyPhoneNumber","visibility","visibilityPrivacyLastSeen","lastSeen","visibilityPrivacyProfilePhoto","profilePhoto","visibilityPrivacyForwarding","forwards","visibilityPrivacyGroupChats","chatInvite","loadPrivacySettings","loadBlockedContacts","loadContentSettings","updateContentSettings","getVisibilityValue","languages","language","loadLanguages","selectedLanguage","setSelectedLanguage","markIsLoading","unmarkIsLoading","langCode","setLanguage","currentLangCode","navigator","toLowerCase","shortLangCode","substr","nativeName","buildOptions","loadingOption","getPrivacyKey","screen","privacySettings","allowUserIds","allowChatIds","blockUserIds","blockChatIds","setPrivacyVisibility","visibilityOptions","exceptionLists","shouldShowDenied","shouldShowAllowed","privacyKey","headerText","descriptionText","allowedContactsScreen","deniedContactsScreen","allowedCount","reduce","result","membersCount","blockCount","handleVisibilityChange","getSessionIcon","session","platform","device","deviceModel","systemVersion","getLocation","region","country","terminateAuthorization","terminateAllAuthorizations","isConfirmTerminateAllDialogOpen","openConfirmTerminateAllDialog","closeConfirmTerminateAllDialog","handleTerminateSessionClick","handleTerminateAllSessions","currentSession","isCurrent","otherSessions","appName","appVersion","ip","sessions","handler","dateActive","blockedIds","userSearch","setUserSearchQuery","blockContact","filteredContactIds","availableContactIds","contactId","firstId","secondId","secondName","localeCompare","handleRemoveUser","accessHash","chatsByIds","usersByIds","unblockContact","isBlockUserModalOpen","openBlockUserModal","closeBlockUserModal","handleUnblockClick","isPrivate","renderContact","animatedEmoji","selectAnimatedEmoji","AnimatedEmoji","expectedPassword","clearError","validationError","setValidationError","shouldShowPassword","setShouldShowPassword","newPassword","handleClearError","PasswordMonkey","isBig","isPasswordVisible","PasswordForm","onChangePasswordVisibility","onStart","FOCUS_DELAY_TIMEOUT_MS","shouldConfirm","setValue","isConfirmShown","markIsConfirmShown","unmarkIsConfirmShown","handleInputChange","handleSkip","handleSkipConfirm","codeLength","twoFaSettings","waitingEmailCodeLength","updatePassword","checkPassword","clearTwoFaError","updateRecoveryEmail","provideTwoFaEmailCode","clearPassword","handleStartWizard","handleNewPassword","handleNewPasswordConfirm","handleNewPasswordHint","handleNewPasswordEmail","onSuccess","handleChangePasswordCurrent","handleChangePasswordNew","handleChangePasswordConfirm","handleChangePasswordHint","handleTurnOff","handleRecoveryEmailCurrentPassword","handleRecoveryEmail","handleEmailCode","getCurrentPrivacySettings","isAllowList","setPrivacySettings","selectedContactIds","setSearchQuery","isSubmitShown","setIsSubmitShown","newSelectedContactIds","setNewSelectedContactIds","handleSelectedContactIdsChange","contactsIds","Picker","itemIds","searchInputId","availableReactions","selectedReaction","setDefaultReaction","isInactive","TWO_FA_SCREENS","FOLDERS_SCREENS","PRIVACY_SCREENS","PRIVACY_PHONE_NUMBER_SCREENS","PRIVACY_LAST_SEEN_PHONE_SCREENS","PRIVACY_PROFILE_PHOTO_SCREENS","PRIVACY_FORWARDING_SCREENS","PRIVACY_GROUP_CHATS_SCREENS","foldersState","foldersDispatch","shouldSkipTransition","twoFaState","twoFaDispatch","useReducer","handleSaveFilter","renderCurrentSection","isScreenActive","isFrom","currentKey","privacyAllowScreens","isTwoFaScreen","isFoldersScreen","isPrivacyScreen","values","SettingsGeneralBackgroundColor","renderCurrentSectionContent","LAYERS_ANIMATION_NAME","statusesById","userStatusesById","openNewContactDialog","filteredIds","sortUserIds","isSearching","selectedMemberIds","onSelectedMemberIdsChange","onNextStep","setGlobalSearchQuery","canBeInvitedToGroup","isUserBot","handleNextStep","creationProgress","creationError","chatCreation","createGroupChat","createChannel","setTitle","setAbout","chatTitleEmptyError","channelTitleEmptyError","chatTooManyUsersError","ChatCreationProgress","handleTitleChange","handleDescriptionChange","handleCreateGroup","handleCreateChannel","renderedError","RENDER_COUNT","LeftColumnContent","onContentChange","newChatMemberIds","setNewChatMemberIds","isStepActive","ChatList","folderType","folderOrderedIds","editChatFolders","initialSelectedFolderIds","pinnedChatIds","selectedFolderIds","setSelectedFolderIds","folders","idsToRemove","idsToAdd","CheckboxGroup","getCopyLabel","hasSelection","scrollLockEl","IGNORED_KEYS","Down","ArrowDown","Up","ArrowUp","Left","ArrowLeft","Right","ArrowRight","PageUp","PageDown","End","Home","Tab","getTouchY","changedTouches","clientY","scrollHeight","preventDefaultForScrollKeys","HTMLElement","tagName","getAttribute","isTextBox","disableScrolling","_excludedClosestSelector","passive","onkeydown","enableScrolling","REACTION_SIZE","IS_COMPACT_MENU","cn","createClassNameBuilder","previewIndex","onSendReaction","isReady","selectAnimation","isActivated","activate","deactivate","markAnimationLoaded","shouldRenderAnimated","animatedClassNames","shouldRenderStatic","staticClassNames","onMouseEnter","enabledReactions","itemsScrollRef","isHorizontalScrollEnabled","enableHorizontalScroll","handleWheel","onWheelCapture","onTouchMove","anchor","canSendNow","canReschedule","canReply","canEdit","canPin","canUnpin","canForward","canFaveSticker","canUnfaveSticker","canCopy","canCopyLink","canSelect","canSaveGif","canShowSeenBy","canShowReactionsCount","canRemoveReaction","canShowReactionList","seenByRecentUsers","onReply","onEdit","onPin","onFaveSticker","onUnfaveSticker","onSend","onReschedule","onCopyLink","onDownload","onSaveGif","onShowSeenBy","onShowReactors","onCopyMessages","menuRef","scrollableRef","copyOptions","afterEffect","getMessageText","canImageBeCopied","hasMessageLocalBlobUrl","CLIPBOARD_ITEM_SUPPORTED","selection","getSelection","Promise","resolve","mediaLoader","copyImageToClipboard","anchorNode","parentNode","getMessageIdsForSelectedText","clipboardText","getMessageTextWithSpoilers","copyTextToClipboard","getMessageCopyOptions","noReactions","withReactions","markIsReady","unmarkIsReady","getTriggerElement","getRootElement","getMenuElement","getLayout","extraHeightAudioPlayer","pinnedElement","extraHeightPinned","extraPaddingX","extraTopPadding","marginSides","extraMarginTop","handleRemoveReaction","transformOriginX","transformOriginY","menuStyle","withScroll","useContextMenuPosition","bubbleStyle","option","START_SIZE","selectActiveDownloadIds","seenByExpiresAt","seenByMaxChatMembers","noOptions","isScheduled","isLocal","isMessageLocal","isChatGroup","isOwnMessage","isAction","isActionMessage","areReactionsEmpty","canSeeList","some","isChosen","isForbidden","hasFullInfo","SERVICE_NOTIFICATIONS_USER_ID","chatUsername","setReplyingToId","setEditingId","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","loadSeenBy","openSeenByModal","sendReaction","openReactorListModal","loadFullChat","copyMessagesByIds","saveGif","setIsMenuOpen","setIsDeleteModalOpen","setIsReportModalOpen","isPinModalOpen","setIsPinModalOpen","isCalendarOpen","openCalendar","closeCalendar","recentReactions","msg","handleReport","closeMenu","closePinModal","handleCloseCalendar","handleReply","handleEdit","handlePin","handleUnpin","handleFaveSticker","handleUnfaveSticker","handleSelectMessage","params","childMessageIds","withShift","handleScheduledMessageSend","handleOpenCalendar","handleOpenSeenByModal","handleOpenReactorListModal","handleRescheduleMessage","scheduledAt","handleCopyMessages","handleCopyLink","handleSaveGif","gif","handleSendReaction","reportMessageIds","scheduledMaxDate","getDayStartAt","stickerSetShortName","currentMessageList","sendOptions","getAllowedAttachmentOptions","canSendStickers","canScheduleUntilOnline","selectCanScheduleUntilOnline","shouldSchedule","selectShouldSchedule","selectStickerSet","stickerSetId","selectStickerSetByShortName","loadStickers","toggleStickerSet","requestCalendar","calendar","useSchedule","stickerSetAccessHash","isScheduleRequested","isPreloadedGlobally","handleButtonClick","STICKER_SIZE_MODAL","BOT_BUTTONS","help","isRestricted","canAddContact","getCanAddContact","canReportChat","chatBot","REPLIES_USER_ID","selectChatBot","canDeleteChat","getCanDeleteChat","hasLinkedChat","linkedChatId","botCommands","botInfo","commands","withExtraActions","canStartBot","canRestartBot","canSubscribe","canSearch","canCall","canMute","canViewStatistics","canLeave","canEnterVoiceChat","canCreateVoiceChat","onSubscribeChannel","onSearchClick","updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot","joinGroupCall","createGroupCall","openLinkedChat","openAddContactDialog","requestCall","toggleStatistics","handleStartBot","command","handleRestartBot","handleToggleMuteClick","handleEnterVoiceChatClick","handleLinkedChatClick","handleAddContactClick","handleSubscribe","handleVideoCall","handleCall","handleSearch","handleStatisticsClick","handleSelectMessages","botButtons","cmd","Portal","runDebouncedForSearch","selectCurrentTextSearch","isHistoryCalendarOpen","setLocalTextSearchQuery","searchTextMessagesLocal","closeLocalTextSearch","openHistoryCalendar","focusedIndex","setFocusedIndex","visualViewport","mainEl","pageTop","Array","input","div","contentEditable","blur","handleMessageSearchQueryChange","newQuery","handleUp","newFocusIndex","handleDown","SearchInput","findInViewport","selectorOrElements","margin","isDense","shouldContainBottom","isHorizontal","viewportY1","viewportY2","allElements","visibleIndexes","isFound","y2","setTooltipItemVisible","first","isFullyVisible","fastSmoothScroll","useKeyboardNavigation","shouldSaveSelectionOnUpdateItems","shouldRemoveSelectionOnReset","noArrowNavigation","shouldSelectOnTab","selectedItemIndex","setSelectedItemIndex","getSelectedIndex","newIndex","cycleRestrict","handleArrowKey","handleItemSelect","item","isSelectionOutOfRange","onUp","onDown","onLeft","onRight","onTab","onInsertUserName","filteredUsers","handleUserSelect","forceFocus","handleSelectMention","member","selectedMentionIndex","prevChatMembers","renderedChatMembers","attachments","caption","canShowCustomSendMenu","groupChatMembers","recentEmojis","baseEmojiKeywords","emojiKeywords","addRecentEmoji","onCaptionUpdate","onFileAppend","onClear","onSendSilent","onSendScheduled","captionRef","useStateRef","mainButtonRef","hideTimeoutRef","prevAttachments","renderingAttachments","isHovered","markHovered","unmarkHovered","isQuick","every","quick","isMentionTooltipOpen","closeMentionTooltip","insertMention","mentionFilteredUsers","useMentionTooltip","EDITABLE_INPUT_MODAL_ID","isEmojiTooltipOpen","closeEmojiTooltip","filteredEmojis","insertEmoji","useEmojiTooltip","isContextMenuOpen","isCustomSendMenuOpen","handleContextMenu","handleContextMenuClose","handleContextMenuHide","useContextMenuHandlers","sendAttachments","handleFilesDrop","dataTransfer","newFiles","file","CONTENT_TYPES_WITH_PREVIEW","areAllPhotos","SUPPORTED_IMAGE_CONTENT_TYPES","mimeType","areAllVideos","SUPPORTED_VIDEO_CONTENT_TYPES","areAllAudios","SUPPORTED_AUDIO_CONTENT_TYPES","isOpenToBottom","onSendSchedule","renderHeader","onDragEnter","onDrop","onDragOver","onDragLeave","relatedTarget","toTarget","fromTarget","attachment","File","filename","extension","getFileExtension","previewData","emojis","onEmojiSelect","MessageInput","isAttachmentModalInput","html","editableInputId","canAutoFocus","isQuiz","shouldBeAnonimous","questionInputRef","optionsListRef","solutionRef","question","setQuestion","setOptions","isAnonymous","setIsAnonymous","isMultipleAnswers","setIsMultipleAnswers","isQuizMode","setIsQuizMode","solution","setSolution","correctOption","setCorrectOption","hasErrors","setHasErrors","focusInput","solutionEl","innerHTML","addNewOption","newOptions","list","scrollTo","behavior","handleCreate","questionTrimmed","optionsTrimmed","o","summary","answers","correct","isPublic","multipleChoice","quiz","entities","parseMessageInput","correctAnswers","solutionEntities","updateOption","removeOption","handleCorrectOptionChange","handleIsAnonymousChange","handleMultipleAnswersChange","handleQuizModeChange","handleKeyPress","keyCode","handleQuestionChange","getQuestionError","getOptionsError","renderOptions","onKeyPress","renderQuizNoOptionError","hidden","emoji","native","isLoaded","LOADED_EMOJIS","names","IS_EMOJI_SUPPORTED","loading","handleEmojiLoad","category","allEmojis","useOnIntersect","emojisPerRow","ceil","displayedEmoji","ICONS_BY_CATEGORY","recent","people","nature","foods","activity","places","objects","symbols","flags","categoryIntersections","emojiDataPromise","emojiRawData","emojiData","headerRef","categories","setCategories","setEmojis","activeCategoryIndex","setActiveCategoryIndex","entries","entry","intersectingWithIndexes","newLeft","HEADER_BUTTON_WIDTH","fastSmoothScrollHorizontal","allCategories","themeCategories","unshift","exec","default","uncompressEmoji","ensureEmojiData","selectCategory","categoryEl","handleEmojiSelect","MENU_TRANSITION_DURATION","containerClassName","faded","STICKER_MARGIN","loadAndPlay","favoriteStickers","onStickerSelect","onStickerUnfave","onStickerFave","stickersPerRow","STICKER_SIZE_PICKER","favoriteStickerIdsSet","noAnimate","onUnfaveClick","has","onFaveClick","stickerSetIntersections","favorite","recentStickers","addedSetIds","shouldPlay","loadRecentStickers","addRecentSticker","activeSetIndex","setActiveSetIndex","sendMessageAction","useSendMessageAction","areAddedLoaded","allSets","noPopulatedSets","stickerSetEl","handleStickerSelect","handleStickerUnfave","handleStickerFave","fullClassName","buttonClassName","onUnsaveClick","videoData","shouldRenderVideo","isVideoReady","contextMenuPosition","handleBeforeContextMenu","handleUnsaveClick","handleContextDelete","handleSendQuiet","handleSendScheduled","handleMouseDown","preventMessageInputBlurWithBubbling","preload","savedGifs","gifs","saved","canSendGifs","onGifSelect","loadSavedGifs","debounceMs","shouldUnsave","SymbolMenuTabs","SYMBOL_MENU_TAB_TITLES","SYMBOL_MENU_TAB_ICONS","Emoji","Stickers","GIFs","onRemoveSymbol","onSearchOpen","renderTabButton","handleSearchOpen","isLeftColumnShown","setRecentEmojis","handleMouseEnter","handleMouseLeave","useMouseInside","fastRaf","recentEmojisRef","renderContent","onMouseLeave","noCloseOnBackdrop","noCompact","withAvatar","botCommand","handleSendCommand","selectedCommandIndex","prevCommands","renderedCommands","chatBotCommand","forEmoji","clearStickersForEmoji","prevStickers","displayedStickers","listEmojis","usePrevDuringAnimation","handleSelectEmoji","selectedIndex","setItemVisible","thumbUrl","thumbnailDataUrl","decoding","webThumbnail","isForGallery","inlineResult","_gif","STICKER_SIZE_INLINE_BOT_RESULT","isGallery","inlineBotResults","switchPm","onSelectResult","startBot","handleSendPm","startParam","prevInlineBotResults","renderedInlineBotResults","sensitiveArea","inlineBotResult","selectedSendAsId","sendAsIds","saveDefaultSendAs","markMouseInside","sendAsId","selectedSendAsIndex","messagesById","viewportResults","senderUser","senderChat","forwardInfo","isChannelPost","foundResult","isOnTop","preloadBackwards","teactOrderKey","LastMessageMeta","selectShouldLoopStickers","isSomeModalOpen","onModalToggle","isAdded","areStickersLoaded","coverStickerIds","covers","otherStickers","handleAddClick","canRenderStickers","STICKER_SIZE_SEARCH","selectCurrentStickerSearch","resultIds","featured","featuredIds","loadFeaturedStickers","setIsModalOpen","selectCurrentGifSearch","isChatWithBot","selectIsChatWithBot","canPostInChat","searchMoreGifs","setGifSearchQuery","handleGifClick","hasResults","CHANNEL_OVERVIEW","isPercentage","GROUP_OVERVIEW","MESSAGE_OVERVIEW","isPlain","isApproximate","isMessage","statistics","period","formatFullDate","row","cell","field","percentage","change","isChangeNegative","renderOverviewItemValue","toggleMessageStatistics","views","formatDateTimeToString","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","currentMessageId","setIsReady","loadedCharts","loadStatistics","loadStatisticsAsyncGraph","graphs","graphTitles","graph","token","ensureLovelyChart","zoomToken","create","callApi","zoomOutLabel","recentTopMessages","GRAPH_TITLES","viewsGraph","GRAPHS","currentMessage","loadMessageStatistics","answer","voters","offsets","pollResults","answerVote","totalVoters","loadPollOptionResults","closePollResults","prevVotersCount","votersCount","setIsLoading","areVotersLoaded","limit","shouldResetVoters","handleViewMoreClick","handleMemberClick","leftVotersCount","renderViewMoreButton","total","getMessagePoll","resultsByOption","buildCollectionByKey","management","deleteContact","closeManagement","isDeleteDialogOpen","openDeleteDialog","closeDeleteDialog","isNotificationsEnabled","setIsNotificationsEnabled","ManagementProgress","handleNotificationChange","handleDeleteContact","withFullInfo","GROUP_TITLE_EMPTY","hasLinkedChannel","isBasicGroup","invites","canChangeInfo","isCreator","getHasAdminRight","canBanUsers","canInvite","exportedInvites","availableReactionsCount","togglePreHistoryHidden","updateChat","deleteChat","leaveChannel","deleteChannel","loadExportedChatInvites","loadChatJoinRequests","currentTitle","currentAbout","imageHash","isPublicGroup","isRevoked","handleClickEditType","ManagementScreens","handleClickDiscussion","handleClickReactions","handleClickPermissions","handleClickAdministrators","handleClickInvites","handleClickRequests","handleSetPhoto","handleAboutChange","handleUpdateGroup","trimmedTitle","trimmedAbout","handleClickMembers","handleTogglePreHistory","isPreHistoryHidden","enabledReactionsCount","enabledPermissionsCount","defaultBannedRights","sendStickers","sendGifs","adminsCount","adminMembers","handleDeleteGroup","formatInteger","joinRequests","onChatMemberSelect","updateChatDefaultBannedRights","permissions","setPermissions","havePermissionChanged","setHavePermissionChanged","handleRemovedUsersClick","handleAddExceptionClick","handleExceptionMemberClick","promotedByUserId","handlePermissionChange","getUpdatedPermissionValue","handleSavePermissions","bannedRights","removedUsersCount","kickedMembers","exceptionMembers","members","getMemberExceptions","langKey","getLangKeyForBannedRightKey","translatedString","sendMessages","blocking","sendMedia","sendPolls","embedLinks","inviteUsers","pinMessages","changeInfo","loadMoreMembers","deleteChatMember","usersId","availableMemberIds","acc","isAdmin","isOwner","canDeleteMembers","updateChatMemberBannedRights","isRemoveUserModalOpen","openRemoveUserModal","closeRemoveUserModal","removedMembers","getRemovedBy","kickedByUserId","kickedByUser","getContextActions","CHANNEL_TITLE_EMPTY","isSignaturesShown","toggleSignatures","handleUpdateChannel","handleToggleSignatures","handleClickSubscribers","handleDeleteChannel","selectManagement","checkPublicLink","updatePublicLink","updatePrivateLink","toggleIsProtected","privateLink","inviteLink","privacyType","setPrivacyType","isRevokeConfirmDialogOpen","openRevokeConfirmDialog","closeRevokeConfirmDialog","canUpdate","handleOptionChange","handleForwardingOptionChange","handleSave","handleRevokePrivateLink","langPrefix1","langPrefix2","forwardingOptions","SafeLink","forDiscussionIds","linkedChat","loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup","linkedGroupId","setLinkedGroupId","isConfirmUnlinkGroupDialogOpen","openConfirmUnlinkGroupDialog","closeConfirmUnlinkGroupDialog","isConfirmLinkGroupDialogOpen","openConfirmLinkGroupDialog","closeConfirmLinkGroupDialog","handleUnlinkGroupSessions","channelId","handleLinkGroupSessions","STICKER_SIZE_DISCUSSION_GROUPS","teactFastList","linkedGroup","renderLinkGroupHeader","hasPrivateLink","renderLinkGroupConfirmText","isButtonsInOneRow","isPromotedByCurrentUser","isFormFullyDisabled","selectedChatMemberId","isBanConfirmationDialogOpen","openBanConfirmationDialog","closeBanConfirmationDialog","selectedChatMember","handleBanFromGroup","viewMessages","getControlIsDisabled","handleRecentActionsClick","handleAdminMemberClick","handleAddAdminClick","getMemberStatus","promotedByUser","defaultRights","adminRights","isNewAdmin","selectedUserId","updateChatAdmin","setIsTouched","isDismissConfirmationDialogOpen","openDismissConfirmationDialog","closeDismissConfirmationDialog","customTitle","setCustomTitle","selectedAdminMember","handleDismissAdmin","memberStatus","handleCustomTitleChange","postMessages","editMessages","banUsers","addAdmins","manageCall","anonymous","maxLength","noAdmins","adminIds","shouldUseSearchResults","listedIds","noScrollRestore","memberId","inviteComparator","i1","i2","isPermanent","i1IsPermanent","usage","i1Usage","i1Date","i2IsPermanent","i2Usage","i2Date","revokedInvites","revokedExportedInvites","setEditingExportedInvite","editExportedChatInvite","deleteExportedChatInvite","deleteRevokedExportedChatInvites","setOpenedInviteInfo","isDeleteRevokeAllDialogOpen","openDeleteRevokeAllDialog","closeDeleteRevokeAllDialog","isRevokeDialogOpen","openRevokeDialog","closeRevokeDialog","revokingInvite","setRevokingInvite","deletingInvite","setDeletingInvite","hasDetailedCountdown","expireDate","getServerTime","MILLISECONDS_IN_DAY","primaryInvite","primaryInviteLink","link","temporalInvites","revokeInvite","usageLimit","askToRevoke","handleRevoke","handleCreateNewClick","handlePrimaryRevoke","handleDeleteAllRevoked","showInviteInfo","deleteInvite","askToDelete","copyLink","handleCopyPrimaryClicked","prepareUsageText","requested","diff","formatCountdown","prepareContextActions","actions","editInvite","PrimaryLinkMenuButton","STICKER_SIZE_INVITES","secondaryIcon","DEFAULT_USAGE_LIMITS","DEFAULT_EXPIRE_DATE","hour","week","DEFAULT_CUSTOM_EXPIRE_DATE","editingInvite","exportChatInvite","isCalendarOpened","setIsRequestNeeded","customExpireDate","setCustomExpireDate","selectedExpireOption","setSelectedExpireOption","customUsageLimit","setCustomUsageLimit","selectedUsageOption","setSelectedUsageOption","isSubmitBlocked","setIsSubmitBlocked","oldEditingInvite","editingTitle","editingIsRequestNeeded","minSafeDate","handleIsRequestChange","handleCustomUsageLimitChange","handleExpireDateChange","handleSaveClick","n","setChatEnabledReactions","localEnabledReactions","setLocalEnabledReactions","handleSaveReactions","handleReactionChange","newEnabledReactions","inviteInfo","importers","requesters","loadChatInviteImporters","loadChatInviteRequesters","adminId","isExpired","handleCopyClicked","importer","renderImporters","requester","renderRequesters","hideChatJoinRequest","fixedDate","dateString","isToday","formatHumanDate","handleAcceptRequest","isApproved","handleRejectRequest","hideAllChatJoinRequests","isAcceptAllDialogOpen","openAcceptAllDialog","closeAcceptAllDialog","isRejectAllDialogOpen","openRejectAllDialog","closeRejectAllDialog","handleAcceptAllRequests","handleRejectAllRequests","STICKER_SIZE_JOIN_REQUESTS","managementType","selectCurrentManagementType","VISA","MASTERCARD1","MASTERCARD2","CardType","cards","Default","Visa","Mastercard","detectCardType","cardNumber","formatsCache","defaultPhoneNumberFormat","str","flag","phoneFormat","format","formatValue","phoneNumberFormat","phoneNumberGroups","RegExp","repeat","getPhoneNumberFormat","streetLine1","streetLine2","city","countryIso2","postCode","shipping","cardholder","expiry","cvv","billingCountry","billingZip","saveInfo","saveCredentials","formErrors","reducer","getBillingCountry","countryCode","useFocusAfterAnimation","animationDuration","hasArrow","labelText","htmlFor","needEmail","needPhone","needName","needAddress","phoneRef","selectCountryRef","handleAddress1Change","handleAddress2Change","handleCityChange","handleStateChange","handleCountryChange","handlePostCodeChange","handleFullNameChange","handleEmailChange","handleSaveInfoChange","shippingOptions","currency","handleShippingSelect","amount","formatCurrency","renderPaymentItem","main","renderCheckoutItem","invoiceContent","prices","shippingPrices","checkoutInfo","totalPrice","photoUrl","paymentMethod","paymentProvider","shippingAddress","shippingMethod","expiryInputRef","charAt","parts","formatCardExpiry","cardNumberRef","cardType","setCardType","newCardType","formatCardNumber","cardIcon","mastercardIconPath","visaIconPath","getCardIcon","canSaveCredentials","needCardholderName","needCountry","needZip","handleCardNumberChange","handleCardholderChange","toUpperCase","handleExpiryChange","handleCvvChange","handleBillingPostCodeChange","handleChangeSaveCredentials","SUPPORTED_PROVIDERS","savedInfo","invoice","nativeProvider","nativeParams","passwordMissing","confirmPaymentUrl","payment","isProviderError","nameRequested","phoneRequested","emailRequested","shippingAddressRequested","flexible","phoneToProvider","emailToProvider","validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError","paymentState","paymentDispatch","canRenderFooter","PaymentStep","handleErrorModalClose","shippingOption","getShippingPrices","totalPrices","cur","getTotalPrice","detectCardTypeText","findShippingOption","getCheckoutInfo","validateRequest","requestInfo","getRequestInfo","sendCredentials","credentials","expiryMonth","expiryYear","zip","getCredentials","sendForm","shippingOptionId","setStep","nextStep","currentStep","renderModalContent","renderError","optionId","receipt","info","totalAmount","credentialsTitle","fullAddress","onInputChange","setPassword","canSubmit","setCanSubmit","select","autoComplete","MIN_PASSWORD_LENGTH","SEGMENT_COVER_EYES","SEGMENT_UNCOVER_EYE","SEGMENT_COVER_EYE","STICKER_SIZE","STICKER_SIZE_AUTH_MOBILE","STICKER_SIZE_AUTH","closeMonkeyData","setCloseMonkeyData","peekMonkeyData","setPeekMonkeyData","isFirstMonkeyLoaded","setIsFirstMonkeyLoaded","isPeekShown","setIsPeekShown","handleFirstMonkeyLoad","STICKER_SIZE_TWO_FA","playSegment","cropperResultOptions","circle","Croppie","croppiePromise","cropper","isCroppieReady","setIsCroppieReady","imgFile","cropContainer","enableZoom","boundary","viewport","blobToDataUri","bind","DEBUG","console","initCropper","ensureCroppie","handleCropClick","croppedImg","blobToFile","selectedFile","setSelectedFile","croppedBlobUrl","setCroppedBlobUrl","handleAvatarCrop","URL","revokeObjectURL","createObjectURL","handleModalClose","labelClassName","accept"],"sourceRoot":""}