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,KAI9CspD,EAAgB7+F,EAAOu1C,MAAM,IAC7Bv1C,EAAO7D,MAAQ,KAiCTmjG,OAAO,0BAET,wBAAGzpG,UAAU,oBACZipG,GAAkB,0BAAK9vG,IAAK8vG,EAAgB94F,IAAI,YAEnD,mBAAC,EAAD,CAAWsgE,KAAMs4B,EAAc/hG,QAASuiG,EAAkBhjG,SAAU4iG","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/SettingsActiveSession.module.scss?ead4","webpack://telegram-t/./src/components/left/settings/SettingsActiveSession.tsx","webpack://telegram-t/./src/components/left/settings/SettingsActiveSessions.tsx","webpack://telegram-t/./src/components/left/settings/BlockUserModal.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyBlockedUsers.tsx","webpack://telegram-t/./src/components/left/settings/twoFa/SettingsTwoFaEnabled.tsx","webpack://telegram-t/./src/components/left/settings/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';\nimport { isElementInViewport } from '../../../util/isElementInViewport';\n\nconst ANIMATION_DURATION = 200;\n\nexport function animateOpening(\n hasFooter: boolean,\n origin: MediaViewerOrigin,\n bestImageData: string,\n dimensions: ApiDimensions,\n isVideo: boolean,\n message?: ApiMessage,\n) {\n const { mediaEl: fromImage } = getNodes(origin, message);\n if (!fromImage) {\n return;\n }\n\n const { width: windowWidth } = windowSize.get();\n const {\n width: availableWidth, height: availableHeight,\n } = getMediaViewerAvailableDimensions(hasFooter, isVideo);\n const { width: toWidth, height: toHeight } = calculateDimensions(\n availableWidth, availableHeight, dimensions.width, dimensions.height,\n );\n const toLeft = (windowWidth - toWidth) / 2;\n const toTop = getTopOffset(hasFooter) + (availableHeight - toHeight) / 2;\n\n let {\n top: fromTop, left: fromLeft, width: fromWidth, height: fromHeight,\n } = fromImage.getBoundingClientRect();\n\n if ([\n MediaViewerOrigin.SharedMedia,\n MediaViewerOrigin.Album,\n MediaViewerOrigin.ScheduledAlbum,\n MediaViewerOrigin.SearchResult,\n ].includes(origin)) {\n const uncovered = uncover(toWidth, toHeight, fromTop, fromLeft, fromWidth, fromHeight);\n fromTop = uncovered.top;\n fromLeft = uncovered.left;\n fromWidth = uncovered.width;\n fromHeight = uncovered.height;\n }\n\n const fromTranslateX = (fromLeft + fromWidth / 2) - (toLeft + toWidth / 2);\n const fromTranslateY = (fromTop + fromHeight / 2) - (toTop + toHeight / 2);\n const fromScaleX = fromWidth / toWidth;\n const fromScaleY = fromHeight / toHeight;\n\n const ghost = createGhost(bestImageData || fromImage);\n applyStyles(ghost, {\n top: `${toTop}px`,\n left: `${toLeft}px`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n transform: `translate3d(${fromTranslateX}px, ${fromTranslateY}px, 0) scale(${fromScaleX}, ${fromScaleY})`,\n });\n applyShape(ghost, origin);\n\n document.body.classList.add('ghost-animating');\n\n requestAnimationFrame(() => {\n document.body.appendChild(ghost);\n\n requestAnimationFrame(() => {\n ghost.style.transform = '';\n clearShape(ghost);\n\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (document.body.contains(ghost)) {\n document.body.removeChild(ghost);\n }\n document.body.classList.remove('ghost-animating');\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n });\n });\n}\n\nexport function animateClosing(origin: MediaViewerOrigin, bestImageData: string, message?: ApiMessage) {\n const { container, mediaEl: toImage } = getNodes(origin, message);\n if (!toImage) {\n return;\n }\n\n const fromImage = document.getElementById('MediaViewer')!.querySelector<HTMLImageElement>(\n '.MediaViewerSlide--active img, .MediaViewerSlide--active video',\n );\n if (!fromImage || !toImage) {\n return;\n }\n\n const {\n top: fromTop, left: fromLeft, width: fromWidth, height: fromHeight,\n } = fromImage.getBoundingClientRect();\n const {\n top: targetTop, left: toLeft, width: toWidth, height: toHeight,\n } = toImage.getBoundingClientRect();\n\n let toTop = targetTop;\n if (!isElementInViewport(container)) {\n const { height: windowHeight } = windowSize.get();\n toTop = targetTop < fromTop ? -toHeight : windowHeight;\n }\n\n const fromTranslateX = (fromLeft + fromWidth / 2) - (toLeft + toWidth / 2);\n const fromTranslateY = (fromTop + fromHeight / 2) - (toTop + toHeight / 2);\n let fromScaleX = fromWidth / toWidth;\n let fromScaleY = fromHeight / toHeight;\n\n const shouldFadeOut = (\n [MediaViewerOrigin.Inline, MediaViewerOrigin.ScheduledInline].includes(origin)\n && !isMessageImageFullyVisible(container, toImage)\n ) || (\n [MediaViewerOrigin.Album, MediaViewerOrigin.ScheduledAlbum].includes(origin)\n && !isMessageImageFullyVisible(container, toImage)\n );\n\n if ([\n MediaViewerOrigin.SharedMedia,\n MediaViewerOrigin.Album,\n MediaViewerOrigin.ScheduledAlbum,\n MediaViewerOrigin.SearchResult,\n ].includes(origin)) {\n if (fromScaleX > fromScaleY) {\n fromScaleX = fromScaleY;\n } else if (fromScaleY > fromScaleX) {\n fromScaleY = fromScaleX;\n }\n }\n\n const existingGhost = document.getElementsByClassName('ghost')[0] as HTMLDivElement;\n\n const ghost = existingGhost || createGhost(bestImageData || toImage, origin);\n if (!existingGhost) {\n applyStyles(ghost, {\n top: `${toTop}px`,\n left: `${toLeft}px`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n transform: `translate3d(${fromTranslateX}px, ${fromTranslateY}px, 0) scale(${fromScaleX}, ${fromScaleY})`,\n });\n }\n\n requestAnimationFrame(() => {\n if (existingGhost) {\n const {\n top,\n left,\n width,\n height,\n } = existingGhost.getBoundingClientRect();\n const scaleX = width / toWidth;\n const scaleY = height / toHeight;\n\n applyStyles(ghost, {\n transition: 'none',\n top: `${toTop}px`,\n left: `${toLeft}px`,\n transformOrigin: 'top left',\n transform: `translate3d(${left - toLeft}px, ${top - toTop}px, 0) scale(${scaleX}, ${scaleY})`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n });\n }\n document.body.classList.add('ghost-animating');\n if (!existingGhost) document.body.appendChild(ghost);\n\n requestAnimationFrame(() => {\n if (existingGhost) {\n existingGhost.style.transition = '';\n }\n\n ghost.style.transform = '';\n\n if (shouldFadeOut) {\n ghost.style.opacity = '0';\n }\n\n applyShape(ghost, origin);\n\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (document.body.contains(ghost)) {\n document.body.removeChild(ghost);\n }\n document.body.classList.remove('ghost-animating');\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n });\n });\n}\n\nfunction createGhost(source: string | HTMLImageElement | HTMLVideoElement, origin?: MediaViewerOrigin) {\n const ghost = document.createElement('div');\n ghost.classList.add('ghost');\n\n const img = new Image();\n img.draggable = false;\n img.oncontextmenu = stopEvent;\n\n if (typeof source === 'string') {\n img.src = source;\n } else if (source instanceof HTMLVideoElement) {\n img.src = source.poster;\n } else {\n img.src = source.src;\n }\n\n ghost.appendChild(img);\n\n if (origin === MediaViewerOrigin.ProfileAvatar || origin === MediaViewerOrigin.SettingsAvatar) {\n ghost.classList.add('ProfileInfo');\n if (origin === MediaViewerOrigin.SettingsAvatar) {\n ghost.classList.add('self');\n }\n const profileInfo = document.querySelector(\n origin === MediaViewerOrigin.ProfileAvatar\n ? '#RightColumn .ProfileInfo .info'\n : '#Settings .ProfileInfo .info',\n );\n if (profileInfo) {\n ghost.appendChild(profileInfo.cloneNode(true));\n }\n }\n\n return ghost;\n}\n\nfunction uncover(realWidth: number, realHeight: number, top: number, left: number, width: number, height: number) {\n if (realWidth === realHeight) {\n const size = Math.max(width, height) * (realWidth / realHeight);\n left -= (size - width) / 2;\n top -= (size - height) / 2;\n width = size;\n height = size;\n } else if (realWidth > realHeight) {\n const srcWidth = width;\n width = height * (realWidth / realHeight);\n left -= (width - srcWidth) / 2;\n } else if (realHeight > realWidth) {\n const srcHeight = height;\n height = width * (realHeight / realWidth);\n top -= (height - srcHeight) / 2;\n }\n\n return {\n top, left, width, height,\n };\n}\n\nfunction isMessageImageFullyVisible(container: HTMLElement, imageEl: HTMLElement) {\n const messageListElement = document.querySelector<HTMLDivElement>('.Transition__slide--active > .MessageList')!;\n let imgOffsetTop = container.offsetTop + imageEl.closest<HTMLDivElement>('.content-inner, .WebPage')!.offsetTop;\n if (container.id.includes('album-media-')) {\n imgOffsetTop += container.parentElement!.offsetTop + container.closest<HTMLDivElement>('.Message')!.offsetTop;\n }\n\n return imgOffsetTop > messageListElement.scrollTop\n && imgOffsetTop + imageEl.offsetHeight < messageListElement.scrollTop + messageListElement.offsetHeight;\n}\n\nfunction getTopOffset(hasFooter: boolean) {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n let topOffsetRem = 4.125;\n if (hasFooter && !IS_TOUCH_ENV) {\n topOffsetRem += mql.matches ? 0.875 : 2.125;\n }\n\n return topOffsetRem * REM;\n}\n\nfunction applyStyles(element: HTMLElement, styles: Record<string, string>) {\n Object.assign(element.style, styles);\n}\n\nfunction getNodes(origin: MediaViewerOrigin, message?: ApiMessage) {\n let containerSelector;\n let mediaSelector;\n\n switch (origin) {\n case MediaViewerOrigin.Album:\n case MediaViewerOrigin.ScheduledAlbum:\n containerSelector = `.Transition__slide--active > .MessageList #album-media-${getMessageHtmlId(message!.id)}`;\n mediaSelector = '.full-media';\n break;\n\n case MediaViewerOrigin.SharedMedia:\n containerSelector = `#shared-media${getMessageHtmlId(message!.id)}`;\n mediaSelector = 'img';\n break;\n\n case MediaViewerOrigin.SearchResult:\n containerSelector = `#search-media${getMessageHtmlId(message!.id)}`;\n mediaSelector = 'img';\n break;\n\n case MediaViewerOrigin.MiddleHeaderAvatar:\n containerSelector = '.MiddleHeader .Transition__slide--active .ChatInfo .Avatar';\n mediaSelector = '.avatar-media';\n break;\n\n case MediaViewerOrigin.SettingsAvatar:\n containerSelector = '#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto';\n mediaSelector = '.avatar-media';\n break;\n\n case MediaViewerOrigin.ProfileAvatar:\n containerSelector = '#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto';\n mediaSelector = '.avatar-media';\n break;\n\n case MediaViewerOrigin.ScheduledInline:\n case MediaViewerOrigin.Inline:\n default:\n containerSelector = `.Transition__slide--active > .MessageList #${getMessageHtmlId(message!.id)}`;\n mediaSelector = '.message-content .full-media, .message-content .thumbnail';\n }\n\n const container = document.querySelector<HTMLElement>(containerSelector)!;\n const mediaEls = container && container.querySelectorAll<HTMLImageElement | HTMLVideoElement>(mediaSelector);\n\n return {\n container,\n mediaEl: mediaEls?.[mediaEls.length - 1],\n };\n}\n\nfunction applyShape(ghost: HTMLDivElement, origin: MediaViewerOrigin) {\n switch (origin) {\n case MediaViewerOrigin.Album:\n case MediaViewerOrigin.ScheduledAlbum:\n case MediaViewerOrigin.Inline:\n case MediaViewerOrigin.ScheduledInline:\n ghost.classList.add('rounded-corners');\n break;\n\n case MediaViewerOrigin.SharedMedia:\n case MediaViewerOrigin.SettingsAvatar:\n case MediaViewerOrigin.ProfileAvatar:\n case MediaViewerOrigin.SearchResult:\n (ghost.firstChild as HTMLElement).style.objectFit = 'cover';\n break;\n\n case MediaViewerOrigin.MiddleHeaderAvatar:\n ghost.classList.add('circle');\n break;\n }\n}\n\nfunction clearShape(ghost: HTMLDivElement) {\n (ghost.firstChild as HTMLElement).style.objectFit = 'default';\n ghost.classList.remove('rounded-corners', 'circle');\n}\n","import 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({\n isActive: isOpen,\n onBack: closeMediaViewer,\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(\n lang('NewContact.Phone.Hidden.Text', renderingUser?.firstName || ''),\n ['emoji', 'simple_markdown'],\n )}\n </p>\n <Checkbox\n checked={shouldSharePhoneNumber}\n tabIndex={0}\n onCheck={setShouldSharePhoneNumber}\n label={lang('lng_new_contact_share')}\n />\n <p className=\"NewContactModal__help-text\">\n {renderText(lang('AddContact.SharedContactExceptionInfo', renderingUser?.firstName))}\n </p>\n </>\n );\n }\n\n function renderCreateContact() {\n return (\n <div className=\"NewContactModal__new-contact\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Avatar size=\"jumbo\" text={`${firstName} ${lastName}`} />\n <div className=\"NewContactModal__new-contact-fieldset\">\n <InputText\n ref={inputRef}\n value={phone}\n inputMode=\"tel\"\n label={lang('lng_contact_phone')}\n tabIndex={0}\n onChange={handlePhoneChange}\n />\n <InputText\n value={firstName}\n label={lang('FirstName')}\n tabIndex={0}\n onChange={handleFirstNameChange}\n />\n <InputText\n value={lastName}\n label={lang('LastName')}\n tabIndex={0}\n onChange={handleLastNameChange}\n />\n </div>\n </div>\n );\n }\n\n return (\n <Modal\n className=\"NewContactModal\"\n title={lang('NewContact')}\n isOpen={isOpen}\n onClose={handleClose}\n onCloseAnimationEnd={unmarkIsShown}\n >\n {renderingUser && renderAddContact()}\n {renderingIsByPhoneNumber && renderCreateContact()}\n <div className=\"dialog-buttons\">\n <Button\n isText\n className=\"confirm-dialog-button\"\n onClick={handleClose}\n >\n {lang('Cancel')}\n </Button>\n <Button\n isText\n className=\"confirm-dialog-button\"\n disabled={!canBeSubmitted}\n onClick={handleSubmit}\n >\n {lang('Done')}\n </Button>\n </div>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n return {\n user: userId ? selectUser(global, userId) : undefined,\n userStatus: userId ? selectUserStatus(global, userId) : undefined,\n serverTimeOffset: global.serverTimeOffset,\n phoneCodeList: global.countryList.phoneCodes,\n };\n },\n)(NewContactModal));\n","import useWindowSize from '../../../hooks/useWindowSize';\nimport { useCallback, useEffect, useRef } from '../../../lib/teact/teact';\nimport { extractCurrentThemeParams } from '../../../util/themeStyle';\n\nexport type WebAppInboundEvent = {\n eventType: 'web_app_data_send';\n eventData: {\n data: string;\n };\n} | {\n eventType: 'web_app_setup_main_button';\n eventData: {\n is_visible: boolean;\n is_active: boolean;\n text: string;\n color: string;\n text_color: string;\n is_progress_visible: boolean;\n };\n} | {\n eventType: 'web_app_open_tg_link';\n eventData: {\n path_full: string;\n };\n} | {\n eventType: 'web_app_request_viewport' | 'web_app_request_theme' | 'web_app_ready' | 'web_app_expand'\n | 'web_app_close' | 'iframe_ready';\n};\n\ntype WebAppOutboundEvent = {\n eventType: 'viewport_changed';\n eventData: {\n height: number;\n width?: number;\n is_expanded?: boolean;\n };\n} | {\n eventType: 'theme_changed';\n eventData: {\n theme_params: {\n bg_color: string;\n text_color: string;\n hint_color: string;\n link_color: string;\n button_color: string;\n button_text_color: string;\n };\n };\n} | {\n eventType: 'set_custom_style';\n eventData: string;\n} | {\n eventType: 'main_button_pressed';\n};\n\nconst SCROLLBAR_STYLE = `* {\n scrollbar-width: thin;\n scrollbar-color: rgba(90,90,90,0.3) transparent;\n}\n\n*::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border-radius: 6px;\n background-color: rgba(90, 90, 90, 0.3);\n}\n\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}`;\n\nconst useWebAppFrame = (isOpen: boolean, isSimpleView: boolean, onEvent: (event: WebAppInboundEvent) => void) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLIFrameElement>(null);\n const ignoreEventsRef = useRef<boolean>(false);\n const windowSize = useWindowSize();\n\n const reloadFrame = useCallback((url: string) => {\n if (!ref.current) return;\n const frame = ref.current;\n frame.src = 'about:blank';\n frame.addEventListener('load', () => {\n frame.src = url;\n }, { once: true });\n }, []);\n\n const sendEvent = useCallback((event: WebAppOutboundEvent) => {\n if (!ref.current?.contentWindow) return;\n ref.current.contentWindow.postMessage(JSON.stringify(event), '*');\n }, []);\n\n const sendViewport = useCallback(() => {\n if (!ref.current) {\n return;\n }\n const { width, height } = ref.current.getBoundingClientRect();\n sendEvent({\n eventType: 'viewport_changed',\n eventData: {\n width,\n height,\n is_expanded: true,\n },\n });\n }, [sendEvent]);\n\n const sendTheme = useCallback(() => {\n sendEvent({\n eventType: 'theme_changed',\n eventData: {\n theme_params: extractCurrentThemeParams(),\n },\n });\n }, [sendEvent]);\n\n const sendCustomStyle = useCallback((style: string) => {\n sendEvent({\n eventType: 'set_custom_style',\n eventData: style,\n });\n }, [sendEvent]);\n\n const handleMessage = useCallback((event: MessageEvent<string>) => {\n if (ignoreEventsRef.current) {\n return;\n }\n\n try {\n const data = JSON.parse(event.data) as WebAppInboundEvent;\n // Handle some app requests here to simplify hook usage\n if (data.eventType === 'web_app_request_viewport') {\n sendViewport();\n }\n\n if (data.eventType === 'web_app_request_theme') {\n sendTheme();\n }\n\n if (data.eventType === 'iframe_ready') {\n sendCustomStyle(SCROLLBAR_STYLE);\n }\n\n if (data.eventType === 'web_app_data_send') {\n if (!isSimpleView) return; // Allowed only in simple view\n ignoreEventsRef.current = true;\n }\n onEvent(data);\n } catch (err) {\n // Ignore other messages\n }\n }, [isSimpleView, onEvent, sendCustomStyle, sendTheme, sendViewport]);\n\n useEffect(() => {\n if (windowSize) {\n sendViewport();\n }\n }, [sendViewport, windowSize]);\n\n useEffect(() => {\n window.addEventListener('message', handleMessage);\n return () => window.removeEventListener('message', handleMessage);\n }, [handleMessage]);\n\n useEffect(() => {\n if (isOpen && ref.current?.contentWindow) {\n sendViewport();\n ignoreEventsRef.current = false;\n }\n }, [isOpen, sendViewport]);\n\n return {\n ref, sendEvent, reloadFrame, sendViewport, sendTheme,\n };\n};\n\nexport default useWebAppFrame;\n","import React, {\n 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;\nconst LINK_PREFIX = 'https://t.me/';\n\nconst WebAppModal: FC<OwnProps & StateProps> = ({\n webApp,\n chat,\n isInstalled,\n theme,\n}) => {\n const {\n closeWebApp, sendWebViewData, prolongWebView, toggleBotInAttachMenu, openTelegramLink, openChat,\n } = getActions();\n const [mainButton, setMainButton] = useState<WebAppButton | undefined>();\n const lang = useLang();\n const {\n url, bot, buttonText, queryId,\n } = webApp || {};\n const isOpen = Boolean(url);\n const isSimple = !queryId;\n\n const handleEvent = useCallback((event: WebAppInboundEvent) => {\n const { eventType } = event;\n if (eventType === 'web_app_close') {\n closeWebApp();\n }\n\n if (eventType === 'web_app_open_tg_link') {\n const linkUrl = LINK_PREFIX + event.eventData.path_full;\n openTelegramLink({ url: linkUrl });\n closeWebApp();\n }\n\n if (eventType === 'web_app_data_send') {\n const { eventData } = event;\n closeWebApp();\n sendWebViewData({\n bot: bot!,\n buttonText: buttonText!,\n data: eventData.data,\n });\n }\n\n if (eventType === 'web_app_setup_main_button') {\n const { eventData } = event;\n const themeParams = extractCurrentThemeParams();\n // Validate colors if they are present\n const color = !eventData.color || validateHexColor(eventData.color) ? eventData.color\n : themeParams.button_color;\n const textColor = !eventData.text_color || validateHexColor(eventData.text_color) ? eventData.text_color\n : themeParams.text_color;\n setMainButton({\n isVisible: eventData.is_visible && Boolean(eventData.text?.trim().length),\n isActive: eventData.is_active,\n text: eventData.text || '',\n color,\n textColor,\n isProgressVisible: eventData.is_progress_visible,\n });\n }\n }, [bot, buttonText, closeWebApp, openTelegramLink, sendWebViewData]);\n\n const {\n ref, reloadFrame, sendEvent, sendViewport, sendTheme,\n } = useWebAppFrame(isOpen, isSimple, handleEvent);\n\n const shouldShowMainButton = mainButton?.isVisible && mainButton.text.trim().length > 0;\n\n useInterval(() => {\n prolongWebView({\n bot: bot!,\n queryId: queryId!,\n peer: chat!,\n });\n }, queryId ? PROLONG_INTERVAL : undefined, true);\n\n const handleMainButtonClick = useCallback(() => {\n sendEvent({\n eventType: 'main_button_pressed',\n });\n }, [sendEvent]);\n\n const handleRefreshClick = useCallback(() => {\n reloadFrame(webApp!.url);\n }, [reloadFrame, webApp]);\n\n // Notify view that height changed\n useOnChange(() => {\n setTimeout(() => {\n sendViewport();\n }, ANIMATION_WAIT);\n }, [mainButton?.isVisible, sendViewport]);\n\n // Notify view that theme changed\n useOnChange(() => {\n setTimeout(() => {\n sendTheme();\n }, ANIMATION_WAIT);\n }, [theme, sendTheme]);\n\n // Prevent refresh when rotating device\n useEffect(() => {\n if (!isOpen) return undefined;\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isOpen]);\n\n const handleToggleClick = useCallback(() => {\n toggleBotInAttachMenu({\n botId: bot!.id,\n isEnabled: !isInstalled,\n });\n }, [bot, isInstalled, toggleBotInAttachMenu]);\n\n const openBotChat = useCallback(() => {\n openChat({\n id: bot!.id,\n });\n closeWebApp();\n }, [bot, closeWebApp, openChat]);\n\n const MoreMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen: isMenuOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isMenuOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"More actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n const header = useMemo(() => {\n return (\n <div className=\"modal-header\">\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Close')}\n onClick={closeWebApp}\n >\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{bot?.firstName}</div>\n <DropdownMenu\n className=\"web-app-more-menu\"\n trigger={MoreMenuButton}\n positionX=\"right\"\n >\n {chat && bot && chat.id !== bot.id && (\n <MenuItem icon=\"bots\" onClick={openBotChat}>{lang('BotWebViewOpenBot')}</MenuItem>\n )}\n <MenuItem icon=\"reload\" onClick={handleRefreshClick}>{lang('WebApp.ReloadPage')}</MenuItem>\n {bot?.isAttachMenuBot && (\n <MenuItem icon={isInstalled ? 'stop' : 'install'} onClick={handleToggleClick} destructive={isInstalled}>\n {lang(isInstalled ? 'WebApp.RemoveBot' : 'WebApp.AddToAttachmentAdd')}\n </MenuItem>\n )}\n </DropdownMenu>\n </div>\n );\n }, [lang, closeWebApp, bot, MoreMenuButton, handleRefreshClick, isInstalled, handleToggleClick, chat, openBotChat]);\n\n const prevMainButtonColor = usePrevious(mainButton?.color, true);\n const prevMainButtonTextColor = usePrevious(mainButton?.textColor, true);\n const prevMainButtonIsActive = usePrevious(mainButton && Boolean(mainButton.isActive), true);\n const prevMainButtonText = usePrevious(mainButton?.text, true);\n\n const mainButtonCurrentColor = mainButton?.color || prevMainButtonColor;\n const mainButtonCurrentTextColor = mainButton?.textColor || prevMainButtonTextColor;\n const mainButtonCurrentIsActive = mainButton?.isActive !== undefined ? mainButton.isActive : prevMainButtonIsActive;\n const mainButtonCurrentText = mainButton?.text || prevMainButtonText;\n\n useEffect(() => {\n if (!isOpen) setMainButton(undefined);\n }, [isOpen]);\n\n const [shouldDecreaseWebFrameSize, setShouldDecreaseWebFrameSize] = useState(false);\n const [shouldHideButton, setShouldHideButton] = useState(true);\n\n const buttonChangeTimeout = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n if (buttonChangeTimeout.current) clearTimeout(buttonChangeTimeout.current);\n if (!shouldShowMainButton) {\n setShouldDecreaseWebFrameSize(false);\n buttonChangeTimeout.current = setTimeout(() => {\n setShouldHideButton(true);\n }, MAIN_BUTTON_ANIMATION_TIME);\n } else {\n setShouldHideButton(false);\n buttonChangeTimeout.current = setTimeout(() => {\n setShouldDecreaseWebFrameSize(true);\n }, MAIN_BUTTON_ANIMATION_TIME);\n }\n }, [setShouldDecreaseWebFrameSize, shouldShowMainButton]);\n\n return (\n <Modal\n className=\"WebAppModal\"\n isOpen={isOpen}\n onClose={closeWebApp}\n header={header}\n hasCloseButton\n >\n {isOpen && (\n <>\n <iframe\n ref={ref}\n className={buildClassName('web-app-frame', shouldDecreaseWebFrameSize && 'with-button')}\n src={url}\n title={`${bot?.firstName} Web App`}\n sandbox=\"allow-scripts allow-same-origin allow-popups allow-forms\"\n allow=\"camera; microphone; geolocation;\"\n allowFullScreen\n />\n <Button\n className={buildClassName(\n 'web-app-button',\n shouldShowMainButton && 'visible',\n shouldHideButton && 'hidden',\n )}\n style={`background-color: ${mainButtonCurrentColor}; color: ${mainButtonCurrentTextColor}`}\n disabled={!mainButtonCurrentIsActive}\n onClick={handleMainButtonClick}\n >\n {mainButtonCurrentText}\n {mainButton?.isProgressVisible && <Spinner color=\"white\" />}\n </Button>\n </>\n )}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { webApp }): StateProps => {\n const { bot } = webApp || {};\n const isInstalled = Boolean(bot && global.attachMenu.bots[bot.id]);\n const chat = selectCurrentChat(global);\n const theme = selectTheme(global);\n\n return {\n isInstalled,\n chat,\n theme,\n };\n },\n)(WebAppModal));\n","import 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 { useHotkeys } from '../../../hooks/useHotkeys';\n\nconst useCopySelectedMessages = (isActive: boolean, copySelectedMessages: NoneToVoidFunction) => {\n function handleCopy(e: KeyboardEvent) {\n if (!isActive) {\n return;\n }\n\n e.preventDefault();\n copySelectedMessages();\n }\n\n useHotkeys([['meta+C', handleCopy]]);\n};\n\nexport default useCopySelectedMessages;\n","import 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-heart\" />\n {reactors?.count && formatIntegerCompact(reactors.count)}\n </Button>\n {allReactions.map((reaction) => {\n const count = reactions?.results.find((l) => l.reaction === reaction)?.count;\n return (\n <Button\n className={buildClassName(chosenTab === reaction && 'chosen')}\n size=\"tiny\"\n ripple\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setChosenTab(reaction)}\n >\n <ReactionStaticEmoji reaction={reaction} className=\"reaction-filter-emoji\" />\n {count && formatIntegerCompact(count)}\n </Button>\n );\n })}\n </div>\n )}\n\n <div dir={lang.isRtl ? 'rtl' : undefined}>\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"reactor-list custom-scroll\"\n items={viewportIds}\n onLoadMore={getMore}\n >\n {viewportIds?.map(\n (userId) => {\n const user = usersById[userId];\n const fullName = getUserFullName(user);\n const reaction = reactors?.reactions.find((l) => l.userId === userId)?.reaction;\n return (\n <ListItem\n key={userId}\n className=\"chat-item-clickable reactors-list-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleClick(userId)}\n >\n <Avatar user={user} size=\"medium\" />\n <div className=\"title\">\n <h3 dir=\"auto\">{fullName && renderText(fullName)}</h3>\n </div>\n {reaction && <ReactionStaticEmoji className=\"reactors-list-emoji\" reaction={reaction} />}\n </ListItem>\n );\n },\n )}\n </InfiniteScroll>\n ) : <Loading />}\n </div>\n <Button\n className=\"confirm-dialog-button\"\n isText\n onClick={closeReactorListModal}\n >\n {lang('Close')}\n </Button>\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { chatId, messageId } = global.reactorModal || {};\n const message = chatId && messageId ? selectChatMessage(global, chatId, messageId) : undefined;\n\n return {\n chatId,\n messageId,\n reactions: message?.reactions,\n reactors: message?.reactors,\n seenByUserIds: message?.seenByUserIds,\n };\n },\n)(ReactorListModal));\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isActive, undefined, '.ListItem-button', true);\n\n return (\n <div className=\"LeftSearch\" ref={containerRef} onKeyDown={handleKeyDown}>\n <TabList activeTab={activeTab} tabs={chatId ? CHAT_TABS : TABS} onSwitchTab={handleSwitchTab} />\n <Transition\n name={lang.isRtl ? 'slide-optimized-rtl' : 'slide-optimized'}\n renderCount={TRANSITION_RENDER_COUNT}\n activeKey={currentContent}\n >\n {(() => {\n switch (currentContent) {\n case GlobalSearchContent.ChatList:\n if (chatId) {\n return (\n <UserChatResults\n searchQuery={searchQuery}\n dateSearchQuery={dateSearchQuery}\n onReset={onReset}\n onSearchDateSelect={handleSearchDateSelect}\n />\n );\n }\n return (\n <ChatResults\n searchQuery={searchQuery}\n searchDate={searchDate}\n dateSearchQuery={dateSearchQuery}\n onReset={onReset}\n onSearchDateSelect={handleSearchDateSelect}\n />\n );\n case GlobalSearchContent.Media:\n return <MediaResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Links:\n return <LinkResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Files:\n return <FileResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Music:\n return (\n <AudioResults\n key=\"audio\"\n searchQuery={searchQuery}\n />\n );\n case GlobalSearchContent.Voice:\n return (\n <AudioResults\n key=\"voice\"\n isVoice\n searchQuery={searchQuery}\n />\n );\n default:\n return undefined;\n }\n })()}\n </Transition>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentContent, chatId } = global.globalSearch;\n\n return { currentContent, chatId };\n },\n)(LeftSearch));\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n useEffect(() => {\n if (lastSyncTime) {\n loadAuthorizations();\n }\n }, [lastSyncTime, loadAuthorizations]);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-main-menu\">\n {currentUser && (\n <ProfileInfo\n userId={currentUser.id}\n forceShowSelf\n />\n )}\n {currentUser && (\n <ChatExtra\n chatOrUserId={currentUser.id}\n forceShowSelf\n />\n )}\n <ListItem\n icon=\"settings\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.General)}\n >\n {lang('Telegram.GeneralSettingsViewController')}\n </ListItem>\n <ListItem\n icon=\"unmute\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Notifications)}\n >\n {lang('Notifications')}\n </ListItem>\n <ListItem\n icon=\"data\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.DataStorage)}\n >\n {lang('DataSettings')}\n </ListItem>\n <ListItem\n icon=\"lock\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Privacy)}\n >\n {lang('PrivacySettings')}\n </ListItem>\n <ListItem\n icon=\"folder\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Folders)}\n >\n {lang('Filters')}\n </ListItem>\n <ListItem\n icon=\"active-sessions\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.ActiveSessions)}\n >\n {lang('SessionsTitle')}\n {sessionCount > 0 && (<span className=\"settings-item__current-value\">{sessionCount}</span>)}\n </ListItem>\n <ListItem\n icon=\"language\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.Language)}\n >\n {lang('Language')}\n <span className=\"settings-item__current-value\">{lang.langName}</span>\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId, lastSyncTime } = global;\n\n return {\n sessionCount: global.activeSessions.orderedHashes.length,\n currentUser: currentUserId ? selectUser(global, currentUserId) : undefined,\n lastSyncTime,\n };\n },\n)(SettingsMain));\n","import { 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 } from '../../../types';\n\nimport { throttle } from '../../../util/schedulers';\nimport { selectUser } from '../../../global/selectors';\nimport { getChatAvatarHash } from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport InputText from '../../ui/InputText';\nimport renderText from '../../common/helpers/renderText';\nimport UsernameInput from '../../common/UsernameInput';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\ntype OwnProps = {\n isActive: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n currentAvatarHash?: string;\n currentFirstName?: string;\n currentLastName?: string;\n currentBio?: string;\n currentUsername?: string;\n progress?: ProfileEditProgress;\n isUsernameAvailable?: boolean;\n};\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst MAX_BIO_LENGTH = 70;\n\nconst ERROR_FIRST_NAME_MISSING = 'Please provide your first name';\nconst ERROR_BIO_TOO_LONG = 'Bio can\\' be longer than 70 characters';\n\nconst SettingsEditProfile: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n currentAvatarHash,\n currentFirstName,\n currentLastName,\n currentBio,\n currentUsername,\n progress,\n isUsernameAvailable,\n}) => {\n const {\n loadCurrentUser,\n updateProfile,\n checkUsername,\n } = getActions();\n\n const lang = useLang();\n\n const [isUsernameTouched, setIsUsernameTouched] = useState(false);\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [error, setError] = useState<string | undefined>();\n\n const [photo, setPhoto] = useState<File | undefined>();\n const [firstName, setFirstName] = useState(currentFirstName || '');\n const [lastName, setLastName] = useState(currentLastName || '');\n const [bio, setBio] = useState(currentBio || '');\n const [username, setUsername] = useState<string | false>(currentUsername || '');\n\n const currentAvatarBlobUrl = useMedia(currentAvatarHash, false, ApiMediaFormat.BlobUrl);\n\n const isLoading = progress === ProfileEditProgress.InProgress;\n const isUsernameError = username === false;\n\n const isSaveButtonShown = useMemo(() => {\n if (isUsernameError) {\n return false;\n }\n\n return Boolean(photo) || isProfileFieldsTouched || isUsernameAvailable === true;\n }, [photo, isProfileFieldsTouched, isUsernameError, isUsernameAvailable]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadCurrentUser();\n });\n }, [loadCurrentUser]);\n\n useEffect(() => {\n setPhoto(undefined);\n }, [currentAvatarBlobUrl]);\n\n useEffect(() => {\n setFirstName(currentFirstName || '');\n setLastName(currentLastName || '');\n setBio(currentBio || '');\n }, [currentFirstName, currentLastName, currentBio]);\n\n useEffect(() => {\n setUsername(currentUsername || '');\n }, [currentUsername]);\n\n useEffect(() => {\n if (progress === ProfileEditProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setIsUsernameTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handlePhotoChange = useCallback((newPhoto: File) => {\n setPhoto(newPhoto);\n }, []);\n\n const handleFirstNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleLastNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleBioChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setBio(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUsernameChange = useCallback((value: string | false) => {\n setUsername(value);\n setIsUsernameTouched(true);\n }, []);\n\n const handleProfileSave = useCallback(() => {\n const trimmedFirstName = firstName.trim();\n const trimmedLastName = lastName.trim();\n const trimmedBio = bio.trim();\n\n if (!trimmedFirstName.length) {\n setError(ERROR_FIRST_NAME_MISSING);\n return;\n }\n\n if (trimmedBio.length > MAX_BIO_LENGTH) {\n setError(ERROR_BIO_TOO_LONG);\n return;\n }\n\n updateProfile({\n photo,\n ...(isProfileFieldsTouched && {\n firstName: trimmedFirstName,\n lastName: trimmedLastName,\n bio: trimmedBio,\n }),\n ...(isUsernameTouched && {\n username,\n }),\n });\n }, [\n photo,\n firstName, lastName, bio, isProfileFieldsTouched,\n username, isUsernameTouched,\n updateProfile,\n ]);\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-edit-profile settings-item\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handlePhotoChange}\n title=\"Edit your profile photo\"\n disabled={isLoading}\n />\n <InputText\n value={firstName}\n onChange={handleFirstNameChange}\n label={lang('FirstName')}\n disabled={isLoading}\n error={error === ERROR_FIRST_NAME_MISSING ? error : undefined}\n />\n <InputText\n value={lastName}\n onChange={handleLastNameChange}\n label={lang('LastName')}\n disabled={isLoading}\n />\n <InputText\n value={bio}\n onChange={handleBioChange}\n label={lang('UserBio')}\n disabled={isLoading}\n error={error === ERROR_BIO_TOO_LONG ? error : undefined}\n />\n\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderText(lang('lng_settings_about_bio'), ['br', 'simple_markdown'])}\n </p>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('Username')}</h4>\n\n <UsernameInput\n currentUsername={username || ''}\n isLoading={isLoading}\n isUsernameAvailable={isUsernameAvailable}\n checkUsername={checkUsername}\n onChange={handleUsernameChange}\n />\n\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderText(lang('UsernameHelp'), ['br', 'simple_markdown'])}\n </p>\n {username && (\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('lng_username_link')}<br />\n <span className=\"username-link\">https://t.me/{username}</span>\n </p>\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isSaveButtonShown}\n onClick={handleProfileSave}\n disabled={isLoading}\n ariaLabel=\"Save changes\"\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentUserId } = global;\n const { progress, isUsernameAvailable } = global.profileEdit || {};\n const currentUser = currentUserId ? selectUser(global, currentUserId) : undefined;\n\n if (!currentUser) {\n return {\n progress,\n isUsernameAvailable,\n };\n }\n\n const {\n firstName: currentFirstName,\n lastName: currentLastName,\n username: currentUsername,\n fullInfo,\n } = currentUser;\n const { bio: currentBio } = fullInfo || {};\n const currentAvatarHash = getChatAvatarHash(currentUser);\n\n return {\n currentAvatarHash,\n currentFirstName,\n currentLastName,\n currentBio,\n currentUsername,\n progress,\n isUsernameAvailable,\n };\n },\n)(SettingsEditProfile));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ISettings } from '../../../types';\n\nimport { AUTODOWNLOAD_FILESIZE_MB_LIMITS } from '../../../config';\nimport { pick } from '../../../util/iteratees';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport Checkbox from '../../ui/Checkbox';\nimport RangeSlider from '../../ui/RangeSlider';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = Pick<ISettings, (\n 'canAutoLoadPhotoFromContacts' |\n 'canAutoLoadPhotoInPrivateChats' |\n 'canAutoLoadPhotoInGroups' |\n 'canAutoLoadPhotoInChannels' |\n 'canAutoLoadVideoFromContacts' |\n 'canAutoLoadVideoInPrivateChats' |\n 'canAutoLoadVideoInGroups' |\n 'canAutoLoadVideoInChannels' |\n 'canAutoLoadFileFromContacts' |\n 'canAutoLoadFileInPrivateChats' |\n 'canAutoLoadFileInGroups' |\n 'canAutoLoadFileInChannels' |\n 'canAutoPlayGifs' |\n 'canAutoPlayVideos' |\n 'autoLoadFileMaxSizeMb'\n)>;\n\nconst SettingsDataStorage: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n canAutoLoadPhotoFromContacts,\n canAutoLoadPhotoInPrivateChats,\n canAutoLoadPhotoInGroups,\n canAutoLoadPhotoInChannels,\n canAutoLoadVideoFromContacts,\n canAutoLoadVideoInPrivateChats,\n canAutoLoadVideoInGroups,\n canAutoLoadVideoInChannels,\n canAutoLoadFileFromContacts,\n canAutoLoadFileInPrivateChats,\n canAutoLoadFileInGroups,\n canAutoLoadFileInChannels,\n canAutoPlayGifs,\n canAutoPlayVideos,\n autoLoadFileMaxSizeMb,\n}) => {\n const { setSettingOption } = getActions();\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const renderFileSizeCallback = useCallback((value: number) => {\n return lang('AutodownloadSizeLimitUpTo', lang('FileSize.MB', String(AUTODOWNLOAD_FILESIZE_MB_LIMITS[value]), 'i'));\n }, [lang]);\n\n const handleFileSizeChange = useCallback((value: number) => {\n setSettingOption({ autoLoadFileMaxSizeMb: AUTODOWNLOAD_FILESIZE_MB_LIMITS[value] });\n }, [setSettingOption]);\n\n const handleCanAutoPlayGifsChange = useCallback((value: boolean) => {\n setSettingOption({ canAutoPlayGifs: value });\n }, [setSettingOption]);\n\n const handleCanAutoPlayVideosChange = useCallback((value: boolean) => {\n setSettingOption({ canAutoPlayVideos: value });\n }, [setSettingOption]);\n\n function renderContentSizeSlider() {\n const value = AUTODOWNLOAD_FILESIZE_MB_LIMITS.indexOf(autoLoadFileMaxSizeMb);\n\n return (\n <div className=\"pt-5\">\n <RangeSlider\n label={lang('AutoDownloadMaxFileSize')}\n min={0}\n max={5}\n value={value !== -1 ? value : 2}\n renderValue={renderFileSizeCallback}\n onChange={handleFileSizeChange}\n />\n </div>\n );\n }\n\n function renderAutoDownloadBlock(\n title: string,\n key: 'Photo' | 'Video' | 'File',\n canAutoLoadFromContacts: boolean,\n canAutoLoadInPrivateChats: boolean,\n canAutoLoadInGroups: boolean,\n canAutoLoadInChannels: boolean,\n ) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{title}</h4>\n\n <Checkbox\n label={lang('AutoDownloadSettings.Contacts')}\n checked={canAutoLoadFromContacts}\n // TODO rewrite to support `useCallback`\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}FromContacts`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.PrivateChats')}\n checked={canAutoLoadInPrivateChats}\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InPrivateChats`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.GroupChats')}\n checked={canAutoLoadInGroups}\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InGroups`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.Channels')}\n checked={canAutoLoadInChannels}\n // eslint-disable-next-line react/jsx-no-bind\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InChannels`]: isChecked })}\n />\n\n {key === 'File' && renderContentSizeSlider()}\n </div>\n );\n }\n\n return (\n <div className=\"settings-content custom-scroll\">\n {renderAutoDownloadBlock(\n lang('AutoDownloadPhotosTitle'),\n 'Photo',\n canAutoLoadPhotoFromContacts,\n canAutoLoadPhotoInPrivateChats,\n canAutoLoadPhotoInGroups,\n canAutoLoadPhotoInChannels,\n )}\n {renderAutoDownloadBlock(\n lang('AutoDownloadVideosTitle'),\n 'Video',\n canAutoLoadVideoFromContacts,\n canAutoLoadVideoInPrivateChats,\n canAutoLoadVideoInGroups,\n canAutoLoadVideoInChannels,\n )}\n {renderAutoDownloadBlock(\n 'Auto-download files', // Proper translation is not available yet\n 'File',\n canAutoLoadFileFromContacts,\n canAutoLoadFileInPrivateChats,\n canAutoLoadFileInGroups,\n canAutoLoadFileInChannels,\n )}\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('AutoplayMedia')}</h4>\n\n <Checkbox\n label={lang('GifsTab2')}\n checked={canAutoPlayGifs}\n onCheck={handleCanAutoPlayGifsChange}\n />\n <Checkbox\n label={lang('DataAndStorage.Autoplay.Videos')}\n checked={canAutoPlayVideos}\n onCheck={handleCanAutoPlayVideosChange}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return pick(global.settings.byKey, [\n 'canAutoLoadPhotoFromContacts',\n 'canAutoLoadPhotoInPrivateChats',\n 'canAutoLoadPhotoInGroups',\n 'canAutoLoadPhotoInChannels',\n 'canAutoLoadVideoFromContacts',\n 'canAutoLoadVideoInPrivateChats',\n 'canAutoLoadVideoInGroups',\n 'canAutoLoadVideoInChannels',\n 'canAutoLoadFileFromContacts',\n 'canAutoLoadFileInPrivateChats',\n 'canAutoLoadFileInGroups',\n 'canAutoLoadFileInChannels',\n 'canAutoPlayGifs',\n 'canAutoPlayVideos',\n 'autoLoadFileMaxSizeMb',\n ]);\n },\n)(SettingsDataStorage));\n","import React, {\n FC, memo, useMemo, useCallback, useState, useEffect,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport { ApiChatFolder } from '../../../../api/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 onReset: () => void;\n};\n\ntype StateProps = {\n orderedFolderIds?: number[];\n foldersById: Record<number, ApiChatFolder>;\n recommendedChatFolders?: ApiChatFolder[];\n};\n\nconst runThrottledForLoadRecommended = throttle((cb) => cb(), 60000, true);\n\nconst MAX_ALLOWED_FOLDERS = 10;\n\nconst SettingsFoldersMain: FC<OwnProps & StateProps> = ({\n isActive,\n onCreateFolder,\n onEditFolder,\n onReset,\n orderedFolderIds,\n foldersById,\n recommendedChatFolders,\n}) => {\n const {\n loadRecommendedChatFolders,\n addChatFolder,\n showDialog,\n } = getActions();\n\n 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({\n isActive,\n onBack: onReset,\n });\n\n const chatsCountByFolderId = useFolderManagerForChatsCount();\n const userFolders = useMemo(() => {\n if (!orderedFolderIds) {\n return undefined;\n }\n\n return orderedFolderIds.map((id) => {\n const folder = foldersById[id];\n\n return {\n id: folder.id,\n title: folder.title,\n subtitle: getFolderDescriptionText(lang, folder, chatsCountByFolderId[folder.id]),\n };\n });\n }, [orderedFolderIds, foldersById, lang, chatsCountByFolderId]);\n\n const handleCreateFolderFromRecommended = useCallback((folder: ApiChatFolder) => {\n if (Object.keys(foldersById).length >= MAX_ALLOWED_FOLDERS) {\n showDialog({\n data: {\n message: 'DIALOG_FILTERS_TOO_MUCH',\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n addChatFolder({ folder });\n }, [foldersById, addChatFolder, showDialog]);\n\n return (\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-content-header\">\n <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 { 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 onReset: () => void;\n onBack: () => void;\n};\n\ntype StateProps = {\n loadedActiveChatIds?: string[];\n loadedArchivedChatIds?: string[];\n};\n\nconst SUBMIT_TIMEOUT = 500;\n\nconst INITIAL_CHATS_LIMIT = 5;\n\nconst ERROR_NO_TITLE = 'Please provide a title for this folder.';\nconst ERROR_NO_CHATS = 'ChatList.Filter.Error.Empty';\n\nconst SettingsFoldersEdit: FC<OwnProps & StateProps> = ({\n state,\n dispatch,\n onAddIncludedChats,\n onAddExcludedChats,\n isActive,\n onReset,\n onBack,\n loadedActiveChatIds,\n loadedArchivedChatIds,\n}) => {\n const {\n editChatFolder,\n addChatFolder,\n } = getActions();\n\n const [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({\n isActive,\n onBack,\n });\n\n const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n const { currentTarget } = event;\n dispatch({ type: 'setTitle', payload: currentTarget.value.trim() });\n }, [dispatch]);\n\n const handleSubmit = useCallback(() => {\n const { title } = state.folder;\n\n if (!title) {\n dispatch({ type: 'setError', payload: ERROR_NO_TITLE });\n return;\n }\n\n if (!includedChatIds.length && !Object.keys(includedChatTypes).length) {\n dispatch({ type: 'setError', payload: ERROR_NO_CHATS });\n return;\n }\n\n dispatch({ type: 'setIsLoading', payload: true });\n if (state.mode === 'edit') {\n editChatFolder({ id: state.folderId, folderUpdate: state.folder });\n } else {\n addChatFolder({ folder: state.folder });\n }\n\n setTimeout(() => {\n onReset();\n }, SUBMIT_TIMEOUT);\n }, [addChatFolder, dispatch, editChatFolder, includedChatIds.length, includedChatTypes, onReset, state]);\n\n function renderChatType(key: string, mode: 'included' | 'excluded') {\n const chatType = mode === 'included'\n ? INCLUDED_CHAT_TYPES.find(({ key: typeKey }) => typeKey === key)\n : EXCLUDED_CHAT_TYPES.find(({ key: typeKey }) => typeKey === key);\n\n if (!chatType) {\n return undefined;\n }\n\n return (\n <ListItem\n key={chatType.key}\n className=\"settings-folders-list-item mb-1\"\n icon={chatType.icon}\n narrow\n inactive\n >\n {lang(chatType.title)}\n </ListItem>\n );\n }\n\n function renderChats(mode: 'included' | 'excluded') {\n const selectedChatTypes = mode === 'included' ? includedChatTypes : excludedChatTypes;\n const visibleChatIds = mode === 'included' ? visibleIncludedChatIds : visibleExcludedChatIds;\n\n const isExpanded = mode === 'included' ? isIncludedChatsListExpanded : isExcludedChatsListExpanded;\n const allChatIds = mode === 'included' ? includedChatIds : excludedChatIds;\n const leftChatsCount = allChatIds.length - selectedChatTypes.length - visibleChatIds.length;\n const clickHandler = mode === 'included'\n ? () => setIsIncludedChatsListExpanded(true)\n : () => setIsExcludedChatsListExpanded(true);\n\n return (\n <>\n {selectedChatTypes.map((key) => renderChatType(key, mode))}\n {visibleChatIds.map((id) => (\n <ListItem\n className=\"settings-folders-list-item mb-1\"\n narrow\n inactive\n >\n {isUserId(id) ? (\n <PrivateChatInfo avatarSize=\"small\" userId={id} />\n ) : (\n <GroupChatInfo avatarSize=\"small\" chatId={id} />\n )}\n </ListItem>\n ))}\n {(!isExpanded && leftChatsCount > 0) && (\n <ShowMoreButton\n count={leftChatsCount}\n itemName=\"chat\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={clickHandler}\n />\n )}\n </>\n );\n }\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content no-border custom-scroll\">\n <div className=\"settings-content-header\">\n <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 { 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 onReset: () => void;\n};\n\nconst SettingsFoldersChatFilters: FC<OwnProps> = ({\n mode,\n state,\n dispatch,\n isActive,\n onReset,\n}) => {\n const { chatFilter } = state;\n const { selectedChatIds, selectedChatTypes } = selectChatFilters(state, mode, true);\n\n const lang = useLang();\n\n const folderAllOrderedIds = useFolderManagerForOrderedIds(ALL_FOLDER_ID);\n const folderArchivedOrderedIds = useFolderManagerForOrderedIds(ARCHIVED_FOLDER_ID);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on chats, so we avoid them\n const chatsById = getGlobal().chats.byId;\n\n const chatIds = [...folderAllOrderedIds || [], ...folderArchivedOrderedIds || []];\n return unique([\n ...selectedChatIds,\n ...filterChatsByName(lang, chatIds, chatsById, chatFilter),\n ]);\n }, [folderAllOrderedIds, folderArchivedOrderedIds, selectedChatIds, lang, chatFilter]);\n\n const handleFilterChange = useCallback((newFilter: string) => {\n dispatch({\n type: 'setChatFilter',\n payload: newFilter,\n });\n }, [dispatch]);\n\n const handleSelectedIdsChange = useCallback((ids: string[]) => {\n if (mode === 'included') {\n dispatch({\n type: 'setIncludeFilters',\n payload: { ...state.includeFilters, includedChatIds: ids },\n });\n } else {\n dispatch({\n type: 'setExcludeFilters',\n payload: { ...state.excludeFilters, excludedChatIds: ids },\n });\n }\n }, [mode, state, dispatch]);\n\n const handleSelectedChatTypesChange = useCallback((keys: string[]) => {\n const newFilters: Record<string, boolean> = {};\n keys.forEach((key) => {\n newFilters[key] = true;\n });\n\n if (mode === 'included') {\n dispatch({\n type: 'setIncludeFilters',\n payload: {\n includedChatIds: selectedChatIds,\n ...newFilters,\n },\n });\n } else {\n dispatch({\n type: 'setExcludeFilters',\n payload: {\n excludedChatIds: selectedChatIds,\n ...newFilters,\n },\n });\n }\n }, [mode, selectedChatIds, dispatch]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n if (!displayedIds) {\n return <Loading />;\n }\n\n return (\n <SettingsFoldersChatsPicker\n mode={mode}\n chatIds={displayedIds}\n selectedIds={selectedChatIds}\n selectedChatTypes={selectedChatTypes}\n filterValue={chatFilter}\n onSelectedIdsChange={handleSelectedIdsChange}\n onSelectedChatTypesChange={handleSelectedChatTypesChange}\n onFilterChange={handleFilterChange}\n />\n );\n};\n\nexport default memo(SettingsFoldersChatFilters);\n","import 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 isActive={isActive || [\n SettingsScreens.FoldersCreateFolder,\n SettingsScreens.FoldersEditFolder,\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersExcludedChats,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n return (\n <SettingsFoldersEdit\n state={state}\n dispatch={dispatch}\n onAddIncludedChats={handleAddIncludedChats}\n onAddExcludedChats={handleAddExcludedChats}\n onReset={handleReset}\n isActive={isActive || [\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersExcludedChats,\n ].includes(shownScreen)}\n onBack={onReset}\n />\n );\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n return (\n <SettingsFoldersChatFilters\n mode=\"included\"\n state={state}\n dispatch={dispatch}\n onReset={handleReset}\n isActive={isActive}\n />\n );\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <SettingsFoldersChatFilters\n mode=\"excluded\"\n state={state}\n dispatch={dispatch}\n onReset={handleReset}\n isActive={isActive}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(SettingsFolders);\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('SETTINGS')}</h4>\n\n <RangeSlider\n label={lang('TextSize')}\n min={12}\n max={20}\n value={messageTextSize}\n onChange={handleMessageTextSizeChange}\n />\n\n <ListItem\n icon=\"photo\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.GeneralChatBackground)}\n >\n {lang('ChatBackground')}\n </ListItem>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('Theme')}\n </h4>\n <RadioGroup\n name=\"theme\"\n options={APPEARANCE_THEME_OPTIONS}\n selected={shouldUseSystemTheme ? 'auto' : theme}\n onChange={handleAppearanceThemeChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Time Format\n </h4>\n <RadioGroup\n name=\"timeformat\"\n options={TIME_FORMAT_OPTIONS}\n selected={timeFormat}\n onChange={handleTimeFormatChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Animation Level\n </h4>\n <p className=\"settings-item-description\" dir={lang.isRtl ? 'rtl' : undefined}>\n Choose the desired animations amount.\n </p>\n\n <RangeSlider\n options={ANIMATION_LEVEL_OPTIONS}\n value={animationLevel}\n onChange={handleAnimationLevelChange}\n />\n </div>\n\n {KEYBOARD_SEND_OPTIONS && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('VoiceOver.Keyboard')}</h4>\n\n <RadioGroup\n name=\"keyboard-send-settings\"\n options={KEYBOARD_SEND_OPTIONS}\n onChange={handleMessageSendComboChange}\n selected={messageSendKeyCombo}\n />\n </div>\n )}\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('AccDescrStickers')}</h4>\n\n {defaultReaction && (\n <ListItem\n className=\"SettingsDefaultReaction\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.QuickReaction)}\n >\n <ReactionStaticEmoji reaction={defaultReaction} />\n <div className=\"title\">{lang('DoubleTapSetting')}</div>\n </ListItem>\n )}\n\n <Checkbox\n label={lang('SuggestStickers')}\n checked={shouldSuggestStickers}\n onCheck={handleSuggestStickersChange}\n />\n <Checkbox\n label={lang('LoopAnimatedStickers')}\n checked={shouldLoopStickers}\n onCheck={handleShouldLoopStickersChange}\n />\n\n <div className=\"mt-4\" ref={stickerSettingsRef}>\n {stickerSets && stickerSets.map((stickerSet: ApiStickerSet) => (\n <SettingsStickerSet\n key={stickerSet.id}\n stickerSet={stickerSet}\n observeIntersection={observeIntersectionForCovers}\n onClick={handleStickerSetClick}\n />\n ))}\n </div>\n {sticker && (\n <StickerSetModal\n isOpen={isModalOpen}\n fromSticker={sticker}\n onClose={closeModal}\n />\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { theme, shouldUseSystemTheme } = global.settings.byKey;\n\n return {\n ...pick(global.settings.byKey, [\n 'messageTextSize',\n 'animationLevel',\n 'messageSendKeyCombo',\n 'shouldSuggestStickers',\n 'shouldLoopStickers',\n 'isSensitiveEnabled',\n 'canChangeSensitive',\n 'timeFormat',\n ]),\n stickerSetIds: global.stickers.added.setIds,\n stickerSetsById: global.stickers.setsById,\n defaultReaction: global.appConfig?.defaultReaction,\n theme,\n shouldUseSystemTheme,\n };\n },\n)(SettingsGeneral));\n","/* eslint-disable eqeqeq */\n/* eslint-disable prefer-template */\n/* eslint-disable prefer-const */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable one-var */\n/* eslint-disable one-var-declaration-per-line */\n\nimport { preloadImage } from './files';\n\n/**\n * HEX > RGB\n * input: 'xxxxxx' (ex. 'ed15fa') case-insensitive\n * output: [r, g, b] ([0-255, 0-255, 0-255])\n */\nexport function hex2rgb(param: string): [number, number, number] {\n return [\n parseInt(param.substring(0, 2), 16),\n parseInt(param.substring(2, 4), 16),\n parseInt(param.substring(4, 6), 16),\n ];\n}\n\n/**\n * RGB > HEX\n * input: [r, g, b] ([0-255, 0-255, 0-255])\n * output: 'xxxxxx' (ex. 'ff0000')\n */\nexport function rgb2hex(param: [number, number, number]) {\n const p0 = param[0].toString(16);\n const p1 = param[1].toString(16);\n const p2 = param[2].toString(16);\n return (p0.length == 1 ? '0' + p0 : p0) + (p1.length == 1 ? '0' + p1 : p1) + (p2.length == 1 ? '0' + p2 : p2);\n}\n\n/**\n * Converts an RGB color value to HSV. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes r, g, and b are contained in the set [0, 255] and\n * returns h, s, and v in the set [0, 1].\n *\n * @param Number r The red color value\n * @param Number g The green color value\n * @param Number b The blue color value\n * @return Array The HSV representation\n */\nexport function rgb2hsb([r, g, b]: [number, number, number]): [number, number, number] {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h!: number, s: number, v: number = max;\n\n let d = max - min;\n s = max == 0 ? 0 : d / max;\n\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n\n h /= 6;\n }\n\n return [h, s, v];\n}\n\n/**\n * Converts an HSV color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes h, s, and v are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number v The value\n * @return Array The RGB representation\n */\nexport function hsb2rgb([h, s, v]: [number, number, number]): [number, number, number] {\n let r!: number, g!: number, b!: number;\n\n let i = Math.floor(h * 6);\n let f = h * 6 - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n }\n\n return [\n Math.round(r * 255),\n Math.round(g * 255),\n Math.round(b * 255),\n ];\n}\n\nexport async function getAverageColor(url: string): Promise<[number, number, number]> {\n // Only visit every 5 pixels\n const blockSize = 5;\n const defaultRGB: [number, number, number] = [0, 0, 0];\n let data;\n let width;\n let height;\n let i = -4;\n let length;\n let rgb: [number, number, number] = [0, 0, 0];\n let count = 0;\n\n const canvas = document.createElement('canvas');\n const context = canvas.getContext && canvas.getContext('2d');\n if (!context) {\n return defaultRGB;\n }\n\n const image = await preloadImage(url);\n height = image.naturalHeight || image.offsetHeight || image.height;\n width = image.naturalWidth || image.offsetWidth || image.width;\n canvas.height = height;\n canvas.width = width;\n\n context.drawImage(image, 0, 0);\n\n try {\n data = context.getImageData(0, 0, width, height);\n } catch (e) {\n return defaultRGB;\n }\n\n length = data.data.length;\n\n // eslint-disable-next-line no-cond-assign\n while ((i += blockSize * 4) < length) {\n ++count;\n rgb[0] += data.data[i];\n rgb[1] += data.data[i + 1];\n rgb[2] += data.data[i + 2];\n }\n\n rgb[0] = Math.floor(rgb[0] / count);\n rgb[1] = Math.floor(rgb[1] / count);\n rgb[2] = Math.floor(rgb[2] / count);\n\n return rgb;\n}\n\n// eslint-disable-next-line max-len\n// Function was adapted from https://github.com/telegramdesktop/tdesktop/blob/35ff621b5b52f7e3553fb0f990ea13ade7101b8e/Telegram/SourceFiles/data/data_wall_paper.cpp#L518\nexport function getPatternColor(rgbColor: [number, number, number]) {\n let [hue, saturation, value] = rgb2hsb(rgbColor);\n\n saturation = Math.min(1, saturation + 0.05 + 0.1 * (1 - saturation));\n value = value > 0.5\n ? Math.max(0, value * 0.65)\n : Math.max(0, Math.min(1, 1 - value * 0.65));\n\n return `hsla(${hue * 360}, ${saturation * 100}%, ${value * 100}%, .4)`;\n}\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n const isUploading = loadedWallpapers?.[0] && loadedWallpapers[0].slug === UPLOADING_WALLPAPER_SLUG;\n\n return (\n <div className=\"SettingsGeneralBackground settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <ListItem\n icon=\"camera-add\"\n className=\"mb-0\"\n disabled={isUploading}\n onClick={handleUploadWallpaper}\n >\n {lang('UploadImage')}\n </ListItem>\n\n <ListItem\n icon=\"colorize\"\n className=\"mb-0\"\n onClick={handleSetColor}\n >\n {lang('SetColor')}\n </ListItem>\n\n <ListItem icon=\"favorite\" onClick={handleResetToDefault}>\n {lang('ThemeResetToDefaults')}\n </ListItem>\n\n <Checkbox\n label={lang('BackgroundBlurred')}\n checked={Boolean(isBlurred)}\n onChange={handleWallPaperBlurChange}\n />\n </div>\n\n {loadedWallpapers ? (\n <div className=\"settings-wallpapers\">\n {loadedWallpapers.map((wallpaper) => (\n <WallpaperTile\n wallpaper={wallpaper}\n theme={theme}\n isSelected={background === wallpaper.slug}\n onClick={handleWallPaperSelect}\n />\n ))}\n </div>\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const theme = selectTheme(global);\n const { background, isBlurred } = global.settings.themes[theme] || {};\n const { loadedWallpapers } = global.settings;\n\n return {\n background,\n isBlurred,\n loadedWallpapers,\n theme,\n };\n },\n)(SettingsGeneralBackground));\n","import { 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 { 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 onReset: () => void;\n};\n\ntype StateProps = {\n backgroundColor?: string;\n theme: ThemeKey;\n};\n\ninterface CanvasRects {\n colorRect: {\n offsetLeft: number;\n top: number;\n width: number;\n height: number;\n };\n hueRect: {\n offsetLeft: number;\n width: number;\n };\n}\n\nconst DEFAULT_HSB = rgb2hsb(hex2rgb('e6ebee'));\nconst PREDEFINED_COLORS = [\n '#e6ebee', '#b2cee1', '#008dd0', '#c6e7cb', '#c4e1a6', '#60b16e',\n '#ccd0af', '#a6a997', '#7a7072', '#fdd7af', '#fdb76e', '#dd8851',\n];\n\nconst SettingsGeneralBackground: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n theme,\n backgroundColor,\n}) => {\n const { setThemeSettings } = getActions();\n\n const themeRef = useRef<string>();\n themeRef.current = theme;\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const colorPickerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const huePickerRef = useRef<HTMLDivElement>(null);\n const isFirstRunRef = useRef(true);\n\n const [hsb, setHsb] = useState(getInitialHsb(backgroundColor));\n // Cache for drag handlers\n const hsbRef = useRef(hsb);\n useEffect(() => {\n hsbRef.current = hsb;\n }, [hsb]);\n\n const [isDragging, markIsDragging, unmarkIsDragging] = useFlag();\n const [rgbInput, setRgbInput] = useState('');\n const [hexInput, setHexInput] = useState('');\n\n const rectsRef = useRef<CanvasRects>();\n const colorCtxRef = useRef<CanvasRenderingContext2D>();\n\n // Setup: cache rects, subscribe for drag events\n useEffect(() => {\n // We use `offsetLeft` instead of `left` to support screen transition\n const colorRect = {\n offsetLeft: colorPickerRef.current!.offsetLeft,\n ...pick(colorPickerRef.current!.getBoundingClientRect(), ['top', 'width', 'height']),\n };\n const hueRect = {\n offsetLeft: huePickerRef.current!.offsetLeft,\n ...pick(huePickerRef.current!.getBoundingClientRect(), ['width']),\n };\n\n rectsRef.current = { colorRect, hueRect };\n\n function handleColorDrag(e: MouseEvent | RealTouchEvent) {\n const colorPosition = [\n Math.min(Math.max(0, e.pageX! - colorRect.offsetLeft), colorRect.width - 1),\n Math.min(Math.max(0, e.pageY! - colorRect.top + containerRef.current!.scrollTop), colorRect.height - 1),\n ];\n\n const { huePosition } = hsb2positions(hsbRef.current, rectsRef.current!);\n\n setHsb(positions2hsb({ colorPosition, huePosition }, rectsRef.current!));\n markIsDragging();\n\n return true;\n }\n\n captureEvents(colorPickerRef.current!, {\n onCapture: handleColorDrag,\n onDrag: handleColorDrag,\n onRelease: unmarkIsDragging,\n onClick: unmarkIsDragging,\n selectorToPreventScroll: '.SettingsGeneralBackgroundColor',\n withCursor: true,\n });\n\n function handleHueDrag(e: MouseEvent | RealTouchEvent) {\n const { colorPosition } = hsb2positions(hsbRef.current, rectsRef.current!);\n const huePosition = Math.min(Math.max(0, e.pageX! - hueRect.offsetLeft), hueRect.width - 1);\n\n setHsb(positions2hsb({ colorPosition, huePosition }, rectsRef.current!));\n markIsDragging();\n\n return true;\n }\n\n captureEvents(huePickerRef.current!, {\n onCapture: handleHueDrag,\n onDrag: handleHueDrag,\n onRelease: unmarkIsDragging,\n onClick: unmarkIsDragging,\n selectorToPreventScroll: '.SettingsGeneralBackgroundColor',\n withCursor: true,\n });\n }, [markIsDragging, unmarkIsDragging]);\n\n const { colorPosition = [0, 0], huePosition = 0 } = rectsRef.current ? hsb2positions(hsb, rectsRef.current) : {};\n const hex = rgb2hex(hsb2rgb(hsb));\n const hue = hsb[0];\n const hueHex = rgb2hex(hsb2rgb([hue, 1, 1]));\n\n // Save value and update inputs when HSL changes\n useEffect(() => {\n const rgb = hsb2rgb(hsb);\n const color = `#${rgb2hex(rgb)}`;\n\n setRgbInput(rgb.join(', '));\n setHexInput(color);\n\n if (!isFirstRunRef.current) {\n const patternColor = getPatternColor(rgb);\n setThemeSettings({\n theme: themeRef.current,\n background: undefined,\n backgroundColor: color,\n patternColor,\n });\n }\n isFirstRunRef.current = false;\n }, [hsb, setThemeSettings]);\n\n // Redraw color picker when hue changes\n useEffect(() => {\n drawColor(colorPickerRef.current!.firstChild as HTMLCanvasElement, hue, colorCtxRef, rectsRef);\n }, [hue]);\n\n // Initially draw hue picker\n useEffect(() => {\n drawHue(huePickerRef.current!.firstChild as HTMLCanvasElement);\n }, []);\n\n const handleRgbChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const rgbValue = e.currentTarget.value.replace(/[^\\d, ]/g, '').slice(0, 13);\n\n if (rgbValue.match(/^\\d{1,3},\\s?\\d{1,3},\\s?\\d{1,3}$/)) {\n const rgb = rgbValue.split(',').map((channel) => Number(channel.trim())) as [number, number, number];\n setHsb(rgb2hsb(rgb));\n }\n\n e.currentTarget.value = rgbValue;\n }, []);\n\n const handleHexChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const hexValue = e.currentTarget.value.replace(/[^0-9a-fA-F]/g, '').slice(0, 6);\n\n if (hexValue.match(/^#?[0-9a-fA-F]{6}$/)) {\n setHsb(rgb2hsb(hex2rgb(hexValue.replace('#', ''))));\n }\n\n e.currentTarget.value = hexValue;\n }, []);\n\n const handlePredefinedColorClick = useCallback((e: React.MouseEvent<HTMLInputElement>) => {\n setHsb(rgb2hsb(hex2rgb(e.currentTarget.dataset.color!.replace('#', ''))));\n }, []);\n\n const className = buildClassName(\n 'SettingsGeneralBackgroundColor settings-content custom-scroll',\n isDragging && 'is-dragging',\n );\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div ref={containerRef} className={className}>\n <div className=\"settings-item pt-3\">\n <div ref={colorPickerRef} className=\"color-picker\">\n <canvas />\n <div\n className=\"handle\"\n style={`transform: translate(${colorPosition[0]}px, ${colorPosition[1]}px); background-color: #${hex};`}\n />\n </div>\n <div ref={huePickerRef} className=\"hue-picker\">\n <canvas />\n <div\n className=\"handle\"\n style={`transform: translateX(${huePosition}px); background-color: #${hueHex};`}\n />\n </div>\n <div className=\"tools\">\n <InputText value={hexInput} label=\"HEX\" onChange={handleHexChange} />\n <InputText value={rgbInput} label=\"RGB\" onChange={handleRgbChange} />\n </div>\n </div>\n <div className=\"predefined-colors\">\n {PREDEFINED_COLORS.map((color) => (\n <div\n className={color === `#${hex}` ? 'active' : undefined}\n data-color={color}\n style={`background-color: ${color};`}\n onClick={handlePredefinedColorClick}\n />\n ))}\n </div>\n </div>\n );\n};\n\nfunction getInitialHsb(backgroundColor?: string) {\n return backgroundColor && backgroundColor.startsWith('#')\n ? rgb2hsb(hex2rgb(backgroundColor.replace('#', '')))\n : DEFAULT_HSB;\n}\n\nfunction hsb2positions(hsb: [number, number, number], rects: CanvasRects) {\n return {\n colorPosition: [\n Math.round((hsb[1]) * (rects.colorRect.width - 1)),\n Math.round((1 - hsb[2]) * (rects.colorRect.height - 1)),\n ],\n huePosition: Math.round(hsb[0] * (rects.hueRect.width - 1)),\n };\n}\n\nfunction positions2hsb(\n { colorPosition, huePosition }: { colorPosition: number[]; huePosition: number },\n rects: CanvasRects,\n): [number, number, number] {\n return [\n huePosition / (rects.hueRect.width - 1),\n colorPosition[0] / (rects.colorRect.width - 1),\n 1 - colorPosition[1] / (rects.colorRect.height - 1),\n ];\n}\n\nfunction drawColor(\n canvas: HTMLCanvasElement,\n hue: number,\n colorCtxRef: MutableRefObject<CanvasRenderingContext2D | undefined>,\n rectsRef: RefObject<CanvasRects | undefined>,\n) {\n let w: number;\n let h: number;\n let ctx: CanvasRenderingContext2D;\n\n if (!colorCtxRef.current || !rectsRef.current) {\n // First run\n w = canvas.offsetWidth;\n h = canvas.offsetHeight;\n ctx = canvas.getContext('2d')!;\n\n canvas.width = w;\n canvas.height = h;\n\n colorCtxRef.current = ctx;\n } else {\n w = rectsRef.current.colorRect.width;\n h = rectsRef.current.colorRect.height;\n ctx = colorCtxRef.current;\n }\n\n const imgData = ctx!.createImageData(w, h);\n const pixels = imgData.data;\n const col = hsb2rgb([hue, 1, 1]);\n\n let index = 0;\n\n for (let y = 0; y < h; y++) {\n const perY = 1 - y / (h - 1);\n const st = [255 * perY, 255 * perY, 255 * perY];\n const ed = [col[0] * perY, col[1] * perY, col[2] * perY];\n for (let x = 0; x < w; x++) {\n const perX = x / (w - 1);\n pixels[index++] = st[0] + (ed[0] - st[0]) * perX;\n pixels[index++] = st[1] + (ed[1] - st[1]) * perX;\n pixels[index++] = st[2] + (ed[2] - st[2]) * perX;\n pixels[index++] = 255;\n }\n }\n\n ctx!.putImageData(imgData, 0, 0);\n}\n\nfunction drawHue(canvas: HTMLCanvasElement) {\n const w = canvas.offsetWidth;\n const h = 1;\n canvas.width = w;\n canvas.height = h;\n const ctx = canvas.getContext('2d')!;\n\n const imgData = ctx.createImageData(w, h);\n const pixels = imgData.data;\n\n let index = 0;\n\n for (let x = 0; x < w; x++) {\n const hue = x / (w - 1);\n const rgb = hsb2rgb([hue, 1, 1]);\n /* eslint-disable prefer-destructuring */\n pixels[index++] = rgb[0];\n pixels[index++] = rgb[1];\n pixels[index++] = rgb[2];\n /* eslint-enable prefer-destructuring */\n pixels[index++] = 255;\n }\n\n ctx.putImageData(imgData, 0, 0);\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const theme = selectTheme(global);\n const { backgroundColor } = global.settings.themes[theme] || {};\n return {\n backgroundColor,\n theme,\n };\n },\n)(SettingsGeneralBackground));\n","import { 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 useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { playNotifySound } from '../../../util/notifications';\n\nimport Checkbox from '../../ui/Checkbox';\nimport RangeSlider from '../../ui/RangeSlider';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n hasPrivateChatsNotifications: boolean;\n hasPrivateChatsMessagePreview: boolean;\n hasGroupNotifications: boolean;\n hasGroupMessagePreview: boolean;\n hasBroadcastNotifications: boolean;\n hasBroadcastMessagePreview: boolean;\n hasContactJoinedNotifications: boolean;\n hasWebNotifications: boolean;\n hasPushNotifications: boolean;\n notificationSoundVolume: number;\n};\n\nconst SettingsNotifications: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n hasPrivateChatsNotifications,\n hasPrivateChatsMessagePreview,\n hasGroupNotifications,\n hasGroupMessagePreview,\n hasBroadcastNotifications,\n hasBroadcastMessagePreview,\n hasContactJoinedNotifications,\n hasPushNotifications,\n hasWebNotifications,\n notificationSoundVolume,\n}) => {\n const {\n loadNotificationSettings,\n updateContactSignUpNotification,\n updateNotificationSettings,\n updateWebNotificationSettings,\n } = getActions();\n\n useEffect(() => {\n loadNotificationSettings();\n }, [loadNotificationSettings]);\n\n const runDebounced = useRunDebounced(500, true);\n\n const handleSettingsChange = useCallback((\n e: ChangeEvent<HTMLInputElement>,\n peerType: 'contact' | 'group' | 'broadcast',\n setting: 'silent' | 'showPreviews',\n ) => {\n const currentIsSilent = peerType === 'contact'\n ? !hasPrivateChatsNotifications\n : !(peerType === 'group' ? hasGroupNotifications : hasBroadcastNotifications);\n const currentShouldShowPreviews = peerType === 'contact'\n ? hasPrivateChatsMessagePreview\n : (peerType === 'group' ? hasGroupMessagePreview : hasBroadcastMessagePreview);\n\n updateNotificationSettings({\n peerType,\n ...(setting === 'silent' && { isSilent: !e.target.checked, shouldShowPreviews: currentShouldShowPreviews }),\n ...(setting === 'showPreviews' && { shouldShowPreviews: e.target.checked, isSilent: currentIsSilent }),\n });\n }, [\n hasBroadcastMessagePreview, hasBroadcastNotifications,\n hasGroupMessagePreview, hasGroupNotifications,\n hasPrivateChatsMessagePreview, hasPrivateChatsNotifications,\n updateNotificationSettings,\n ]);\n\n const handleWebNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n updateWebNotificationSettings({\n hasWebNotifications: e.target.checked,\n });\n }, [updateWebNotificationSettings]);\n\n const handlePushNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n updateWebNotificationSettings({\n hasPushNotifications: e.target.checked,\n });\n }, [updateWebNotificationSettings]);\n\n const handlePrivateChatsNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'contact', 'silent');\n }, [handleSettingsChange]);\n\n const handlePrivateChatsPreviewChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'contact', 'showPreviews');\n }, [handleSettingsChange]);\n\n const handleGroupsNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'group', 'silent');\n }, [handleSettingsChange]);\n\n const handleGroupsPreviewChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'group', 'showPreviews');\n }, [handleSettingsChange]);\n\n const handleChannelsNotificationsChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'broadcast', 'silent');\n }, [handleSettingsChange]);\n\n const handleChannelsPreviewChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n handleSettingsChange(e, 'broadcast', 'showPreviews');\n }, [handleSettingsChange]);\n\n const handleContactNotificationChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n updateContactSignUpNotification({\n isSilent: !e.target.checked,\n });\n }, [updateContactSignUpNotification]);\n\n const handleVolumeChange = useCallback((volume: number) => {\n updateWebNotificationSettings({\n notificationSoundVolume: volume,\n });\n runDebounced(() => playNotifySound(undefined, volume));\n }, [runDebounced, updateWebNotificationSettings]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Web notifications\n </h4>\n <Checkbox\n label=\"Web notifications\"\n // eslint-disable-next-line max-len\n subLabel={lang(hasWebNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasWebNotifications}\n onChange={handleWebNotificationsChange}\n />\n <Checkbox\n label=\"Offline notifications\"\n disabled={!hasWebNotifications}\n // eslint-disable-next-line max-len\n subLabel={lang(hasPushNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasPushNotifications}\n onChange={handlePushNotificationsChange}\n />\n <div className=\"settings-item-slider\">\n <RangeSlider\n label=\"Sound\"\n min={0}\n max={10}\n value={notificationSoundVolume}\n onChange={handleVolumeChange}\n />\n </div>\n </div>\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('AutodownloadPrivateChats')}\n </h4>\n\n <Checkbox\n label={lang('NotificationsForPrivateChats')}\n // eslint-disable-next-line max-len\n subLabel={lang(hasPrivateChatsNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasPrivateChatsNotifications}\n onChange={handlePrivateChatsNotificationsChange}\n />\n <Checkbox\n label={lang('MessagePreview')}\n disabled={!hasPrivateChatsNotifications}\n // eslint-disable-next-line max-len\n subLabel={lang(hasPrivateChatsMessagePreview ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasPrivateChatsMessagePreview}\n onChange={handlePrivateChatsPreviewChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterGroups')}</h4>\n\n <Checkbox\n label={lang('NotificationsForGroups')}\n subLabel={lang(hasGroupNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasGroupNotifications}\n onChange={handleGroupsNotificationsChange}\n />\n <Checkbox\n label={lang('MessagePreview')}\n disabled={!hasGroupNotifications}\n subLabel={lang(hasGroupMessagePreview ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasGroupMessagePreview}\n onChange={handleGroupsPreviewChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('FilterChannels')}</h4>\n\n <Checkbox\n label={lang('NotificationsForChannels')}\n // eslint-disable-next-line max-len\n subLabel={lang(hasBroadcastNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasBroadcastNotifications}\n onChange={handleChannelsNotificationsChange}\n />\n <Checkbox\n label={lang('MessagePreview')}\n disabled={!hasBroadcastNotifications}\n // eslint-disable-next-line max-len\n subLabel={lang(hasBroadcastMessagePreview ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasBroadcastMessagePreview}\n onChange={handleChannelsPreviewChange}\n />\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('PhoneOther')}</h4>\n\n <Checkbox\n label={lang('ContactJoined')}\n checked={hasContactJoinedNotifications}\n onChange={handleContactNotificationChange}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n hasPrivateChatsNotifications: Boolean(global.settings.byKey.hasPrivateChatsNotifications),\n hasPrivateChatsMessagePreview: Boolean(global.settings.byKey.hasPrivateChatsMessagePreview),\n hasGroupNotifications: Boolean(global.settings.byKey.hasGroupNotifications),\n hasGroupMessagePreview: Boolean(global.settings.byKey.hasGroupMessagePreview),\n hasBroadcastNotifications: Boolean(global.settings.byKey.hasBroadcastNotifications),\n hasBroadcastMessagePreview: Boolean(global.settings.byKey.hasBroadcastMessagePreview),\n hasContactJoinedNotifications: Boolean(global.settings.byKey.hasContactJoinedNotifications),\n hasWebNotifications: global.settings.byKey.hasWebNotifications,\n hasPushNotifications: global.settings.byKey.hasPushNotifications,\n notificationSoundVolume: global.settings.byKey.notificationSoundVolume,\n };\n },\n)(SettingsNotifications));\n","import React, { FC, memo, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiPrivacySettings, 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 privacyPhoneNumber?: ApiPrivacySettings;\n privacyLastSeen?: ApiPrivacySettings;\n privacyProfilePhoto?: ApiPrivacySettings;\n privacyForwarding?: ApiPrivacySettings;\n privacyGroupChats?: ApiPrivacySettings;\n privacyPhoneCall?: ApiPrivacySettings;\n privacyPhoneP2P?: ApiPrivacySettings;\n};\n\nconst SettingsPrivacy: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n hasPassword,\n blockedCount,\n isSensitiveEnabled,\n canChangeSensitive,\n privacyPhoneNumber,\n privacyLastSeen,\n privacyProfilePhoto,\n privacyForwarding,\n privacyGroupChats,\n privacyPhoneCall,\n privacyPhoneP2P,\n\n}) => {\n const {\n loadPrivacySettings,\n loadBlockedContacts,\n loadAuthorizations,\n loadContentSettings,\n updateContentSettings,\n } = getActions();\n\n useEffect(() => {\n loadBlockedContacts();\n loadAuthorizations();\n loadPrivacySettings();\n loadContentSettings();\n }, [loadBlockedContacts, loadAuthorizations, loadPrivacySettings, loadContentSettings]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function getVisibilityValue(setting?: ApiPrivacySettings) {\n const { visibility } = setting || {};\n const blockCount = setting ? setting.blockChatIds.length + setting.blockUserIds.length : 0;\n const allowCount = setting ? setting.allowChatIds.length + setting.allowUserIds.length : 0;\n const total = [];\n if (blockCount) total.push(`-${blockCount}`);\n if (allowCount) total.push(`+${allowCount}`);\n\n const exceptionString = total.length ? `(${total.join(',')})` : '';\n\n switch (visibility) {\n case 'everybody':\n return `${lang('P2PEverybody')} ${exceptionString}`;\n\n case 'contacts':\n return `${lang('P2PContacts')} ${exceptionString}`;\n\n case 'nobody':\n return `${lang('P2PNobody')} ${exceptionString}`;\n }\n\n return undefined;\n }\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <ListItem\n icon=\"delete-user\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyBlockedUsers)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('BlockedUsers')}</span>\n {blockedCount > 0 && (\n <span className=\"subtitle\" dir=\"auto\">\n {lang('Users', blockedCount)}\n </span>\n )}\n </div>\n </ListItem>\n <ListItem\n icon=\"lock\"\n narrow\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(\n hasPassword ? SettingsScreens.TwoFaEnabled : SettingsScreens.TwoFaDisabled,\n )}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('TwoStepVerification')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {lang(hasPassword ? 'PasswordOn' : 'PasswordOff')}\n </span>\n </div>\n </ListItem>\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('PrivacyTitle')}</h4>\n\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneNumber)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyPhoneTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyPhoneNumber)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyLastSeen)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('LastSeenTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyLastSeen)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyProfilePhoto)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyProfilePhotoTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyProfilePhoto)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneCall)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('WhoCanCallMe')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyPhoneCall)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneP2P)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyP2P')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyPhoneP2P)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyForwarding)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyForwardsTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyForwarding)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onScreenSelect(SettingsScreens.PrivacyGroupChats)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('WhoCanAddMe')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(privacyGroupChats)}\n </span>\n </div>\n </ListItem>\n </div>\n\n {canChangeSensitive && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('lng_settings_sensitive_title')}\n </h4>\n <Checkbox\n label={lang('lng_settings_sensitive_disable_filtering')}\n subLabel={lang('lng_settings_sensitive_about')}\n checked={Boolean(isSensitiveEnabled)}\n disabled={!canChangeSensitive}\n onCheck={updateContentSettings}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n settings: {\n byKey: { hasPassword, isSensitiveEnabled, canChangeSensitive },\n privacy,\n },\n blocked,\n } = global;\n\n return {\n hasPassword,\n blockedCount: blocked.totalCount,\n isSensitiveEnabled,\n canChangeSensitive,\n privacyPhoneNumber: privacy.phoneNumber,\n privacyLastSeen: privacy.lastSeen,\n privacyProfilePhoto: privacy.profilePhoto,\n privacyForwarding: privacy.forwards,\n privacyGroupChats: privacy.chatInvite,\n privacyPhoneCall: privacy.phoneCall,\n privacyPhoneP2P: privacy.phoneP2P,\n };\n },\n)(SettingsPrivacy));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ISettings, LangCode } 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 onReset: () => void;\n};\n\ntype StateProps = Pick<ISettings, 'languages' | 'language'>;\n\nconst SettingsLanguage: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n languages,\n language,\n}) => {\n const {\n loadLanguages,\n setSettingOption,\n } = getActions();\n\n const [selectedLanguage, setSelectedLanguage] = useState<string>(language);\n const [isLoading, markIsLoading, unmarkIsLoading] = useFlag();\n\n // TODO Throttle\n useEffect(() => {\n loadLanguages();\n }, [loadLanguages]);\n\n const handleChange = useCallback((langCode: string) => {\n setSelectedLanguage(langCode);\n markIsLoading();\n\n void setLanguage(langCode as LangCode, () => {\n unmarkIsLoading();\n\n setSettingOption({ language: langCode });\n });\n }, [markIsLoading, unmarkIsLoading, setSettingOption]);\n\n const options = useMemo(() => {\n return languages ? buildOptions(languages) : undefined;\n }, [languages]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content settings-item settings-language custom-scroll settings-item--first\">\n {options ? (\n <RadioGroup\n name=\"keyboard-send-settings\"\n options={options}\n selected={selectedLanguage}\n loadingOption={isLoading ? selectedLanguage : undefined}\n onChange={handleChange}\n />\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nfunction buildOptions(languages: ApiLanguage[]) {\n const currentLangCode = (window.navigator.language || 'en').toLowerCase();\n const shortLangCode = currentLangCode.substr(0, 2);\n\n return languages.map(({ langCode, nativeName, name }) => ({\n value: langCode,\n label: nativeName,\n subLabel: name,\n })).sort((a) => {\n return currentLangCode && (a.value === currentLangCode || a.value === shortLangCode) ? -1 : 0;\n });\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n languages: global.settings.byKey.languages,\n language: global.settings.byKey.language,\n };\n },\n)(SettingsLanguage));\n","import { 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 case SettingsScreens.PrivacyPhoneCall:\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n return 'phoneCall';\n case SettingsScreens.PrivacyPhoneP2P:\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n return 'phoneP2P';\n }\n\n return undefined;\n}\n","import 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 case SettingsScreens.PrivacyPhoneCall:\n return lang('WhoCanCallMe');\n case SettingsScreens.PrivacyPhoneP2P:\n return lang('PrivacyP2P');\n default:\n return undefined;\n }\n }, [lang, screen]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const descriptionText = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyLastSeen:\n return lang('CustomHelp');\n default:\n return undefined;\n }\n }, [lang, screen]);\n\n const allowedContactsScreen = (() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return SettingsScreens.PrivacyPhoneNumberAllowedContacts;\n case SettingsScreens.PrivacyLastSeen:\n return SettingsScreens.PrivacyLastSeenAllowedContacts;\n case SettingsScreens.PrivacyProfilePhoto:\n return SettingsScreens.PrivacyProfilePhotoAllowedContacts;\n case SettingsScreens.PrivacyForwarding:\n return SettingsScreens.PrivacyForwardingAllowedContacts;\n case SettingsScreens.PrivacyPhoneCall:\n return SettingsScreens.PrivacyPhoneCallAllowedContacts;\n case SettingsScreens.PrivacyPhoneP2P:\n return SettingsScreens.PrivacyPhoneP2PAllowedContacts;\n default:\n return SettingsScreens.PrivacyGroupChatsAllowedContacts;\n }\n })();\n\n const deniedContactsScreen = (() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return SettingsScreens.PrivacyPhoneNumberDeniedContacts;\n case SettingsScreens.PrivacyLastSeen:\n return SettingsScreens.PrivacyLastSeenDeniedContacts;\n case SettingsScreens.PrivacyProfilePhoto:\n return SettingsScreens.PrivacyProfilePhotoDeniedContacts;\n case SettingsScreens.PrivacyForwarding:\n return SettingsScreens.PrivacyForwardingDeniedContacts;\n case SettingsScreens.PrivacyPhoneCall:\n return SettingsScreens.PrivacyPhoneCallDeniedContacts;\n case SettingsScreens.PrivacyPhoneP2P:\n return SettingsScreens.PrivacyPhoneP2PDeniedContacts;\n default:\n return SettingsScreens.PrivacyGroupChatsDeniedContacts;\n }\n })();\n\n const allowedCount = useMemo(() => {\n if (!allowUserIds || !allowChatIds || !chatsById) {\n return 0;\n }\n\n return allowChatIds.reduce((result, chatId) => {\n return result + (chatsById[chatId] ? chatsById[chatId].membersCount! : 0);\n }, allowUserIds.length);\n }, [allowChatIds, allowUserIds, chatsById]);\n\n const blockCount = useMemo(() => {\n if (!blockUserIds || !blockChatIds || !chatsById) {\n return 0;\n }\n\n return blockChatIds.reduce((result, chatId) => {\n return result + (chatsById[chatId] ? chatsById[chatId].membersCount! : 0);\n }, blockUserIds.length);\n }, [blockChatIds, blockUserIds, chatsById]);\n\n const handleVisibilityChange = useCallback((value) => {\n setPrivacyVisibility({\n privacyKey,\n visibility: value,\n });\n }, [privacyKey, setPrivacyVisibility]);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{headerText}</h4>\n\n <RadioGroup\n name={`visibility-${privacyKey}`}\n options={visibilityOptions}\n onChange={handleVisibilityChange}\n selected={visibility}\n />\n\n {descriptionText && (\n <p className=\"settings-item-description-larger\" dir={lang.isRtl ? 'rtl' : undefined}>{descriptionText}</p>\n )}\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('PrivacyExceptions')}</h4>\n\n {exceptionLists.shouldShowAllowed && (\n <ListItem\n narrow\n icon=\"add-user\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => {\n onScreenSelect(allowedContactsScreen);\n }}\n >\n <div className=\"multiline-menu-item full-size\">\n {allowedCount > 0 && <span className=\"date\" dir=\"auto\">+{allowedCount}</span>}\n <span className=\"title\">{lang('AlwaysAllow')}</span>\n <span className=\"subtitle\">{lang('EditAdminAddUsers')}</span>\n </div>\n </ListItem>\n )}\n {exceptionLists.shouldShowDenied && (\n <ListItem\n narrow\n icon=\"delete-user\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => {\n onScreenSelect(deniedContactsScreen);\n }}\n >\n <div className=\"multiline-menu-item full-size\">\n {blockCount > 0 && <span className=\"date\" dir=\"auto\">−{blockCount}</span>}\n <span className=\"title\">{lang('NeverAllow')}</span>\n <span className=\"subtitle\">{lang('EditAdminAddUsers')}</span>\n </div>\n </ListItem>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { screen }): StateProps => {\n let privacySettings: ApiPrivacySettings | undefined;\n\n const {\n chats: { byId: chatsById },\n settings: { privacy },\n } = global;\n\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n privacySettings = privacy.phoneNumber;\n break;\n\n case SettingsScreens.PrivacyLastSeen:\n privacySettings = privacy.lastSeen;\n break;\n\n case SettingsScreens.PrivacyProfilePhoto:\n privacySettings = privacy.profilePhoto;\n break;\n\n case SettingsScreens.PrivacyPhoneCall:\n privacySettings = privacy.phoneCall;\n break;\n\n case SettingsScreens.PrivacyPhoneP2P:\n privacySettings = privacy.phoneP2P;\n break;\n\n case SettingsScreens.PrivacyForwarding:\n privacySettings = privacy.forwards;\n break;\n\n case SettingsScreens.PrivacyGroupChats:\n privacySettings = privacy.chatInvite;\n break;\n }\n\n if (!privacySettings) {\n return {};\n }\n\n return {\n ...privacySettings,\n chatsById,\n };\n },\n)(SettingsPrivacyVisibility));\n","import { ApiSession } from '../../../../api/types';\n\nexport default function getSessionIcon(session: ApiSession): string {\n const platform = session.platform.toLowerCase();\n const device = session.deviceModel.toLowerCase();\n const systemVersion = session.systemVersion.toLowerCase();\n\n if (device.includes('xbox')) {\n return 'xbox';\n }\n\n if (device.includes('chrome') && !device.includes('chromebook')) {\n return 'chrome';\n }\n if (device.includes('brave')) {\n return 'brave';\n }\n if (device.includes('vivaldi')) {\n return 'vivaldi';\n }\n if (device.includes('safari')) {\n return 'safari';\n }\n if (device.includes('firefox')) {\n return 'firefox';\n }\n if (device.includes('opera')) {\n return 'opera';\n }\n if (device.includes('samsungbrowser')) {\n return 'samsung';\n }\n if (platform.includes('android')) {\n return 'android';\n }\n if (\n device.includes('iphone')\n || device.includes('ipad')\n || platform.includes('ios')\n || platform.includes('macos')\n || systemVersion.includes('macos')\n ) {\n return 'apple';\n }\n if (platform.includes('ubuntu') || systemVersion.includes('ubuntu')) {\n return 'ubuntu';\n }\n if (platform.includes('linux') || systemVersion.includes('linux')) {\n return 'linux';\n }\n if (platform.includes('windows') || systemVersion.includes('windows')) {\n return 'windows';\n }\n\n return 'unknown';\n}\n","// extracted by mini-css-extract-plugin\nexport default {\"SettingsActiveSession\":\"src-components-left-settings-SettingsActiveSession-module__SettingsActiveSession\",\"settingsActiveSession\":\"src-components-left-settings-SettingsActiveSession-module__SettingsActiveSession\",\"iconDevice\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice\",\"iconDevice__android\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__android\",\"iconDeviceAndroid\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__android\",\"iconDevice__apple\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__apple\",\"iconDeviceApple\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__apple\",\"iconDevice__brave\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__brave\",\"iconDeviceBrave\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__brave\",\"iconDevice__chrome\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__chrome\",\"iconDeviceChrome\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__chrome\",\"iconDevice__edge\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__edge\",\"iconDeviceEdge\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__edge\",\"iconDevice__firefox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__firefox\",\"iconDeviceFirefox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__firefox\",\"iconDevice__linux\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__linux\",\"iconDeviceLinux\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__linux\",\"iconDevice__opera\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__opera\",\"iconDeviceOpera\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__opera\",\"iconDevice__safari\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__safari\",\"iconDeviceSafari\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__safari\",\"iconDevice__samsung\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__samsung\",\"iconDeviceSamsung\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__samsung\",\"iconDevice__ubuntu\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__ubuntu\",\"iconDeviceUbuntu\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__ubuntu\",\"iconDevice__unknown\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__unknown\",\"iconDeviceUnknown\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__unknown\",\"iconDevice__vivaldi\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__vivaldi\",\"iconDeviceVivaldi\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__vivaldi\",\"iconDevice__windows\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__windows\",\"iconDeviceWindows\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__windows\",\"iconDevice__xbox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__xbox\",\"iconDeviceXbox\":\"src-components-left-settings-SettingsActiveSession-module__iconDevice__xbox\",\"title\":\"src-components-left-settings-SettingsActiveSession-module__title\",\"note\":\"src-components-left-settings-SettingsActiveSession-module__note\",\"date\":\"src-components-left-settings-SettingsActiveSession-module__date\",\"box\":\"src-components-left-settings-SettingsActiveSession-module__box\",\"actionHeader\":\"src-components-left-settings-SettingsActiveSession-module__actionHeader\",\"actionName\":\"src-components-left-settings-SettingsActiveSession-module__actionName\",\"headerButton\":\"src-components-left-settings-SettingsActiveSession-module__headerButton\"};","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiSession } from '../../../api/types';\n\nimport { formatDateTimeToString } from '../../../util/dateFormat';\nimport useLang from '../../../hooks/useLang';\nimport useCurrentOrPrev from '../../../hooks/useCurrentOrPrev';\nimport getSessionIcon from './helpers/getSessionIcon';\nimport buildClassName from '../../../util/buildClassName';\n\nimport ListItem from '../../ui/ListItem';\nimport Modal from '../../ui/Modal';\nimport Switcher from '../../ui/Switcher';\nimport Button from '../../ui/Button';\n\nimport styles from './SettingsActiveSession.module.scss';\n\ntype OwnProps = {\n isOpen: boolean;\n hash?: string;\n onClose: () => void;\n};\n\ntype StateProps = {\n session?: ApiSession;\n};\n\nconst SettingsActiveSession: FC<OwnProps & StateProps> = ({\n isOpen, session, onClose,\n}) => {\n const { changeSessionSettings, terminateAuthorization } = getActions();\n const lang = useLang();\n\n const renderingSession = useCurrentOrPrev(session, true);\n\n const handleSecretChatsStateChange = useCallback(() => {\n changeSessionSettings({\n hash: session!.hash,\n areSecretChatsEnabled: !session!.areSecretChatsEnabled,\n });\n }, [changeSessionSettings, session]);\n\n const handleCallsStateChange = useCallback(() => {\n changeSessionSettings({\n hash: session!.hash,\n areCallsEnabled: !session!.areCallsEnabled,\n });\n }, [changeSessionSettings, session]);\n\n const handleTerminateSessionClick = useCallback(() => {\n terminateAuthorization({ hash: session!.hash });\n onClose();\n }, [onClose, session, terminateAuthorization]);\n\n if (!renderingSession) {\n return undefined;\n }\n\n function renderHeader() {\n return (\n <div className=\"modal-header-condensed\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button round color=\"translucent\" size=\"smaller\" ariaLabel={lang('Close')} onClick={onClose}>\n <i className=\"icon-close\" />\n </Button>\n <div className=\"modal-title\">{lang('SessionPreview.Title')}</div>\n <Button\n color=\"danger\"\n onClick={handleTerminateSessionClick}\n className={buildClassName('modal-action-button', styles.headerButton)}\n >\n {lang('SessionPreview.TerminateSession')}\n </Button>\n </div>\n );\n }\n return (\n <Modal\n header={renderHeader()}\n isOpen={isOpen}\n hasCloseButton\n onClose={onClose}\n className={styles.SettingsActiveSession}\n >\n <div className={buildClassName(\n styles.iconDevice,\n renderingSession && styles[`iconDevice__${getSessionIcon(renderingSession)}`],\n )}\n />\n <h3 className={styles.title} dir=\"auto\">{renderingSession?.deviceModel}</h3>\n <div className={styles.date} aria-label={lang('PrivacySettings.LastSeen')}>\n {formatDateTimeToString(renderingSession.dateActive * 1000, lang.code)}\n </div>\n\n <dl className={styles.box}>\n <dt>{lang('SessionPreview.App')}</dt>\n <dd>\n {renderingSession?.appName} {renderingSession?.appVersion},{' '}\n {renderingSession?.platform} {renderingSession?.systemVersion}\n </dd>\n\n <dt>{lang('SessionPreview.Ip')}</dt>\n <dd>{renderingSession?.ip}</dd>\n\n <dt>{lang('SessionPreview.Location')}</dt>\n <dd>{renderingSession && getLocation(renderingSession)}</dd>\n </dl>\n\n <p className={styles.note}>{lang('SessionPreview.IpDesc')}</p>\n\n <h4 className={styles.actionHeader}>{lang('AuthSessions.View.AcceptTitle')}</h4>\n\n <ListItem onClick={handleSecretChatsStateChange}>\n <span className={styles.actionName}>{lang('SessionPreview.Accept.Secret')}</span>\n <Switcher\n id=\"accept_secrets\"\n label=\"On\"\n checked={renderingSession.areSecretChatsEnabled}\n />\n </ListItem>\n <ListItem onClick={handleCallsStateChange}>\n <span className={styles.actionName}>{lang('SessionPreview.Accept.Calls')}</span>\n <Switcher\n id=\"accept_calls\"\n label=\"On\"\n checked={renderingSession.areCallsEnabled}\n />\n </ListItem>\n </Modal>\n );\n};\n\nfunction getLocation(session: ApiSession) {\n return [session.region, session.country].filter(Boolean).join(', ');\n}\n\nexport default memo(withGlobal<OwnProps>((global, { hash }) => {\n return {\n session: hash ? global.activeSessions.byHash[hash] : undefined,\n };\n})(SettingsActiveSession));\n","/* eslint-disable react/jsx-no-bind */\nimport React, {\n FC, memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport { ApiSession } from '../../../api/types';\n\nimport { formatPastTimeShort } from '../../../util/dateFormat';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport getSessionIcon from './helpers/getSessionIcon';\n\nimport ListItem from '../../ui/ListItem';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\nimport SettingsActiveSession from './SettingsActiveSession';\n\nimport './SettingsActiveSessions.scss';\nimport RadioGroup from '../../ui/RadioGroup';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n byHash: Record<string, ApiSession>;\n orderedHashes: string[];\n ttlDays?: number;\n};\n\nconst SettingsActiveSessions: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n byHash,\n orderedHashes,\n ttlDays,\n}) => {\n const {\n terminateAuthorization,\n terminateAllAuthorizations,\n changeSessionTtl,\n } = getActions();\n\n const lang = useLang();\n const [isConfirmTerminateAllDialogOpen, openConfirmTerminateAllDialog, closeConfirmTerminateAllDialog] = useFlag();\n const [openedSessionHash, setOpenedSessionHash] = useState<string | undefined>();\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n const autoTerminateValue = useMemo(() => {\n if (ttlDays === undefined) {\n return undefined;\n }\n if (ttlDays <= 7) {\n return '7';\n }\n if (ttlDays <= 30) {\n return '30';\n }\n if (ttlDays <= 90) {\n return '90';\n }\n if (ttlDays <= 180) {\n return '180';\n }\n\n return undefined;\n }, [ttlDays]);\n\n const AUTO_TERMINATE_OPTIONS = useMemo(() => [{\n label: lang('Weeks', 1, 'i'),\n value: '7',\n }, {\n label: lang('Months', 1, 'i'),\n value: '30',\n }, {\n label: lang('Months', 3, 'i'),\n value: '90',\n }, {\n label: lang('Months', 6, 'i'),\n value: '180',\n }], [lang]);\n\n const handleTerminateSessionClick = useCallback((hash: string) => {\n terminateAuthorization({ hash });\n }, [terminateAuthorization]);\n\n const handleTerminateAllSessions = useCallback(() => {\n closeConfirmTerminateAllDialog();\n terminateAllAuthorizations();\n }, [closeConfirmTerminateAllDialog, terminateAllAuthorizations]);\n\n const handleOpenSessionModal = useCallback((hash: string) => {\n setOpenedSessionHash(hash);\n openModal();\n }, [openModal]);\n\n const handleCloseSessionModal = useCallback(() => {\n setOpenedSessionHash(undefined);\n closeModal();\n }, [closeModal]);\n\n const handleChangeSessionTtl = useCallback((value: string) => {\n changeSessionTtl({ days: Number(value) });\n }, [changeSessionTtl]);\n\n const currentSession = useMemo(() => {\n const currentSessionHash = orderedHashes.find((hash) => byHash[hash].isCurrent);\n\n return currentSessionHash ? byHash[currentSessionHash] : undefined;\n }, [byHash, orderedHashes]);\n\n const otherSessionHashes = useMemo(() => {\n return orderedHashes.filter((hash) => !byHash[hash].isCurrent);\n }, [byHash, orderedHashes]);\n const hasOtherSessions = Boolean(otherSessionHashes.length);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function renderCurrentSession(session: ApiSession) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('AuthSessions.CurrentSession')}\n </h4>\n\n <ListItem narrow inactive icon={`device-${getSessionIcon(session)} icon-device`}>\n <div className=\"multiline-menu-item\" dir=\"auto\">\n <span className=\"title\" dir=\"auto\">{session.deviceModel}</span>\n <span className=\"subtitle black tight\">\n {session.appName} {session.appVersion}, {session.platform} {session.systemVersion}\n </span>\n <span className=\"subtitle\">{session.ip} - {getLocation(session)}</span>\n </div>\n </ListItem>\n\n {hasOtherSessions && (\n <ListItem\n className=\"destructive mb-0 no-icon\"\n icon=\"stop\"\n ripple\n narrow\n onClick={openConfirmTerminateAllDialog}\n >\n {lang('TerminateAllSessions')}\n </ListItem>\n )}\n </div>\n );\n }\n\n function renderOtherSessions(sessionHashes: string[]) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('OtherSessions')}\n </h4>\n\n {sessionHashes.map(renderSession)}\n </div>\n );\n }\n\n function renderAutoTerminate() {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('TerminateOldSessionHeader')}\n </h4>\n\n <p>{lang('IfInactiveFor')}</p>\n <RadioGroup\n name=\"session_ttl\"\n options={AUTO_TERMINATE_OPTIONS}\n selected={autoTerminateValue}\n onChange={handleChangeSessionTtl}\n />\n </div>\n );\n }\n\n function renderSession(sessionHash: string) {\n const session = byHash[sessionHash];\n\n return (\n <ListItem\n key={session.hash}\n ripple\n narrow\n contextActions={[{\n title: 'Terminate',\n icon: 'stop',\n handler: () => {\n handleTerminateSessionClick(session.hash);\n },\n }]}\n icon={`device-${getSessionIcon(session)} icon-device`}\n onClick={() => { handleOpenSessionModal(session.hash); }}\n >\n <div className=\"multiline-menu-item full-size\" dir=\"auto\">\n <span className=\"date\">{formatPastTimeShort(lang, session.dateActive * 1000)}</span>\n <span className=\"title\">{session.deviceModel}</span>\n <span className=\"subtitle black tight\">\n {session.appName} {session.appVersion}, {session.platform} {session.systemVersion}\n </span>\n <span className=\"subtitle\">{session.ip} {getLocation(session)}</span>\n </div>\n </ListItem>\n );\n }\n\n return (\n <div className=\"settings-content custom-scroll SettingsActiveSessions\">\n {currentSession && renderCurrentSession(currentSession)}\n {hasOtherSessions && renderOtherSessions(otherSessionHashes)}\n {renderAutoTerminate()}\n {hasOtherSessions && (\n <ConfirmDialog\n isOpen={isConfirmTerminateAllDialogOpen}\n onClose={closeConfirmTerminateAllDialog}\n text={lang('AreYouSureSessions')}\n confirmLabel={lang('TerminateAllSessions')}\n confirmHandler={handleTerminateAllSessions}\n confirmIsDestructive\n />\n )}\n <SettingsActiveSession isOpen={isModalOpen} hash={openedSessionHash} onClose={handleCloseSessionModal} />\n </div>\n );\n};\n\nfunction getLocation(session: ApiSession) {\n return [session.region, session.country].filter(Boolean).join(', ');\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => global.activeSessions,\n)(SettingsActiveSessions));\n","import 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';\n\nimport { CHAT_HEIGHT_PX } from '../../../config';\nimport { formatPhoneNumberWithCode } from '../../../util/phoneNumber';\nimport {\n getChatTitle, getUserFullName, isUserId,\n} from '../../../global/helpers';\nimport renderText from '../../common/helpers/renderText';\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useFlag from '../../../hooks/useFlag';\n\nimport ListItem from '../../ui/ListItem';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Avatar from '../../common/Avatar';\nimport Loading from '../../ui/Loading';\nimport BlockUserModal from './BlockUserModal';\n\ntype OwnProps = {\n isActive?: boolean;\n onReset: () => void;\n};\n\ntype StateProps = {\n chatsByIds: Record<string, ApiChat>;\n usersByIds: Record<string, ApiUser>;\n blockedIds: string[];\n phoneCodeList: ApiCountryCode[];\n};\n\nconst SettingsPrivacyBlockedUsers: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n chatsByIds,\n usersByIds,\n blockedIds,\n phoneCodeList,\n}) => {\n const { unblockContact } = getActions();\n\n const lang = useLang();\n const [isBlockUserModalOpen, openBlockUserModal, closeBlockUserModal] = useFlag();\n const handleUnblockClick = useCallback((contactId: string) => {\n unblockContact({ contactId });\n }, [unblockContact]);\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n function renderContact(contactId: string, i: number, viewportOffset: number) {\n const isPrivate = isUserId(contactId);\n const user = isPrivate ? usersByIds[contactId] : undefined;\n const chat = !isPrivate ? chatsByIds[contactId] : undefined;\n\n const className = buildClassName(\n 'Chat chat-item-clickable blocked-list-item small-icon',\n isPrivate ? 'private' : 'group',\n );\n\n return (\n <ListItem\n key={contactId}\n className={className}\n ripple\n narrow\n contextActions={[{\n title: 'Unblock',\n icon: 'unlock',\n handler: () => {\n handleUnblockClick(contactId);\n },\n }]}\n style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}\n >\n <Avatar size=\"medium\" user={user} chat={chat} />\n <div className=\"contact-info\" dir=\"auto\">\n <h3 dir=\"auto\">{renderText((isPrivate ? getUserFullName(user) : getChatTitle(lang, chat!)) || '')}</h3>\n {user?.phoneNumber && (\n <div className=\"contact-phone\" dir=\"auto\">{formatPhoneNumberWithCode(phoneCodeList, user.phoneNumber)}</div>\n )}\n {user && !user.phoneNumber && user.username && (\n <div className=\"contact-username\" dir=\"auto\">@{user.username}</div>\n )}\n </div>\n </ListItem>\n );\n }\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content infinite-scroll\">\n <div className=\"settings-item no-border\">\n <p className=\"settings-item-description-larger mt-0 mb-2\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('BlockedUsersInfo')}\n </p>\n </div>\n\n <div className=\"chat-list custom-scroll\">\n {blockedIds?.length ? (\n <div className=\"scroll-container\">\n {blockedIds!.map((contactId, i) => renderContact(contactId, i, 0))}\n </div>\n ) : blockedIds && !blockedIds.length ? (\n <div className=\"no-results\" dir=\"auto\">{lang('NoBlocked')}</div>\n ) : (\n <Loading key=\"loading\" />\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown\n onClick={openBlockUserModal}\n ariaLabel={lang('BlockContact')}\n >\n <i className=\"icon-add\" />\n </FloatingActionButton>\n <BlockUserModal\n isOpen={isBlockUserModalOpen}\n onClose={closeBlockUserModal}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n chats: {\n byId: chatsByIds,\n },\n users: {\n byId: usersByIds,\n },\n blocked: {\n ids,\n },\n countryList: {\n phoneCodes: phoneCodeList,\n },\n } = global;\n\n return {\n chatsByIds,\n usersByIds,\n blockedIds: ids,\n phoneCodeList,\n };\n },\n)(SettingsPrivacyBlockedUsers));\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <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 useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport PasswordMonkey from '../../../common/PasswordMonkey';\nimport PasswordForm from '../../../common/PasswordForm';\n\ntype OwnProps = {\n error?: string;\n isLoading?: boolean;\n expectedPassword?: string;\n placeholder?: string;\n hint?: string;\n submitLabel?: string;\n clearError?: NoneToVoidFunction;\n onSubmit: (password: string) => void;\n isActive?: boolean;\n onReset: () => void;\n};\n\nconst EQUAL_PASSWORD_ERROR = 'Passwords Should Be Equal';\n\nconst SettingsTwoFaPassword: FC<OwnProps> = ({\n isActive,\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({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <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';\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 onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst SettingsTwoFaStart: FC<OwnProps & StateProps> = ({\n isActive, onReset, animatedEmoji, onStart,\n}) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <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';\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 onReset: () => void;\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 onReset,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n const [isConfirmShown, markIsConfirmShown, unmarkIsConfirmShown] = useFlag(false);\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (error && clearError) {\n clearError();\n }\n\n setValue(e.target.value);\n }, [clearError, error]);\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n\n if (!inputRef.current) {\n return;\n }\n\n onSubmit(value);\n };\n\n const handleSkip = useCallback(() => {\n onSubmit();\n }, [onSubmit]);\n\n const handleSkipConfirm = useCallback(() => {\n unmarkIsConfirmShown();\n onSubmit();\n }, [onSubmit, unmarkIsConfirmShown]);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <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({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <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';\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 onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n codeLength: number;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\n\nconst SettingsTwoFaEmailCode: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n codeLength,\n isLoading,\n error,\n clearError,\n onSubmit,\n isActive,\n onReset,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (error && clearError) {\n clearError();\n }\n\n const newValue = e.target.value.slice(0, codeLength);\n\n if (newValue.length === codeLength) {\n onSubmit(newValue);\n }\n\n setValue(newValue);\n e.target.value = newValue;\n }, [clearError, codeLength, error, onSubmit]);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header no-border\">\n <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 isActive={isActive || [\n SettingsScreens.TwoFaNewPassword,\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPassword:\n return (\n <SettingsTwoFaPassword\n placeholder={lang('PleaseEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPassword}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordConfirm:\n return (\n <SettingsTwoFaPassword\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPasswordConfirm}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleNewPasswordHint}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmail:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"email\"\n type=\"email\"\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n placeholder={lang('RecoveryEmailTitle')}\n shouldConfirm\n onSubmit={handleNewPasswordEmail}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n return (\n <SettingsTwoFaEmailCode\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaCongratulations:\n return (\n <SettingsTwoFaCongratulations\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaEnabled:\n return (\n <SettingsTwoFaEnabled\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordCurrent,\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaTurnOff,\n SettingsScreens.TwoFaRecoveryEmailCurrentPassword,\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordCurrent:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleChangePasswordCurrent}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordNew:\n return (\n <SettingsTwoFaPassword\n placeholder={lang('PleaseEnterNewFirstPassword')}\n onSubmit={handleChangePasswordNew}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordConfirm:\n return (\n <SettingsTwoFaPassword\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n onSubmit={handleChangePasswordConfirm}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleChangePasswordHint}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaTurnOff:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleTurnOff}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleRecoveryEmailCurrentPassword}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmail:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"email\"\n type=\"email\"\n placeholder={lang('RecoveryEmailTitle')}\n onSubmit={handleRecoveryEmail}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFaEmailCode\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => ({ ...global.twoFaSettings }),\n)(SettingsTwoFa));\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"NewChat-inner step-1\">\n <Picker\n itemIds={displayedIds || []}\n selectedIds={newSelectedContactIds}\n filterValue={searchQuery}\n filterPlaceholder={isAllowList ? lang('AlwaysAllowPlaceholder') : lang('NeverAllowPlaceholder')}\n searchInputId=\"new-group-picker-search\"\n onSelectedIdsChange={handleSelectedContactIdsChange}\n onFilterChange={setSearchQuery}\n />\n\n <FloatingActionButton\n isShown={isSubmitShown}\n onClick={handleSubmit}\n ariaLabel={isAllowList ? lang('AlwaysAllow') : lang('NeverAllow')}\n >\n <i className=\"icon-arrow-right\" />\n </FloatingActionButton>\n </div>\n );\n};\n\nfunction getCurrentPrivacySettings(global: GlobalState, screen: SettingsScreens) {\n const { privacy } = global.settings;\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n return privacy.phoneNumber;\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n return privacy.lastSeen;\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n return privacy.profilePhoto;\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n return privacy.phoneCall;\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n return privacy.phoneP2P;\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return privacy.forwards;\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return privacy.chatInvite;\n }\n\n return undefined;\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { screen }): StateProps => {\n return {\n currentUserId: global.currentUserId,\n settings: getCurrentPrivacySettings(global, screen),\n };\n },\n)(SettingsPrivacyVisibilityExceptionList));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\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 onReset: () => void;\n};\n\ntype StateProps = {\n availableReactions?: ApiAvailableReaction[];\n selectedReaction?: string;\n};\n\nconst SettingsQuickReaction: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n availableReactions,\n selectedReaction,\n}) => {\n const { setDefaultReaction } = getActions();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n const options = availableReactions?.filter((l) => !l.isInactive).map((l) => {\n return {\n label: <><ReactionStaticEmoji reaction={l.reaction} />{l.title}</>,\n value: l.reaction,\n };\n }) || [];\n\n const handleChange = useCallback((reaction: string) => {\n setDefaultReaction({ reaction });\n }, [setDefaultReaction]);\n\n return (\n <div className=\"settings-content settings-item custom-scroll settings-quick-reaction\">\n <RadioGroup\n name=\"quick-reaction-settings\"\n options={options}\n selected={selectedReaction}\n onChange={handleChange}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global) => {\n const { availableReactions, appConfig } = global;\n\n return {\n availableReactions,\n selectedReaction: appConfig?.defaultReaction,\n };\n },\n)(SettingsQuickReaction));\n","import 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_PHONE_CALL_SCREENS = [\n SettingsScreens.PrivacyPhoneCallAllowedContacts,\n SettingsScreens.PrivacyPhoneCallDeniedContacts,\n];\n\nconst PRIVACY_PHONE_P2P_SCREENS = [\n SettingsScreens.PrivacyPhoneP2PAllowedContacts,\n SettingsScreens.PrivacyPhoneP2PDeniedContacts,\n];\n\nconst PRIVACY_FORWARDING_SCREENS = [\n SettingsScreens.PrivacyForwardingAllowedContacts,\n SettingsScreens.PrivacyForwardingDeniedContacts,\n];\n\nconst PRIVACY_GROUP_CHATS_SCREENS = [\n SettingsScreens.PrivacyGroupChatsAllowedContacts,\n SettingsScreens.PrivacyGroupChatsDeniedContacts,\n];\n\nexport type OwnProps = {\n isActive: boolean;\n currentScreen: SettingsScreens;\n foldersState: FoldersState;\n foldersDispatch: FolderEditDispatch;\n onScreenSelect: (screen: SettingsScreens) => void;\n shouldSkipTransition?: boolean;\n onReset: () => 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.PrivacyPhoneCall]: PRIVACY_PHONE_CALL_SCREENS.includes(screen),\n [SettingsScreens.PrivacyPhoneP2P]: PRIVACY_PHONE_P2P_SCREENS.includes(screen),\n [SettingsScreens.PrivacyForwarding]: PRIVACY_FORWARDING_SCREENS.includes(screen),\n [SettingsScreens.PrivacyGroupChats]: PRIVACY_GROUP_CHATS_SCREENS.includes(screen),\n };\n\n const isTwoFaScreen = TWO_FA_SCREENS.includes(screen);\n const 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 isActive={isActive && isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.General:\n return (\n <SettingsGeneral\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive\n || screen === SettingsScreens.GeneralChatBackgroundColor\n || screen === SettingsScreens.GeneralChatBackground\n || screen === SettingsScreens.QuickReaction\n || isPrivacyScreen || isFoldersScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.QuickReaction:\n return (\n <SettingsQuickReaction isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Notifications:\n return (\n <SettingsNotifications isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.DataStorage:\n return (\n <SettingsDataStorage isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Privacy:\n return (\n <SettingsPrivacy\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || isPrivacyScreen || isTwoFaScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.Language:\n return (\n <SettingsLanguage isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.GeneralChatBackground:\n return (\n <SettingsGeneralBackground\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || screen === SettingsScreens.GeneralChatBackgroundColor}\n onReset={handleReset}\n />\n );\n case SettingsScreens.GeneralChatBackgroundColor:\n return (\n <SettingsGeneralBackgroundColor\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.ActiveSessions:\n return (\n <SettingsActiveSessions\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyBlockedUsers:\n return (\n <SettingsPrivacyBlockedUsers\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyPhoneCall:\n case SettingsScreens.PrivacyPhoneP2P:\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyGroupChats:\n return (\n <SettingsPrivacyVisibility\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n isAllowList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.Folders:\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <SettingsFolders\n currentScreen={currentScreen}\n shownScreen={screen}\n state={foldersState}\n dispatch={foldersDispatch}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.TwoFaDisabled:\n case SettingsScreens.TwoFaNewPassword:\n case SettingsScreens.TwoFaNewPasswordConfirm:\n case SettingsScreens.TwoFaNewPasswordHint:\n case SettingsScreens.TwoFaNewPasswordEmail:\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n case SettingsScreens.TwoFaCongratulations:\n case SettingsScreens.TwoFaEnabled:\n case SettingsScreens.TwoFaChangePasswordCurrent:\n case SettingsScreens.TwoFaChangePasswordNew:\n case SettingsScreens.TwoFaChangePasswordConfirm:\n case SettingsScreens.TwoFaChangePasswordHint:\n case SettingsScreens.TwoFaTurnOff:\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n case SettingsScreens.TwoFaRecoveryEmail:\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFa\n currentScreen={currentScreen}\n state={twoFaState}\n dispatch={twoFaDispatch}\n shownScreen={screen}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n 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({\n isActive,\n onBack: onReset,\n });\n\n const handleClick = useCallback((id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n }, [openChat]);\n\n const listIds = useMemo(() => {\n if (!contactIds) {\n return undefined;\n }\n\n const filteredIds = filterUsersByName(contactIds, usersById, filter);\n\n return sortUserIds(filteredIds, usersById, userStatusesById, undefined, serverTimeOffset);\n }, [contactIds, filter, usersById, userStatusesById, serverTimeOffset]);\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, listIds, Boolean(filter));\n\n return (\n <InfiniteScroll items={viewportIds} onLoadMore={getMore} className=\"chat-list custom-scroll\">\n {viewportIds?.length ? (\n viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleClick(id)}\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n >\n <PrivateChatInfo userId={id} forceShowSelf avatarSize=\"large\" />\n </ListItem>\n ))\n ) : viewportIds && !viewportIds.length ? (\n <p className=\"no-results\" key=\"no-results\" dir=\"auto\">\n {filter.length ? 'No contacts matched your search.' : 'Contact list is empty.'}\n </p>\n ) : (\n <Loading key=\"loading\" />\n )}\n <FloatingActionButton\n isShown\n onClick={openNewContactDialog}\n ariaLabel={lang('CreateNewContact')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: contactIds } = global.contactList || {};\n const { byId: usersById, statusesById: userStatusesById } = global.users;\n\n return {\n usersById,\n userStatusesById,\n contactIds,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ContactList));\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n const handleFilterChange = useCallback((query: string) => {\n setGlobalSearchQuery({ query });\n }, [setGlobalSearchQuery]);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const foundContactIds = localContactIds ? filterUsersByName(localContactIds, usersById, searchQuery) : [];\n\n return sortChatIds(\n unique([\n ...foundContactIds,\n ...(localUserIds || []),\n ...(globalUserIds || []),\n ]).filter((contactId) => {\n const user = usersById[contactId];\n if (!user) {\n return true;\n }\n\n return !user.isSelf && (user.canBeInvitedToGroup || !isUserBot(user));\n }),\n chatsById,\n false,\n selectedMemberIds,\n );\n }, [localContactIds, chatsById, searchQuery, localUserIds, globalUserIds, selectedMemberIds]);\n\n const handleNextStep = useCallback(() => {\n if (selectedMemberIds.length || isChannel) {\n setGlobalSearchQuery({ query: '' });\n onNextStep();\n }\n }, [selectedMemberIds.length, isChannel, setGlobalSearchQuery, onNextStep]);\n\n return (\n <div className=\"NewChat step-1\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel=\"Return to Chat List\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang('GroupAddMembers')}</h3>\n </div>\n <div className=\"NewChat-inner step-1\">\n <Picker\n itemIds={displayedIds}\n selectedIds={selectedMemberIds}\n filterValue={searchQuery}\n filterPlaceholder={lang('SendMessageTo')}\n searchInputId=\"new-group-picker-search\"\n isLoading={isSearching}\n onSelectedIdsChange={onSelectedMemberIdsChange}\n onFilterChange={handleFilterChange}\n />\n\n <FloatingActionButton\n isShown={Boolean(selectedMemberIds.length || isChannel)}\n onClick={handleNextStep}\n ariaLabel={isChannel ? 'Continue To Channel Info' : 'Continue To Group Info'}\n >\n <i className=\"icon-arrow-right\" />\n </FloatingActionButton>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: localContactIds } = global.contactList || {};\n const { byId: chatsById } = global.chats;\n\n const {\n query: searchQuery,\n fetchingStatus,\n globalResults,\n localResults,\n } = global.globalSearch;\n const { userIds: globalUserIds } = globalResults || {};\n const { userIds: localUserIds } = localResults || {};\n\n return {\n chatsById,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus?.chats,\n globalUserIds,\n localUserIds,\n };\n },\n)(NewChatStep1));\n","import 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({\n isActive,\n onBack: onReset,\n });\n\n const [title, setTitle] = useState('');\n const [about, setAbout] = useState('');\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n\n const chatTitleEmptyError = 'Chat title can\\'t be empty';\n const channelTitleEmptyError = 'Channel title can\\'t be empty';\n const chatTooManyUsersError = 'Sorry, creating supergroups is not yet supported';\n\n const isLoading = creationProgress === ChatCreationProgress.InProgress;\n\n const handleTitleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { value } = e.currentTarget;\n const newValue = value.replace(/^\\s+/, '');\n\n setTitle(newValue);\n\n if (newValue !== value) {\n e.currentTarget.value = newValue;\n }\n }, []);\n\n const handleDescriptionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setAbout(e.currentTarget.value);\n }, []);\n\n const handleCreateGroup = useCallback(() => {\n if (!title.length) {\n setError(chatTitleEmptyError);\n return;\n }\n\n if (memberIds.length > MAX_USERS_FOR_LEGACY_CHAT) {\n setError(chatTooManyUsersError);\n return;\n }\n\n createGroupChat({\n title,\n photo,\n memberIds,\n });\n }, [title, memberIds, createGroupChat, photo, chatTitleEmptyError, chatTooManyUsersError]);\n\n const handleCreateChannel = useCallback(() => {\n if (!title.length) {\n setError(channelTitleEmptyError);\n return;\n }\n\n createChannel({\n title,\n about,\n photo,\n memberIds,\n });\n }, [title, createChannel, about, photo, memberIds, channelTitleEmptyError]);\n\n useEffect(() => {\n if (creationProgress === ChatCreationProgress.Complete) {\n onReset(true);\n }\n }, [creationProgress, onReset]);\n\n const renderedError = (creationError && lang(creationError)) || (\n error !== chatTitleEmptyError && error !== channelTitleEmptyError\n ? error\n : undefined\n );\n\n return (\n <div className=\"NewChat\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onReset()}\n ariaLabel=\"Return to member selection\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang(isChannel ? 'NewChannel' : 'NewGroup')}</h3>\n </div>\n <div className=\"NewChat-inner step-2\">\n <AvatarEditable\n onChange={setPhoto}\n title={lang('AddPhoto')}\n />\n <InputText\n value={title}\n onChange={handleTitleChange}\n label={lang(isChannel ? 'EnterChannelName' : 'GroupName')}\n error={error === chatTitleEmptyError || error === channelTitleEmptyError ? error : undefined}\n />\n {isChannel && (\n <>\n <InputText\n value={about}\n onChange={handleDescriptionChange}\n label={lang('DescriptionOptionalPlaceholder')}\n />\n <p className=\"note\">{lang('DescriptionInfo')}</p>\n </>\n )}\n\n {renderedError && (\n <p className=\"error\">{renderedError}</p>\n )}\n\n {memberIds.length > 0 && (\n <>\n <h3 className=\"chat-members-heading\">{lang('GroupInfo.ParticipantCount', memberIds.length, 'i')}</h3>\n\n <div className=\"chat-members-list custom-scroll\">\n {memberIds.map((id) => (\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo userId={id} />\n </ListItem>\n ))}\n </div>\n </>\n )}\n </div>\n\n <FloatingActionButton\n isShown={title.length !== 0}\n onClick={isChannel ? handleCreateChannel : handleCreateGroup}\n disabled={isLoading}\n ariaLabel={isChannel ? lang('ChannelIntro.CreateChannel') : 'Create Group'}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-arrow-right\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n progress: creationProgress,\n error: creationError,\n } = global.chatCreation || {};\n\n return {\n creationProgress,\n creationError,\n };\n },\n)(NewChatStep2));\n","import 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 }) => {\n const lang = useLang();\n\n useHistoryBack({\n isActive,\n onBack: onReset,\n });\n\n return (\n <div className=\"ArchivedChats\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel=\"Return to chat list\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang('ArchivedChats')}</h3>\n </div>\n <ChatList folderType=\"archived\" isActive={isActive} />\n </div>\n );\n};\n\nexport default memo(ArchivedChats);\n","import 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=\"heart-outline\" onClick={handleRemoveReaction}>Remove Reaction</MenuItem>}\n {canSendNow && <MenuItem icon=\"send-outline\" onClick={onSend}>{lang('MessageScheduleSend')}</MenuItem>}\n {canReschedule && (\n <MenuItem icon=\"schedule\" onClick={onReschedule}>{lang('MessageScheduleEditTime')}</MenuItem>\n )}\n {canReply && <MenuItem icon=\"reply\" onClick={onReply}>{lang('Reply')}</MenuItem>}\n {canEdit && <MenuItem icon=\"edit\" onClick={onEdit}>{lang('Edit')}</MenuItem>}\n {canFaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onFaveSticker}>{lang('AddToFavorites')}</MenuItem>\n )}\n {canUnfaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onUnfaveSticker}>{lang('Stickers.RemoveFromFavorites')}</MenuItem>\n )}\n {canCopy && copyOptions.map((option) => (\n <MenuItem key={option.label} icon={option.icon} onClick={option.handler}>{lang(option.label)}</MenuItem>\n ))}\n {canPin && <MenuItem icon=\"pin\" onClick={onPin}>{lang('DialogPin')}</MenuItem>}\n {canUnpin && <MenuItem icon=\"unpin\" onClick={onUnpin}>{lang('DialogUnpin')}</MenuItem>}\n {canSaveGif && <MenuItem icon=\"gifs\" onClick={onSaveGif}>{lang('lng_context_save_gif')}</MenuItem>}\n {canDownload && (\n <MenuItem icon=\"download\" onClick={onDownload}>\n {isDownloading ? lang('lng_context_cancel_download') : lang('lng_media_download')}\n </MenuItem>\n )}\n {canForward && <MenuItem icon=\"forward\" onClick={onForward}>{lang('Forward')}</MenuItem>}\n {canSelect && <MenuItem icon=\"select\" onClick={onSelect}>{lang('Common.Select')}</MenuItem>}\n {canReport && <MenuItem icon=\"flag\" onClick={onReport}>{lang('lng_context_report_msg')}</MenuItem>}\n {(canShowSeenBy || canShowReactionsCount) && (\n <MenuItem\n className=\"MessageContextMenu--seen-by\"\n icon={canShowReactionsCount ? 'heart-outline' : 'group'}\n onClick={canShowReactionsCount ? onShowReactors : onShowSeenBy}\n disabled={!canShowReactionsCount && !message.seenByUserIds?.length}\n >\n <span className=\"MessageContextMenu--seen-by-label\">\n {canShowReactionsCount && message.reactors?.count ? (\n canShowSeenBy && message.seenByUserIds?.length\n ? lang(\n 'Chat.OutgoingContextMixedReactionCount',\n [message.reactors.count, message.seenByUserIds.length],\n )\n : lang('Chat.ContextReactionCount', message.reactors.count, 'i')\n ) : (\n message.seenByUserIds?.length === 1 && seenByRecentUsers\n ? getUserFullName(seenByRecentUsers[0])\n : (message.seenByUserIds?.length\n ? lang('Conversation.ContextMenuSeen', message.seenByUserIds.length, 'i')\n : lang('Conversation.ContextMenuNoViews')\n )\n )}\n </span>\n <div className=\"avatars\">\n {seenByRecentUsers?.map((user) => (\n <Avatar\n size=\"micro\"\n user={user}\n />\n ))}\n </div>\n </MenuItem>\n )}\n {canDelete && <MenuItem destructive icon=\"delete\" onClick={onDelete}>{lang('Delete')}</MenuItem>}\n </div>\n </Menu>\n );\n};\n\nexport default memo(MessageContextMenu);\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const [viewportIds, getMore] = useInfiniteScroll(searchTextMessagesLocal, foundIds);\n\n const viewportResults = useMemo(() => {\n if (!query || !viewportIds?.length || !messagesById) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return viewportIds.map((id) => {\n const message = messagesById[id];\n if (!message) {\n return undefined;\n }\n\n const senderUser = message.senderId ? selectUser(getGlobal(), message.senderId) : undefined;\n\n let senderChat;\n if (chat && isChatChannel(chat)) {\n senderChat = chat;\n } else if (message.forwardInfo) {\n const { isChannelPost, fromChatId } = message.forwardInfo;\n senderChat = isChannelPost && fromChatId ? selectChat(getGlobal(), fromChatId) : undefined;\n } else {\n senderChat = message.senderId ? selectChat(getGlobal(), message.senderId) : undefined;\n }\n\n return {\n message,\n senderUser,\n senderChat,\n onClick: () => focusMessage({ chatId, threadId, messageId: id }),\n };\n }).filter(Boolean);\n }, [query, viewportIds, messagesById, chat, focusMessage, chatId, threadId]);\n\n const handleKeyDown = useKeyboardListNavigation(containerRef, true, (index) => {\n const foundResult = viewportResults?.[index === -1 ? 0 : index];\n if (foundResult) {\n foundResult.onClick();\n }\n }, '.ListItem-button', true);\n\n const renderSearchResult = ({\n message, senderUser, senderChat, onClick,\n }: {\n message: ApiMessage;\n senderUser?: ApiUser;\n senderChat?: ApiChat;\n onClick: NoneToVoidFunction;\n }) => {\n const title = senderChat ? getChatTitle(lang, senderChat) : getUserFullName(senderUser);\n const text = renderMessageSummary(lang, message, undefined, query);\n\n return (\n <ListItem\n key={message.id}\n teactOrderKey={-message.date}\n className=\"chat-item-clickable search-result-message m-0\"\n onClick={onClick}\n >\n <Avatar chat={senderChat} user={senderUser} />\n <div className=\"info\">\n <div className=\"title\">\n <h3 dir=\"auto\">{title && renderText(title)}</h3>\n <LastMessageMeta message={message} />\n </div>\n <div className=\"subtitle\" dir=\"auto\">\n {text}\n </div>\n </div>\n </ListItem>\n );\n };\n\n const isOnTop = viewportIds?.[0] === foundIds?.[0];\n\n return (\n <InfiniteScroll\n ref={containerRef}\n className=\"RightSearch custom-scroll\"\n items={viewportResults}\n preloadBackwards={0}\n onLoadMore={getMore}\n onKeyDown={handleKeyDown}\n >\n {isOnTop && (\n <p key=\"helper-text\" className=\"helper-text\" dir=\"auto\">\n {!query ? (\n lang('lng_dlg_search_for_messages')\n ) : (totalCount === 0 || !viewportResults.length) ? (\n lang('lng_search_no_results')\n ) : totalCount === 1 ? (\n '1 message found'\n ) : (\n `${(viewportResults.length && (totalCount || viewportResults.length))} messages found`\n )}\n </p>\n )}\n {viewportResults.map(renderSearchResult)}\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const messagesById = chat && selectChatMessages(global, chat.id);\n if (!chat || !messagesById) {\n return {};\n }\n\n const { query, results } = selectCurrentTextSearch(global) || {};\n const { totalCount, foundIds } = results || {};\n\n return {\n chat,\n messagesById,\n query,\n totalCount,\n foundIds,\n };\n },\n)(RightSearch));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n function renderContent() {\n if (query === undefined) {\n return undefined;\n }\n\n if (!query && featuredIds) {\n return featuredIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n if (resultIds) {\n if (!resultIds.length) {\n return <p className=\"helper-text\" dir=\"auto\">Nothing found.</p>;\n }\n\n return resultIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n return <Loading />;\n }\n\n return (\n <div ref={containerRef} className=\"StickerSearch custom-scroll\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderContent()}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const currentSearch = selectCurrentStickerSearch(global);\n const { query, resultIds } = currentSearch || {};\n const { featured } = global.stickers;\n\n return {\n query,\n featuredIds: featured.setIds,\n resultIds,\n };\n },\n)(StickerSearch));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n function renderContent() {\n if (query === undefined) {\n return undefined;\n }\n\n if (!results) {\n return (\n <Loading />\n );\n }\n\n if (!results.length) {\n return (\n <p className=\"helper-text\" dir=\"auto\">{lang('NoGIFsFound')}</p>\n );\n }\n\n return results.map((gif) => (\n <GifButton\n key={gif.id}\n gif={gif}\n observeIntersection={observeIntersection}\n onClick={canSendGifs ? handleGifClick : undefined}\n isSavedMessages={isSavedMessages}\n />\n ));\n }\n\n const hasResults = Boolean(query !== undefined && results && results.length);\n\n return (\n <div className=\"GifSearch\" dir={lang.isRtl ? 'rtl' : undefined}>\n <InfiniteScroll\n ref={containerRef}\n className={buildClassName('gif-container custom-scroll', hasResults && 'grid')}\n items={results}\n itemSelector=\".GifButton\"\n preloadBackwards={PRELOAD_BACKWARDS}\n noFastList\n onLoadMore={searchMoreGifs}\n >\n {renderContent()}\n </InfiniteScroll>\n {calendar}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const currentSearch = selectCurrentGifSearch(global);\n const { query, results } = currentSearch || {};\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n const chat = chatId ? selectChat(global, chatId) : undefined;\n const isChatWithBot = chat ? selectIsChatWithBot(global, chat) : undefined;\n const isSavedMessages = Boolean(chatId) && selectIsChatWithSelf(global, chatId);\n const canPostInChat = Boolean(chat) && Boolean(threadId) && getCanPostInChat(chat, threadId);\n\n return {\n query,\n results,\n chat,\n isChatWithBot,\n isSavedMessages,\n canPostInChat,\n canScheduleUntilOnline: Boolean(chatId) && selectCanScheduleUntilOnline(global, chatId),\n };\n },\n)(GifSearch));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n if (!message || !chat) {\n return <Loading />;\n }\n\n const { summary, results } = getMessagePoll(message)!;\n if (!results.results) {\n return undefined;\n }\n\n const resultsByOption = buildCollectionByKey(results.results, 'option');\n\n return (\n <div className=\"PollResults\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"poll-question\" dir=\"auto\">{renderText(summary.question, ['emoji', 'br'])}</h3>\n <div className=\"poll-results-list custom-scroll\">\n {lastSyncTime && summary.answers.map((answer) => (\n <PollAnswerResults\n key={`${message.id}-${answer.option}`}\n chat={chat}\n message={message}\n answer={answer}\n answerVote={resultsByOption[answer.option]}\n totalVoters={results.totalVoters!}\n />\n ))}\n {!lastSyncTime && <Loading />}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n pollResults: { chatId, messageId },\n lastSyncTime,\n } = global;\n\n if (!chatId || !messageId) {\n return {};\n }\n\n const chat = selectChat(global, chatId);\n const message = selectChatMessage(global, chatId, messageId);\n\n return {\n chat,\n message,\n lastSyncTime,\n };\n },\n)(PollResults));\n","import { 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({\n isActive,\n onBack: onClose,\n });\n\n const currentFirstName = user ? (user.firstName || '') : '';\n const currentLastName = user ? (user.lastName || '') : '';\n\n const [firstName, setFirstName] = useState(currentFirstName);\n const [lastName, setLastName] = useState(currentLastName);\n const [isNotificationsEnabled, setIsNotificationsEnabled] = useState(!isMuted);\n\n useEffect(() => {\n setIsNotificationsEnabled(!isMuted);\n }, [isMuted]);\n\n useEffect(() => {\n setIsProfileFieldsTouched(false);\n closeDeleteDialog();\n }, [closeDeleteDialog, userId]);\n\n useEffect(() => {\n setFirstName(currentFirstName);\n setLastName(currentLastName);\n }, [currentFirstName, currentLastName, user]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n closeDeleteDialog();\n }\n }, [closeDeleteDialog, progress]);\n\n const handleFirstNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleLastNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleNotificationChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsNotificationsEnabled(e.target.checked);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleProfileSave = useCallback(() => {\n const trimmedFirstName = firstName.trim();\n const trimmedLastName = lastName.trim();\n\n if (!trimmedFirstName.length) {\n setError(ERROR_FIRST_NAME_MISSING);\n }\n\n updateContact({\n userId,\n isMuted: !isNotificationsEnabled,\n firstName: trimmedFirstName,\n lastName: trimmedLastName,\n });\n }, [firstName, lastName, updateContact, userId, isNotificationsEnabled]);\n\n const handleDeleteContact = useCallback(() => {\n deleteContact({ userId });\n closeDeleteDialog();\n closeManagement();\n }, [closeDeleteDialog, closeManagement, deleteContact, userId]);\n\n if (!user) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <PrivateChatInfo\n userId={user.id}\n avatarSize=\"jumbo\"\n status=\"original name\"\n withFullInfo\n />\n <InputText\n id=\"user-first-name\"\n label={lang('UserInfo.FirstNamePlaceholder')}\n onChange={handleFirstNameChange}\n value={firstName}\n error={error === ERROR_FIRST_NAME_MISSING ? error : undefined}\n />\n <InputText\n id=\"user-last-name\"\n label={lang('UserInfo.LastNamePlaceholder')}\n onChange={handleLastNameChange}\n value={lastName}\n />\n <div className=\"ListItem no-selection narrow\">\n <Checkbox\n checked={isNotificationsEnabled}\n label={lang('Notifications')}\n subLabel={lang(isNotificationsEnabled\n ? 'UserInfo.NotificationsEnabled'\n : 'UserInfo.NotificationsDisabled')}\n onChange={handleNotificationChange}\n />\n </div>\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {lang('DeleteContact')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleProfileSave}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n text={lang('AreYouSureDeleteContact')}\n confirmLabel={lang('DeleteContact')}\n confirmHandler={handleDeleteContact}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n const user = selectUser(global, userId);\n const chat = selectChat(global, userId)!;\n const { progress } = global.management;\n const isMuted = selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global));\n\n return {\n user, progress, isMuted,\n };\n },\n)(ManageUser));\n","import { 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({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (lastSyncTime && canInvite) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, canInvite, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handleClickEditType = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatPrivacyType);\n }, [onScreenSelect]);\n\n const handleClickDiscussion = useCallback(() => {\n onScreenSelect(ManagementScreens.Discussion);\n }, [onScreenSelect]);\n\n const handleClickReactions = useCallback(() => {\n onScreenSelect(ManagementScreens.Reactions);\n }, [onScreenSelect]);\n\n const handleClickPermissions = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupPermissions);\n }, [onScreenSelect]);\n\n const handleClickAdministrators = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }, [onScreenSelect]);\n\n const handleClickInvites = useCallback(() => {\n onScreenSelect(ManagementScreens.Invites);\n }, [onScreenSelect]);\n\n const handleClickRequests = useCallback(() => {\n onScreenSelect(ManagementScreens.JoinRequests);\n }, [onScreenSelect]);\n\n const handleSetPhoto = useCallback((file: File) => {\n setPhoto(file);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleAboutChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setAbout(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUpdateGroup = useCallback(() => {\n const trimmedTitle = title.trim();\n const trimmedAbout = about.trim();\n\n if (!trimmedTitle.length) {\n setError(GROUP_TITLE_EMPTY);\n return;\n }\n\n updateChat({\n chatId,\n title: trimmedTitle,\n about: trimmedAbout,\n photo,\n });\n }, [about, chatId, photo, title, updateChat]);\n\n const handleClickMembers = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupMembers);\n }, [onScreenSelect]);\n\n const handleTogglePreHistory = useCallback(() => {\n if (!chat.fullInfo) {\n return;\n }\n\n const { isPreHistoryHidden } = chat.fullInfo;\n\n togglePreHistoryHidden({ chatId: chat.id, isEnabled: !isPreHistoryHidden });\n }, [chat, togglePreHistoryHidden]);\n\n const enabledReactionsCount = chat.fullInfo?.enabledReactions?.length || 0;\n\n const enabledPermissionsCount = useMemo(() => {\n if (!chat.defaultBannedRights) {\n return 0;\n }\n\n let totalCount = [\n 'sendMessages',\n 'sendMedia',\n 'embedLinks',\n 'sendPolls',\n 'changeInfo',\n 'inviteUsers',\n 'pinMessages',\n ].filter(\n (key) => !chat.defaultBannedRights![key as keyof ApiChatBannedRights],\n ).length;\n\n const { sendStickers, sendGifs } = chat.defaultBannedRights;\n\n // These two rights are controlled with a single checkbox\n if (!sendStickers && !sendGifs) {\n totalCount += 1;\n }\n\n return totalCount;\n }, [chat]);\n\n const adminsCount = (chat.fullInfo?.adminMembers?.length) || 0;\n\n const handleDeleteGroup = useCallback(() => {\n if (isBasicGroup) {\n deleteChat({ chatId: chat.id });\n } else if (!chat.isCreator) {\n leaveChannel({ chatId: chat.id });\n } else {\n deleteChannel({ chatId: chat.id });\n }\n closeDeleteDialog();\n closeManagement();\n openChat({ id: undefined });\n }, [\n isBasicGroup, chat.isCreator, chat.id,\n closeDeleteDialog, closeManagement, leaveChannel, deleteChannel, deleteChat, openChat,\n ]);\n\n if (chat.isRestricted || chat.isForbidden) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handleSetPhoto}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-title\"\n label={lang('GroupName')}\n onChange={handleTitleChange}\n value={title}\n error={error === GROUP_TITLE_EMPTY ? error : undefined}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n disabled={!canChangeInfo}\n />\n {chat.isCreator && (\n <ListItem icon=\"lock\" multiline onClick={handleClickEditType}>\n <span className=\"title\">{lang('GroupType')}</span>\n <span className=\"subtitle\">{chat.username ? lang('TypePublic') : lang('TypePrivate')}</span>\n </ListItem>\n )}\n {hasLinkedChannel && (\n <ListItem\n icon=\"message\"\n multiline\n onClick={handleClickDiscussion}\n >\n <span className=\"title\">{lang('LinkedChannel')}</span>\n <span className=\"subtitle\">{lang('DiscussionUnlink')}</span>\n </ListItem>\n )}\n <ListItem\n icon=\"permissions\"\n multiline\n onClick={handleClickPermissions}\n disabled={!canBanUsers}\n >\n <span className=\"title\">{lang('ChannelPermissions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledPermissionsCount}/{TOTAL_PERMISSIONS_COUNT}\n </span>\n </ListItem>\n\n <ListItem\n icon=\"heart-outline\"\n multiline\n onClick={handleClickReactions}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Reactions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledReactionsCount}/{availableReactionsCount}\n </span>\n </ListItem>\n <ListItem\n icon=\"admin\"\n multiline\n onClick={handleClickAdministrators}\n >\n <span className=\"title\">{lang('ChannelAdministrators')}</span>\n <span className=\"subtitle\">{formatInteger(adminsCount)}</span>\n </ListItem>\n {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('MemberRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n </div>\n <div className=\"section\">\n <ListItem icon=\"group\" multiline onClick={handleClickMembers}>\n <span className=\"title\">{lang('GroupMembers')}</span>\n <span className=\"subtitle\">{formatInteger(chat.membersCount ?? 0)}</span>\n </ListItem>\n\n {!isPublicGroup && chat.fullInfo && (\n <div className=\"ListItem narrow no-selection\">\n <Checkbox\n checked={!chat.fullInfo.isPreHistoryHidden}\n label={lang('ChatHistory')}\n onChange={handleTogglePreHistory}\n disabled={!canBanUsers}\n />\n </div>\n )}\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {lang('DeleteMega')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleUpdateGroup}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n textParts={renderText(\n isBasicGroup || !chat.isCreator\n ? lang('AreYouSureDeleteAndExit')\n : lang('AreYouSureDeleteThisChatWithGroup', chat.title),\n ['br', 'simple_markdown'],\n )}\n confirmLabel={isBasicGroup || !chat.isCreator ? lang('DeleteMega') : lang('DeleteGroupForAll')}\n confirmHandler={handleDeleteGroup}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { progress } = global.management;\n const hasLinkedChannel = Boolean(chat.fullInfo?.linkedChatId);\n const isBasicGroup = isChatBasicGroup(chat);\n const { invites } = global.management.byChatId[chatId] || {};\n\n return {\n chat,\n progress,\n isBasicGroup,\n hasLinkedChannel,\n canChangeInfo: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'changeInfo'),\n canBanUsers: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'banUsers'),\n canInvite: isBasicGroup ? chat.isCreator : getHasAdminRight(chat, 'inviteUsers'),\n exportedInvites: invites,\n lastSyncTime: global.lastSyncTime,\n availableReactionsCount: global.availableReactions?.filter((l) => !l.isInactive).length,\n };\n },\n)(ManageGroup));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const handleRemovedUsersClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupRemovedUsers);\n }, [onScreenSelect]);\n\n const handleAddExceptionClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupUserPermissionsCreate);\n }, [onScreenSelect]);\n\n const handleExceptionMemberClick = useCallback((member: ApiChatMember) => {\n onChatMemberSelect(member.userId, member.promotedByUserId === currentUserId);\n onScreenSelect(ManagementScreens.GroupUserPermissions);\n }, [currentUserId, onChatMemberSelect, onScreenSelect]);\n\n useEffect(() => {\n setPermissions((chat?.defaultBannedRights) || {});\n setHavePermissionChanged(false);\n setTimeout(() => {\n setIsLoading(false);\n }, FLOATING_BUTTON_ANIMATION_TIMEOUT_MS);\n }, [chat]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as Exclude<keyof ApiChatBannedRights, 'untilDate'>]),\n ...(name === 'sendStickers' && {\n sendGifs: getUpdatedPermissionValue(p[name]),\n }),\n }));\n setHavePermissionChanged(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!chat) {\n return;\n }\n\n setIsLoading(true);\n updateChatDefaultBannedRights({ chatId: chat.id, bannedRights: permissions });\n }, [chat, permissions, updateChatDefaultBannedRights]);\n\n const removedUsersCount = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.kickedMembers) {\n return 0;\n }\n\n return chat.fullInfo.kickedMembers.length;\n }, [chat]);\n\n const exceptionMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.members) {\n return [];\n }\n\n return chat.fullInfo.members.filter(({ bannedRights }) => Boolean(bannedRights));\n }, [chat]);\n\n const getMemberExceptions = useCallback((member: ApiChatMember) => {\n const { bannedRights } = member;\n if (!bannedRights || !chat) {\n return undefined;\n }\n\n const { defaultBannedRights } = chat;\n\n return Object.keys(bannedRights).reduce((result, key) => {\n if (\n !bannedRights[key as keyof ApiChatBannedRights]\n || (defaultBannedRights?.[key as keyof ApiChatBannedRights])\n || key === 'sendInline' || key === 'viewMessages' || key === 'sendGames'\n ) {\n return result;\n }\n\n const langKey = getLangKeyForBannedRightKey(key);\n\n if (!langKey) {\n return result;\n }\n\n const translatedString = lang(langKey);\n\n return `${result}${!result.length ? translatedString : `, ${translatedString}`}`;\n }, '');\n }, [chat, lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <h3 className=\"section-heading\" dir=\"auto\">{lang('ChannelPermissionsHeader')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMessages\"\n checked={!permissions.sendMessages}\n label={lang('UserRestrictionsSend')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMedia\"\n checked={!permissions.sendMedia}\n label={lang('UserRestrictionsSendMedia')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendStickers\"\n checked={!permissions.sendStickers && !permissions.sendGifs}\n label={lang('UserRestrictionsSendStickers')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendPolls\"\n checked={!permissions.sendPolls}\n label={lang('UserRestrictionsSendPolls')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"embedLinks\"\n checked={!permissions.embedLinks}\n label={lang('UserRestrictionsEmbedLinks')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={!permissions.inviteUsers}\n label={lang('UserRestrictionsInviteUsers')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={!permissions.pinMessages}\n label={lang('UserRestrictionsPinMessages')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!permissions.changeInfo}\n label={lang('UserRestrictionsChangeInfo')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n </div>\n\n <div className=\"section\">\n <ListItem\n icon=\"delete-user\"\n multiline\n narrow\n onClick={handleRemovedUsersClick}\n >\n <span className=\"title\">{lang('ChannelBlockedUsers')}</span>\n <span className=\"subtitle\">{removedUsersCount}</span>\n </ListItem>\n </div>\n\n <div className=\"section\">\n <h3 className=\"section-heading\" dir=\"auto\">{lang('PrivacyExceptions')}</h3>\n\n <ListItem\n icon=\"add-user\"\n onClick={handleAddExceptionClick}\n >\n {lang('ChannelAddException')}\n </ListItem>\n\n {exceptionMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable exceptions-member\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleExceptionMemberClick(member)}\n >\n <PrivateChatInfo\n userId={member.userId}\n status={getMemberExceptions(member)}\n />\n </ListItem>\n ))}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={havePermissionChanged}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n\n return { chat, currentUserId: global.currentUserId };\n },\n)(ManageGroupPermissions));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const removedMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.kickedMembers) {\n return [];\n }\n\n return chat.fullInfo.kickedMembers;\n }, [chat]);\n\n const getRemovedBy = useCallback((member: ApiChatMember) => {\n if (!member.kickedByUserId) {\n return undefined;\n }\n\n const kickedByUser = usersById[member.kickedByUserId];\n if (!kickedByUser) {\n return undefined;\n }\n\n return lang('UserRemovedBy', getUserFullName(kickedByUser));\n }, [lang, usersById]);\n\n const getContextActions = useCallback((member: ApiChatMember) => {\n if (!chat) {\n return undefined;\n }\n\n return [{\n title: lang('Unblock'),\n icon: 'delete',\n destructive: true,\n handler: () => updateChatMemberBannedRights({\n chatId: chat.id,\n userId: member.userId,\n bannedRights: {},\n }),\n }];\n }, [lang, chat, updateChatMemberBannedRights]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <p className=\"text-muted\">{lang(isChannel ? 'NoBlockedChannel2' : 'NoBlockedGroup2')}</p>\n\n {removedMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable\"\n ripple\n contextActions={getContextActions(member)}\n >\n <PrivateChatInfo\n userId={member.userId}\n status={getRemovedBy(member)}\n />\n </ListItem>\n ))}\n {canDeleteMembers && (\n <FloatingActionButton\n isShown\n onClick={openRemoveUserModal}\n ariaLabel={lang('Channel.EditAdmin.Permission.BanUsers')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n )}\n {chat && canDeleteMembers && (\n <RemoveGroupUserModal\n chat={chat}\n isOpen={isRemoveUserModalOpen}\n onClose={closeRemoveUserModal}\n />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { byId: usersById } = global.users;\n const canDeleteMembers = chat && (getHasAdminRight(chat, 'banUsers') || chat.isCreator);\n\n return {\n chat,\n usersById,\n canDeleteMembers,\n isChannel: chat && isChatChannel(chat),\n };\n },\n)(ManageChatRemovedUsers));\n","import { 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({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (lastSyncTime) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const adminsCount = (chat?.fullInfo?.adminMembers?.length) || 0;\n const removedUsersCount = (chat?.fullInfo?.kickedMembers?.length) || 0;\n\n const handleClickEditType = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatPrivacyType);\n }, [onScreenSelect]);\n\n const handleClickDiscussion = useCallback(() => {\n onScreenSelect(ManagementScreens.Discussion);\n }, [onScreenSelect]);\n\n const handleClickReactions = useCallback(() => {\n onScreenSelect(ManagementScreens.Reactions);\n }, [onScreenSelect]);\n\n const handleClickAdministrators = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }, [onScreenSelect]);\n\n const handleClickInvites = useCallback(() => {\n onScreenSelect(ManagementScreens.Invites);\n }, [onScreenSelect]);\n\n const handleClickRequests = useCallback(() => {\n onScreenSelect(ManagementScreens.JoinRequests);\n }, [onScreenSelect]);\n\n const handleSetPhoto = useCallback((file: File) => {\n setPhoto(file);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleAboutChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setAbout(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUpdateChannel = useCallback(() => {\n const trimmedTitle = title.trim();\n const trimmedAbout = about.trim();\n\n if (!trimmedTitle.length) {\n setError(CHANNEL_TITLE_EMPTY);\n return;\n }\n\n updateChat({\n chatId,\n title: trimmedTitle,\n about: trimmedAbout,\n photo,\n });\n }, [about, chatId, photo, title, updateChat]);\n\n const handleToggleSignatures = useCallback(() => {\n toggleSignatures({ chatId, isEnabled: !isSignaturesShown });\n }, [chatId, isSignaturesShown, toggleSignatures]);\n\n const handleClickSubscribers = useCallback(() => {\n onScreenSelect(ManagementScreens.ChannelSubscribers);\n }, [onScreenSelect]);\n\n const handleRemovedUsersClick = useCallback(() => {\n onScreenSelect(ManagementScreens.ChannelRemovedUsers);\n }, [onScreenSelect]);\n\n const handleDeleteChannel = useCallback(() => {\n if (chat.isCreator) {\n deleteChannel({ chatId: chat.id });\n } else {\n leaveChannel({ chatId: chat.id });\n }\n\n closeDeleteDialog();\n closeManagement();\n openChat({ id: undefined });\n }, [chat.isCreator, chat.id, closeDeleteDialog, closeManagement, leaveChannel, deleteChannel, openChat]);\n\n const enabledReactionsCount = chat.fullInfo?.enabledReactions?.length || 0;\n\n if (chat.isRestricted || chat.isForbidden) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handleSetPhoto}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"channel-title\"\n label={lang('EnterChannelName')}\n onChange={handleTitleChange}\n value={title}\n error={error === CHANNEL_TITLE_EMPTY ? error : undefined}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"channel-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n disabled={!canChangeInfo}\n />\n {chat.isCreator && (\n <ListItem icon=\"lock\" multiline onClick={handleClickEditType}>\n <span className=\"title\">{lang('ChannelType')}</span>\n <span className=\"subtitle\">{chat.username ? lang('TypePublic') : lang('TypePrivate')}</span>\n </ListItem>\n )}\n <ListItem\n icon=\"message\"\n multiline\n onClick={handleClickDiscussion}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Discussion')}</span>\n <span className=\"subtitle\">{hasLinkedChat ? lang('DiscussionUnlink') : lang('Add')}</span>\n </ListItem>\n {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('SubscribeRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n <ListItem\n icon=\"heart-outline\"\n multiline\n onClick={handleClickReactions}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Reactions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledReactionsCount}/{availableReactionsCount}\n </span>\n </ListItem>\n <div className=\"ListItem no-selection narrow\">\n <Checkbox\n checked={isSignaturesShown}\n label={lang('ChannelSignMessages')}\n onChange={handleToggleSignatures}\n />\n </div>\n </div>\n <div className=\"section\">\n <ListItem\n icon=\"admin\"\n multiline\n onClick={handleClickAdministrators}\n >\n <span className=\"title\">{lang('ChannelAdministrators')}</span>\n <span className=\"subtitle\">{adminsCount}</span>\n </ListItem>\n <ListItem\n icon=\"group\"\n multiline\n onClick={handleClickSubscribers}\n >\n <span className=\"title\" dir=\"auto\">{lang('ChannelSubscribers')}</span>\n <span className=\"subtitle\" dir=\"auto\">{lang('Subscribers', chat.membersCount ?? 0, 'i')}</span>\n </ListItem>\n <ListItem\n icon=\"delete-user\"\n multiline\n narrow\n onClick={handleRemovedUsersClick}\n >\n <span className=\"title\">{lang('ChannelBlockedUsers')}</span>\n <span className=\"subtitle\">{removedUsersCount}</span>\n </ListItem>\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {chat.isCreator ? lang('ChannelDelete') : lang('LeaveChannel')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleUpdateChannel}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n text={chat.isCreator ? lang('ChannelDeleteAlert') : lang('ChannelLeaveAlert')}\n confirmLabel={chat.isCreator ? lang('ChannelDelete') : lang('LeaveChannel')}\n confirmHandler={handleDeleteChannel}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { progress } = global.management;\n const isSignaturesShown = Boolean(chat?.isSignaturesShown);\n const { invites } = global.management.byChatId[chatId] || {};\n\n return {\n chat,\n progress,\n isSignaturesShown,\n canChangeInfo: getHasAdminRight(chat, 'changeInfo'),\n canInvite: getHasAdminRight(chat, 'inviteUsers'),\n lastSyncTime: global.lastSyncTime,\n exportedInvites: invites,\n availableReactionsCount: global.availableReactions?.filter((l) => !l.isInactive).length,\n };\n },\n)(ManageChannel));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (privacyType && !privateLink) {\n updatePrivateLink();\n }\n }, [privacyType, privateLink, updatePrivateLink]);\n\n const handleOptionChange = useCallback((value: string) => {\n setPrivacyType(value as PrivacyType);\n }, []);\n\n const handleForwardingOptionChange = useCallback((value: string) => {\n toggleIsProtected({\n chatId: chat.id,\n isProtected: value === 'protected',\n });\n }, [chat.id, toggleIsProtected]);\n\n const handleSave = useCallback(() => {\n updatePublicLink({ username: privacyType === 'public' ? username : '' });\n }, [privacyType, updatePublicLink, username]);\n\n const handleRevokePrivateLink = useCallback(() => {\n closeRevokeConfirmDialog();\n updatePrivateLink();\n }, [closeRevokeConfirmDialog, updatePrivateLink]);\n\n const lang = useLang();\n const langPrefix1 = isChannel ? 'Channel' : 'Mega';\n const langPrefix2 = isChannel ? 'Channel' : 'Group';\n\n const options = [\n { value: 'private', label: lang(`${langPrefix1}Private`), subLabel: lang(`${langPrefix1}PrivateInfo`) },\n { value: 'public', label: lang(`${langPrefix1}Public`), subLabel: lang(`${langPrefix1}PublicInfo`) },\n ];\n\n const forwardingOptions = [{\n value: 'allowed',\n label: lang('ChannelVisibility.Forwarding.Enabled'),\n }, {\n value: 'protected',\n label: lang('ChannelVisibility.Forwarding.Disabled'),\n }];\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">{lang(`${langPrefix2}Type`)}</h3>\n <RadioGroup\n selected={privacyType}\n name=\"channel-type\"\n options={options}\n onChange={handleOptionChange}\n />\n </div>\n {privacyType === 'private' ? (\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n {privateLink ? (\n <>\n <SafeLink url={privateLink} className=\"group-link\" text={privateLink} />\n <p className=\"section-info\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang(`${langPrefix1}PrivateLinkHelp`)}\n </p>\n\n <ListItem icon=\"delete\" ripple destructive onClick={openRevokeConfirmDialog}>\n {lang('RevokeLink')}\n </ListItem>\n <ConfirmDialog\n isOpen={isRevokeConfirmDialogOpen}\n onClose={closeRevokeConfirmDialog}\n text={lang('RevokeAlert')}\n confirmLabel={lang('RevokeButton')}\n confirmHandler={handleRevokePrivateLink}\n confirmIsDestructive\n />\n </>\n ) : (\n <Loading />\n )}\n </div>\n ) : (\n <div className=\"section no-border\">\n <UsernameInput\n asLink\n currentUsername={chat.username}\n isLoading={isLoading}\n isUsernameAvailable={isUsernameAvailable}\n checkUsername={checkPublicLink}\n onChange={setUsername}\n />\n <p className=\"section-info\" dir=\"auto\">\n {lang(`${langPrefix2}.Username.CreatePublicLinkHelp`)}\n </p>\n </div>\n )}\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">\n {lang(isChannel ? 'ChannelVisibility.Forwarding.ChannelTitle' : 'ChannelVisibility.Forwarding.GroupTitle')}\n </h3>\n <RadioGroup\n selected={isProtected ? 'protected' : 'allowed'}\n name=\"forwarding-type\"\n options={forwardingOptions}\n onChange={handleForwardingOptionChange}\n />\n <p className=\"section-info\">\n {isChannel\n ? lang('ChannelVisibility.Forwarding.ChannelInfo')\n : lang('ChannelVisibility.Forwarding.GroupInfo')}\n </p>\n </div>\n </div>\n <FloatingActionButton\n isShown={canUpdate}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n onClick={handleSave}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { isUsernameAvailable } = selectManagement(global, chatId)!;\n\n return {\n chat,\n isChannel: isChatChannel(chat),\n progress: global.management.progress,\n isUsernameAvailable,\n isProtected: chat?.isProtected,\n };\n },\n)(ManageChatPrivacyType));\n","import 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({\n isActive,\n onBack: onClose,\n });\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({\n isActive,\n onBack: onClose,\n });\n\n const selectedChatMember = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.members) {\n return undefined;\n }\n\n return chat.fullInfo.members.find(({ userId }) => userId === selectedChatMemberId);\n }, [chat, selectedChatMemberId]);\n\n useEffect(() => {\n if (chat?.fullInfo && selectedChatMemberId && !selectedChatMember) {\n onScreenSelect(ManagementScreens.GroupPermissions);\n }\n }, [chat, onScreenSelect, selectedChatMember, selectedChatMemberId]);\n\n useEffect(() => {\n setPermissions((selectedChatMember?.bannedRights) || (chat?.defaultBannedRights) || {});\n setHavePermissionChanged(false);\n setIsLoading(false);\n }, [chat, selectedChatMember]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as Exclude<keyof ApiChatBannedRights, 'untilDate'>]),\n ...(name === 'sendStickers' && {\n sendGifs: getUpdatedPermissionValue(p[name]),\n }),\n }));\n setHavePermissionChanged(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!chat || !selectedChatMemberId) {\n return;\n }\n\n setIsLoading(true);\n updateChatMemberBannedRights({\n chatId: chat.id,\n userId: selectedChatMemberId,\n bannedRights: permissions,\n });\n }, [chat, selectedChatMemberId, permissions, updateChatMemberBannedRights]);\n\n const handleBanFromGroup = useCallback(() => {\n if (!chat || !selectedChatMemberId) {\n return;\n }\n\n updateChatMemberBannedRights({\n chatId: chat.id,\n userId: selectedChatMemberId,\n bannedRights: {\n viewMessages: true,\n },\n });\n }, [chat, selectedChatMemberId, updateChatMemberBannedRights]);\n\n const getControlIsDisabled = useCallback((key: Exclude<keyof ApiChatBannedRights, 'untilDate'>) => {\n if (isFormFullyDisabled) {\n return true;\n }\n\n if (!chat || !chat.defaultBannedRights) {\n return false;\n }\n\n return chat.defaultBannedRights[key];\n }, [chat, isFormFullyDisabled]);\n\n if (!selectedChatMember) {\n return undefined;\n }\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo userId={selectedChatMember.userId} />\n </ListItem>\n\n <h3 className=\"section-heading mt-4\" dir=\"auto\">{lang('UserRestrictionsCanDo')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMessages\"\n checked={!permissions.sendMessages}\n label={lang('UserRestrictionsSend')}\n blocking\n disabled={getControlIsDisabled('sendMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMedia\"\n checked={!permissions.sendMedia}\n label={lang('UserRestrictionsSendMedia')}\n blocking\n disabled={getControlIsDisabled('sendMedia')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendStickers\"\n checked={!permissions.sendStickers && !permissions.sendGifs}\n label={lang('UserRestrictionsSendStickers')}\n blocking\n disabled={getControlIsDisabled('sendStickers')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendPolls\"\n checked={!permissions.sendPolls}\n label={lang('UserRestrictionsSendPolls')}\n blocking\n disabled={getControlIsDisabled('sendPolls')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"embedLinks\"\n checked={!permissions.embedLinks}\n label={lang('UserRestrictionsEmbedLinks')}\n blocking\n disabled={getControlIsDisabled('embedLinks')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={!permissions.inviteUsers}\n label={lang('UserRestrictionsInviteUsers')}\n blocking\n disabled={getControlIsDisabled('inviteUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={!permissions.pinMessages}\n label={lang('UserRestrictionsPinMessages')}\n blocking\n disabled={getControlIsDisabled('pinMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!permissions.changeInfo}\n label={lang('UserRestrictionsChangeInfo')}\n blocking\n disabled={getControlIsDisabled('changeInfo')}\n onChange={handlePermissionChange}\n />\n </div>\n </div>\n\n {!isFormFullyDisabled && (\n <div className=\"section\">\n <ListItem icon=\"delete-user\" ripple destructive onClick={openBanConfirmationDialog}>\n {lang('UserRestrictionsBlock')}\n </ListItem>\n </div>\n )}\n </div>\n\n <FloatingActionButton\n isShown={havePermissionChanged}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n\n <ConfirmDialog\n isOpen={isBanConfirmationDialogOpen}\n onClose={closeBanConfirmationDialog}\n text=\"Are you sure you want to ban and remove this user from the group?\"\n confirmLabel=\"Remove\"\n confirmHandler={handleBanFromGroup}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, isPromotedByCurrentUser }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const isFormFullyDisabled = !(chat.isCreator || isPromotedByCurrentUser);\n\n return { chat, isFormFullyDisabled };\n },\n)(ManageGroupUserPermissions));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const handleRecentActionsClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupRecentActions);\n }, [onScreenSelect]);\n\n const adminMembers = useMemo(() => {\n if (!chat.fullInfo || !chat.fullInfo.adminMembers) {\n return [];\n }\n\n return chat.fullInfo.adminMembers.sort((a, b) => {\n if (a.isOwner) {\n return -1;\n } else if (b.isOwner) {\n return 1;\n }\n\n return 0;\n });\n }, [chat]);\n\n const handleAdminMemberClick = useCallback((member: ApiChatMember) => {\n onChatMemberSelect(member.userId, member.promotedByUserId === currentUserId);\n onScreenSelect(ManagementScreens.ChatAdminRights);\n }, [currentUserId, onChatMemberSelect, onScreenSelect]);\n\n const handleAddAdminClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupAddAdmins);\n }, [onScreenSelect]);\n\n const getMemberStatus = useCallback((member: ApiChatMember) => {\n if (member.isOwner) {\n return lang('ChannelCreator');\n }\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const promotedByUser = member.promotedByUserId ? usersById[member.promotedByUserId] : undefined;\n\n if (promotedByUser) {\n return lang('EditAdminPromotedBy', getUserFullName(promotedByUser));\n }\n\n return lang('ChannelAdmin');\n }, [lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem\n icon=\"recent\"\n multiline\n onClick={handleRecentActionsClick}\n >\n <span className=\"title\">{lang('EventLog')}</span>\n <span className=\"subtitle\">{lang(isChannel ? 'EventLogInfoDetailChannel' : 'EventLogInfoDetail')}</span>\n </ListItem>\n </div>\n\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <p className=\"text-muted\" dir=\"auto\">\n {isChannel\n ? 'You can add administrators to help you manage your channel.'\n : 'You can add administrators to help you manage your group.'}\n </p>\n\n {adminMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleAdminMemberClick(member)}\n >\n <PrivateChatInfo\n userId={member.userId}\n status={getMemberStatus(member)}\n forceShowSelf\n />\n </ListItem>\n ))}\n\n <FloatingActionButton\n isShown\n onClick={handleAddAdminClick}\n ariaLabel={lang('Channel.Management.AddModerator')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n\n return {\n chat,\n currentUserId: global.currentUserId,\n isChannel: isChatChannel(chat),\n };\n },\n)(ManageChatAdministrators));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const adminMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.adminMembers) {\n return [];\n }\n\n return chat.fullInfo.adminMembers.sort((a, b) => {\n if (a.isOwner) {\n return -1;\n } else if (b.isOwner) {\n return 1;\n }\n\n return 0;\n });\n }, [chat]);\n\n const getMemberStatus = useCallback((member: ApiChatMember) => {\n if (member.isOwner) {\n return lang('ChannelCreator');\n }\n\n return lang('ChannelAdmin');\n }, [lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section not-implemented\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\" dir=\"auto\">Actions</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogAllEvents')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterNewAdmins')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterNewMembers')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterChannelInfo')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterDeletedMessages')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterEditedMessages')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterLeavingMembers')}\n onChange={undefined}\n />\n </div>\n </div>\n\n <div className=\"section not-implemented\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\" dir=\"auto\">{lang('Channel.Management.Title')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogAllAdmins')}\n onChange={undefined}\n />\n </div>\n\n {adminMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable picker-list-item\"\n onClick={undefined}\n ripple\n >\n <Checkbox label=\"\" checked={!false} />\n <PrivateChatInfo\n userId={member.userId}\n status={getMemberStatus(member)}\n forceShowSelf\n />\n </ListItem>\n ))}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n\n return { chat };\n },\n)(ManageGroupRecentActions));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const selectedChatMember = useMemo(() => {\n const selectedAdminMember = chat.fullInfo?.adminMembers?.find(({ userId }) => userId === selectedUserId);\n\n // If `selectedAdminMember` variable is filled with a value, then we have already saved the administrator,\n // so now we need to return to the list of administrators\n if (isNewAdmin && (selectedAdminMember || !selectedUserId)) {\n return undefined;\n }\n\n if (isNewAdmin) {\n const user = getGlobal().users.byId[selectedUserId!];\n\n return user ? {\n userId: user.id,\n adminRights: defaultRights,\n customTitle: lang('ChannelAdmin'),\n isOwner: false,\n promotedByUserId: undefined,\n } : undefined;\n }\n\n return selectedAdminMember;\n }, [chat.fullInfo?.adminMembers, defaultRights, isNewAdmin, lang, selectedUserId]);\n\n useEffect(() => {\n if (chat?.fullInfo && selectedUserId && !selectedChatMember) {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }\n }, [chat, onScreenSelect, selectedChatMember, selectedUserId]);\n\n useEffect(() => {\n setPermissions(selectedChatMember?.adminRights || {});\n setCustomTitle((selectedChatMember?.customTitle || '').substr(0, CUSTOM_TITLE_MAX_LENGTH));\n setIsTouched(Boolean(isNewAdmin));\n setIsLoading(false);\n }, [defaultRights, isNewAdmin, selectedChatMember]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as keyof ApiChatAdminRights]),\n }));\n setIsTouched(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!selectedUserId) {\n return;\n }\n\n setIsLoading(true);\n updateChatAdmin({\n chatId: chat.id,\n userId: selectedUserId,\n adminRights: permissions,\n customTitle,\n });\n }, [selectedUserId, updateChatAdmin, chat.id, permissions, customTitle]);\n\n const handleDismissAdmin = useCallback(() => {\n if (!selectedUserId) {\n return;\n }\n\n updateChatAdmin({\n chatId: chat.id,\n userId: selectedUserId,\n adminRights: {},\n });\n closeDismissConfirmationDialog();\n }, [chat.id, closeDismissConfirmationDialog, selectedUserId, updateChatAdmin]);\n\n const getControlIsDisabled = useCallback((key: keyof ApiChatAdminRights) => {\n if (isChatBasicGroup(chat)) {\n return false;\n }\n\n if (isFormFullyDisabled || !chat.adminRights) {\n return true;\n }\n\n return !chat.adminRights![key];\n }, [chat, isFormFullyDisabled]);\n\n const memberStatus = useMemo(() => {\n if (isNewAdmin || !selectedChatMember) {\n return undefined;\n }\n\n if (selectedChatMember.isOwner) {\n return lang('ChannelCreator');\n }\n\n const promotedByUser = selectedChatMember.promotedByUserId\n ? usersById[selectedChatMember.promotedByUserId]\n : undefined;\n\n if (promotedByUser) {\n return lang('EditAdminPromotedBy', getUserFullName(promotedByUser));\n }\n\n return lang('ChannelAdmin');\n }, [isNewAdmin, selectedChatMember, usersById, lang]);\n\n const handleCustomTitleChange = useCallback((e) => {\n const { value } = e.target;\n setCustomTitle(value);\n setIsTouched(true);\n }, []);\n\n if (!selectedChatMember) {\n return undefined;\n }\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo\n userId={selectedChatMember.userId}\n status={memberStatus}\n forceShowSelf\n />\n </ListItem>\n\n <h3 className=\"section-heading mt-4\" dir=\"auto\">{lang('EditAdminWhatCanDo')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={Boolean(permissions.changeInfo)}\n label={lang(isChannel ? 'EditAdminChangeChannelInfo' : 'EditAdminChangeGroupInfo')}\n blocking\n disabled={getControlIsDisabled('changeInfo')}\n onChange={handlePermissionChange}\n />\n </div>\n {isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"postMessages\"\n checked={Boolean(permissions.postMessages)}\n label={lang('EditAdminPostMessages')}\n blocking\n disabled={getControlIsDisabled('postMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n {isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"editMessages\"\n checked={Boolean(permissions.editMessages)}\n label={lang('EditAdminEditMessages')}\n blocking\n disabled={getControlIsDisabled('editMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"deleteMessages\"\n checked={Boolean(permissions.deleteMessages)}\n label={lang(isChannel ? 'EditAdminDeleteMessages' : 'EditAdminGroupDeleteMessages')}\n blocking\n disabled={getControlIsDisabled('deleteMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"banUsers\"\n checked={Boolean(permissions.banUsers)}\n label={lang('EditAdminBanUsers')}\n blocking\n disabled={getControlIsDisabled('banUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={Boolean(permissions.inviteUsers)}\n label={lang('EditAdminAddUsers')}\n blocking\n disabled={getControlIsDisabled('inviteUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={Boolean(permissions.pinMessages)}\n label={lang('EditAdminPinMessages')}\n blocking\n disabled={getControlIsDisabled('pinMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"addAdmins\"\n checked={Boolean(permissions.addAdmins)}\n label={lang('EditAdminAddAdmins')}\n blocking\n disabled={getControlIsDisabled('addAdmins')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"manageCall\"\n checked={Boolean(permissions.manageCall)}\n label={lang('StartVoipChatPermission')}\n blocking\n disabled={getControlIsDisabled('manageCall')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"anonymous\"\n checked={Boolean(permissions.anonymous)}\n label={lang('EditAdminSendAnonymously')}\n blocking\n disabled={getControlIsDisabled('anonymous')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n\n {isFormFullyDisabled && (\n <p className=\"section-info mb-4\" dir=\"auto\">\n {lang('Channel.EditAdmin.CannotEdit')}\n </p>\n )}\n\n {!isChannel && (\n <InputText\n id=\"admin-title\"\n label={lang('EditAdminRank')}\n onChange={handleCustomTitleChange}\n value={customTitle}\n disabled={isFormFullyDisabled}\n maxLength={CUSTOM_TITLE_MAX_LENGTH}\n />\n )}\n\n {currentUserId !== selectedUserId && !isFormFullyDisabled && !isNewAdmin && (\n <ListItem icon=\"delete\" ripple destructive onClick={openDismissConfirmationDialog}>\n {lang('EditAdminRemoveAdmin')}\n </ListItem>\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isTouched}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n\n {!isNewAdmin && (\n <ConfirmDialog\n isOpen={isDismissConfirmationDialogOpen}\n onClose={closeDismissConfirmationDialog}\n text=\"Are you sure you want to dismiss this admin?\"\n confirmLabel={lang('Channel.Admin.Dismiss')}\n confirmHandler={handleDismissAdmin}\n confirmIsDestructive\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, isPromotedByCurrentUser }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { byId: usersById } = global.users;\n const { currentUserId } = global;\n const isChannel = isChatChannel(chat);\n const isFormFullyDisabled = !(chat.isCreator || isPromotedByCurrentUser);\n\n return {\n chat,\n usersById,\n currentUserId,\n isChannel,\n isFormFullyDisabled,\n defaultRights: chat.adminRights,\n };\n },\n)(ManageGroupAdminRights));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n function renderSearchField() {\n return (\n <div className=\"Management__filter\" dir={lang.isRtl ? 'rtl' : undefined}>\n <InputText\n ref={inputRef}\n value={searchQuery}\n onChange={handleFilterChange}\n placeholder={lang('Search')}\n />\n </div>\n );\n }\n\n return (\n <div className=\"Management\">\n {noAdmins && renderSearchField()}\n <div className=\"custom-scroll\">\n <div className=\"section\">\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"picker-list custom-scroll\"\n items={displayedIds}\n onLoadMore={getMore}\n noScrollRestore={Boolean(searchQuery)}\n ref={containerRef}\n onKeyDown={handleKeyDown}\n >\n {viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable scroll-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleMemberClick(id)}\n >\n <PrivateChatInfo userId={id} forceShowSelf />\n </ListItem>\n ))}\n </InfiniteScroll>\n ) : !isSearching && viewportIds && !viewportIds.length ? (\n <NothingFound\n teactOrderKey={0}\n key=\"nothing-found\"\n text={isChannel ? 'No subscribers found' : 'No members found'}\n />\n ) : (\n <Loading />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { statusesById: userStatusesById } = global.users;\n const members = chat?.fullInfo?.members;\n const adminMembers = chat?.fullInfo?.adminMembers;\n const isChannel = chat && isChatChannel(chat);\n const { userIds: localContactIds } = global.contactList || {};\n\n const {\n query: searchQuery,\n fetchingStatus,\n globalUserIds,\n localUserIds,\n } = global.userSearch;\n\n return {\n members,\n adminMembers,\n userStatusesById,\n isChannel,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus,\n globalUserIds,\n localUserIds,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageGroupMembers));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const memberIds = useMemo(() => {\n if (!members || !usersById) {\n return undefined;\n }\n\n return sortUserIds(\n members.filter((member) => !member.isOwner).map(({ userId }) => userId),\n usersById,\n userStatusesById,\n undefined,\n serverTimeOffset,\n );\n }, [members, serverTimeOffset, usersById, userStatusesById]);\n\n const handleExceptionMemberClick = useCallback((memberId: string) => {\n onChatMemberSelect(memberId);\n onScreenSelect(ManagementScreens.GroupUserPermissions);\n }, [onChatMemberSelect, onScreenSelect]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" teactFastList>\n {memberIds ? (\n memberIds.map((id, i) => (\n <ListItem\n key={id}\n teactOrderKey={i}\n className=\"chat-item-clickable scroll-item\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleExceptionMemberClick(id)}\n >\n <PrivateChatInfo userId={id} forceShowSelf />\n </ListItem>\n ))\n ) : (\n <NothingFound\n teactOrderKey={0}\n key=\"nothing-found\"\n text={isChannel ? 'No subscribers found' : 'No members found'}\n />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { byId: usersById, statusesById: userStatusesById } = global.users;\n const members = chat?.fullInfo?.members;\n const isChannel = chat && isChatChannel(chat);\n\n return {\n members,\n usersById,\n userStatusesById,\n isChannel,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageGroupUserPermissionsCreate));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const hasDetailedCountdown = useMemo(() => {\n if (!exportedInvites) return undefined;\n return exportedInvites\n .some(({ expireDate }) => (\n expireDate && (expireDate - getServerTime(serverTimeOffset) < MILLISECONDS_IN_DAY / 1000)\n ));\n }, [exportedInvites, serverTimeOffset]);\n const forceUpdate = useForceUpdate();\n useInterval(() => {\n forceUpdate();\n }, hasDetailedCountdown ? 1000 : undefined);\n\n const primaryInvite = exportedInvites?.find(({ isPermanent }) => isPermanent);\n const primaryInviteLink = chat?.username ? `t.me/${chat.username}` : primaryInvite?.link;\n const temporalInvites = useMemo(() => {\n const invites = chat?.username ? exportedInvites : exportedInvites?.filter(({ isPermanent }) => !isPermanent);\n return invites?.sort(inviteComparator);\n }, [chat?.username, exportedInvites]);\n\n const editInvite = (invite: ApiExportedInvite) => {\n setEditingExportedInvite({ chatId, invite });\n onScreenSelect(ManagementScreens.EditInvite);\n };\n\n const revokeInvite = useCallback((invite: ApiExportedInvite) => {\n const {\n link, title, isRequestNeeded, expireDate, usageLimit,\n } = invite;\n editExportedChatInvite({\n chatId,\n link,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n isRevoked: true,\n });\n }, [chatId, editExportedChatInvite]);\n\n const askToRevoke = useCallback((invite: ApiExportedInvite) => {\n setRevokingInvite(invite);\n openRevokeDialog();\n }, [openRevokeDialog]);\n\n const handleRevoke = useCallback(() => {\n if (!revokingInvite) return;\n revokeInvite(revokingInvite);\n setRevokingInvite(undefined);\n closeRevokeDialog();\n }, [closeRevokeDialog, revokeInvite, revokingInvite]);\n\n const handleCreateNewClick = useCallback(() => {\n onScreenSelect(ManagementScreens.EditInvite);\n }, [onScreenSelect]);\n\n const handlePrimaryRevoke = useCallback(() => {\n if (primaryInvite) {\n askToRevoke(primaryInvite);\n }\n }, [askToRevoke, primaryInvite]);\n\n const handleDeleteAllRevoked = useCallback(() => {\n deleteRevokedExportedChatInvites({ chatId });\n closeDeleteRevokeAllDialog();\n }, [chatId, closeDeleteRevokeAllDialog, deleteRevokedExportedChatInvites]);\n\n const showInviteInfo = useCallback((invite: ApiExportedInvite) => {\n setOpenedInviteInfo({ chatId, invite });\n onScreenSelect(ManagementScreens.InviteInfo);\n }, [chatId, onScreenSelect, setOpenedInviteInfo]);\n\n const deleteInvite = useCallback((invite: ApiExportedInvite) => {\n deleteExportedChatInvite({ chatId, link: invite.link });\n }, [chatId, deleteExportedChatInvite]);\n\n const askToDelete = useCallback((invite: ApiExportedInvite) => {\n setDeletingInvite(invite);\n openDeleteDialog();\n }, [openDeleteDialog]);\n\n const handleDelete = useCallback(() => {\n if (!deletingInvite) return;\n deleteInvite(deletingInvite);\n setDeletingInvite(undefined);\n closeDeleteDialog();\n }, [closeDeleteDialog, deleteInvite, deletingInvite]);\n\n const copyLink = useCallback((link: string) => {\n copyTextToClipboard(link);\n showNotification({\n message: lang('LinkCopied'),\n });\n }, [lang, showNotification]);\n\n const handleCopyPrimaryClicked = useCallback(() => {\n copyLink(primaryInviteLink!);\n }, [copyLink, primaryInviteLink]);\n\n const prepareUsageText = (invite: ApiExportedInvite) => {\n const {\n usage = 0, usageLimit, expireDate, isPermanent, requested, isRevoked,\n } = invite;\n let text = '';\n if (!isRevoked && usageLimit && usage < usageLimit) {\n text = lang('CanJoin', usageLimit - usage);\n } else if (usage) {\n text = lang('PeopleJoined', usage);\n } else {\n text = lang('NoOneJoined');\n }\n\n if (isRevoked) {\n text += ` ${BULLET} ${lang('Revoked')}`;\n return text;\n }\n\n if (requested) {\n text += ` ${BULLET} ${lang('JoinRequests', requested)}`;\n }\n\n if (usageLimit !== undefined && usage === usageLimit) {\n text += ` ${BULLET} ${lang('LinkLimitReached')}`;\n } else if (expireDate) {\n const diff = (expireDate - getServerTime(serverTimeOffset)) * 1000;\n text += ` ${BULLET} `;\n if (diff > 0) {\n text += lang('InviteLink.ExpiresIn', formatCountdown(lang, diff));\n } else {\n text += lang('InviteLink.Expired');\n }\n } else if (isPermanent) {\n text += ` ${BULLET} ${lang('Permanent')}`;\n }\n\n return text;\n };\n\n const prepareContextActions = (invite: ApiExportedInvite) => {\n const actions = [];\n actions.push({\n title: lang('Copy'),\n icon: 'copy',\n handler: () => copyLink(invite.link),\n });\n\n if (!invite.isPermanent && !invite.isRevoked) {\n actions.push({\n title: lang('Edit'),\n icon: 'edit',\n handler: () => editInvite(invite),\n });\n }\n\n if (!invite.isRevoked) {\n actions.push({\n title: lang('RevokeButton'),\n icon: 'delete',\n handler: () => askToRevoke(invite),\n destructive: true,\n });\n } else {\n actions.push({\n title: lang('DeleteLink'),\n icon: 'delete',\n handler: () => askToDelete(invite),\n destructive: true,\n });\n }\n return actions;\n };\n\n const PrimaryLinkMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"Actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n return (\n <div className=\"Management ManageInvites\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <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({\n isActive,\n onBack: onClose,\n });\n\n useOnChange(([oldEditingInvite]) => {\n if (oldEditingInvite === editingInvite) return;\n if (!editingInvite) {\n setTitle('');\n setSelectedExpireOption('unlimited');\n setSelectedUsageOption('0');\n setCustomExpireDate(getServerTime(serverTimeOffset) * 1000 + DEFAULT_CUSTOM_EXPIRE_DATE);\n setCustomUsageLimit(10);\n setIsRequestNeeded(false);\n } else {\n const {\n title: editingTitle, usageLimit, expireDate, isRequestNeeded: editingIsRequestNeeded,\n } = editingInvite;\n if (editingTitle) setTitle(editingTitle);\n if (usageLimit) {\n setSelectedUsageOption(DEFAULT_USAGE_LIMITS.includes(usageLimit) ? usageLimit.toString() : 'custom');\n setCustomUsageLimit(usageLimit);\n }\n if (expireDate) {\n const minSafeDate = getServerTime(serverTimeOffset) + DEFAULT_CUSTOM_EXPIRE_DATE;\n setSelectedExpireOption('custom');\n setCustomExpireDate(Math.max(expireDate, minSafeDate) * 1000);\n }\n if (editingIsRequestNeeded) {\n setIsRequestNeeded(true);\n }\n }\n }, [editingInvite, serverTimeOffset]);\n\n const handleIsRequestChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsRequestNeeded(e.target.checked);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n }, []);\n\n const handleCustomUsageLimitChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setCustomUsageLimit(Number.parseInt(e.target.value, 10));\n }, []);\n\n const handleExpireDateChange = useCallback((date: Date) => {\n setCustomExpireDate(date.getTime());\n closeCalendar();\n }, [closeCalendar]);\n\n const handleSaveClick = useCallback(() => {\n setIsSubmitBlocked(true);\n const usageLimit = selectedUsageOption === 'custom' ? customUsageLimit : selectedUsageOption;\n let expireDate;\n switch (selectedExpireOption) {\n case 'custom':\n expireDate = getServerTime(serverTimeOffset) + (customExpireDate - Date.now()) / 1000;\n break;\n case 'hour':\n case 'day':\n case 'week':\n expireDate = getServerTime(serverTimeOffset) + DEFAULT_EXPIRE_DATE[selectedExpireOption] / 1000;\n break;\n case 'unlimited':\n 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({\n isActive,\n onBack: onClose,\n });\n\n const handleSaveReactions = useCallback(() => {\n if (!chat) return;\n setIsLoading(true);\n\n setChatEnabledReactions({\n chatId: chat.id,\n enabledReactions: localEnabledReactions,\n });\n }, [chat, localEnabledReactions, setChatEnabledReactions]);\n\n useEffect(() => {\n if (enabledReactions) {\n setIsLoading(false);\n setIsTouched(false);\n setLocalEnabledReactions(enabledReactions);\n }\n }, [enabledReactions]);\n\n const handleReactionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (!chat || !availableReactions) return;\n\n const { name, checked } = e.currentTarget;\n const newEnabledReactions = name === 'all' ? (checked ? availableReactions.map((l) => l.reaction) : [])\n : (!checked\n ? localEnabledReactions.filter((l) => l !== name)\n : [...localEnabledReactions, name]);\n\n setLocalEnabledReactions(newEnabledReactions);\n setIsTouched(true);\n }, [availableReactions, chat, localEnabledReactions]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"all\"\n checked={!localEnabledReactions || localEnabledReactions.length > 0}\n label={lang('EnableReactions')}\n onChange={handleReactionChange}\n />\n </div>\n {availableReactions?.filter((l) => !l.isInactive).map(({ reaction, title }) => (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name={reaction}\n checked={!localEnabledReactions || localEnabledReactions?.includes(reaction)}\n disabled={localEnabledReactions?.length === 0}\n label={(\n <div className=\"Reaction\">\n <ReactionStaticEmoji reaction={reaction} />\n {title}\n </div>\n )}\n onChange={handleReactionChange}\n />\n </div>\n ))}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isTouched}\n onClick={handleSaveReactions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n\n return {\n enabledReactions: chat.fullInfo?.enabledReactions,\n availableReactions: global.availableReactions,\n chat,\n };\n },\n)(ManageReactions));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n const renderImporters = () => {\n if (!importers?.length && requesters?.length) return undefined;\n if (!importers) return <Spinner />;\n return (\n <div className=\"section\">\n <p>{importers.length ? lang('PeopleJoined', usage) : lang('NoOneJoined')}</p>\n <p className=\"text-muted\">\n {!importers.length && (\n usageLimit ? lang('PeopleCanJoinViaLinkCount', usageLimit - usage) : lang('NoOneJoinedYet')\n )}\n {importers.map((importer) => (\n <ListItem\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openChat({ id: importer.userId })}\n >\n <PrivateChatInfo\n userId={importer.userId}\n status={formatMediaDateTime(lang, importer.date * 1000, true)}\n forceShowSelf\n />\n </ListItem>\n ))}\n </p>\n </div>\n );\n };\n\n const renderRequesters = () => {\n if (invite?.isRevoked) return undefined;\n if (!requesters && importers) return <Spinner />;\n if (!requesters?.length) return undefined;\n return (\n <div className=\"section\">\n <p>{isChannel ? lang('SubscribeRequests') : lang('MemberRequests')}</p>\n <p className=\"text-muted\">\n {requesters.map((requester) => (\n <ListItem\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openChat({ id: requester.userId })}\n >\n <PrivateChatInfo\n userId={requester.userId}\n status={formatMediaDateTime(lang, requester.date * 1000, true)}\n forceShowSelf\n />\n </ListItem>\n ))}\n </p>\n </div>\n );\n };\n\n return (\n <div className=\"Management ManageInviteInfo\">\n <div className=\"custom-scroll\">\n {!invite && (\n <p className=\"text-muted\">{lang('Loading')}</p>\n )}\n {invite && (\n <>\n <div className=\"section\">\n <h3 className=\"link-title\">{invite.title || invite.link}</h3>\n <input\n className=\"form-control\"\n value={invite.link}\n readOnly\n onClick={handleCopyClicked}\n />\n <Button className=\"copy-link\" onClick={handleCopyClicked}>{lang('CopyLink')}</Button>\n {expireDate && (\n <p className=\"text-muted\">\n {isExpired\n ? lang('ExpiredLink')\n : lang('LinkExpiresIn', `${formatFullDate(lang, expireDate)} ${formatTime(lang, expireDate)}`)}\n </p>\n )}\n </div>\n {adminId && (\n <div className=\"section\">\n <p>{lang('LinkCreatedeBy')}</p>\n <ListItem\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openChat({ id: adminId })}\n >\n <PrivateChatInfo\n userId={adminId}\n status={formatMediaDateTime(lang, invite.date * 1000, true)}\n forceShowSelf\n />\n </ListItem>\n </div>\n )}\n {renderImporters()}\n {renderRequesters()}\n </>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { inviteInfo } = global.management.byChatId[chatId];\n const { invite, importers, requesters } = inviteInfo || {};\n const chat = selectChat(global, chatId);\n const isChannel = chat && isChatChannel(chat);\n\n return {\n invite,\n importers,\n requesters,\n isChannel,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageInviteInfo));\n","import 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({\n isActive,\n onBack: onClose,\n });\n\n useEffect(() => {\n if (!chat?.joinRequests && !isUserId(chatId)) {\n loadChatJoinRequests({ chatId });\n }\n }, [chat, chatId, loadChatJoinRequests]);\n\n const handleAcceptAllRequests = useCallback(() => {\n hideAllChatJoinRequests({ chatId, isApproved: true });\n closeAcceptAllDialog();\n }, [hideAllChatJoinRequests, chatId, closeAcceptAllDialog]);\n\n const handleRejectAllRequests = useCallback(() => {\n hideAllChatJoinRequests({ chatId, isApproved: false });\n closeRejectAllDialog();\n }, [hideAllChatJoinRequests, chatId, closeRejectAllDialog]);\n\n return (\n <div className=\"Management ManageJoinRequests\">\n <div className=\"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'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","isElementInViewport","windowHeight","shouldFadeOut","existingGhost","getElementsByClassName","transition","transformOrigin","opacity","animateClosing","timer","closeZoom","handleZoomToggle","handleZoomValue","level","canCloseZoom","close","handleFooterClick","handleForward","fromChatId","forceOnHeavyAnimation","captureEscKeyListener","stopCurrentAudio","fromId","index","handlePan","useHistoryBack","onBack","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","openTelegramLink","openChat","mainButton","setMainButton","buttonText","queryId","isSimple","handleEvent","eventType","linkUrl","eventData","path_full","data","themeParams","extractCurrentThemeParams","validateHexColor","button_color","textColor","text_color","is_visible","trim","is_active","isProgressVisible","is_progress_visible","reloadFrame","sendEvent","sendViewport","sendTheme","isSimpleView","onEvent","ignoreEventsRef","useWindowSize","frame","once","contentWindow","postMessage","JSON","stringify","is_expanded","theme_params","sendCustomStyle","handleMessage","parse","err","useWebAppFrame","shouldShowMainButton","useInterval","peer","handleMainButtonClick","handleRefreshClick","handleToggleClick","botId","isEnabled","openBotChat","MoreMenuButton","isMenuOpen","isAttachMenuBot","destructive","prevMainButtonColor","prevMainButtonTextColor","prevMainButtonIsActive","prevMainButtonText","mainButtonCurrentColor","mainButtonCurrentTextColor","mainButtonCurrentIsActive","mainButtonCurrentText","shouldDecreaseWebFrameSize","setShouldDecreaseWebFrameSize","shouldHideButton","setShouldHideButton","buttonChangeTimeout","hasCloseButton","sandbox","allow","allowFullScreen","cancelBotTrustRequest","markBotTrusted","previousBot","previousType","currentBot","currentType","handleBotTrustAccept","getUserFullName","closeBotAttachRequestModal","confirmBotAttachRequest","isSchedule","selectCurrentMessageList","canDeleteForAll","selectAllowedMessageActions","contactName","getUserFirstOrLastName","getPrivateChatUserId","willDeleteForCurrentUserOnly","isChatBasicGroup","willDeleteForAll","isChatSuperGroup","album","deleteMessages","deleteScheduledMessages","handleDeleteMessageForAll","messages","shouldDeleteForAll","handleDeleteMessageForSelf","onEnter","isPrivateChat","isChatChannel","isGroup","isSuperGroup","canPinForAll","pinMessage","handlePinMessageForAll","isUnpin","handlePinMessage","isOneSide","isSilent","pinnedMessagesCount","onUnpin","selectedMessageIds","selectedMessages","selectCanDeleteSelectedMessages","exitMessageSelectMode","messageListType","canDelete","selectCanReportSelectedMessages","canDownload","selectCanDownloadSelectedMessages","hasProtectedMessage","selectHasProtectedMessage","selectedMessagesCount","selectSelectedMessagesCount","canDeleteMessages","canReportMessages","canDownloadMessages","canPost","openForwardMenuForSelectedMessages","downloadSelectedMessages","copySelectedMessages","isDeleteModalOpen","openDeleteModal","closeDeleteModal","useHotkeys","useCopySelectedMessages","captureKeyboardListeners","onBackspace","onDelete","onEsc","handleCopy","handleDownload","prevSelectedMessagesCount","renderingSelectedMessagesCount","formattedMessagesCount","renderButton","seenByModal","memberIds","seenByUserIds","closeSeenByModal","handleClick","renderingMemberIds","noStatusOrTyping","reactorModal","reactions","reactors","loadReactors","closeReactorListModal","isClosing","startClosing","stopClosing","chosenTab","setChosenTab","canShowFilters","count","results","chatIdRef","handleCloseAnimationEnd","handleLoadMore","allReactions","l","reaction","concat","nextOffset","LoadMoreDirection","formatIntegerCompact","find","ReactionStaticEmoji","fullName","activeEmojiInteraction","animatedEffect","selectAnimatedEmojiEffect","effectAnimationId","localEffectAnimation","keys","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","orderedHashes","currentUser","loadProfilePhotos","loadAuthorizations","profileId","ProfileInfo","forceShowSelf","ChatExtra","langName","LINK_PREFIX","LINK_PREFIX_REGEX","USERNAME_REGEX","runDebouncedForCheckUsername","currentUsername","asLink","isUsernameAvailable","checkUsername","username","setUsername","langPrefix","usernameSuccess","usernameError","test","handleUsernameChange","newUsername","isValid","isUsernameValid","success","readOnly","ERROR_FIRST_NAME_MISSING","ERROR_BIO_TOO_LONG","profileEdit","currentFirstName","currentLastName","fullInfo","bio","currentBio","currentAvatarHash","loadCurrentUser","updateProfile","isUsernameTouched","setIsUsernameTouched","isProfileFieldsTouched","setIsProfileFieldsTouched","setError","setPhoto","setBio","currentAvatarBlobUrl","ProfileEditProgress","isUsernameError","isSaveButtonShown","handlePhotoChange","newPhoto","handleBioChange","handleProfileSave","trimmedFirstName","trimmedLastName","trimmedBio","AvatarEditable","UsernameInput","FloatingActionButton","canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb","setSettingOption","renderFileSizeCallback","AUTODOWNLOAD_FILESIZE_MB_LIMITS","handleFileSizeChange","handleCanAutoPlayGifsChange","handleCanAutoPlayVideosChange","renderAutoDownloadBlock","canAutoLoadFromContacts","canAutoLoadInPrivateChats","canAutoLoadInGroups","canAutoLoadInChannels","isChecked","renderValue","renderContentSizeSlider","runThrottledForLoadRecommended","orderedFolderIds","foldersById","recommended","recommendedChatFolders","onCreateFolder","onEditFolder","loadRecommendedChatFolders","addChatFolder","showDialog","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","editChatFolder","isIncludedChatsListExpanded","setIsIncludedChatsListExpanded","isExcludedChatsListExpanded","setIsExcludedChatsListExpanded","selectedChatIds","includedChatIds","selectedChatTypes","includedChatTypes","selectChatFilters","excludedChatIds","excludedChatTypes","folderId","visibleIncludedChatIds","visibleExcludedChatIds","allLoadedChatsSet","Set","loadedIncludedChatIds","findIntersectionWithSet","loadedExcludedChatIds","handleChange","mode","folderUpdate","renderChats","visibleChatIds","isExpanded","leftChatsCount","clickHandler","chatType","INCLUDED_CHAT_TYPES","typeKey","EXCLUDED_CHAT_TYPES","inactive","renderChatType","isTouched","selectedIds","filterValue","onSelectedIdsChange","onSelectedChatTypesChange","chatTypes","shouldMinimize","hasMaxChats","handleItemClick","newSelectedIds","splice","handleChatTypeClick","newSelectedChatTypes","selectedType","isMinimized","canClose","isSelected","withChatType","chatFilter","folderAllOrderedIds","useFolderManagerForOrderedIds","ALL_FOLDER_ID","folderArchivedOrderedIds","ARCHIVED_FOLDER_ID","displayedIds","newFilter","handleSelectedIdsChange","ids","includeFilters","excludeFilters","handleSelectedChatTypesChange","newFilters","forEach","shownScreen","handleReset","handleEditFolder","handleAddIncludedChats","handleAddExcludedChats","STICKER_SIZE_PICKER_HEADER","stickerSet","isIntersecting","useIsIntersecting","mediaHash","lottieData","useMediaTransition","firstLetters","getFirstLetters","hasThumbnail","isVideos","IS_WEBM_SUPPORTED","stickers","firstSticker","isLottie","STICKER_SIZE_GENERAL_SETTINGS","StickerButton","sticker","noContextMenu","ANIMATION_LEVEL_OPTIONS","TIME_FORMAT_OPTIONS","shouldUseSystemTheme","stickerSetIds","added","setIds","stickerSetsById","setsById","defaultReaction","appConfig","messageTextSize","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","timeFormat","stickerSettingsRef","observeIntersectionForCovers","setSticker","APPEARANCE_THEME_OPTIONS","KEYBOARD_SEND_OPTIONS","subLabel","IS_MAC_OS","handleAnimationLevelChange","newLevel","_","handleMessageTextSizeChange","newSize","documentElement","setProperty","setAttribute","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","privacyPhoneNumber","privacyLastSeen","lastSeen","privacyProfilePhoto","profilePhoto","privacyForwarding","forwards","privacyGroupChats","chatInvite","privacyPhoneCall","phoneCall","privacyPhoneP2P","phoneP2P","loadPrivacySettings","loadBlockedContacts","loadContentSettings","updateContentSettings","getVisibilityValue","visibility","blockCount","blockChatIds","blockUserIds","allowCount","allowChatIds","allowUserIds","total","exceptionString","languages","language","loadLanguages","selectedLanguage","setSelectedLanguage","markIsLoading","unmarkIsLoading","langCode","setLanguage","currentLangCode","navigator","toLowerCase","shortLangCode","substr","nativeName","buildOptions","loadingOption","getPrivacyKey","screen","privacySettings","setPrivacyVisibility","visibilityOptions","exceptionLists","shouldShowDenied","shouldShowAllowed","privacyKey","headerText","descriptionText","allowedContactsScreen","deniedContactsScreen","allowedCount","reduce","result","membersCount","handleVisibilityChange","getSessionIcon","session","platform","device","deviceModel","systemVersion","byHash","changeSessionSettings","terminateAuthorization","renderingSession","handleSecretChatsStateChange","areSecretChatsEnabled","handleCallsStateChange","areCallsEnabled","handleTerminateSessionClick","formatDateTimeToString","dateActive","appName","appVersion","ip","region","country","getLocation","Switcher","ttlDays","terminateAllAuthorizations","changeSessionTtl","isConfirmTerminateAllDialogOpen","openConfirmTerminateAllDialog","closeConfirmTerminateAllDialog","openedSessionHash","setOpenedSessionHash","autoTerminateValue","AUTO_TERMINATE_OPTIONS","handleTerminateAllSessions","handleOpenSessionModal","handleCloseSessionModal","handleChangeSessionTtl","days","currentSession","currentSessionHash","isCurrent","otherSessionHashes","hasOtherSessions","sessionHashes","sessionHash","handler","blockedIds","userSearch","setUserSearchQuery","blockContact","filteredContactIds","availableContactIds","contactId","firstId","secondId","secondName","localeCompare","handleRemoveUser","accessHash","chatsByIds","usersByIds","unblockContact","isBlockUserModalOpen","openBlockUserModal","closeBlockUserModal","handleUnblockClick","isPrivate","renderContact","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_PHONE_CALL_SCREENS","PRIVACY_PHONE_P2P_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","el","_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","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","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":""} |