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Oo9B,OAAUp9B,EAAOo9B,MAAM,KAI9CygD,EAAgB79E,EAAOo9B,MAAM,IAC7Bp9B,EAAOhK,MAAQ,KAiCT4jC,OAAO,0BAET,wBAAG7zC,UAAU,oBACZ+3F,GAAkB,0BAAKt8F,IAAKs8F,EAAgBnpF,IAAI,YAEnD,mBAAC,EAAD,CAAW40D,KAAMq0B,EAAcrxF,QAzBnC,WACEsxF,OAAgB73F,IAwB4C8Z,SAnC9D,SAA0B49E,GACxBG,OAAgB73F,GAChB8Z,EAAS49E,GAELI,GACFG,IAAIC,gBAAgBJ,GAEtBC,EAAkBE,IAAIE,gBAAgBT,Y","sources":["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/hooks/useTimeout.ts","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/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/DeleteSelectedMessageModal.tsx","webpack://telegram-t/./src/components/common/ReportMessageModal.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/systemFilesDialog.ts","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/helper/privacy.ts","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyVisibility.tsx","webpack://telegram-t/./src/components/left/settings/SettingsPrivacyActiveSessions.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/AttachMenu.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/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/ManageGroupRemovedUsers.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/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 { 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';\n\nconst ANIMATION_DURATION = 200;\n\nexport function animateOpening(\n hasFooter: boolean,\n origin: MediaViewerOrigin,\n bestImageData: string,\n dimensions: ApiDimensions,\n isVideo: boolean,\n message?: ApiMessage,\n) {\n const { mediaEl: fromImage } = getNodes(origin, message);\n if (!fromImage) {\n return;\n }\n\n const { width: windowWidth } = windowSize.get();\n const {\n width: availableWidth, height: availableHeight,\n } = getMediaViewerAvailableDimensions(hasFooter, isVideo);\n const { width: toWidth, height: toHeight } = calculateDimensions(\n availableWidth, availableHeight, dimensions.width, dimensions.height,\n );\n const toLeft = (windowWidth - toWidth) / 2;\n const toTop = getTopOffset(hasFooter) + (availableHeight - toHeight) / 2;\n\n let {\n top: fromTop, left: fromLeft, width: fromWidth, height: fromHeight,\n } = fromImage.getBoundingClientRect();\n\n if ([\n MediaViewerOrigin.SharedMedia,\n MediaViewerOrigin.Album,\n MediaViewerOrigin.ScheduledAlbum,\n MediaViewerOrigin.SearchResult,\n ].includes(origin)) {\n const uncovered = uncover(toWidth, toHeight, fromTop, fromLeft, fromWidth, fromHeight);\n fromTop = uncovered.top;\n fromLeft = uncovered.left;\n fromWidth = uncovered.width;\n fromHeight = uncovered.height;\n }\n\n const fromTranslateX = (fromLeft + fromWidth / 2) - (toLeft + toWidth / 2);\n const fromTranslateY = (fromTop + fromHeight / 2) - (toTop + toHeight / 2);\n const fromScaleX = fromWidth / toWidth;\n const fromScaleY = fromHeight / toHeight;\n\n const ghost = createGhost(bestImageData || fromImage);\n applyStyles(ghost, {\n top: `${toTop}px`,\n left: `${toLeft}px`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n transform: `translate3d(${fromTranslateX}px, ${fromTranslateY}px, 0) scale(${fromScaleX}, ${fromScaleY})`,\n });\n applyShape(ghost, origin);\n\n document.body.classList.add('ghost-animating');\n\n requestAnimationFrame(() => {\n document.body.appendChild(ghost);\n\n requestAnimationFrame(() => {\n ghost.style.transform = '';\n clearShape(ghost);\n\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (document.body.contains(ghost)) {\n document.body.removeChild(ghost);\n }\n document.body.classList.remove('ghost-animating');\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n });\n });\n}\n\nexport function animateClosing(origin: MediaViewerOrigin, bestImageData: string, message?: ApiMessage) {\n const { container, mediaEl: toImage } = getNodes(origin, message);\n if (!toImage) {\n return;\n }\n\n const fromImage = document.getElementById('MediaViewer')!.querySelector<HTMLImageElement>(\n '.MediaViewerSlide--active img, .MediaViewerSlide--active video',\n );\n if (!fromImage || !toImage) {\n return;\n }\n\n const {\n top: fromTop, left: fromLeft, width: fromWidth, height: fromHeight,\n } = fromImage.getBoundingClientRect();\n const {\n top: targetTop, left: toLeft, width: toWidth, height: toHeight,\n } = toImage.getBoundingClientRect();\n\n let toTop = targetTop;\n if (!isElementInViewport(container)) {\n const { height: windowHeight } = windowSize.get();\n toTop = targetTop < fromTop ? -toHeight : windowHeight;\n }\n\n const fromTranslateX = (fromLeft + fromWidth / 2) - (toLeft + toWidth / 2);\n const fromTranslateY = (fromTop + fromHeight / 2) - (toTop + toHeight / 2);\n let fromScaleX = fromWidth / toWidth;\n let fromScaleY = fromHeight / toHeight;\n\n const shouldFadeOut = (\n [MediaViewerOrigin.Inline, MediaViewerOrigin.ScheduledInline].includes(origin)\n && !isMessageImageFullyVisible(container, toImage)\n ) || (\n [MediaViewerOrigin.Album, MediaViewerOrigin.ScheduledAlbum].includes(origin)\n && !isMessageImageFullyVisible(container, toImage)\n );\n\n if ([\n MediaViewerOrigin.SharedMedia,\n MediaViewerOrigin.Album,\n MediaViewerOrigin.ScheduledAlbum,\n MediaViewerOrigin.SearchResult,\n ].includes(origin)) {\n if (fromScaleX > fromScaleY) {\n fromScaleX = fromScaleY;\n } else if (fromScaleY > fromScaleX) {\n fromScaleY = fromScaleX;\n }\n }\n\n const existingGhost = document.getElementsByClassName('ghost')[0] as HTMLDivElement;\n\n const ghost = existingGhost || createGhost(bestImageData || toImage, origin);\n if (!existingGhost) {\n applyStyles(ghost, {\n top: `${toTop}px`,\n left: `${toLeft}px`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n transform: `translate3d(${fromTranslateX}px, ${fromTranslateY}px, 0) scale(${fromScaleX}, ${fromScaleY})`,\n });\n }\n\n requestAnimationFrame(() => {\n if (existingGhost) {\n const {\n top,\n left,\n width,\n height,\n } = existingGhost.getBoundingClientRect();\n const scaleX = width / toWidth;\n const scaleY = height / toHeight;\n\n applyStyles(ghost, {\n transition: 'none',\n top: `${toTop}px`,\n left: `${toLeft}px`,\n transformOrigin: 'top left',\n transform: `translate3d(${left - toLeft}px, ${top - toTop}px, 0) scale(${scaleX}, ${scaleY})`,\n width: `${toWidth}px`,\n height: `${toHeight}px`,\n });\n }\n document.body.classList.add('ghost-animating');\n if (!existingGhost) document.body.appendChild(ghost);\n\n requestAnimationFrame(() => {\n if (existingGhost) {\n existingGhost.style.transition = '';\n }\n\n ghost.style.transform = '';\n\n if (shouldFadeOut) {\n ghost.style.opacity = '0';\n }\n\n applyShape(ghost, origin);\n\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (document.body.contains(ghost)) {\n document.body.removeChild(ghost);\n }\n document.body.classList.remove('ghost-animating');\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n });\n });\n}\n\nfunction createGhost(source: string | HTMLImageElement | HTMLVideoElement, origin?: MediaViewerOrigin) {\n const ghost = document.createElement('div');\n ghost.classList.add('ghost');\n\n const img = new Image();\n img.draggable = false;\n img.oncontextmenu = stopEvent;\n\n if (typeof source === 'string') {\n img.src = source;\n } else if (source instanceof HTMLVideoElement) {\n img.src = source.poster;\n } else {\n img.src = source.src;\n }\n\n ghost.appendChild(img);\n\n if (origin === MediaViewerOrigin.ProfileAvatar || origin === MediaViewerOrigin.SettingsAvatar) {\n ghost.classList.add('ProfileInfo');\n if (origin === MediaViewerOrigin.SettingsAvatar) {\n ghost.classList.add('self');\n }\n const profileInfo = document.querySelector(\n origin === MediaViewerOrigin.ProfileAvatar\n ? '#RightColumn .ProfileInfo .info'\n : '#Settings .ProfileInfo .info',\n );\n if (profileInfo) {\n ghost.appendChild(profileInfo.cloneNode(true));\n }\n }\n\n return ghost;\n}\n\nfunction uncover(realWidth: number, realHeight: number, top: number, left: number, width: number, height: number) {\n if (realWidth === realHeight) {\n const size = Math.max(width, height) * (realWidth / realHeight);\n left -= (size - width) / 2;\n top -= (size - height) / 2;\n width = size;\n height = size;\n } else if (realWidth > realHeight) {\n const srcWidth = width;\n width = height * (realWidth / realHeight);\n left -= (width - srcWidth) / 2;\n } else if (realHeight > realWidth) {\n const srcHeight = height;\n height = width * (realHeight / realWidth);\n top -= (height - srcHeight) / 2;\n }\n\n return {\n top, left, width, height,\n };\n}\n\nfunction isElementInViewport(el: HTMLElement) {\n if (el.style.display === 'none') {\n return false;\n }\n\n const rect = el.getBoundingClientRect();\n const { height: windowHeight } = windowSize.get();\n\n return (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n}\n\nfunction isMessageImageFullyVisible(container: HTMLElement, imageEl: HTMLElement) {\n const messageListElement = document.querySelector<HTMLDivElement>('.Transition__slide--active > .MessageList')!;\n let imgOffsetTop = container.offsetTop + imageEl.closest<HTMLDivElement>('.content-inner, .WebPage')!.offsetTop;\n if (container.id.includes('album-media-')) {\n imgOffsetTop += container.parentElement!.offsetTop + container.closest<HTMLDivElement>('.Message')!.offsetTop;\n }\n\n return imgOffsetTop > messageListElement.scrollTop\n && imgOffsetTop + imageEl.offsetHeight < messageListElement.scrollTop + messageListElement.offsetHeight;\n}\n\nfunction getTopOffset(hasFooter: boolean) {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n let topOffsetRem = 4.125;\n if (hasFooter && !IS_TOUCH_ENV) {\n topOffsetRem += mql.matches ? 0.875 : 2.125;\n }\n\n return topOffsetRem * REM;\n}\n\nfunction applyStyles(element: HTMLElement, styles: Record<string, string>) {\n Object.assign(element.style, styles);\n}\n\nfunction getNodes(origin: MediaViewerOrigin, message?: ApiMessage) {\n let containerSelector;\n let mediaSelector;\n\n switch (origin) {\n case MediaViewerOrigin.Album:\n case MediaViewerOrigin.ScheduledAlbum:\n containerSelector = `.Transition__slide--active > .MessageList #album-media-${message!.id}`;\n mediaSelector = '.full-media';\n break;\n\n case MediaViewerOrigin.SharedMedia:\n containerSelector = `#shared-media${message!.id}`;\n mediaSelector = 'img';\n break;\n\n case MediaViewerOrigin.SearchResult:\n containerSelector = `#search-media${message!.id}`;\n mediaSelector = 'img';\n break;\n\n case MediaViewerOrigin.MiddleHeaderAvatar:\n containerSelector = '.MiddleHeader .Transition__slide--active .ChatInfo .Avatar';\n mediaSelector = 'img.avatar-media';\n break;\n\n case MediaViewerOrigin.SettingsAvatar:\n containerSelector = '#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto';\n mediaSelector = 'img.avatar-media';\n break;\n\n case MediaViewerOrigin.ProfileAvatar:\n containerSelector = '#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto';\n mediaSelector = 'img.avatar-media';\n break;\n\n case MediaViewerOrigin.ScheduledInline:\n case MediaViewerOrigin.Inline:\n default:\n containerSelector = `.Transition__slide--active > .MessageList #message${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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiMessage } from '../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { getMessageMediaHash } from '../../modules/helpers';\nimport useLang from '../../hooks/useLang';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport { selectIsDownloading, selectIsMessageProtected } from '../../modules/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 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 onCloseMediaViewer,\n onForward,\n onZoomToggle,\n}) => {\n const {\n downloadMessageMedia,\n cancelMessageMediaDownload,\n } = getDispatch();\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 });\n } else {\n downloadMessageMedia({ 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 </DropdownMenu>\n {isDownloading && <ProgressSpinner progress={downloadProgress} size=\"s\" noCross />}\n </div>\n );\n }\n\n return (\n <div className=\"MediaViewerActions\">\n {!isAvatar && !isProtected && (\n <>\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 )}\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 <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 { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { throttle } from '../../util/schedulers';\nimport buildClassName from '../../util/buildClassName';\nimport { TextPart } from '../common/helpers/renderMessageText';\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, useState, useEffect, useRef, useCallback,\n} from '../../lib/teact/teact';\nimport buildClassName from '../../util/buildClassName';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { formatMediaDuration } from '../../util/dateFormat';\nimport formatFileSize from './helpers/formatFileSize';\nimport useLang from '../../hooks/useLang';\nimport { captureEvents } from '../../util/captureEvents';\n\nimport Button from '../ui/Button';\n\nimport './VideoPlayerControls.scss';\n\ntype IProps = {\n bufferedProgress: number;\n currentTime: number;\n duration: number;\n fileSize: number;\n isForceVisible: boolean;\n isForceMobileVersion?: boolean;\n isPlayed: boolean;\n isFullscreenSupported: boolean;\n isFullscreen: boolean;\n onChangeFullscreen: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n onPlayPause: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n onSeek: (position: number) => void;\n};\n\nconst stopEvent = (e: React.MouseEvent<HTMLElement>) => {\n e.stopPropagation();\n};\n\nconst HIDE_CONTROLS_TIMEOUT_MS = 800;\n\nconst VideoPlayerControls: FC<IProps> = ({\n bufferedProgress,\n currentTime,\n duration,\n fileSize,\n isForceVisible,\n isForceMobileVersion,\n isPlayed,\n isFullscreenSupported,\n isFullscreen,\n onChangeFullscreen,\n onPlayPause,\n onSeek,\n}) => {\n const [isVisible, setVisibility] = useState(true);\n // eslint-disable-next-line no-null/no-null\n const seekerRef = useRef<HTMLDivElement>(null);\n const isSeeking = useRef<boolean>(false);\n\n useEffect(() => {\n if (isForceVisible) {\n setVisibility(isForceVisible);\n }\n }, [isForceVisible]);\n\n useEffect(() => {\n let timeout: number | undefined;\n\n if (!isForceVisible) {\n if (IS_SINGLE_COLUMN_LAYOUT) {\n setVisibility(false);\n } else {\n timeout = window.setTimeout(() => {\n setVisibility(false);\n }, HIDE_CONTROLS_TIMEOUT_MS);\n }\n }\n\n return () => {\n if (timeout) {\n window.clearTimeout(timeout);\n }\n };\n }, [isForceVisible]);\n\n useEffect(() => {\n if (isVisible || isForceVisible) {\n document.body.classList.add('video-controls-visible');\n }\n\n return () => {\n document.body.classList.remove('video-controls-visible');\n };\n }, [isForceVisible, isVisible]);\n\n const lang = useLang();\n\n const handleSeek = useCallback((e: MouseEvent | TouchEvent) => {\n if (isSeeking.current && seekerRef.current) {\n const { width, left } = 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 isSeeking.current = true;\n handleSeek(e);\n }, [handleSeek]);\n\n const handleStopSeek = useCallback(() => {\n isSeeking.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 isActive = isVisible || isForceVisible;\n\n return (\n <div\n className={buildClassName('VideoPlayerControls', isForceMobileVersion && 'mobile', isActive && 'active')}\n onClick={stopEvent}\n >\n {renderSeekLine(currentTime, duration, bufferedProgress, seekerRef)}\n <Button\n ariaLabel={lang('AccActionPlay')}\n size=\"tiny\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n color=\"translucent-white\"\n className=\"play\"\n onClick={onPlayPause}\n >\n <i className={isPlayed ? 'icon-pause' : 'icon-play'} />\n </Button>\n {renderTime(currentTime, duration)}\n {bufferedProgress < 1 && renderFileSize(bufferedProgress, fileSize)}\n {isFullscreenSupported && (\n <Button\n ariaLabel=\"Fullscreen\"\n size=\"tiny\"\n color=\"translucent-white\"\n className=\"fullscreen\"\n onClick={onChangeFullscreen}\n >\n <i className={`${isFullscreen ? 'icon-smallscreen' : 'icon-fullscreen'}`} />\n </Button>\n )}\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, bufferedProgress: number, seekerRef: React.RefObject<HTMLDivElement>,\n) {\n const percentagePlayed = (currentTime / duration) * 100;\n const percentageBuffered = bufferedProgress * 100;\n\n return (\n <div className=\"player-seekline\" ref={seekerRef}>\n <div className=\"player-seekline-track\">\n <div\n className=\"player-seekline-buffered\"\n // @ts-ignore teact feature\n style={`width: ${percentageBuffered || 0}%`}\n />\n <div\n className=\"player-seekline-played\"\n // @ts-ignore teact feature\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';\n\nimport { ApiDimensions } from '../../api/types';\n\nimport { IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useBuffering from '../../hooks/useBuffering';\nimport useFullscreenStatus from '../../hooks/useFullscreen';\nimport useVideoCleanup from '../../hooks/useVideoCleanup';\nimport safePlay from '../../util/safePlay';\n\nimport VideoPlayerControls from './VideoPlayerControls';\nimport ProgressSpinner from '../ui/ProgressSpinner';\nimport Button from '../ui/Button';\n\nimport './VideoPlayer.scss';\n\ntype OwnProps = {\n url?: string;\n isGif?: boolean;\n posterData?: string;\n posterSize?: ApiDimensions;\n loadProgress?: number;\n fileSize: number;\n isMediaViewerOpen?: boolean;\n noPlay?: boolean;\n 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 onClose,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isPlayed, setIsPlayed] = useState(!IS_TOUCH_ENV || !IS_IOS);\n const [currentTime, setCurrentTime] = useState(0);\n const [isControlsVisible, setIsControlsVisible] = useState(true);\n\n const [isFullscreen, setFullscreen, exitFullscreen] = useFullscreenStatus(videoRef, setIsPlayed);\n\n const { isBuffered, bufferedProgress, bufferingHandlers } = 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 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 if (IS_SINGLE_COLUMN_LAYOUT) {\n setIsControlsVisible(false);\n }\n }\n }, [isPlayed]);\n\n useVideoCleanup(videoRef, []);\n\n const handleMouseOver = useCallback(() => {\n setIsControlsVisible(true);\n }, []);\n\n const handleMouseOut = useCallback(() => {\n setIsControlsVisible(false);\n }, []);\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 setIsControlsVisible(true);\n }, []);\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 toggleControls = useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n setIsControlsVisible(!isControlsVisible);\n }, [isControlsVisible]);\n\n useEffect(() => {\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]);\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 onClick={!isGif && IS_SINGLE_COLUMN_LAYOUT ? toggleControls : undefined}\n onMouseOver={!isGif && !IS_TOUCH_ENV ? handleMouseOver : undefined}\n onMouseOut={!isGif && !IS_TOUCH_ENV ? handleMouseOut : undefined}\n >\n <div\n // @ts-ignore\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}\n id=\"media-viewer-video\"\n // @ts-ignore\n style={videoStyle}\n onPlay={IS_IOS ? () => setIsPlayed(true) : undefined}\n onEnded={handleEnded}\n onClick={!IS_SINGLE_COLUMN_LAYOUT ? togglePlayState : undefined}\n onDoubleClick={handleFullscreenChange}\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 bufferedProgress={bufferedProgress}\n currentTime={currentTime}\n isFullscreenSupported={Boolean(setFullscreen)}\n isFullscreen={isFullscreen}\n fileSize={fileSize}\n duration={videoRef.current ? videoRef.current.duration || 0 : 0}\n isForceVisible={isControlsVisible}\n isForceMobileVersion={posterSize && posterSize.width < MOBILE_VERSION_CONTROL_WIDTH}\n onSeek={handleSeek}\n onChangeFullscreen={handleFullscreenChange}\n onPlayPause={togglePlayState}\n />\n )}\n </div>\n );\n};\n\nexport default memo(VideoPlayer);\n","import React, { FC, memo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../lib/teact/teactn';\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 '../../modules/helpers';\nimport {\n selectChat, selectChatMessage, selectIsMessageProtected, selectScheduledMessage, selectUser,\n} from '../../modules/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 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};\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 onClose,\n onFooterClick,\n isFooterHidden,\n isProtected,\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 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, false),\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, false)}\n loadProgress={loadProgress}\n fileSize={videoSize!}\n isMediaViewerOpen={isOpen && isActive}\n noPlay={!isActive}\n onClose={onClose}\n />\n ))}\n {textParts && (\n <MediaViewerFooter\n text={textParts}\n onClick={onFooterClick}\n isHidden={isFooterHidden}\n isForVideo={isVideo && !isGif}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, ownProps): StateProps => {\n const {\n chatId,\n threadId,\n messageId,\n avatarOwnerId,\n profilePhotoIndex,\n origin,\n } = ownProps;\n\n if (origin === MediaViewerOrigin.SearchResult) {\n if (!(chatId && messageId)) {\n return {};\n }\n\n const message = selectChatMessage(global, chatId, messageId);\n if (!message) {\n return {};\n }\n\n return {\n chatId,\n messageId,\n senderId: message.senderId,\n origin,\n message,\n isProtected: selectIsMessageProtected(global, message),\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 };\n }\n\n if (!(chatId && threadId && messageId)) {\n return {};\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 {};\n }\n\n return {\n chatId,\n threadId,\n messageId,\n senderId: message.senderId,\n origin,\n message,\n isProtected: selectIsMessageProtected(global, message),\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 // @ts-ignore teact feature\n style={imageSize ? `width: ${imageSize.width}px` : ''}\n draggable={Boolean(canDrag)}\n />\n )\n : (\n <div\n className=\"spinner-wrapper\"\n // @ts-ignore teact feature\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 // @ts-ignore\n style={wrapperStyle}\n >\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <video\n // @ts-ignore\n style={videoStyle}\n draggable={Boolean(canDrag)}\n />\n </div>\n </div>\n )\n : (\n <div\n className=\"spinner-wrapper\"\n // @ts-ignore teact feature\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 useDebounce from '../../hooks/useDebounce';\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';\n\nimport MediaViewerContent from './MediaViewerContent';\n\nimport './MediaViewerSlides.scss';\nimport useTimeout from '../../hooks/useTimeout';\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;\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 setIsActive = useCallback((value: boolean) => {\n isActiveRef.current = value;\n forceUpdate();\n }, [forceUpdate]);\n\n const debounceSetMessage = useDebounce(DEBOUNCE_MESSAGE, true);\n const debounceSwipeDirection = useDebounce(DEBOUNCE_SWIPE, true);\n const debounceActive = useDebounce(DEBOUNCE_ACTIVE, true);\n\n const handleToggleFooterVisibility = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (!IS_TOUCH_ENV || !hasFooter || (!isPhoto && !isGif)) return;\n if (e.pageX < CLICK_X_THRESHOLD) return;\n if (e.pageX > window.innerWidth - CLICK_X_THRESHOLD) return;\n setIsFooterHidden(!isFooterHidden);\n }, [hasFooter, isFooterHidden, isGif, isPhoto]);\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 (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 debounceSetMessage(() => selectMessage(mId));\n debounceActive(() => {\n setIsActive(true);\n });\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: '.VideoPlayerControls, .MediaViewerFooter',\n onCapture: () => {\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 // 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 debounceSwipeDirection(() => {\n swipeDirectionRef.current = undefined;\n });\n debounceActive(() => {\n setIsActive(true);\n });\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 debounceSetMessage(() => selectMessage(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 // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n isZoomed,\n onClose,\n setTransform,\n getMessageId,\n activeMessageId,\n setIsActive,\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 && /* @ts-ignore */ (\n <div className=\"MediaViewerSlide\" style={getAnimationStyle(-window.innerWidth + offsetX - SLIDES_GAP)}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <MediaViewerContent {...rest} messageId={previousMessageId} isFooterHidden={isFooterHidden} />\n </div>\n )}\n {activeMessageId && (\n <div\n className={`MediaViewerSlide ${isActive ? 'MediaViewerSlide--active' : ''}`}\n onClick={handleToggleFooterVisibility}\n ref={activeSlideRef}\n /* @ts-ignore */\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 isFooterHidden={isFooterHidden || isZoomed || scale !== 1}\n />\n </div>\n )}\n {nextMessageId && scale === 1 && /* @ts-ignore */ (\n <div className=\"MediaViewerSlide\" style={getAnimationStyle(window.innerWidth + offsetX + SLIDES_GAP)}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <MediaViewerContent {...rest} messageId={nextMessageId} isFooterHidden={isFooterHidden} />\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","import { useEffect, useLayoutEffect, useRef } from '../lib/teact/teact';\n\nfunction useTimeout(callback: () => void, delay: number | null) {\n const savedCallback = useRef(callback);\n\n useLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n useEffect(() => {\n if (typeof delay !== 'number') {\n return undefined;\n }\n const id = setTimeout(() => savedCallback.current(), delay);\n return () => clearTimeout(id);\n }, [delay]);\n}\n\nexport default useTimeout;\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: any;\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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiChat, ApiMessage, ApiUser } from '../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { getSenderTitle, isUserId } from '../../modules/helpers';\nimport { formatMediaDateTime } from '../../util/dateFormat';\nimport renderText from '../common/helpers/renderText';\nimport {\n selectChat,\n selectChatMessage,\n selectSender,\n selectUser,\n} from '../../modules/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 } = getDispatch();\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, { TransitionProps } from '../ui/Transition';\n\nconst SlideTransition: FC<TransitionProps> = ({ 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 = () => {\n if (inputRef.current) {\n setZoomLevel(Math.max(MIN_ZOOM_LEVEL, zoomLevel - 0.5));\n }\n };\n\n const handleZoomIn = () => {\n if (inputRef.current) {\n setZoomLevel(Math.min(MAX_ZOOM_LEVEL, zoomLevel + 0.5));\n }\n };\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 // @ts-ignore teact feature\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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\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 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 '../../modules/helpers';\nimport {\n selectChat,\n selectChatMessage,\n selectChatMessages,\n selectCurrentMediaSearch,\n selectListedIds,\n selectOutlyingIds,\n selectScheduledMessage,\n selectScheduledMessages,\n selectUser,\n} from '../../modules/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';\n\nimport './MediaViewer.scss';\n\ntype StateProps = {\n chatId?: string;\n threadId?: number;\n messageId?: number;\n senderId?: string;\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 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 } = getDispatch();\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 [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\n const localBlobUrl = (photo || video) ? (photo || video)!.blobUrl : undefined;\n let bestImageData = (!isVideo && (localBlobUrl || fullMediaBlobUrl)) || previewBlobUrl || pictogramBlobUrl;\n const thumbDataUri = useBlurSync(!bestImageData && message && getMessageMediaThumbDataUri(message));\n if (!bestImageData && origin !== MediaViewerOrigin.SearchResult) {\n bestImageData = thumbDataUri;\n }\n\n const fileName = message\n ? getMessageFileName(message)\n : isAvatar\n ? `avatar${avatarOwner!.id}-${profilePhotoIndex}.jpg`\n : undefined;\n\n let dimensions!: ApiDimensions;\n if (message) {\n if (isDocumentPhoto || isDocumentVideo) {\n dimensions = getMessageDocument(message)!.mediaSize!;\n } else if (photo || webPagePhoto) {\n dimensions = getPhotoFullDimensions((photo || webPagePhoto)!)!;\n } else if (video || webPageVideo) {\n dimensions = getVideoDimensions((video || webPageVideo)!)!;\n }\n } else {\n dimensions = AVATAR_FULL_DIMENSIONS;\n }\n\n useEffect(() => {\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n return;\n }\n\n document.body.classList.toggle('is-media-viewer-open', isOpen);\n }, [isOpen]);\n\n const forceUpdate = useForceUpdate();\n useEffect(() => {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n if (typeof mql.addEventListener === 'function') {\n mql.addEventListener('change', forceUpdate);\n } else if (typeof mql.addListener === 'function') {\n mql.addListener(forceUpdate);\n }\n\n return () => {\n if (typeof mql.removeEventListener === 'function') {\n mql.removeEventListener('change', forceUpdate);\n } else if (typeof mql.removeListener === 'function') {\n mql.removeListener(forceUpdate);\n }\n };\n }, [forceUpdate]);\n\n const prevMessage = usePrevious<ApiMessage | undefined>(message);\n const prevOrigin = usePrevious(origin);\n const prevAvatarOwner = usePrevious<ApiChat | ApiUser | undefined>(avatarOwner);\n const prevBestImageData = usePrevious(bestImageData);\n const textParts = message ? renderMessageText(message) : undefined;\n const hasFooter = Boolean(textParts);\n\n useEffect(() => {\n if (isGhostAnimation && isOpen && !prevMessage && !prevAvatarOwner) {\n dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);\n animateOpening(hasFooter, origin!, bestImageData!, dimensions, isVideo, message);\n }\n\n if (isGhostAnimation && !isOpen && (prevMessage || prevAvatarOwner)) {\n dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);\n animateClosing(prevOrigin!, prevBestImageData!, prevMessage || undefined);\n }\n }, [\n isGhostAnimation, isOpen, origin, prevOrigin, message, prevMessage, prevAvatarOwner,\n bestImageData, prevBestImageData, dimensions, isVideo, hasFooter,\n ]);\n\n useEffect(() => {\n let timer: number | undefined;\n\n if (isZoomed) {\n setCanPanZoomWrap(true);\n } else {\n timer = window.setTimeout(() => {\n setCanPanZoomWrap(false);\n }, ANIMATION_DURATION);\n }\n\n return () => {\n if (timer) {\n window.clearTimeout(timer);\n }\n };\n }, [isZoomed]);\n\n const closeZoom = () => {\n setIsZoomed(false);\n setZoomLevel(1);\n setPanDelta({\n x: 0,\n y: 0,\n });\n };\n\n const handleZoomToggle = useCallback(() => {\n setIsZoomed(!isZoomed);\n setZoomLevel(!isZoomed ? 1.5 : 1);\n if (isZoomed) {\n setPanDelta({\n x: 0,\n y: 0,\n });\n }\n }, [isZoomed]);\n\n const handleZoomValue = useCallback((level: number, canCloseZoom = false) => {\n setZoomLevel(level);\n if (level === 1 && canCloseZoom) {\n closeZoom();\n }\n }, []);\n\n const close = useCallback(() => {\n closeMediaViewer();\n closeZoom();\n }, [closeMediaViewer]);\n\n const handleFooterClick = useCallback(() => {\n close();\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n setTimeout(() => {\n toggleChatInfo(false, { forceSyncOnIOs: true });\n focusMessage({ chatId, threadId, messageId });\n }, ANIMATION_DURATION);\n } else {\n focusMessage({ chatId, threadId, messageId });\n }\n }, [close, chatId, threadId, focusMessage, toggleChatInfo, messageId]);\n\n const handleForward = useCallback(() => {\n openForwardMenu({\n fromChatId: chatId,\n messageIds: [messageId],\n });\n closeZoom();\n }, [openForwardMenu, chatId, messageId]);\n\n const selectMessage = useCallback((id?: number) => openMediaViewer({\n chatId,\n threadId,\n messageId: id,\n origin,\n }, {\n forceOnHeavyAnimation: true,\n }), [chatId, openMediaViewer, origin, threadId]);\n\n useEffect(() => (isOpen ? captureEscKeyListener(() => {\n if (isZoomed) {\n closeZoom();\n } else {\n close();\n }\n }) : undefined), [close, isOpen, isZoomed]);\n\n useEffect(() => {\n if (isVideo && !isGif) {\n stopCurrentAudio();\n }\n }, [isGif, isVideo]);\n\n // Prevent refresh when rotating device to watch a video\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isOpen]);\n\n const getMessageId = useCallback((fromId?: number, direction?: number): number | undefined => {\n if (!fromId) return undefined;\n const index = messageIds.indexOf(fromId);\n if ((direction === -1 && index > 0) || (direction === 1 && index < messageIds.length - 1)) {\n return messageIds[index + direction];\n }\n return undefined;\n }, [messageIds]);\n\n const nextMessageId = getMessageId(messageId, 1);\n const previousMessageId = getMessageId(messageId, -1);\n\n const handlePan = useCallback((x: number, y: number) => {\n setPanDelta({\n x,\n y,\n });\n }, []);\n\n const lang = useLang();\n\n useHistoryBack(isOpen, closeMediaViewer, openMediaViewer, {\n chatId,\n threadId,\n messageId,\n origin,\n avatarOwnerId: avatarOwner && avatarOwner.id,\n });\n\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n function handleKeyDown(e: KeyboardEvent) {\n switch (e.key) {\n case 'Left': // IE/Edge specific value\n case 'ArrowLeft':\n selectMessage(previousMessageId);\n break;\n\n case 'Right': // IE/Edge specific value\n case 'ArrowRight':\n selectMessage(nextMessageId);\n break;\n }\n }\n\n document.addEventListener('keydown', handleKeyDown, false);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown, false);\n };\n }, [isOpen, nextMessageId, previousMessageId, selectMessage]);\n\n useEffect(() => {\n if (isZoomed || IS_TOUCH_ENV) return undefined;\n const element = document.querySelector<HTMLDivElement>('.MediaViewerSlide--active');\n if (!element) {\n return undefined;\n }\n\n const shouldCloseOnVideo = isGif && !IS_IOS;\n\n return captureEvents(element, {\n // eslint-disable-next-line max-len\n excludedClosestSelector: `.backdrop, .navigation, .media-viewer-head, .Spoiler, .media-viewer-footer${!shouldCloseOnVideo ? ', .VideoPlayer' : ''}`,\n onClick: close,\n });\n }, [close, isGif, isZoomed, messageId]);\n\n function renderSenderInfo() {\n return isAvatar ? (\n <SenderInfo\n key={avatarOwner!.id}\n chatId={avatarOwner!.id}\n isAvatar\n />\n ) : (\n <SenderInfo\n key={messageId}\n chatId={chatId}\n messageId={messageId}\n />\n );\n }\n\n return (\n <ShowTransition\n id=\"MediaViewer\"\n className={isZoomed ? 'zoomed' : ''}\n isOpen={isOpen}\n >\n {() => (\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 onCloseMediaViewer={close}\n onForward={handleForward}\n onZoomToggle={handleZoomToggle}\n isAvatar={isAvatar}\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 </>\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 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 origin,\n message,\n animationLevel,\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 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 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 '../../modules/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 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 { getDispatch, getGlobal, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiChat, MAIN_THREAD_ID } from '../../api/types';\n\nimport {\n filterChatsByName,\n filterUsersByName,\n getCanPostInChat,\n sortChatIds,\n} from '../../modules/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};\n\nconst ForwardPicker: FC<OwnProps & StateProps> = ({\n chatsById,\n activeListIds,\n archivedListIds,\n pinnedIds,\n contactIds,\n currentUserId,\n isOpen,\n}) => {\n const {\n setForwardChatId,\n exitForwardMode,\n loadMoreChats,\n } = getDispatch();\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 setForwardChatId({ id: userId });\n }, [setForwardChatId]);\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 loadMore={loadMoreChats}\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 } = global;\n\n return {\n chatsById,\n activeListIds: listIds.active,\n archivedListIds: listIds.archived,\n pinnedIds: orderedPinnedIds.active,\n contactIds: global.contactList?.userIds,\n currentUserId,\n };\n },\n)(ForwardPicker));\n","import React, { FC, memo, useEffect } from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\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 } = getDispatch();\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 isText className=\"confirm-dialog-button\" onClick={handleJoinClick}>\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 className=\"confirm-dialog-button\" isText onClick={handleConfirm}>{lang('OK')}</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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\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 } = getDispatch();\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 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 { getDispatch } from '../../lib/teact/teactn';\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 } = getDispatch();\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 function handleSubmit() {\n onSubmit(selectedDate);\n }\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();\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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\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 } = getDispatch();\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, { FC, useCallback, memo } from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiMessage } from '../../api/types';\nimport { IAlbum } from '../../types';\n\nimport {\n selectAllowedMessageActions,\n selectChat,\n selectCurrentMessageList,\n selectUser,\n} from '../../modules/selectors';\nimport {\n isUserId,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n} from '../../modules/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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { selectChat, selectIsChatWithSelf, selectUser } from '../../modules/selectors';\nimport {\n isUserId,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n isChatChannel,\n} from '../../modules/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 } = getDispatch();\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 React, {\n FC, useCallback, memo, useEffect,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { selectCanDeleteSelectedMessages, selectCurrentChat, selectUser } from '../../modules/selectors';\nimport {\n isUserId,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n} from '../../modules/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 } = getDispatch();\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 { ChangeEvent } from 'react';\n\nimport React, {\n FC, memo, useCallback, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch } from '../../lib/teact/teactn';\n\nimport { ApiReportReason } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport RadioGroup from '../ui/RadioGroup';\nimport InputText from '../ui/InputText';\n\nexport type OwnProps = {\n isOpen: boolean;\n messageIds?: number[];\n onClose: () => void;\n};\n\nconst ReportMessageModal: FC<OwnProps> = ({\n isOpen,\n messageIds,\n onClose,\n}) => {\n const {\n reportMessages,\n exitMessageSelectMode,\n } = getDispatch();\n\n const [selectedReason, setSelectedReason] = useState<ApiReportReason>('spam');\n const [description, setDescription] = useState('');\n\n const handleReport = () => {\n reportMessages({ messageIds, reason: selectedReason, description });\n exitMessageSelectMode();\n onClose();\n };\n\n const handleSelectReason = useCallback((value: string) => {\n setSelectedReason(value as ApiReportReason);\n }, []);\n\n const handleDescriptionChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setDescription(e.target.value);\n }, []);\n\n const lang = useLang();\n\n const REPORT_OPTIONS: { value: ApiReportReason; label: string }[] = [\n { value: 'spam', label: lang('lng_report_reason_spam') },\n { value: 'violence', label: lang('lng_report_reason_violence') },\n { value: 'pornography', label: lang('lng_report_reason_pornography') },\n { value: 'childAbuse', label: lang('lng_report_reason_child_abuse') },\n { value: 'copyright', label: lang('ReportPeer.ReasonCopyright') },\n { value: 'other', label: lang('lng_report_reason_other') },\n ];\n\n if (!messageIds) {\n return undefined;\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n onEnter={isOpen ? handleReport : undefined}\n className=\"report\"\n title={lang('lng_report_message_title')}\n >\n <RadioGroup\n name=\"report-message\"\n options={REPORT_OPTIONS}\n onChange={handleSelectReason}\n selected={selectedReason}\n />\n <InputText\n label={lang('lng_report_reason_description')}\n value={description}\n onChange={handleDescriptionChange}\n />\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleReport}>\n {lang('lng_report_button')}\n </Button>\n <Button className=\"confirm-dialog-button\" isText onClick={onClose}>{lang('Cancel')}</Button>\n </Modal>\n );\n};\n\nexport default memo(ReportMessageModal);\n","import React, {\n FC, memo, useCallback, useEffect,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { MessageListType } from '../../global/types';\n\nimport {\n selectCanDeleteSelectedMessages,\n selectCanDownloadSelectedMessages,\n selectCanReportSelectedMessages,\n selectCurrentMessageList,\n selectHasProtectedMessage,\n selectSelectedMessagesCount,\n} from '../../modules/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';\n\nimport Button from '../ui/Button';\n\nimport DeleteSelectedMessageModal from './DeleteSelectedMessageModal';\nimport ReportMessageModal from '../common/ReportMessageModal';\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 } = getDispatch();\n\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isReportModalOpen, openReportModal, closeReportModal] = useFlag();\n\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 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('delete', lang('EditAdminGroupDeleteMessages'), openDeleteModal, !canDeleteMessages, true)}\n </div>\n )}\n </div>\n <DeleteSelectedMessageModal\n isOpen={isDeleteModalOpen}\n isSchedule={isSchedule}\n onClose={closeDeleteModal}\n />\n <ReportMessageModal\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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport useLang from '../../hooks/useLang';\nimport { selectChatMessage } from '../../modules/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 } = getDispatch();\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=\"Which users read the message\"\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 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 { getDispatch, getGlobal, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiMessage } from '../../api/types';\nimport { LoadMoreDirection } from '../../types';\n\nimport useLang from '../../hooks/useLang';\nimport { selectChatMessage } from '../../modules/selectors';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport { getUserFullName } from '../../modules/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 } = getDispatch();\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 onClick={() => setChosenTab(undefined)}\n >\n <i className=\"icon-reaction-filled\" />\n {reactors?.count && formatIntegerCompact(reactors.count)}\n </Button>\n {allReactions.map((reaction) => {\n const count = reactions?.results.find((l) => l.reaction === reaction)?.count;\n return (\n <Button\n className={buildClassName(chosenTab === reaction && 'chosen')}\n size=\"tiny\"\n ripple\n 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 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, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\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 '../../modules/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 emojiInteraction: ActiveEmojiInteraction;\n};\n\ntype StateProps = {\n effectAnimationId?: string;\n localEffectAnimation?: string;\n isReversed?: boolean;\n};\n\nconst HIDE_ANIMATION_DURATION = 250;\nconst PLAYING_DURATION = 3000;\nconst EFFECT_SIZE = 240;\n\nconst EmojiInteractionAnimation: FC<OwnProps & StateProps> = ({\n emojiInteraction,\n effectAnimationId,\n localEffectAnimation,\n isReversed,\n}) => {\n const { stopActiveEmojiInteraction } = getDispatch();\n\n const [isHiding, startHiding] = useFlag(false);\n const [isPlaying, startPlaying] = useFlag(false);\n\n const stop = useCallback(() => {\n startHiding();\n setTimeout(() => {\n stopActiveEmojiInteraction();\n }, HIDE_ANIMATION_DURATION);\n }, [startHiding, stopActiveEmojiInteraction]);\n\n useEffect(() => {\n document.addEventListener('touchstart', stop);\n document.addEventListener('touchmove', stop);\n document.addEventListener('mousedown', stop);\n document.addEventListener('wheel', stop);\n\n return () => {\n document.removeEventListener('touchstart', stop);\n document.removeEventListener('touchmove', stop);\n document.removeEventListener('mousedown', stop);\n document.removeEventListener('wheel', stop);\n };\n }, [stop]);\n\n useLayoutEffect(() => {\n const dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();\n\n 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 const scale = (emojiInteraction.startSize || 0) / EFFECT_SIZE;\n\n return (\n <div\n className={buildClassName(\n 'EmojiInteractionAnimation', isHiding && 'hiding', isPlaying && 'playing', isReversed && 'reversed',\n )}\n // @ts-ignore teact feature\n style={`--scale: ${scale}; --start-x: ${emojiInteraction.x}px; --start-y: ${emojiInteraction.y}px;`}\n >\n <AnimatedSticker\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, { emojiInteraction }): StateProps => {\n const animatedEffect = emojiInteraction.animatedEffect !== undefined\n && selectAnimatedEmojiEffect(global, emojiInteraction.animatedEffect);\n return {\n effectAnimationId: animatedEffect ? animatedEffect.id : undefined,\n localEffectAnimation: !animatedEffect && emojiInteraction.animatedEffect\n && Object.keys(ANIMATED_STICKERS_PATHS).includes(emojiInteraction.animatedEffect)\n ? emojiInteraction.animatedEffect : undefined,\n isReversed: emojiInteraction.isReversed,\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,\n} from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat, ApiUser } from '../../../api/types';\n\nimport useChatContextActions from '../../../hooks/useChatContextActions';\nimport useFlag from '../../../hooks/useFlag';\nimport { isUserId, getPrivateChatUserId, selectIsChatMuted } from '../../../modules/helpers';\nimport {\n selectChat, selectUser, selectIsChatPinned, selectNotifySettings, selectNotifyExceptions,\n} from '../../../modules/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 = () => {\n onClick(chatId);\n };\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiUser } from '../../../api/types';\n\nimport { getUserFirstOrLastName } from '../../../modules/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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/helpers';\nimport { selectChat, selectUser } from '../../../modules/selectors';\nimport renderText from '../../common/helpers/renderText';\nimport useMedia from '../../../hooks/useMedia';\nimport { formatPastTimeShort } from '../../../util/dateFormat';\nimport useLang, { LangFn } from '../../../hooks/useLang';\nimport useSelectWithEnter from '../../../hooks/useSelectWithEnter';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport Avatar from '../../common/Avatar';\nimport VerifiedIcon from '../../common/VerifiedIcon';\nimport ListItem from '../../ui/ListItem';\nimport Link from '../../ui/Link';\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 } = getDispatch();\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 </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={isRoundVideo ? 'round' : undefined} />\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 { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\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 '../../../../modules/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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\n\n const lang = useLang();\n const [activeTab, setActiveTab] = useState(currentContent);\n const dateSearchQuery = useMemo(() => parseDateString(searchQuery), [searchQuery]);\n\n const handleSwitchTab = useCallback((index: number) => {\n const tab = TABS[index];\n setGlobalSearchContent({ content: tab.type });\n setActiveTab(index);\n }, [setGlobalSearchContent]);\n\n const handleSearchDateSelect = useCallback((value: Date) => {\n setGlobalSearchDate({ date: value.getTime() / 1000 });\n }, [setGlobalSearchDate]);\n\n useHistoryBack(isActive, onReset, undefined, undefined, true);\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isActive, undefined, '.ListItem-button', true);\n\n return (\n <div className=\"LeftSearch\" ref={containerRef} onKeyDown={handleKeyDown}>\n <TabList activeTab={activeTab} tabs={chatId ? CHAT_TABS : TABS} onSwitchTab={handleSwitchTab} />\n <Transition\n name={lang.isRtl ? 'slide-optimized-rtl' : 'slide-optimized'}\n renderCount={TRANSITION_RENDER_COUNT}\n activeKey={currentContent}\n >\n {() => {\n switch (currentContent) {\n case GlobalSearchContent.ChatList:\n if (chatId) {\n return (\n <UserChatResults\n searchQuery={searchQuery}\n dateSearchQuery={dateSearchQuery}\n onReset={onReset}\n onSearchDateSelect={handleSearchDateSelect}\n />\n );\n }\n return (\n <ChatResults\n searchQuery={searchQuery}\n searchDate={searchDate}\n dateSearchQuery={dateSearchQuery}\n onReset={onReset}\n onSearchDateSelect={handleSearchDateSelect}\n />\n );\n case GlobalSearchContent.Media:\n return <MediaResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Links:\n return <LinkResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Files:\n return <FileResults searchQuery={searchQuery} />;\n case GlobalSearchContent.Music:\n return (\n <AudioResults\n key=\"audio\"\n searchQuery={searchQuery}\n />\n );\n case GlobalSearchContent.Voice:\n return (\n <AudioResults\n key=\"voice\"\n isVoice\n searchQuery={searchQuery}\n />\n );\n default:\n return undefined;\n }\n }}\n </Transition>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { currentContent, chatId } = global.globalSearch;\n\n return { currentContent, chatId };\n },\n)(LeftSearch));\n","import useReducer, { StateReducer, Dispatch } from '../useReducer';\n\nexport type TwoFaActions = (\n 'setCurrentPassword' | 'setPassword' | 'setHint' | 'setEmail' | 'reset'\n);\nexport type TwoFaDispatch = Dispatch<TwoFaActions>;\n\nexport type TwoFaState = {\n currentPassword: string;\n password: string;\n hint: string;\n email: string;\n};\n\nconst INITIAL_STATE: TwoFaState = {\n currentPassword: '',\n password: '',\n hint: '',\n email: '',\n};\n\nconst twoFaReducer: StateReducer<TwoFaState, TwoFaActions> = (\n state,\n action,\n) => {\n switch (action.type) {\n case 'setCurrentPassword':\n return {\n ...state,\n currentPassword: action.payload,\n };\n\n case 'setPassword':\n return {\n ...state,\n password: action.payload,\n };\n\n case 'setHint':\n return {\n ...state,\n hint: action.payload,\n };\n\n case 'setEmail':\n return {\n ...state,\n email: action.payload,\n };\n\n case 'reset':\n return INITIAL_STATE;\n\n default:\n return state;\n }\n};\n\nconst useTwoFaReducer = () => {\n return useReducer(twoFaReducer, INITIAL_STATE);\n};\n\nexport default useTwoFaReducer;\n","import React, {\n FC, memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch } from '../../../lib/teact/teactn';\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 } = getDispatch();\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.PrivacyActiveSessions:\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 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { SettingsScreens } from '../../../types';\nimport { ApiUser } from '../../../api/types';\n\nimport { selectUser } from '../../../modules/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 currentUser?: ApiUser;\n lastSyncTime?: number;\n};\n\nconst SettingsMain: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n currentUser,\n lastSyncTime,\n}) => {\n const { loadProfilePhotos } = getDispatch();\n\n const lang = useLang();\n const profileId = currentUser?.id;\n\n useEffect(() => {\n if (profileId && lastSyncTime) {\n loadProfilePhotos({ profileId });\n }\n }, [lastSyncTime, profileId, loadProfilePhotos]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Main);\n\n 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 onClick={() => onScreenSelect(SettingsScreens.General)}\n >\n {lang('Telegram.GeneralSettingsViewController')}\n </ListItem>\n <ListItem\n icon=\"unmute\"\n onClick={() => onScreenSelect(SettingsScreens.Notifications)}\n >\n {lang('Notifications')}\n </ListItem>\n <ListItem\n icon=\"lock\"\n onClick={() => onScreenSelect(SettingsScreens.Privacy)}\n >\n {lang('PrivacySettings')}\n </ListItem>\n <ListItem\n icon=\"data\"\n onClick={() => onScreenSelect(SettingsScreens.DataStorage)}\n >\n {lang('DataSettings')}\n </ListItem>\n <ListItem\n icon=\"folder\"\n onClick={() => onScreenSelect(SettingsScreens.Folders)}\n >\n {lang('Filters')}\n </ListItem>\n <ListItem\n icon=\"language\"\n onClick={() => onScreenSelect(SettingsScreens.Language)}\n >\n {lang('Language')}\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 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiMediaFormat } from '../../../api/types';\nimport { ProfileEditProgress, SettingsScreens } from '../../../types';\n\nimport { throttle } from '../../../util/schedulers';\nimport { selectUser } from '../../../modules/selectors';\nimport { getChatAvatarHash } from '../../../modules/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\n\nimport AvatarEditable from '../../ui/AvatarEditable';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Spinner from '../../ui/Spinner';\nimport InputText from '../../ui/InputText';\nimport renderText from '../../common/helpers/renderText';\nimport UsernameInput from '../../common/UsernameInput';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\ntype OwnProps = {\n isActive: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n currentAvatarHash?: string;\n currentFirstName?: string;\n currentLastName?: string;\n currentBio?: string;\n currentUsername?: string;\n progress?: ProfileEditProgress;\n isUsernameAvailable?: boolean;\n};\n\nconst runThrottled = throttle((cb) => cb(), 60000, true);\n\nconst MAX_BIO_LENGTH = 70;\n\nconst ERROR_FIRST_NAME_MISSING = 'Please provide your first name';\nconst ERROR_BIO_TOO_LONG = 'Bio can\\' be longer than 70 characters';\n\nconst SettingsEditProfile: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n currentAvatarHash,\n currentFirstName,\n currentLastName,\n currentBio,\n currentUsername,\n progress,\n isUsernameAvailable,\n}) => {\n const {\n loadCurrentUser,\n updateProfile,\n checkUsername,\n } = getDispatch();\n\n const lang = useLang();\n\n const [isUsernameTouched, setIsUsernameTouched] = useState(false);\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [error, setError] = useState<string | undefined>();\n\n const [photo, setPhoto] = useState<File | undefined>();\n const [firstName, setFirstName] = useState(currentFirstName || '');\n const [lastName, setLastName] = useState(currentLastName || '');\n const [bio, setBio] = useState(currentBio || '');\n const [username, setUsername] = useState<string | false>(currentUsername || '');\n\n const currentAvatarBlobUrl = useMedia(currentAvatarHash, false, ApiMediaFormat.BlobUrl);\n\n const isLoading = progress === ProfileEditProgress.InProgress;\n const isUsernameError = username === false;\n\n const isSaveButtonShown = useMemo(() => {\n if (isUsernameError) {\n return false;\n }\n\n return Boolean(photo) || isProfileFieldsTouched || isUsernameAvailable === true;\n }, [photo, isProfileFieldsTouched, isUsernameError, isUsernameAvailable]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.EditProfile);\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadCurrentUser();\n });\n }, [loadCurrentUser]);\n\n useEffect(() => {\n setPhoto(undefined);\n }, [currentAvatarBlobUrl]);\n\n useEffect(() => {\n setFirstName(currentFirstName || '');\n setLastName(currentLastName || '');\n setBio(currentBio || '');\n }, [currentFirstName, currentLastName, currentBio]);\n\n useEffect(() => {\n setUsername(currentUsername || '');\n }, [currentUsername]);\n\n useEffect(() => {\n if (progress === ProfileEditProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setIsUsernameTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handlePhotoChange = useCallback((newPhoto: File) => {\n setPhoto(newPhoto);\n }, []);\n\n const handleFirstNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleLastNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleBioChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setBio(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleUsernameChange = useCallback((value: string | false) => {\n setUsername(value);\n setIsUsernameTouched(true);\n }, []);\n\n const handleProfileSave = useCallback(() => {\n const trimmedFirstName = firstName.trim();\n const trimmedLastName = lastName.trim();\n const trimmedBio = bio.trim();\n\n if (!trimmedFirstName.length) {\n setError(ERROR_FIRST_NAME_MISSING);\n return;\n }\n\n if (trimmedBio.length > MAX_BIO_LENGTH) {\n setError(ERROR_BIO_TOO_LONG);\n return;\n }\n\n updateProfile({\n photo,\n ...(isProfileFieldsTouched && {\n firstName: trimmedFirstName,\n lastName: trimmedLastName,\n bio: trimmedBio,\n }),\n ...(isUsernameTouched && {\n username,\n }),\n });\n }, [\n photo,\n firstName, lastName, bio, isProfileFieldsTouched,\n username, isUsernameTouched,\n updateProfile,\n ]);\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-edit-profile\">\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { SettingsScreens, ISettings } from '../../../types';\n\nimport { AUTODOWNLOAD_FILESIZE_MB_LIMITS } from '../../../config';\nimport { pick } from '../../../util/iteratees';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport Checkbox from '../../ui/Checkbox';\nimport RangeSlider from '../../ui/RangeSlider';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = Pick<ISettings, (\n 'canAutoLoadPhotoFromContacts' |\n 'canAutoLoadPhotoInPrivateChats' |\n 'canAutoLoadPhotoInGroups' |\n 'canAutoLoadPhotoInChannels' |\n 'canAutoLoadVideoFromContacts' |\n 'canAutoLoadVideoInPrivateChats' |\n 'canAutoLoadVideoInGroups' |\n 'canAutoLoadVideoInChannels' |\n 'canAutoLoadFileFromContacts' |\n 'canAutoLoadFileInPrivateChats' |\n 'canAutoLoadFileInGroups' |\n 'canAutoLoadFileInChannels' |\n 'canAutoPlayGifs' |\n 'canAutoPlayVideos' |\n 'autoLoadFileMaxSizeMb'\n)>;\n\nconst SettingsDataStorage: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n canAutoLoadPhotoFromContacts,\n canAutoLoadPhotoInPrivateChats,\n canAutoLoadPhotoInGroups,\n canAutoLoadPhotoInChannels,\n canAutoLoadVideoFromContacts,\n canAutoLoadVideoInPrivateChats,\n canAutoLoadVideoInGroups,\n canAutoLoadVideoInChannels,\n canAutoLoadFileFromContacts,\n canAutoLoadFileInPrivateChats,\n canAutoLoadFileInGroups,\n canAutoLoadFileInChannels,\n canAutoPlayGifs,\n canAutoPlayVideos,\n autoLoadFileMaxSizeMb,\n}) => {\n const { setSettingOption } = getDispatch();\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.General);\n\n const renderFileSizeCallback = useCallback((value: number) => {\n return lang('AutodownloadSizeLimitUpTo', lang('FileSize.MB', String(AUTODOWNLOAD_FILESIZE_MB_LIMITS[value]), 'i'));\n }, [lang]);\n\n const handleFileSizeChange = useCallback((value: number) => {\n setSettingOption({ autoLoadFileMaxSizeMb: AUTODOWNLOAD_FILESIZE_MB_LIMITS[value] });\n }, [setSettingOption]);\n\n 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 onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}FromContacts`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.PrivateChats')}\n checked={canAutoLoadInPrivateChats}\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InPrivateChats`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.GroupChats')}\n checked={canAutoLoadInGroups}\n onCheck={(isChecked) => setSettingOption({ [`canAutoLoad${key}InGroups`]: isChecked })}\n />\n <Checkbox\n label={lang('AutoDownloadSettings.Channels')}\n checked={canAutoLoadInChannels}\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={(isChecked) => setSettingOption({ canAutoPlayGifs: isChecked })}\n />\n <Checkbox\n label={lang('DataAndStorage.Autoplay.Videos')}\n checked={canAutoPlayVideos}\n onCheck={(isChecked) => setSettingOption({ canAutoPlayVideos: isChecked })}\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 { getDispatch, withGlobal } from '../../../../lib/teact/teactn';\n\nimport { ApiChatFolder } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config';\nimport { throttle } from '../../../../util/schedulers';\nimport getAnimationData from '../../../common/helpers/animatedAssets';\nimport { getFolderDescriptionText } from '../../../../modules/helpers';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\nimport { useFolderManagerForChatsCount } from '../../../../hooks/useFolderManager';\n\nimport ListItem from '../../../ui/ListItem';\nimport Button from '../../../ui/Button';\nimport Loading from '../../../ui/Loading';\nimport AnimatedSticker from '../../../common/AnimatedSticker';\n\ntype OwnProps = {\n isActive?: boolean;\n onCreateFolder: () => void;\n onEditFolder: (folder: ApiChatFolder) => void;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n orderedFolderIds?: number[];\n foldersById: Record<number, ApiChatFolder>;\n recommendedChatFolders?: ApiChatFolder[];\n};\n\nconst runThrottledForLoadRecommended = throttle((cb) => cb(), 60000, true);\n\nconst MAX_ALLOWED_FOLDERS = 10;\n\nconst SettingsFoldersMain: FC<OwnProps & StateProps> = ({\n isActive,\n onCreateFolder,\n onEditFolder,\n onScreenSelect,\n onReset,\n orderedFolderIds,\n foldersById,\n recommendedChatFolders,\n}) => {\n const {\n loadRecommendedChatFolders,\n addChatFolder,\n showDialog,\n } = getDispatch();\n\n const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('FoldersAll').then(setAnimationData);\n }\n }, [animationData]);\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottledForLoadRecommended(() => {\n loadRecommendedChatFolders();\n });\n }, [loadRecommendedChatFolders]);\n\n const handleCreateFolder = useCallback(() => {\n if (Object.keys(foldersById).length >= MAX_ALLOWED_FOLDERS) {\n showDialog({\n data: {\n message: 'DIALOG_FILTERS_TOO_MUCH',\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n onCreateFolder();\n }, [foldersById, showDialog, onCreateFolder]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Folders);\n\n const chatsCountByFolderId = useFolderManagerForChatsCount();\n const userFolders = useMemo(() => {\n if (!orderedFolderIds) {\n return undefined;\n }\n\n return orderedFolderIds.map((id) => {\n const folder = foldersById[id];\n\n return {\n id: folder.id,\n title: folder.title,\n subtitle: getFolderDescriptionText(lang, folder, chatsCountByFolderId[folder.id]),\n };\n });\n }, [orderedFolderIds, foldersById, lang, chatsCountByFolderId]);\n\n const handleCreateFolderFromRecommended = useCallback((folder: ApiChatFolder) => {\n if (Object.keys(foldersById).length >= MAX_ALLOWED_FOLDERS) {\n showDialog({\n data: {\n message: 'DIALOG_FILTERS_TOO_MUCH',\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n addChatFolder({ folder });\n }, [foldersById, addChatFolder, showDialog]);\n\n return (\n <div className=\"settings-content 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 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 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 { getDispatch, withGlobal } from '../../../../lib/teact/teactn';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config';\nimport { findIntersectionWithSet } from '../../../../util/iteratees';\nimport { isUserId } from '../../../../modules/helpers';\nimport getAnimationData from '../../../common/helpers/animatedAssets';\nimport {\n EXCLUDED_CHAT_TYPES,\n FolderEditDispatch,\n FoldersState,\n INCLUDED_CHAT_TYPES,\n selectChatFilters,\n} from '../../../../hooks/reducers/useFoldersReducer';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport ListItem from '../../../ui/ListItem';\nimport AnimatedSticker from '../../../common/AnimatedSticker';\nimport InputText from '../../../ui/InputText';\nimport PrivateChatInfo from '../../../common/PrivateChatInfo';\nimport GroupChatInfo from '../../../common/GroupChatInfo';\nimport FloatingActionButton from '../../../ui/FloatingActionButton';\nimport Spinner from '../../../ui/Spinner';\nimport ShowMoreButton from '../../../ui/ShowMoreButton';\n\ntype OwnProps = {\n state: FoldersState;\n dispatch: FolderEditDispatch;\n onAddIncludedChats: () => void;\n onAddExcludedChats: () => void;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n onBack: () => void;\n};\n\ntype StateProps = {\n loadedActiveChatIds?: string[];\n loadedArchivedChatIds?: string[];\n};\n\nconst SUBMIT_TIMEOUT = 500;\n\nconst INITIAL_CHATS_LIMIT = 5;\n\nconst ERROR_NO_TITLE = 'Please provide a title for this folder.';\nconst ERROR_NO_CHATS = 'ChatList.Filter.Error.Empty';\n\nconst SettingsFoldersEdit: FC<OwnProps & StateProps> = ({\n state,\n dispatch,\n onAddIncludedChats,\n onAddExcludedChats,\n isActive,\n onScreenSelect,\n onReset,\n onBack,\n loadedActiveChatIds,\n loadedArchivedChatIds,\n}) => {\n const {\n editChatFolder,\n addChatFolder,\n loadMoreChats,\n } = getDispatch();\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 useEffect(() => {\n if (\n visibleIncludedChatIds.length < includedChatIds.length\n || visibleExcludedChatIds.length < excludedChatIds.length\n ) {\n loadMoreChats({ listType: 'active' });\n }\n }, [\n loadMoreChats,\n excludedChatIds.length,\n includedChatIds.length,\n visibleExcludedChatIds.length,\n visibleIncludedChatIds.length,\n ]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onBack, onScreenSelect, state.mode === 'edit'\n ? SettingsScreens.FoldersEditFolder\n : SettingsScreens.FoldersCreateFolder);\n\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { currentTarget } = event;\n dispatch({ type: 'setTitle', payload: currentTarget.value.trim() });\n }\n\n function handleSubmit() {\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 }\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 onClick={clickHandler}\n />\n )}\n </>\n );\n }\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content 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 no-border 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 '../../../../modules/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 onLoadMore: () => 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 onLoadMore,\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 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 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(onLoadMore, 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 { getDispatch, getGlobal } from '../../../../lib/teact/teactn';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport { unique } from '../../../../util/iteratees';\n\nimport { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID } from '../../../../config';\nimport { filterChatsByName } from '../../../../modules/helpers';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\nimport { useFolderManagerForOrderedIds } from '../../../../hooks/useFolderManager';\nimport {\n FoldersState,\n FolderEditDispatch,\n selectChatFilters,\n} from '../../../../hooks/reducers/useFoldersReducer';\n\nimport SettingsFoldersChatsPicker from './SettingsFoldersChatsPicker';\nimport Loading from '../../../ui/Loading';\n\ntype OwnProps = {\n mode: 'included' | 'excluded';\n state: FoldersState;\n dispatch: FolderEditDispatch;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsFoldersChatFilters: FC<OwnProps> = ({\n mode,\n state,\n dispatch,\n isActive,\n onScreenSelect,\n onReset,\n}) => {\n const { loadMoreChats } = getDispatch();\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, onReset, onScreenSelect,\n mode === 'included' ? SettingsScreens.FoldersIncludedChats : SettingsScreens.FoldersExcludedChats,\n );\n\n if (!displayedIds) {\n return <Loading />;\n }\n\n return (\n <SettingsFoldersChatsPicker\n mode={mode}\n chatIds={displayedIds}\n selectedIds={selectedChatIds}\n selectedChatTypes={selectedChatTypes}\n filterValue={chatFilter}\n onSelectedIdsChange={handleSelectedIdsChange}\n onSelectedChatTypesChange={handleSelectedChatTypesChange}\n onFilterChange={handleFilterChange}\n onLoadMore={loadMoreChats}\n />\n );\n};\n\nexport default memo(SettingsFoldersChatFilters);\n","import React, { FC, memo, useCallback } from '../../../../lib/teact/teact';\n\nimport { ApiChatFolder } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { FolderEditDispatch, FoldersState } from '../../../../hooks/reducers/useFoldersReducer';\n\nimport SettingsFoldersMain from './SettingsFoldersMain';\nimport SettingsFoldersEdit from './SettingsFoldersEdit';\nimport SettingsFoldersChatFilters from './SettingsFoldersChatFilters';\n\nimport './SettingsFolders.scss';\n\nconst TRANSITION_DURATION = 200;\n\nexport type OwnProps = {\n currentScreen: SettingsScreens;\n shownScreen: SettingsScreens;\n state: FoldersState;\n dispatch: FolderEditDispatch;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst SettingsFolders: FC<OwnProps> = ({\n currentScreen,\n shownScreen,\n state,\n dispatch,\n isActive,\n onScreenSelect,\n onReset,\n}) => {\n const handleReset = useCallback(() => {\n if (\n currentScreen === SettingsScreens.FoldersCreateFolder\n || currentScreen === SettingsScreens.FoldersEditFolder\n || currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ) {\n setTimeout(() => {\n dispatch({ type: 'reset' });\n }, TRANSITION_DURATION);\n }\n\n if (\n currentScreen === SettingsScreens.FoldersIncludedChats\n || currentScreen === SettingsScreens.FoldersExcludedChats\n ) {\n if (state.mode === 'create') {\n onScreenSelect(SettingsScreens.FoldersCreateFolder);\n } else {\n onScreenSelect(SettingsScreens.FoldersEditFolder);\n }\n return;\n }\n\n onReset();\n }, [\n state.mode, dispatch,\n currentScreen, onReset, onScreenSelect,\n ]);\n\n const handleCreateFolder = useCallback(() => {\n dispatch({ type: 'reset' });\n onScreenSelect(SettingsScreens.FoldersCreateFolder);\n }, [onScreenSelect, dispatch]);\n\n const handleEditFolder = useCallback((folder: ApiChatFolder) => {\n dispatch({ type: 'editFolder', payload: folder });\n onScreenSelect(SettingsScreens.FoldersEditFolder);\n }, [dispatch, onScreenSelect]);\n\n const handleAddIncludedChats = useCallback(() => {\n dispatch({ type: 'editIncludeFilters' });\n onScreenSelect(currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ? SettingsScreens.FoldersIncludedChatsFromChatList\n : SettingsScreens.FoldersIncludedChats);\n }, [currentScreen, dispatch, onScreenSelect]);\n\n const handleAddExcludedChats = useCallback(() => {\n dispatch({ type: 'editExcludeFilters' });\n onScreenSelect(currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ? SettingsScreens.FoldersExcludedChatsFromChatList\n : SettingsScreens.FoldersExcludedChats);\n }, [currentScreen, dispatch, onScreenSelect]);\n\n switch (currentScreen) {\n case SettingsScreens.Folders:\n return (\n <SettingsFoldersMain\n onCreateFolder={handleCreateFolder}\n onEditFolder={handleEditFolder}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.FoldersCreateFolder,\n SettingsScreens.FoldersEditFolder,\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersExcludedChats,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n return (\n <SettingsFoldersEdit\n state={state}\n dispatch={dispatch}\n onAddIncludedChats={handleAddIncludedChats}\n onAddExcludedChats={handleAddExcludedChats}\n onReset={handleReset}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.FoldersIncludedChats,\n SettingsScreens.FoldersExcludedChats,\n ].includes(shownScreen)}\n onBack={onReset}\n />\n );\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n return (\n <SettingsFoldersChatFilters\n mode=\"included\"\n state={state}\n dispatch={dispatch}\n onReset={handleReset}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n />\n );\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <SettingsFoldersChatFilters\n mode=\"excluded\"\n state={state}\n dispatch={dispatch}\n onReset={handleReset}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(SettingsFolders);\n","import React, {\n FC, memo, useMemo, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiMediaFormat, ApiStickerSet } from '../../../api/types';\n\nimport { STICKER_SIZE_PICKER_HEADER } from '../../../config';\nimport { ObserveFn, useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport { getFirstLetters } from '../../../util/textFormat';\n\nimport AnimatedSticker from '../../common/AnimatedSticker';\n\ntype OwnProps = {\n size?: number;\n stickerSet: ApiStickerSet;\n observeIntersection: ObserveFn;\n};\n\nconst StickerSetCoverAnimated: FC<OwnProps> = ({\n size = STICKER_SIZE_PICKER_HEADER,\n stickerSet,\n observeIntersection,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const mediaHash = `stickerSet${stickerSet.id}`;\n const lottieData = useMedia(mediaHash, !isIntersecting, ApiMediaFormat.Lottie);\n const transitionClassNames = useMediaTransition(lottieData);\n\n const firstLetters = useMemo(() => {\n if (lottieData) return undefined;\n\n return getFirstLetters(stickerSet.title, 2);\n }, [lottieData, stickerSet.title]);\n\n return (\n <div ref={ref} className=\"sticker-set-cover\">\n {firstLetters}\n {lottieData && (\n <AnimatedSticker\n id={mediaHash}\n size={size}\n animationData={lottieData}\n className={transitionClassNames}\n />\n )}\n </div>\n );\n};\n\nexport default memo(StickerSetCoverAnimated);\n","import React, {\n FC, memo, useMemo, useRef,\n} from '../../../lib/teact/teact';\n\nimport { ApiStickerSet } from '../../../api/types';\n\nimport { IS_WEBM_SUPPORTED } from '../../../util/environment';\nimport { getFirstLetters } from '../../../util/textFormat';\nimport { ObserveFn, useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\n\ntype OwnProps = {\n stickerSet: ApiStickerSet;\n observeIntersection: ObserveFn;\n};\n\nconst StickerSetCover: FC<OwnProps> = ({ stickerSet, observeIntersection }) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const mediaData = useMedia(stickerSet.hasThumbnail && `stickerSet${stickerSet.id}`, !isIntersecting);\n const transitionClassNames = useMediaTransition(mediaData);\n const isGif = stickerSet.isGifs;\n\n const firstLetters = useMemo(() => {\n if ((isGif && !IS_WEBM_SUPPORTED) || !mediaData) return getFirstLetters(stickerSet.title, 2);\n }, [isGif, mediaData, stickerSet.title]);\n\n return (\n <div ref={ref} className=\"sticker-set-cover\">\n {firstLetters}\n {isGif ? (\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 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 onClick={() => onClick(firstSticker)}\n >\n <StickerButton\n sticker={firstSticker}\n size={STICKER_SIZE_GENERAL_SETTINGS}\n title={stickerSet.title}\n observeIntersection={observeIntersection}\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { SettingsScreens, ISettings, TimeFormat } from '../../../types';\nimport { ApiSticker, ApiStickerSet } from '../../../api/types';\n\nimport { IS_IOS, IS_MAC_OS, IS_TOUCH_ENV } 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';\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 };\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}) => {\n const {\n setSettingOption,\n } = getDispatch();\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 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 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 stickerSets = stickerSetIds && stickerSetIds.map((id: string) => {\n return stickerSetsById?.[id]?.installedDate ? stickerSetsById[id] : false;\n }).filter<ApiStickerSet>(Boolean as any);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.General);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('SETTINGS')}</h4>\n\n <RangeSlider\n label={lang('TextSize')}\n min={12}\n max={20}\n value={messageTextSize}\n onChange={handleMessageTextSizeChange}\n />\n\n <ListItem\n icon=\"photo\"\n 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 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={(value) => setSettingOption({ messageSendKeyCombo: value })}\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 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={(isChecked) => setSettingOption({ shouldSuggestStickers: isChecked })}\n />\n <Checkbox\n label={lang('LoopAnimatedStickers')}\n checked={shouldLoopStickers}\n onCheck={(isChecked) => setSettingOption({ shouldLoopStickers: isChecked })}\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 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 };\n },\n)(SettingsGeneral));\n","let fileSelector: HTMLInputElement;\n\nexport function openSystemFilesDialog(accept = '*', callback: (e: Event) => void, noMultiple = false) {\n if (!fileSelector) {\n fileSelector = document.createElement('input');\n fileSelector.setAttribute('type', 'file');\n }\n\n fileSelector.setAttribute('accept', accept);\n\n if (noMultiple) {\n fileSelector.removeAttribute('multiple');\n } else {\n fileSelector.setAttribute('multiple', 'multiple');\n }\n\n // eslint-disable-next-line no-null/no-null\n fileSelector.onchange = null;\n fileSelector.value = '';\n fileSelector.onchange = callback;\n\n fileSelector.click();\n}\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/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 } = getDispatch();\n\n const themeRef = useRef<string>();\n themeRef.current = theme;\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadWallpapers();\n });\n }, [loadWallpapers]);\n\n const handleFileSelect = useCallback((e: Event) => {\n const { files } = e.target as HTMLInputElement;\n\n if (files && files.length > 0) {\n uploadWallpaper(files[0]);\n }\n }, [uploadWallpaper]);\n\n const handleUploadWallpaper = useCallback(() => {\n openSystemFilesDialog(SUPPORTED_TYPES, handleFileSelect, true);\n }, [handleFileSelect]);\n\n const handleSetColor = useCallback(() => {\n onScreenSelect(SettingsScreens.GeneralChatBackgroundColor);\n }, [onScreenSelect]);\n\n const handleResetToDefault = useCallback(() => {\n setThemeSettings({\n theme,\n background: undefined,\n backgroundColor: undefined,\n isBlurred: true,\n patternColor: theme === 'dark' ? DARK_THEME_PATTERN_COLOR : DEFAULT_PATTERN_COLOR,\n });\n }, [setThemeSettings, theme]);\n\n const handleWallPaperSelect = useCallback((slug: string) => {\n setThemeSettings({ theme: themeRef.current, background: slug });\n const currentWallpaper = loadedWallpapers && loadedWallpapers.find((wallpaper) => wallpaper.slug === slug);\n if (currentWallpaper?.document.thumbnail) {\n getAverageColor(currentWallpaper.document.thumbnail.dataUri)\n .then((color) => {\n const patternColor = getPatternColor(color);\n const rgbColor = `#${rgb2hex(color)}`;\n setThemeSettings({ theme: themeRef.current, backgroundColor: rgbColor, patternColor });\n });\n }\n }, [loadedWallpapers, setThemeSettings]);\n\n const handleWallPaperBlurChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setThemeSettings({ theme: themeRef.current, isBlurred: e.target.checked });\n }, [setThemeSettings]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.GeneralChatBackground);\n\n const isUploading = loadedWallpapers?.[0] && loadedWallpapers[0].slug === UPLOADING_WALLPAPER_SLUG;\n\n return (\n <div className=\"SettingsGeneralBackground settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <ListItem\n icon=\"camera-add\"\n className=\"mb-0\"\n disabled={isUploading}\n onClick={handleUploadWallpaper}\n >\n {lang('UploadImage')}\n </ListItem>\n\n <ListItem\n icon=\"colorize\"\n className=\"mb-0\"\n onClick={handleSetColor}\n >\n {lang('SetColor')}\n </ListItem>\n\n <ListItem icon=\"favorite\" onClick={handleResetToDefault}>\n {lang('ThemeResetToDefaults')}\n </ListItem>\n\n <Checkbox\n label={lang('BackgroundBlurred')}\n checked={Boolean(isBlurred)}\n onChange={handleWallPaperBlurChange}\n />\n </div>\n\n {loadedWallpapers ? (\n <div className=\"settings-wallpapers\">\n {loadedWallpapers.map((wallpaper) => (\n <WallpaperTile\n wallpaper={wallpaper}\n theme={theme}\n isSelected={background === wallpaper.slug}\n onClick={handleWallPaperSelect}\n />\n ))}\n </div>\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const theme = selectTheme(global);\n const { background, isBlurred } = global.settings.themes[theme] || {};\n const { loadedWallpapers } = global.settings;\n\n return {\n background,\n isBlurred,\n loadedWallpapers,\n theme,\n };\n },\n)(SettingsGeneralBackground));\n","import { ChangeEvent, MutableRefObject, RefObject } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { SettingsScreens, ThemeKey } from '../../../types';\n\nimport { pick } from '../../../util/iteratees';\nimport {\n getPatternColor, hex2rgb, hsb2rgb, rgb2hex, rgb2hsb,\n} from '../../../util/colors';\nimport { captureEvents, RealTouchEvent } from '../../../util/captureEvents';\nimport { selectTheme } from '../../../modules/selectors';\nimport useFlag from '../../../hooks/useFlag';\nimport buildClassName from '../../../util/buildClassName';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport InputText from '../../ui/InputText';\n\nimport './SettingsGeneralBackgroundColor.scss';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n backgroundColor?: string;\n theme: ThemeKey;\n};\n\ninterface CanvasRects {\n colorRect: {\n offsetLeft: number;\n top: number;\n width: number;\n height: number;\n };\n hueRect: {\n offsetLeft: number;\n width: number;\n };\n}\n\nconst DEFAULT_HSB = rgb2hsb(hex2rgb('e6ebee'));\nconst PREDEFINED_COLORS = [\n '#e6ebee', '#b2cee1', '#008dd0', '#c6e7cb', '#c4e1a6', '#60b16e',\n '#ccd0af', '#a6a997', '#7a7072', '#fdd7af', '#fdb76e', '#dd8851',\n];\n\nconst SettingsGeneralBackground: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n theme,\n backgroundColor,\n}) => {\n const { setThemeSettings } = getDispatch();\n\n const themeRef = useRef<string>();\n themeRef.current = theme;\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const colorPickerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const huePickerRef = useRef<HTMLDivElement>(null);\n const isFirstRunRef = useRef(true);\n\n const [hsb, setHsb] = useState(getInitialHsb(backgroundColor));\n // Cache for drag handlers\n const hsbRef = useRef(hsb);\n useEffect(() => {\n hsbRef.current = hsb;\n }, [hsb]);\n\n const [isDragging, markIsDragging, unmarkIsDragging] = useFlag();\n const [rgbInput, setRgbInput] = useState('');\n const [hexInput, setHexInput] = useState('');\n\n const rectsRef = useRef<CanvasRects>();\n const colorCtxRef = useRef<CanvasRenderingContext2D>();\n\n // Setup: cache rects, subscribe for drag events\n useEffect(() => {\n // We use `offsetLeft` instead of `left` to support screen transition\n const colorRect = {\n offsetLeft: colorPickerRef.current!.offsetLeft,\n ...pick(colorPickerRef.current!.getBoundingClientRect(), ['top', 'width', 'height']),\n };\n const hueRect = {\n offsetLeft: huePickerRef.current!.offsetLeft,\n ...pick(huePickerRef.current!.getBoundingClientRect(), ['width']),\n };\n\n rectsRef.current = { colorRect, hueRect };\n\n function handleColorDrag(e: MouseEvent | RealTouchEvent) {\n const colorPosition = [\n Math.min(Math.max(0, e.pageX! - colorRect.offsetLeft), colorRect.width - 1),\n Math.min(Math.max(0, e.pageY! - colorRect.top + containerRef.current!.scrollTop), colorRect.height - 1),\n ];\n\n const { huePosition } = hsb2positions(hsbRef.current, rectsRef.current!);\n\n setHsb(positions2hsb({ colorPosition, huePosition }, rectsRef.current!));\n markIsDragging();\n\n return true;\n }\n\n captureEvents(colorPickerRef.current!, {\n onCapture: handleColorDrag,\n onDrag: handleColorDrag,\n onRelease: unmarkIsDragging,\n onClick: unmarkIsDragging,\n selectorToPreventScroll: '.SettingsGeneralBackgroundColor',\n withCursor: true,\n });\n\n function handleHueDrag(e: MouseEvent | RealTouchEvent) {\n const { colorPosition } = hsb2positions(hsbRef.current, rectsRef.current!);\n const huePosition = Math.min(Math.max(0, e.pageX! - hueRect.offsetLeft), hueRect.width - 1);\n\n setHsb(positions2hsb({ colorPosition, huePosition }, rectsRef.current!));\n markIsDragging();\n\n return true;\n }\n\n captureEvents(huePickerRef.current!, {\n onCapture: handleHueDrag,\n onDrag: handleHueDrag,\n onRelease: unmarkIsDragging,\n onClick: unmarkIsDragging,\n selectorToPreventScroll: '.SettingsGeneralBackgroundColor',\n withCursor: true,\n });\n }, [markIsDragging, unmarkIsDragging]);\n\n const { colorPosition = [0, 0], huePosition = 0 } = rectsRef.current ? hsb2positions(hsb, rectsRef.current) : {};\n const hex = rgb2hex(hsb2rgb(hsb));\n const hue = hsb[0];\n const hueHex = rgb2hex(hsb2rgb([hue, 1, 1]));\n\n // Save value and update inputs when HSL changes\n useEffect(() => {\n const rgb = hsb2rgb(hsb);\n const color = `#${rgb2hex(rgb)}`;\n\n setRgbInput(rgb.join(', '));\n setHexInput(color);\n\n if (!isFirstRunRef.current) {\n const patternColor = getPatternColor(rgb);\n setThemeSettings({\n theme: themeRef.current,\n background: undefined,\n backgroundColor: color,\n patternColor,\n });\n }\n isFirstRunRef.current = false;\n }, [hsb, setThemeSettings]);\n\n // Redraw color picker when hue changes\n useEffect(() => {\n drawColor(colorPickerRef.current!.firstChild as HTMLCanvasElement, hue, colorCtxRef, rectsRef);\n }, [hue]);\n\n // Initially draw hue picker\n useEffect(() => {\n drawHue(huePickerRef.current!.firstChild as HTMLCanvasElement);\n }, []);\n\n const handleRgbChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const rgbValue = e.currentTarget.value.replace(/[^\\d, ]/g, '').slice(0, 13);\n\n if (rgbValue.match(/^\\d{1,3},\\s?\\d{1,3},\\s?\\d{1,3}$/)) {\n const rgb = rgbValue.split(',').map((channel) => Number(channel.trim())) as [number, number, number];\n setHsb(rgb2hsb(rgb));\n }\n\n e.currentTarget.value = rgbValue;\n }, []);\n\n const handleHexChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const hexValue = e.currentTarget.value.replace(/[^0-9a-fA-F]/g, '').slice(0, 6);\n\n if (hexValue.match(/^#?[0-9a-fA-F]{6}$/)) {\n setHsb(rgb2hsb(hex2rgb(hexValue.replace('#', ''))));\n }\n\n e.currentTarget.value = hexValue;\n }, []);\n\n const handlePredefinedColorClick = useCallback((e: React.MouseEvent<HTMLInputElement>) => {\n setHsb(rgb2hsb(hex2rgb(e.currentTarget.dataset.color!.replace('#', ''))));\n }, []);\n\n const className = buildClassName(\n 'SettingsGeneralBackgroundColor settings-content custom-scroll',\n isDragging && 'is-dragging',\n );\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.GeneralChatBackgroundColor);\n\n return (\n <div ref={containerRef} className={className}>\n <div className=\"settings-item pt-3\">\n <div ref={colorPickerRef} className=\"color-picker\">\n <canvas />\n <div\n className=\"handle\"\n // @ts-ignore\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 // @ts-ignore\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 // @ts-ignore\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 useDebounce from '../../../hooks/useDebounce';\nimport React, {\n FC, memo, useCallback, useEffect,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { SettingsScreens } from '../../../types';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { playNotifySound } from '../../../util/notifications';\n\nimport Checkbox from '../../ui/Checkbox';\nimport RangeSlider from '../../ui/RangeSlider';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n hasPrivateChatsNotifications: boolean;\n hasPrivateChatsMessagePreview: boolean;\n hasGroupNotifications: boolean;\n hasGroupMessagePreview: boolean;\n hasBroadcastNotifications: boolean;\n hasBroadcastMessagePreview: boolean;\n hasContactJoinedNotifications: boolean;\n hasWebNotifications: boolean;\n hasPushNotifications: boolean;\n notificationSoundVolume: number;\n};\n\nconst SettingsNotifications: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n hasPrivateChatsNotifications,\n hasPrivateChatsMessagePreview,\n hasGroupNotifications,\n hasGroupMessagePreview,\n hasBroadcastNotifications,\n hasBroadcastMessagePreview,\n hasContactJoinedNotifications,\n hasPushNotifications,\n hasWebNotifications,\n notificationSoundVolume,\n}) => {\n const {\n loadNotificationSettings,\n updateContactSignUpNotification,\n updateNotificationSettings,\n updateWebNotificationSettings,\n } = getDispatch();\n\n useEffect(() => {\n loadNotificationSettings();\n }, [loadNotificationSettings]);\n\n const runDebounced = useDebounce(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 handleContactNotificationChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n updateContactSignUpNotification({\n isSilent: !e.target.checked,\n });\n }, [updateContactSignUpNotification]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Notifications);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n Web notifications\n </h4>\n <Checkbox\n label=\"Web notifications\"\n // eslint-disable-next-line max-len\n subLabel={lang(hasWebNotifications ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasWebNotifications}\n onChange={(e) => {\n updateWebNotificationSettings({ hasWebNotifications: e.target.checked });\n }}\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={(e) => {\n updateWebNotificationSettings({ hasPushNotifications: e.target.checked });\n }}\n />\n <div className=\"settings-item-slider\">\n <RangeSlider\n label=\"Sound\"\n min={0}\n max={10}\n value={notificationSoundVolume}\n onChange={(volume) => {\n updateWebNotificationSettings({ notificationSoundVolume: volume });\n runDebounced(() => playNotifySound(undefined, volume));\n }}\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={(e) => {\n handleSettingsChange(e, 'contact', 'silent');\n }}\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={(e) => {\n handleSettingsChange(e, 'contact', 'showPreviews');\n }}\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={(e) => {\n handleSettingsChange(e, 'group', 'silent');\n }}\n />\n <Checkbox\n label={lang('MessagePreview')}\n disabled={!hasGroupNotifications}\n subLabel={lang(hasGroupMessagePreview ? 'UserInfo.NotificationsEnabled' : 'UserInfo.NotificationsDisabled')}\n checked={hasGroupMessagePreview}\n onChange={(e) => {\n handleSettingsChange(e, 'group', 'showPreviews');\n }}\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={(e) => {\n handleSettingsChange(e, 'broadcast', 'silent');\n }}\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={(e) => {\n handleSettingsChange(e, 'broadcast', 'showPreviews');\n }}\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { PrivacyVisibility, SettingsScreens } from '../../../types';\n\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n hasPassword?: boolean;\n blockedCount: number;\n sessionsCount: number;\n isSensitiveEnabled?: boolean;\n canChangeSensitive?: boolean;\n visibilityPrivacyPhoneNumber?: PrivacyVisibility;\n visibilityPrivacyLastSeen?: PrivacyVisibility;\n visibilityPrivacyProfilePhoto?: PrivacyVisibility;\n visibilityPrivacyForwarding?: PrivacyVisibility;\n visibilityPrivacyGroupChats?: PrivacyVisibility;\n};\n\nconst SettingsPrivacy: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n hasPassword,\n blockedCount,\n sessionsCount,\n isSensitiveEnabled,\n canChangeSensitive,\n visibilityPrivacyPhoneNumber,\n visibilityPrivacyLastSeen,\n visibilityPrivacyProfilePhoto,\n visibilityPrivacyForwarding,\n visibilityPrivacyGroupChats,\n\n}) => {\n const {\n loadPrivacySettings,\n loadBlockedContacts,\n loadAuthorizations,\n loadContentSettings,\n updateContentSettings,\n } = getDispatch();\n\n useEffect(() => {\n loadBlockedContacts();\n loadAuthorizations();\n loadPrivacySettings();\n loadContentSettings();\n }, [loadBlockedContacts, loadAuthorizations, loadPrivacySettings, loadContentSettings]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Privacy);\n\n function getVisibilityValue(visibility?: PrivacyVisibility) {\n switch (visibility) {\n case 'everybody':\n return lang('P2PEverybody');\n\n case 'contacts':\n return lang('P2PContacts');\n\n case 'nobody':\n return lang('P2PNobody');\n }\n\n return undefined;\n }\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item pt-3\">\n <ListItem\n icon=\"delete-user\"\n narrow\n 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 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 <ListItem\n icon=\"active-sessions\"\n narrow\n onClick={() => onScreenSelect(SettingsScreens.PrivacyActiveSessions)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('SessionsTitle')}</span>\n {sessionsCount > 0 && (\n <span className=\"subtitle\" dir=\"auto\">\n {sessionsCount === 1 ? '1 session' : `${sessionsCount} sessions`}\n </span>\n )}\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 onClick={() => onScreenSelect(SettingsScreens.PrivacyPhoneNumber)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyPhoneTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(visibilityPrivacyPhoneNumber)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n onClick={() => onScreenSelect(SettingsScreens.PrivacyLastSeen)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('LastSeenTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(visibilityPrivacyLastSeen)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n onClick={() => onScreenSelect(SettingsScreens.PrivacyProfilePhoto)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyProfilePhotoTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(visibilityPrivacyProfilePhoto)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n onClick={() => onScreenSelect(SettingsScreens.PrivacyForwarding)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('PrivacyForwardsTitle')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(visibilityPrivacyForwarding)}\n </span>\n </div>\n </ListItem>\n <ListItem\n narrow\n className=\"no-icon\"\n onClick={() => onScreenSelect(SettingsScreens.PrivacyGroupChats)}\n >\n <div className=\"multiline-menu-item\">\n <span className=\"title\">{lang('WhoCanAddMe')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {getVisibilityValue(visibilityPrivacyGroupChats)}\n </span>\n </div>\n </ListItem>\n </div>\n\n {canChangeSensitive && (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('lng_settings_sensitive_title')}\n </h4>\n <Checkbox\n label={lang('lng_settings_sensitive_disable_filtering')}\n subLabel={lang('lng_settings_sensitive_about')}\n checked={Boolean(isSensitiveEnabled)}\n disabled={!canChangeSensitive}\n onCheck={updateContentSettings}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n settings: {\n byKey: { hasPassword, isSensitiveEnabled, canChangeSensitive },\n privacy,\n },\n blocked,\n activeSessions,\n } = global;\n\n return {\n hasPassword,\n blockedCount: blocked.totalCount,\n sessionsCount: activeSessions.length,\n isSensitiveEnabled,\n canChangeSensitive,\n visibilityPrivacyPhoneNumber: privacy.phoneNumber?.visibility,\n visibilityPrivacyLastSeen: privacy.lastSeen?.visibility,\n visibilityPrivacyProfilePhoto: privacy.profilePhoto?.visibility,\n visibilityPrivacyForwarding: privacy.forwards?.visibility,\n visibilityPrivacyGroupChats: privacy.chatInvite?.visibility,\n };\n },\n)(SettingsPrivacy));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ISettings, LangCode, SettingsScreens } from '../../../types';\nimport { ApiLanguage } from '../../../api/types';\n\nimport { setLanguage } from '../../../util/langProvider';\n\nimport RadioGroup from '../../ui/RadioGroup';\nimport Loading from '../../ui/Loading';\nimport useFlag from '../../../hooks/useFlag';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = Pick<ISettings, 'languages' | 'language'>;\n\nconst SettingsLanguage: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n languages,\n language,\n}) => {\n const {\n loadLanguages,\n setSettingOption,\n } = getDispatch();\n\n const [selectedLanguage, setSelectedLanguage] = useState<string>(language);\n const [isLoading, markIsLoading, unmarkIsLoading] = useFlag();\n\n // TODO Throttle\n useEffect(() => {\n loadLanguages();\n }, [loadLanguages]);\n\n const handleChange = useCallback((langCode: string) => {\n setSelectedLanguage(langCode);\n markIsLoading();\n\n void setLanguage(langCode as LangCode, () => {\n unmarkIsLoading();\n\n setSettingOption({ language: langCode });\n });\n }, [markIsLoading, unmarkIsLoading, setSettingOption]);\n\n const options = useMemo(() => {\n return languages ? buildOptions(languages) : undefined;\n }, [languages]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.Language);\n\n return (\n <div className=\"settings-content settings-item settings-language custom-scroll\">\n {options ? (\n <RadioGroup\n name=\"keyboard-send-settings\"\n options={options}\n selected={selectedLanguage}\n loadingOption={isLoading ? selectedLanguage : undefined}\n onChange={handleChange}\n />\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nfunction buildOptions(languages: ApiLanguage[]) {\n const currentLangCode = (window.navigator.language || 'en').toLowerCase();\n const shortLangCode = currentLangCode.substr(0, 2);\n\n return languages.map(({ langCode, nativeName, name }) => ({\n value: langCode,\n label: nativeName,\n subLabel: name,\n })).sort((a) => {\n return currentLangCode && (a.value === currentLangCode || a.value === shortLangCode) ? -1 : 0;\n });\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n languages: global.settings.byKey.languages,\n language: global.settings.byKey.language,\n };\n },\n)(SettingsLanguage));\n","import { ApiPrivacyKey, SettingsScreens } from '../../../../types';\n\nexport function getPrivacyKey(screen: SettingsScreens): ApiPrivacyKey | undefined {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n return 'phoneNumber';\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n return 'lastSeen';\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n return 'profilePhoto';\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return 'forwards';\n case SettingsScreens.PrivacyGroupChats:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return 'chatInvite';\n }\n\n return undefined;\n}\n","import React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 './helper/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 } = getDispatch();\n\n const lang = useLang();\n\n const visibilityOptions = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyGroupChats:\n return [\n { value: 'everybody', label: lang('P2PEverybody') },\n { value: 'contacts', label: lang('P2PContacts') },\n ];\n\n default:\n return [\n { value: 'everybody', label: lang('P2PEverybody') },\n { value: 'contacts', label: lang('P2PContacts') },\n { value: 'nobody', label: lang('P2PNobody') },\n ];\n }\n }, [lang, screen]);\n\n const exceptionLists = {\n shouldShowDenied: visibility !== 'nobody',\n shouldShowAllowed: visibility !== 'everybody',\n };\n\n const privacyKey = getPrivacyKey(screen);\n\n const headerText = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return lang('PrivacyPhoneTitle');\n case SettingsScreens.PrivacyLastSeen:\n return lang('LastSeenTitle');\n case SettingsScreens.PrivacyProfilePhoto:\n return lang('PrivacyProfilePhotoTitle');\n case SettingsScreens.PrivacyForwarding:\n return lang('PrivacyForwardsTitle');\n case SettingsScreens.PrivacyGroupChats:\n return lang('WhoCanAddMe');\n default:\n return undefined;\n }\n }, [lang, screen]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, screen);\n\n const descriptionText = useMemo(() => {\n switch (screen) {\n case SettingsScreens.PrivacyLastSeen:\n return lang('CustomHelp');\n default:\n return undefined;\n }\n }, [lang, screen]);\n\n const allowedContactsScreen = (() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return SettingsScreens.PrivacyPhoneNumberAllowedContacts;\n case SettingsScreens.PrivacyLastSeen:\n return SettingsScreens.PrivacyLastSeenAllowedContacts;\n case SettingsScreens.PrivacyProfilePhoto:\n return SettingsScreens.PrivacyProfilePhotoAllowedContacts;\n case SettingsScreens.PrivacyForwarding:\n return SettingsScreens.PrivacyForwardingAllowedContacts;\n default:\n return SettingsScreens.PrivacyGroupChatsAllowedContacts;\n }\n })();\n\n const deniedContactsScreen = (() => {\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n return SettingsScreens.PrivacyPhoneNumberDeniedContacts;\n case SettingsScreens.PrivacyLastSeen:\n return SettingsScreens.PrivacyLastSeenDeniedContacts;\n case SettingsScreens.PrivacyProfilePhoto:\n return SettingsScreens.PrivacyProfilePhotoDeniedContacts;\n case SettingsScreens.PrivacyForwarding:\n return SettingsScreens.PrivacyForwardingDeniedContacts;\n default:\n return SettingsScreens.PrivacyGroupChatsDeniedContacts;\n }\n })();\n\n const allowedCount = useMemo(() => {\n if (!allowUserIds || !allowChatIds || !chatsById) {\n return 0;\n }\n\n return allowChatIds.reduce((result, chatId) => {\n return result + (chatsById[chatId] ? chatsById[chatId].membersCount! : 0);\n }, allowUserIds.length);\n }, [allowChatIds, allowUserIds, chatsById]);\n\n const blockCount = useMemo(() => {\n if (!blockUserIds || !blockChatIds || !chatsById) {\n return 0;\n }\n\n return blockChatIds.reduce((result, chatId) => {\n return result + (chatsById[chatId] ? chatsById[chatId].membersCount! : 0);\n }, blockUserIds.length);\n }, [blockChatIds, blockUserIds, chatsById]);\n\n const handleVisibilityChange = useCallback((value) => {\n setPrivacyVisibility({\n privacyKey,\n visibility: value,\n });\n }, [privacyKey, setPrivacyVisibility]);\n\n return (\n <div className=\"settings-content custom-scroll\">\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header\" dir={lang.isRtl ? 'rtl' : undefined}>{headerText}</h4>\n\n <RadioGroup\n name={`visibility-${privacyKey}`}\n options={visibilityOptions}\n onChange={handleVisibilityChange}\n selected={visibility}\n />\n\n {descriptionText && (\n <p className=\"settings-item-description-larger\" dir={lang.isRtl ? 'rtl' : undefined}>{descriptionText}</p>\n )}\n </div>\n\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>{lang('PrivacyExceptions')}</h4>\n\n {exceptionLists.shouldShowAllowed && (\n <ListItem\n narrow\n icon=\"add-user\"\n onClick={() => {\n onScreenSelect(allowedContactsScreen);\n }}\n >\n <div className=\"multiline-menu-item full-size\">\n {allowedCount > 0 && <span className=\"date\" dir=\"auto\">+{allowedCount}</span>}\n <span className=\"title\">{lang('AlwaysShareWith')}</span>\n <span className=\"subtitle\">{lang('EditAdminAddUsers')}</span>\n </div>\n </ListItem>\n )}\n {exceptionLists.shouldShowDenied && (\n <ListItem\n narrow\n icon=\"delete-user\"\n onClick={() => {\n onScreenSelect(deniedContactsScreen);\n }}\n >\n <div className=\"multiline-menu-item full-size\">\n {blockCount > 0 && <span className=\"date\" dir=\"auto\">&minus;{blockCount}</span>}\n <span className=\"title\">{lang('NeverShareWith')}</span>\n <span className=\"subtitle\">{lang('EditAdminAddUsers')}</span>\n </div>\n </ListItem>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { screen }): StateProps => {\n let privacySettings: ApiPrivacySettings | undefined;\n\n const {\n chats: { byId: chatsById },\n settings: { privacy },\n } = global;\n\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumber:\n privacySettings = privacy.phoneNumber;\n break;\n\n case SettingsScreens.PrivacyLastSeen:\n privacySettings = privacy.lastSeen;\n break;\n\n case SettingsScreens.PrivacyProfilePhoto:\n privacySettings = privacy.profilePhoto;\n break;\n\n case SettingsScreens.PrivacyForwarding:\n privacySettings = privacy.forwards;\n break;\n\n case SettingsScreens.PrivacyGroupChats:\n privacySettings = privacy.chatInvite;\n break;\n }\n\n if (!privacySettings) {\n return {};\n }\n\n return {\n ...privacySettings,\n chatsById,\n };\n },\n)(SettingsPrivacyVisibility));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiSession } from '../../../api/types';\nimport { SettingsScreens } from '../../../types';\n\nimport { formatPastTimeShort } from '../../../util/dateFormat';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport ConfirmDialog from '../../ui/ConfirmDialog';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n activeSessions: ApiSession[];\n};\n\nconst SettingsPrivacyActiveSessions: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n activeSessions,\n}) => {\n const {\n loadAuthorizations,\n terminateAuthorization,\n terminateAllAuthorizations,\n } = getDispatch();\n\n const [isConfirmTerminateAllDialogOpen, openConfirmTerminateAllDialog, closeConfirmTerminateAllDialog] = useFlag();\n useEffect(() => {\n loadAuthorizations();\n }, [loadAuthorizations]);\n\n const handleTerminateSessionClick = useCallback((hash: string) => {\n terminateAuthorization({ hash });\n }, [terminateAuthorization]);\n\n const handleTerminateAllSessions = useCallback(() => {\n closeConfirmTerminateAllDialog();\n terminateAllAuthorizations();\n }, [closeConfirmTerminateAllDialog, terminateAllAuthorizations]);\n\n const currentSession = useMemo(() => {\n return activeSessions.find((session) => session.isCurrent);\n }, [activeSessions]);\n\n const otherSessions = useMemo(() => {\n return activeSessions.filter((session) => !session.isCurrent);\n }, [activeSessions]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.PrivacyActiveSessions);\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 className=\"no-icon\">\n <div className=\"multiline-menu-item\" dir=\"auto\">\n <span className=\"title\" dir=\"auto\">{session.appName}</span>\n <span className=\"subtitle black tight\">{getDeviceEnvironment(session)}</span>\n <span className=\"subtitle\">{session.ip} - {getLocation(session)}</span>\n </div>\n </ListItem>\n\n <ListItem\n className=\"destructive mb-0 no-icon\"\n icon=\"stop\"\n ripple\n narrow\n onClick={openConfirmTerminateAllDialog}\n >\n {lang('TerminateAllSessions')}\n </ListItem>\n </div>\n );\n }\n\n function renderOtherSessions(sessions: ApiSession[]) {\n return (\n <div className=\"settings-item\">\n <h4 className=\"settings-item-header mb-4\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang('OtherSessions')}\n </h4>\n\n {sessions.map(renderSession)}\n </div>\n );\n }\n\n function renderSession(session: ApiSession) {\n return (\n <ListItem\n key={session.hash}\n ripple\n narrow\n contextActions={[{\n title: 'Terminate',\n icon: 'stop',\n handler: () => {\n handleTerminateSessionClick(session.hash);\n },\n }]}\n className=\"no-icon\"\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.appName}</span>\n <span className=\"subtitle black tight\">{getDeviceEnvironment(session)}</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\">\n {currentSession && renderCurrentSession(currentSession)}\n {otherSessions && renderOtherSessions(otherSessions)}\n {otherSessions && (\n <ConfirmDialog\n isOpen={isConfirmTerminateAllDialogOpen}\n onClose={closeConfirmTerminateAllDialog}\n text=\"Are you sure you want to terminate all other sessions?\"\n confirmLabel=\"Terminate All Other Sessions\"\n confirmHandler={handleTerminateAllSessions}\n confirmIsDestructive\n />\n )}\n </div>\n );\n};\n\nfunction getLocation(session: ApiSession) {\n return [session.region, session.country].filter(Boolean).join(', ');\n}\n\nfunction getDeviceEnvironment(session: ApiSession) {\n return `${session.deviceModel}${session.deviceModel ? ', ' : ''} ${session.platform} ${session.systemVersion}`;\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n activeSessions: global.activeSessions,\n };\n },\n)(SettingsPrivacyActiveSessions));\n","import React, {\n FC, useMemo, useState, memo, useRef, useCallback, useEffect,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiUser } from '../../../api/types';\n\nimport { filterUsersByName, getUserFullName } from '../../../modules/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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat, ApiCountryCode, ApiUser } from '../../../api/types';\nimport { SettingsScreens } from '../../../types';\n\nimport { CHAT_HEIGHT_PX } from '../../../config';\nimport { formatPhoneNumberWithCode } from '../../../util/phoneNumber';\nimport {\n getChatTitle, getUserFullName, isUserId,\n} from '../../../modules/helpers';\nimport renderText from '../../common/helpers/renderText';\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport useFlag from '../../../hooks/useFlag';\n\nimport ListItem from '../../ui/ListItem';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\nimport Avatar from '../../common/Avatar';\nimport Loading from '../../ui/Loading';\nimport BlockUserModal from './BlockUserModal';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n chatsByIds: Record<string, ApiChat>;\n usersByIds: Record<string, ApiUser>;\n blockedIds: string[];\n phoneCodeList: ApiCountryCode[];\n};\n\nconst SettingsPrivacyBlockedUsers: FC<OwnProps & StateProps> = ({\n isActive,\n onScreenSelect,\n onReset,\n chatsByIds,\n usersByIds,\n blockedIds,\n phoneCodeList,\n}) => {\n const { unblockContact } = getDispatch();\n\n const lang = useLang();\n const [isBlockUserModalOpen, openBlockUserModal, closeBlockUserModal] = useFlag();\n const handleUnblockClick = useCallback((contactId: string) => {\n unblockContact({ contactId });\n }, [unblockContact]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.PrivacyBlockedUsers);\n\n function renderContact(contactId: string, i: number, viewportOffset: number) {\n const isPrivate = isUserId(contactId);\n const user = isPrivate ? usersByIds[contactId] : undefined;\n const chat = !isPrivate ? chatsByIds[contactId] : undefined;\n\n const className = buildClassName(\n 'Chat chat-item-clickable blocked-list-item small-icon',\n isPrivate ? 'private' : 'group',\n );\n\n return (\n <ListItem\n key={contactId}\n className={className}\n ripple\n narrow\n contextActions={[{\n title: 'Unblock',\n icon: 'unlock',\n handler: () => {\n handleUnblockClick(contactId);\n },\n }]}\n style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}\n >\n <Avatar size=\"medium\" user={user} chat={chat} />\n <div className=\"contact-info\" dir=\"auto\">\n <h3 dir=\"auto\">{renderText((isPrivate ? getUserFullName(user) : getChatTitle(lang, chat!)) || '')}</h3>\n {user?.phoneNumber && (\n <div className=\"contact-phone\" dir=\"auto\">{formatPhoneNumberWithCode(phoneCodeList, user.phoneNumber)}</div>\n )}\n {user && !user.phoneNumber && user.username && (\n <div className=\"contact-username\" dir=\"auto\">@{user.username}</div>\n )}\n </div>\n </ListItem>\n );\n }\n\n return (\n <div className=\"settings-fab-wrapper\">\n <div className=\"settings-content infinite-scroll\">\n <div className=\"settings-item\">\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 '../../../../lib/teact/teactn';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { selectAnimatedEmoji } from '../../../../modules/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport ListItem from '../../../ui/ListItem';\nimport AnimatedEmoji from '../../../common/AnimatedEmoji';\nimport renderText from '../../../common/helpers/renderText';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst SettingsTwoFaEnabled: FC<OwnProps & StateProps> = ({\n isActive, onReset, animatedEmoji, onScreenSelect,\n}) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.TwoFaEnabled);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header\">\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 no-border\">\n <ListItem\n icon=\"edit\"\n onClick={() => onScreenSelect(SettingsScreens.TwoFaChangePasswordCurrent)}\n >\n {lang('ChangePassword')}\n </ListItem>\n <ListItem\n icon=\"password-off\"\n onClick={() => onScreenSelect(SettingsScreens.TwoFaTurnOff)}\n >\n {lang('TurnPasswordOff')}\n </ListItem>\n <ListItem\n icon=\"email\"\n onClick={() => onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCurrentPassword)}\n >\n {lang('SetRecoveryEmail')}\n </ListItem>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global) => {\n return {\n animatedEmoji: selectAnimatedEmoji(global, '🔐'),\n };\n})(SettingsTwoFaEnabled));\n","import React, {\n FC, memo, useCallback, useState,\n} from '../../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../../types';\n\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport PasswordMonkey from '../../../common/PasswordMonkey';\nimport PasswordForm from '../../../common/PasswordForm';\n\ntype OwnProps = {\n screen: SettingsScreens;\n error?: string;\n isLoading?: boolean;\n expectedPassword?: string;\n placeholder?: string;\n hint?: string;\n submitLabel?: string;\n clearError?: NoneToVoidFunction;\n onSubmit: (password: string) => void;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst EQUAL_PASSWORD_ERROR = 'Passwords Should Be Equal';\n\nconst SettingsTwoFaPassword: FC<OwnProps> = ({\n screen,\n isActive,\n onScreenSelect,\n onReset,\n error,\n isLoading,\n expectedPassword,\n placeholder = 'Current Password',\n hint,\n submitLabel,\n clearError,\n onSubmit,\n}) => {\n const [validationError, setValidationError] = useState<string>('');\n const [shouldShowPassword, setShouldShowPassword] = useState(false);\n\n const handleSubmit = useCallback((newPassword) => {\n if (expectedPassword && newPassword !== expectedPassword) {\n setValidationError(EQUAL_PASSWORD_ERROR);\n } else {\n onSubmit(newPassword);\n }\n }, [onSubmit, expectedPassword]);\n\n const handleClearError = useCallback(() => {\n if (clearError) {\n clearError();\n }\n setValidationError('');\n }, [clearError]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, screen);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header\">\n <PasswordMonkey isBig isPasswordVisible={shouldShowPassword} />\n </div>\n\n <div className=\"settings-item pt-0 no-border\">\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 '../../../../lib/teact/teactn';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { selectAnimatedEmoji } from '../../../../modules/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport AnimatedEmoji from '../../../common/AnimatedEmoji';\n\ntype OwnProps = {\n onStart: NoneToVoidFunction;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst SettingsTwoFaStart: FC<OwnProps & StateProps> = ({\n isActive, onScreenSelect, onReset, animatedEmoji, onStart,\n}) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.TwoFaDisabled);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header\">\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 no-border\">\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, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../lib/teact/teactn';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../../util/environment';\nimport { selectAnimatedEmoji } from '../../../../modules/selectors';\nimport useFlag from '../../../../hooks/useFlag';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport Button from '../../../ui/Button';\nimport Modal from '../../../ui/Modal';\nimport AnimatedEmoji from '../../../common/AnimatedEmoji';\nimport InputText from '../../../ui/InputText';\nimport renderText from '../../../common/helpers/renderText';\n\ntype OwnProps = {\n icon: 'hint' | 'email';\n type?: 'text' | 'email';\n isLoading?: boolean;\n error?: string;\n placeholder: string;\n shouldConfirm?: boolean;\n clearError?: NoneToVoidFunction;\n onSubmit: (value?: string) => void;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n screen: SettingsScreens;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\n\nconst SettingsTwoFaSkippableForm: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n type = 'text',\n isLoading,\n error,\n placeholder,\n shouldConfirm,\n clearError,\n onSubmit,\n isActive,\n onScreenSelect,\n onReset,\n screen,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n const [isConfirmShown, markIsConfirmShown, unmarkIsConfirmShown] = useFlag(false);\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (error && clearError) {\n clearError();\n }\n\n setValue(e.target.value);\n };\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 = () => {\n onSubmit();\n };\n\n const handleSkipConfirm = () => {\n unmarkIsConfirmShown();\n onSubmit();\n };\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, screen);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header\">\n <AnimatedEmoji sticker={animatedEmoji} size=\"large\" />\n </div>\n\n <div className=\"settings-item pt-0 no-border\">\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 } from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../lib/teact/teactn';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { selectAnimatedEmoji } from '../../../../modules/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 = () => {\n onScreenSelect(SettingsScreens.Privacy);\n };\n\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.TwoFaCongratulations);\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header\">\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 no-border\">\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, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\nimport { withGlobal } from '../../../../lib/teact/teactn';\n\nimport { ApiSticker } from '../../../../api/types';\nimport { SettingsScreens } from '../../../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../../util/environment';\nimport { selectAnimatedEmoji } from '../../../../modules/selectors';\nimport useLang from '../../../../hooks/useLang';\nimport useHistoryBack from '../../../../hooks/useHistoryBack';\n\nimport AnimatedEmoji from '../../../common/AnimatedEmoji';\nimport InputText from '../../../ui/InputText';\nimport Loading from '../../../ui/Loading';\n\ntype OwnProps = {\n isLoading?: boolean;\n error?: string;\n clearError: NoneToVoidFunction;\n onSubmit: (hint: string) => void;\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n screen: SettingsScreens;\n};\n\ntype StateProps = {\n animatedEmoji: ApiSticker;\n codeLength: number;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\n\nconst SettingsTwoFaEmailCode: FC<OwnProps & StateProps> = ({\n animatedEmoji,\n codeLength,\n isLoading,\n error,\n clearError,\n onSubmit,\n isActive,\n onScreenSelect,\n onReset,\n screen,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [value, setValue] = useState<string>('');\n\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n setTimeout(() => {\n inputRef.current!.focus();\n }, FOCUS_DELAY_TIMEOUT_MS);\n }\n }, []);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onScreenSelect, screen);\n\n const handleInputChange = (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 };\n\n return (\n <div className=\"settings-content two-fa custom-scroll\">\n <div className=\"settings-content-header\">\n <AnimatedEmoji sticker={animatedEmoji} size=\"large\" />\n </div>\n\n <div className=\"settings-item pt-0 no-border\">\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 { getDispatch, withGlobal } from '../../../../lib/teact/teactn';\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 } = getDispatch();\n\n useEffect(() => {\n if (waitingEmailCodeLength) {\n if (currentScreen === SettingsScreens.TwoFaNewPasswordEmail) {\n onScreenSelect(SettingsScreens.TwoFaNewPasswordEmailCode);\n } else if (currentScreen === SettingsScreens.TwoFaRecoveryEmail) {\n onScreenSelect(SettingsScreens.TwoFaRecoveryEmailCode);\n }\n }\n }, [currentScreen, onScreenSelect, waitingEmailCodeLength]);\n\n const handleStartWizard = useCallback(() => {\n dispatch({ type: 'reset' });\n onScreenSelect(SettingsScreens.TwoFaNewPassword);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPassword = useCallback((value: string) => {\n dispatch({ type: 'setPassword', payload: value });\n onScreenSelect(SettingsScreens.TwoFaNewPasswordConfirm);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPasswordConfirm = useCallback(() => {\n onScreenSelect(SettingsScreens.TwoFaNewPasswordHint);\n }, [onScreenSelect]);\n\n const handleNewPasswordHint = useCallback((value?: string) => {\n dispatch({ type: 'setHint', payload: value });\n onScreenSelect(SettingsScreens.TwoFaNewPasswordEmail);\n }, [dispatch, onScreenSelect]);\n\n const handleNewPasswordEmail = useCallback((value?: string) => {\n dispatch({ type: 'setEmail', payload: value });\n updatePassword({\n ...state,\n email: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updatePassword]);\n\n const handleChangePasswordCurrent = useCallback((value: string) => {\n dispatch({ type: 'setCurrentPassword', payload: value });\n checkPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaChangePasswordNew);\n },\n });\n }, [checkPassword, dispatch, onScreenSelect]);\n\n const handleChangePasswordNew = useCallback((value: string) => {\n dispatch({ type: 'setPassword', payload: value });\n onScreenSelect(SettingsScreens.TwoFaChangePasswordConfirm);\n }, [dispatch, onScreenSelect]);\n\n const handleChangePasswordConfirm = useCallback(() => {\n onScreenSelect(SettingsScreens.TwoFaChangePasswordHint);\n }, [onScreenSelect]);\n\n const handleChangePasswordHint = useCallback((value?: string) => {\n dispatch({ type: 'setHint', payload: value });\n updatePassword({\n ...state,\n hint: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updatePassword]);\n\n const handleTurnOff = useCallback((value: string) => {\n clearPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.Privacy);\n },\n });\n }, [clearPassword, onScreenSelect]);\n\n const handleRecoveryEmailCurrentPassword = useCallback((value: string) => {\n dispatch({ type: 'setCurrentPassword', payload: value });\n checkPassword({\n currentPassword: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaRecoveryEmail);\n },\n });\n }, [checkPassword, dispatch, onScreenSelect]);\n\n const handleRecoveryEmail = useCallback((value?: string) => {\n dispatch({ type: 'setEmail', payload: value });\n updateRecoveryEmail({\n ...state,\n email: value,\n onSuccess: () => {\n onScreenSelect(SettingsScreens.TwoFaCongratulations);\n },\n });\n }, [dispatch, onScreenSelect, state, updateRecoveryEmail]);\n\n const handleEmailCode = useCallback((code: string) => {\n provideTwoFaEmailCode({ code });\n }, [provideTwoFaEmailCode]);\n\n const lang = useLang();\n\n switch (currentScreen) {\n case SettingsScreens.TwoFaDisabled:\n return (\n <SettingsTwoFaStart\n onStart={handleStartWizard}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPassword,\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPassword:\n return (\n <SettingsTwoFaPassword\n screen={currentScreen}\n placeholder={lang('PleaseEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPassword}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordConfirm,\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordConfirm:\n return (\n <SettingsTwoFaPassword\n screen={currentScreen}\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n submitLabel={lang('Continue')}\n onSubmit={handleNewPasswordConfirm}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordHint,\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleNewPasswordHint}\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmail,\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmail:\n return (\n <SettingsTwoFaSkippableForm\n icon=\"email\"\n type=\"email\"\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n placeholder={lang('RecoveryEmailTitle')}\n shouldConfirm\n onSubmit={handleNewPasswordEmail}\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaNewPasswordEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n return (\n <SettingsTwoFaEmailCode\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaCongratulations:\n return (\n <SettingsTwoFaCongratulations\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaEnabled:\n return (\n <SettingsTwoFaEnabled\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordCurrent,\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaTurnOff,\n SettingsScreens.TwoFaRecoveryEmailCurrentPassword,\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordCurrent:\n return (\n <SettingsTwoFaPassword\n screen={currentScreen}\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleChangePasswordCurrent}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordNew,\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordNew:\n return (\n <SettingsTwoFaPassword\n screen={currentScreen}\n placeholder={lang('PleaseEnterNewFirstPassword')}\n onSubmit={handleChangePasswordNew}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordConfirm,\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordConfirm:\n return (\n <SettingsTwoFaPassword\n screen={currentScreen}\n expectedPassword={state.password}\n placeholder={lang('PleaseReEnterPassword')}\n onSubmit={handleChangePasswordConfirm}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaChangePasswordHint,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaChangePasswordHint:\n return (\n <SettingsTwoFaSkippableForm\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n icon=\"hint\"\n placeholder={lang('PasswordHintPlaceholder')}\n onSubmit={handleChangePasswordHint}\n onScreenSelect={onScreenSelect}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n screen={currentScreen}\n />\n );\n\n case SettingsScreens.TwoFaTurnOff:\n return (\n <SettingsTwoFaPassword\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleTurnOff}\n onScreenSelect={onScreenSelect}\n isActive={isActive}\n onReset={onReset}\n screen={currentScreen}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n return (\n <SettingsTwoFaPassword\n screen={currentScreen}\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n hint={hint}\n onSubmit={handleRecoveryEmailCurrentPassword}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmail,\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmail:\n return (\n <SettingsTwoFaSkippableForm\n screen={currentScreen}\n icon=\"email\"\n type=\"email\"\n placeholder={lang('RecoveryEmailTitle')}\n onSubmit={handleRecoveryEmail}\n onScreenSelect={onScreenSelect}\n isActive={isActive || [\n SettingsScreens.TwoFaRecoveryEmailCode,\n SettingsScreens.TwoFaCongratulations,\n ].includes(shownScreen)}\n onReset={onReset}\n />\n );\n\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFaEmailCode\n screen={currentScreen}\n isLoading={isLoading}\n error={error}\n clearError={clearTwoFaError}\n onSubmit={handleEmailCode}\n onScreenSelect={onScreenSelect}\n isActive={isActive || shownScreen === SettingsScreens.TwoFaCongratulations}\n onReset={onReset}\n />\n );\n\n default:\n return undefined;\n }\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => ({ ...global.twoFaSettings }),\n)(SettingsTwoFa));\n","import React, {\n FC, memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\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, isChatGroup, isUserId } from '../../../modules/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager';\nimport { getPrivacyKey } from './helper/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 } = getDispatch();\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 return chat && ((isUserId(chat.id) && chat.id !== currentUserId) || isChatGroup(chat));\n });\n\n return unique([\n ...selectedContactIds,\n ...filterChatsByName(lang, chatIds, chatsById, searchQuery),\n ]);\n }, [folderAllOrderedIds, folderArchivedOrderedIds, selectedContactIds, lang, searchQuery, currentUserId]);\n\n const handleSelectedContactIdsChange = useCallback((value: string[]) => {\n setNewSelectedContactIds(value);\n setIsSubmitShown(true);\n }, []);\n\n const handleSubmit = useCallback(() => {\n setPrivacySettings({\n privacyKey: getPrivacyKey(screen),\n isAllowList: Boolean(isAllowList),\n contactsIds: newSelectedContactIds,\n });\n\n onScreenSelect(SettingsScreens.Privacy);\n }, [isAllowList, newSelectedContactIds, onScreenSelect, screen, setPrivacySettings]);\n\n useHistoryBack(isActive, onReset, onScreenSelect, screen);\n\n return (\n <div className=\"NewChat-inner step-1\">\n <Picker\n itemIds={displayedIds || []}\n selectedIds={newSelectedContactIds}\n filterValue={searchQuery}\n filterPlaceholder={isAllowList ? lang('AlwaysShareWithPlaceholder') : lang('NeverShareWithPlaceholder')}\n searchInputId=\"new-group-picker-search\"\n onSelectedIdsChange={handleSelectedContactIdsChange}\n onFilterChange={setSearchQuery}\n />\n\n <FloatingActionButton\n isShown={isSubmitShown}\n onClick={handleSubmit}\n ariaLabel={isAllowList ? lang('AlwaysShareWithTitle') : lang('NeverShareWithTitle')}\n >\n <i className=\"icon-arrow-right\" />\n </FloatingActionButton>\n </div>\n );\n};\n\nfunction getCurrentPrivacySettings(global: GlobalState, screen: SettingsScreens) {\n const { privacy } = global.settings;\n switch (screen) {\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n return privacy.phoneNumber;\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n return privacy.lastSeen;\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n return privacy.profilePhoto;\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n return privacy.forwards;\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return privacy.chatInvite;\n }\n\n return undefined;\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { screen }): StateProps => {\n return {\n currentUserId: global.currentUserId,\n settings: getCurrentPrivacySettings(global, screen),\n };\n },\n)(SettingsPrivacyVisibilityExceptionList));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { SettingsScreens } from '../../../types';\nimport { ApiAvailableReaction } from '../../../api/types';\n\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport RadioGroup from '../../ui/RadioGroup';\n\ntype OwnProps = {\n isActive?: boolean;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\ntype StateProps = {\n availableReactions?: ApiAvailableReaction[];\n selectedReaction?: string;\n};\n\nconst SettingsQuickReaction: FC<OwnProps & StateProps> = ({\n isActive,\n onReset,\n onScreenSelect,\n availableReactions,\n selectedReaction,\n}) => {\n const { setDefaultReaction } = getDispatch();\n useHistoryBack(isActive, onReset, onScreenSelect, SettingsScreens.General);\n\n const options = availableReactions?.filter((l) => !l.isInactive).map((l) => {\n return {\n label: <><ReactionStaticEmoji reaction={l.reaction} />{l.title}</>,\n value: l.reaction,\n };\n }) || [];\n\n const handleChange = useCallback((reaction: string) => {\n setDefaultReaction({ reaction });\n }, [setDefaultReaction]);\n\n return (\n <div className=\"settings-content settings-item custom-scroll settings-quick-reaction\">\n <RadioGroup\n name=\"quick-reaction-settings\"\n options={options}\n selected={selectedReaction}\n onChange={handleChange}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global) => {\n const { availableReactions, appConfig } = global;\n\n return {\n availableReactions,\n selectedReaction: appConfig?.defaultReaction,\n };\n },\n)(SettingsQuickReaction));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\n\nimport { SettingsScreens } from '../../../types';\nimport { FolderEditDispatch, FoldersState } from '../../../hooks/reducers/useFoldersReducer';\n\nimport { LAYERS_ANIMATION_NAME } from '../../../util/environment';\nimport useTwoFaReducer from '../../../hooks/reducers/useTwoFaReducer';\n\nimport Transition from '../../ui/Transition';\nimport SettingsHeader from './SettingsHeader';\nimport SettingsMain from './SettingsMain';\nimport SettingsEditProfile from './SettingsEditProfile';\nimport SettingsDataStorage from './SettingsDataStorage';\nimport SettingsFolders from './folders/SettingsFolders';\nimport SettingsGeneral from './SettingsGeneral';\nimport SettingsGeneralBackground from './SettingsGeneralBackground';\nimport SettingsGeneralBackgroundColor from './SettingsGeneralBackgroundColor';\nimport SettingsNotifications from './SettingsNotifications';\nimport SettingsPrivacy from './SettingsPrivacy';\nimport SettingsLanguage from './SettingsLanguage';\nimport SettingsPrivacyVisibility from './SettingsPrivacyVisibility';\nimport SettingsPrivacyActiveSessions from './SettingsPrivacyActiveSessions';\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.PrivacyActiveSessions,\n];\n\nconst PRIVACY_PHONE_NUMBER_SCREENS = [\n SettingsScreens.PrivacyPhoneNumberAllowedContacts,\n SettingsScreens.PrivacyPhoneNumberDeniedContacts,\n];\n\nconst PRIVACY_LAST_SEEN_PHONE_SCREENS = [\n SettingsScreens.PrivacyLastSeenAllowedContacts,\n SettingsScreens.PrivacyLastSeenDeniedContacts,\n];\n\nconst PRIVACY_PROFILE_PHOTO_SCREENS = [\n SettingsScreens.PrivacyProfilePhotoAllowedContacts,\n SettingsScreens.PrivacyProfilePhotoDeniedContacts,\n];\n\nconst PRIVACY_FORWARDING_SCREENS = [\n SettingsScreens.PrivacyForwardingAllowedContacts,\n SettingsScreens.PrivacyForwardingDeniedContacts,\n];\n\nconst PRIVACY_GROUP_CHATS_SCREENS = [\n SettingsScreens.PrivacyGroupChatsAllowedContacts,\n SettingsScreens.PrivacyGroupChatsDeniedContacts,\n];\n\nexport type OwnProps = {\n isActive: boolean;\n currentScreen: SettingsScreens;\n foldersState: FoldersState;\n foldersDispatch: FolderEditDispatch;\n onScreenSelect: (screen: SettingsScreens) => void;\n shouldSkipTransition?: boolean;\n onReset: () => void;\n};\n\nconst Settings: FC<OwnProps> = ({\n isActive,\n currentScreen,\n foldersState,\n foldersDispatch,\n onScreenSelect,\n onReset,\n shouldSkipTransition,\n}) => {\n const [twoFaState, twoFaDispatch] = useTwoFaReducer();\n\n const handleReset = useCallback(() => {\n if (\n currentScreen === SettingsScreens.FoldersCreateFolder\n || currentScreen === SettingsScreens.FoldersEditFolder\n || currentScreen === SettingsScreens.FoldersEditFolderFromChatList\n ) {\n setTimeout(() => {\n foldersDispatch({ type: 'reset' });\n }, TRANSITION_DURATION);\n }\n\n if (\n currentScreen === SettingsScreens.FoldersIncludedChats\n || currentScreen === SettingsScreens.FoldersExcludedChats\n ) {\n if (foldersState.mode === 'create') {\n onScreenSelect(SettingsScreens.FoldersCreateFolder);\n } else {\n onScreenSelect(SettingsScreens.FoldersEditFolder);\n }\n return;\n }\n\n onReset();\n }, [\n foldersState.mode, foldersDispatch,\n currentScreen, onReset, onScreenSelect,\n ]);\n\n const handleSaveFilter = useCallback(() => {\n foldersDispatch({ type: 'saveFilters' });\n handleReset();\n }, [foldersDispatch, handleReset]);\n\n function renderCurrentSectionContent(isScreenActive: boolean, screen: SettingsScreens) {\n const privacyAllowScreens: Record<number, boolean> = {\n [SettingsScreens.PrivacyPhoneNumber]: PRIVACY_PHONE_NUMBER_SCREENS.includes(screen),\n [SettingsScreens.PrivacyLastSeen]: PRIVACY_LAST_SEEN_PHONE_SCREENS.includes(screen),\n [SettingsScreens.PrivacyProfilePhoto]: PRIVACY_PROFILE_PHOTO_SCREENS.includes(screen),\n [SettingsScreens.PrivacyForwarding]: PRIVACY_FORWARDING_SCREENS.includes(screen),\n [SettingsScreens.PrivacyGroupChats]: PRIVACY_GROUP_CHATS_SCREENS.includes(screen),\n };\n\n const isTwoFaScreen = TWO_FA_SCREENS.includes(screen);\n const isFoldersScreen = FOLDERS_SCREENS.includes(screen);\n const isPrivacyScreen = PRIVACY_SCREENS.includes(screen)\n || isTwoFaScreen\n || Object.keys(privacyAllowScreens).includes(screen.toString())\n || Object.values(privacyAllowScreens).find((key) => key === true);\n\n switch (currentScreen) {\n case SettingsScreens.Main:\n return (\n <SettingsMain onScreenSelect={onScreenSelect} isActive={isActive} onReset={handleReset} />\n );\n case SettingsScreens.EditProfile:\n return (\n <SettingsEditProfile\n onScreenSelect={onScreenSelect}\n isActive={isActive && isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.General:\n return (\n <SettingsGeneral\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive\n || screen === SettingsScreens.GeneralChatBackgroundColor\n || screen === SettingsScreens.GeneralChatBackground\n || screen === SettingsScreens.QuickReaction\n || isPrivacyScreen || isFoldersScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.QuickReaction:\n return (\n <SettingsQuickReaction onScreenSelect={onScreenSelect} isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Notifications:\n return (\n <SettingsNotifications onScreenSelect={onScreenSelect} isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.DataStorage:\n return (\n <SettingsDataStorage onScreenSelect={onScreenSelect} isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.Privacy:\n return (\n <SettingsPrivacy\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || isPrivacyScreen || isTwoFaScreen}\n onReset={handleReset}\n />\n );\n case SettingsScreens.Language:\n return (\n <SettingsLanguage onScreenSelect={onScreenSelect} isActive={isScreenActive} onReset={handleReset} />\n );\n case SettingsScreens.GeneralChatBackground:\n return (\n <SettingsGeneralBackground\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || screen === SettingsScreens.GeneralChatBackgroundColor}\n onReset={handleReset}\n />\n );\n case SettingsScreens.GeneralChatBackgroundColor:\n return (\n <SettingsGeneralBackgroundColor\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyActiveSessions:\n return (\n <SettingsPrivacyActiveSessions\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyBlockedUsers:\n return (\n <SettingsPrivacyBlockedUsers\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyGroupChats:\n return (\n <SettingsPrivacyVisibility\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n isAllowList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive || privacyAllowScreens[currentScreen]}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n return (\n <SettingsPrivacyVisibilityExceptionList\n screen={currentScreen}\n onScreenSelect={onScreenSelect}\n isActive={isScreenActive}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.Folders:\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n case SettingsScreens.FoldersEditFolderFromChatList:\n case SettingsScreens.FoldersIncludedChats:\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n case SettingsScreens.FoldersExcludedChats:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n return (\n <SettingsFolders\n currentScreen={currentScreen}\n shownScreen={screen}\n state={foldersState}\n dispatch={foldersDispatch}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n case SettingsScreens.TwoFaDisabled:\n case SettingsScreens.TwoFaNewPassword:\n case SettingsScreens.TwoFaNewPasswordConfirm:\n case SettingsScreens.TwoFaNewPasswordHint:\n case SettingsScreens.TwoFaNewPasswordEmail:\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n case SettingsScreens.TwoFaCongratulations:\n case SettingsScreens.TwoFaEnabled:\n case SettingsScreens.TwoFaChangePasswordCurrent:\n case SettingsScreens.TwoFaChangePasswordNew:\n case SettingsScreens.TwoFaChangePasswordConfirm:\n case SettingsScreens.TwoFaChangePasswordHint:\n case SettingsScreens.TwoFaTurnOff:\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n case SettingsScreens.TwoFaRecoveryEmail:\n case SettingsScreens.TwoFaRecoveryEmailCode:\n return (\n <SettingsTwoFa\n currentScreen={currentScreen}\n state={twoFaState}\n dispatch={twoFaDispatch}\n shownScreen={screen}\n isActive={isScreenActive}\n onScreenSelect={onScreenSelect}\n onReset={handleReset}\n />\n );\n\n default:\n return undefined;\n }\n }\n\n function renderCurrentSection(isScreenActive: boolean, isFrom: boolean, currentKey: SettingsScreens) {\n return (\n <>\n <SettingsHeader\n currentScreen={currentScreen}\n onReset={handleReset}\n onSaveFilter={handleSaveFilter}\n onScreenSelect={onScreenSelect}\n editedFolderId={foldersState.folderId}\n />\n {renderCurrentSectionContent(isScreenActive, currentKey)}\n </>\n );\n }\n\n return (\n <Transition\n id=\"Settings\"\n name={shouldSkipTransition ? 'none' : LAYERS_ANIMATION_NAME}\n activeKey={currentScreen}\n renderCount={TRANSITION_RENDER_COUNT}\n >\n {renderCurrentSection}\n </Transition>\n );\n};\n\nexport default memo(Settings);\n","import React, {\n FC, useEffect, useCallback, useMemo, memo,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/helpers';\nimport useInfiniteScroll from '../../../hooks/useInfiniteScroll';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport ListItem from '../../ui/ListItem';\nimport Loading from '../../ui/Loading';\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 } = getDispatch();\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadContactList();\n });\n });\n\n useHistoryBack(isActive, onReset);\n\n const handleClick = useCallback((id: string) => {\n openChat({ id, shouldReplaceHistory: true });\n }, [openChat]);\n\n const listIds = useMemo(() => {\n if (!contactIds) {\n return undefined;\n }\n\n const filteredIds = filterUsersByName(contactIds, usersById, filter);\n\n return sortUserIds(filteredIds, usersById, userStatusesById, undefined, serverTimeOffset);\n }, [contactIds, filter, usersById, userStatusesById, serverTimeOffset]);\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, listIds, Boolean(filter));\n\n return (\n <InfiniteScroll items={viewportIds} onLoadMore={getMore} className=\"chat-list custom-scroll\">\n {viewportIds?.length ? (\n viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable\"\n 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 </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 { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat } from '../../../api/types';\n\nimport { unique } from '../../../util/iteratees';\nimport { throttle } from '../../../util/schedulers';\nimport { filterUsersByName, isUserBot, sortChatIds } from '../../../modules/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 } = getDispatch();\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadContactList();\n });\n });\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset);\n\n const handleFilterChange = useCallback((query: string) => {\n setGlobalSearchQuery({ query });\n }, [setGlobalSearchQuery]);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const foundContactIds = localContactIds ? filterUsersByName(localContactIds, usersById, searchQuery) : [];\n\n return sortChatIds(\n unique([\n ...foundContactIds,\n ...(localUserIds || []),\n ...(globalUserIds || []),\n ]).filter((contactId) => {\n const user = usersById[contactId];\n if (!user) {\n return true;\n }\n\n return !user.isSelf && (user.canBeInvitedToGroup || !isUserBot(user));\n }),\n chatsById,\n false,\n selectedMemberIds,\n );\n }, [localContactIds, chatsById, searchQuery, localUserIds, globalUserIds, selectedMemberIds]);\n\n const handleNextStep = useCallback(() => {\n if (selectedMemberIds.length || isChannel) {\n setGlobalSearchQuery({ query: '' });\n onNextStep();\n }\n }, [selectedMemberIds.length, isChannel, setGlobalSearchQuery, onNextStep]);\n\n return (\n <div className=\"NewChat step-1\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel=\"Return to Chat List\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang('GroupAddMembers')}</h3>\n </div>\n <div className=\"NewChat-inner step-1\">\n <Picker\n itemIds={displayedIds}\n selectedIds={selectedMemberIds}\n filterValue={searchQuery}\n filterPlaceholder={lang('SendMessageTo')}\n searchInputId=\"new-group-picker-search\"\n isLoading={isSearching}\n onSelectedIdsChange={onSelectedMemberIdsChange}\n onFilterChange={handleFilterChange}\n />\n\n <FloatingActionButton\n isShown={Boolean(selectedMemberIds.length || isChannel)}\n onClick={handleNextStep}\n ariaLabel={isChannel ? 'Continue To Channel Info' : 'Continue To Group Info'}\n >\n <i className=\"icon-arrow-right\" />\n </FloatingActionButton>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { userIds: localContactIds } = global.contactList || {};\n const { byId: chatsById } = global.chats;\n\n const {\n query: searchQuery,\n fetchingStatus,\n globalResults,\n localResults,\n } = global.globalSearch;\n const { userIds: globalUserIds } = globalResults || {};\n const { userIds: localUserIds } = localResults || {};\n\n return {\n chatsById,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus?.chats,\n globalUserIds,\n localUserIds,\n };\n },\n)(NewChatStep1));\n","import React, {\n FC, useState, useCallback, useEffect, memo,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\n\n const lang = useLang();\n\n useHistoryBack(isActive, onReset);\n\n const [title, setTitle] = useState('');\n const [about, setAbout] = useState('');\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n\n const chatTitleEmptyError = 'Chat title can\\'t be empty';\n const channelTitleEmptyError = 'Channel title can\\'t be empty';\n const chatTooManyUsersError = 'Sorry, creating supergroups is not yet supported';\n\n const isLoading = creationProgress === ChatCreationProgress.InProgress;\n\n const handleTitleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { value } = e.currentTarget;\n const newValue = value.replace(/^\\s+/, '');\n\n setTitle(newValue);\n\n if (newValue !== value) {\n e.currentTarget.value = newValue;\n }\n }, []);\n\n const handleDescriptionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setAbout(e.currentTarget.value);\n }, []);\n\n const handleCreateGroup = useCallback(() => {\n if (!title.length) {\n setError(chatTitleEmptyError);\n return;\n }\n\n if (memberIds.length > MAX_USERS_FOR_LEGACY_CHAT) {\n setError(chatTooManyUsersError);\n return;\n }\n\n createGroupChat({\n title,\n photo,\n memberIds,\n });\n }, [title, memberIds, createGroupChat, photo, chatTitleEmptyError, chatTooManyUsersError]);\n\n const handleCreateChannel = useCallback(() => {\n if (!title.length) {\n setError(channelTitleEmptyError);\n return;\n }\n\n createChannel({\n title,\n about,\n photo,\n memberIds,\n });\n }, [title, createChannel, about, photo, memberIds, channelTitleEmptyError]);\n\n useEffect(() => {\n if (creationProgress === ChatCreationProgress.Complete) {\n onReset(true);\n }\n }, [creationProgress, onReset]);\n\n const renderedError = (creationError && lang(creationError)) || (\n error !== chatTitleEmptyError && error !== channelTitleEmptyError\n ? error\n : undefined\n );\n\n return (\n <div className=\"NewChat\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={() => onReset()}\n ariaLabel=\"Return to member selection\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang(isChannel ? 'NewChannel' : 'NewGroup')}</h3>\n </div>\n <div className=\"NewChat-inner step-2\">\n <AvatarEditable\n onChange={setPhoto}\n title={lang('AddPhoto')}\n />\n <InputText\n value={title}\n onChange={handleTitleChange}\n label={lang(isChannel ? 'EnterChannelName' : 'GroupName')}\n error={error === chatTitleEmptyError || error === channelTitleEmptyError ? error : undefined}\n />\n {isChannel && (\n <>\n <InputText\n value={about}\n onChange={handleDescriptionChange}\n label={lang('DescriptionOptionalPlaceholder')}\n />\n <p className=\"note\">{lang('DescriptionInfo')}</p>\n </>\n )}\n\n {renderedError && (\n <p className=\"error\">{renderedError}</p>\n )}\n\n {memberIds.length > 0 && (\n <>\n <h3 className=\"chat-members-heading\">{lang('GroupInfo.ParticipantCount', memberIds.length, 'i')}</h3>\n\n <div className=\"chat-members-list custom-scroll\">\n {memberIds.map((id) => (\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo userId={id} />\n </ListItem>\n ))}\n </div>\n </>\n )}\n </div>\n\n <FloatingActionButton\n isShown={title.length !== 0}\n onClick={isChannel ? handleCreateChannel : handleCreateGroup}\n disabled={isLoading}\n ariaLabel={isChannel ? lang('ChannelIntro.CreateChannel') : 'Create Group'}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-arrow-right\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n progress: creationProgress,\n error: creationError,\n } = global.chatCreation || {};\n\n return {\n creationProgress,\n creationError,\n };\n },\n)(NewChatStep2));\n","import React, {\n FC, memo, useCallback, useState,\n} from '../../../lib/teact/teact';\n\nimport { LeftColumnContent } from '../../../types';\n\nimport { LAYERS_ANIMATION_NAME } from '../../../util/environment';\n\nimport Transition from '../../ui/Transition';\nimport NewChatStep1 from './NewChatStep1';\nimport NewChatStep2 from './NewChatStep2';\n\nimport './NewChat.scss';\n\nexport type OwnProps = {\n isActive: boolean;\n isChannel?: boolean;\n content: LeftColumnContent;\n onContentChange: (content: LeftColumnContent) => void;\n onReset: () => void;\n};\n\nconst RENDER_COUNT = Object.keys(LeftColumnContent).length / 2;\n\nconst NewChat: FC<OwnProps> = ({\n isActive,\n isChannel = false,\n content,\n onContentChange,\n onReset,\n}) => {\n const [newChatMemberIds, setNewChatMemberIds] = useState<string[]>([]);\n\n const handleNextStep = useCallback(() => {\n onContentChange(isChannel ? LeftColumnContent.NewChannelStep2 : LeftColumnContent.NewGroupStep2);\n }, [isChannel, onContentChange]);\n\n return (\n <Transition\n id=\"NewChat\"\n name={LAYERS_ANIMATION_NAME}\n renderCount={RENDER_COUNT}\n activeKey={content}\n >\n {(isStepActive) => {\n switch (content) {\n case LeftColumnContent.NewChannelStep1:\n case LeftColumnContent.NewGroupStep1:\n return (\n <NewChatStep1\n isChannel={isChannel}\n isActive={isActive}\n selectedMemberIds={newChatMemberIds}\n onSelectedMemberIdsChange={setNewChatMemberIds}\n onNextStep={handleNextStep}\n onReset={onReset}\n />\n );\n case LeftColumnContent.NewChannelStep2:\n case LeftColumnContent.NewGroupStep2:\n return (\n <NewChatStep2\n isChannel={isChannel}\n isActive={isStepActive && isActive}\n memberIds={newChatMemberIds}\n onReset={onReset}\n />\n );\n default:\n return undefined;\n }\n }}\n </Transition>\n );\n};\n\nexport default memo(NewChat);\n","import React, { FC, memo } from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\n\nimport Button from '../ui/Button';\nimport ChatList from './main/ChatList';\nimport { LeftColumnContent } from '../../types';\n\nimport './ArchivedChats.scss';\n\nexport type OwnProps = {\n isActive: boolean;\n onReset: () => void;\n onContentChange: (content: LeftColumnContent) => void;\n};\n\nconst ArchivedChats: FC<OwnProps> = ({ isActive, onReset, onContentChange }) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onReset, onContentChange, LeftColumnContent.Archived);\n\n return (\n <div className=\"ArchivedChats\">\n <div className=\"left-header\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={onReset}\n ariaLabel=\"Return to chat list\"\n >\n <i className=\"icon-arrow-left\" />\n </Button>\n <h3>{lang('ArchivedChats')}</h3>\n </div>\n <ChatList folderType=\"archived\" isActive={isActive} />\n </div>\n );\n};\n\nexport default memo(ArchivedChats);\n","import React, {\n FC, useCallback, memo, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\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 } = getDispatch();\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 '../../../../modules/helpers';\nimport { CLIPBOARD_ITEM_SUPPORTED, copyImageToClipboard, copyTextToClipboard } from '../../../../util/clipboard';\n\ntype ICopyOptions = {\n label: string;\n handler: () => void;\n}[];\n\nexport function getMessageCopyOptions(\n message: ApiMessage, afterEffect?: () => void, onCopyLink?: () => 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 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 handler: () => {\n const clipboardText = hasSelection && selection ? selection.toString() : getMessageTextWithSpoilers(message)!;\n copyTextToClipboard(clipboardText);\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 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';\n\nimport AnimatedSticker from '../../common/AnimatedSticker';\n\nimport './ReactionSelectorReaction.scss';\n\nconst REACTION_SIZE = 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> = ({ reaction, previewIndex, onSendReaction, isReady }) => {\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('&')}\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 // @ts-ignore\n style={`background-position-x: ${previewIndex * -32}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 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('&')} 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 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 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 onDownload?: () => 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 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 onShowSeenBy,\n onShowReactors,\n onSendReaction,\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);\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 // @ts-ignore teact feature\n style={menuStyle}\n ref={scrollableRef}\n >\n {canRemoveReaction && <MenuItem icon=\"reactions\" onClick={handleRemoveReaction}>Remove Reaction</MenuItem>}\n {canSendNow && <MenuItem icon=\"send-outline\" onClick={onSend}>{lang('MessageScheduleSend')}</MenuItem>}\n {canReschedule && (\n <MenuItem icon=\"schedule\" onClick={onReschedule}>{lang('MessageScheduleEditTime')}</MenuItem>\n )}\n {canReply && <MenuItem icon=\"reply\" onClick={onReply}>{lang('Reply')}</MenuItem>}\n {canEdit && <MenuItem icon=\"edit\" onClick={onEdit}>{lang('Edit')}</MenuItem>}\n {canFaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onFaveSticker}>{lang('AddToFavorites')}</MenuItem>\n )}\n {canUnfaveSticker && (\n <MenuItem icon=\"favorite\" onClick={onUnfaveSticker}>{lang('Stickers.RemoveFromFavorites')}</MenuItem>\n )}\n {canCopy && copyOptions.map((options) => (\n <MenuItem key={options.label} icon=\"copy\" onClick={options.handler}>{lang(options.label)}</MenuItem>\n ))}\n {canPin && <MenuItem icon=\"pin\" onClick={onPin}>{lang('DialogPin')}</MenuItem>}\n {canUnpin && <MenuItem icon=\"unpin\" onClick={onUnpin}>{lang('DialogUnpin')}</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 icon={canShowReactionsCount ? 'reactions' : 'group'}\n onClick={canShowReactionsCount ? onShowReactors : onShowSeenBy}\n disabled={!canShowReactionsCount && !message.seenByUserIds?.length}\n >\n {canShowReactionsCount && message.reactors?.count ? (\n canShowSeenBy && message.seenByUserIds?.length\n ? lang('Chat.OutgoingContextMixedReactionCount', [message.reactors.count, message.seenByUserIds.length])\n : lang('Chat.ContextReactionCount', message.reactors.count, 'i')\n ) : (\n message.seenByUserIds?.length\n ? lang('Conversation.ContextMenuSeen', message.seenByUserIds.length, 'i')\n : lang('Conversation.ContextMenuNoViews')\n )}\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 { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/selectors';\nimport {\n isActionMessage, isChatChannel,\n isChatGroup, isOwnMessage, areReactionsEmpty, isUserId,\n} from '../../../modules/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 ReportMessageModal from '../../common/ReportMessageModal';\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 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 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 } = getDispatch();\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 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 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 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 onDownload={handleDownloadClick}\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 <ReportMessageModal\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 } = (threadId && selectAllowedMessageActions(global, message, threadId)) || {};\n const isPinned = messageListType === 'pinned';\n const isScheduled = messageListType === 'scheduled';\n const isChannel = chat && isChatChannel(chat);\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 = !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 activeDownloads,\n canShowSeenBy,\n enabledReactions: chat?.fullInfo?.enabledReactions,\n isPrivate,\n hasFullInfo: Boolean(chat?.fullInfo),\n canShowReactionsCount,\n canShowReactionList: !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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiSticker, ApiStickerSet } from '../../api/types';\n\nimport { STICKER_SIZE_MODAL } from '../../config';\nimport {\n selectChat, selectCurrentMessageList, selectStickerSet, selectStickerSetByShortName,\n} from '../../modules/selectors';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport renderText from './helpers/renderText';\nimport { getAllowedAttachmentOptions, getCanPostInChat } from '../../modules/helpers';\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};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst StickerSetModal: FC<OwnProps & StateProps> = ({\n isOpen,\n fromSticker,\n stickerSetShortName,\n stickerSet,\n canSendStickers,\n onClose,\n}) => {\n const {\n loadStickers,\n toggleStickerSet,\n sendMessage,\n } = getDispatch();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const lang = useLang();\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) => {\n sticker = {\n ...sticker,\n isPreloadedGlobally: true,\n };\n\n sendMessage({ sticker });\n onClose();\n }, [onClose, sendMessage]);\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 />\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 </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\n return {\n canSendStickers,\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, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiChat } from '../../api/types';\nimport { IAnchorPosition } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { disableScrolling, enableScrolling } from '../../util/scrollLock';\nimport {\n selectChat, selectNotifySettings, selectNotifyExceptions, selectUser,\n} from '../../modules/selectors';\nimport {\n isUserId, getCanDeleteChat, selectIsChatMuted, getCanAddContact,\n} from '../../modules/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';\n\nimport './HeaderMenuContainer.scss';\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 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 isPrivate?: boolean;\n isMuted?: boolean;\n canAddContact?: 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 canStartBot,\n canRestartBot,\n canSubscribe,\n canSearch,\n canCall,\n canMute,\n canLeave,\n canEnterVoiceChat,\n canCreateVoiceChat,\n chat,\n isPrivate,\n isMuted,\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 addContact,\n openCallFallbackConfirm,\n } = getDispatch();\n\n const [isMenuOpen, setIsMenuOpen] = useState(true);\n const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);\n const { x, y } = anchor;\n\n useShowTransition(isOpen, onCloseAnimationEnd, undefined, false);\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 addContact({ userId: chatId });\n closeMenu();\n }, [addContact, chatId, closeMenu]);\n\n const handleSubscribe = useCallback(() => {\n onSubscribeChannel();\n closeMenu();\n }, [closeMenu, onSubscribeChannel]);\n\n const handleCall = useCallback(() => {\n openCallFallbackConfirm();\n closeMenu();\n }, [closeMenu, openCallFallbackConfirm]);\n\n const handleSearch = useCallback(() => {\n onSearchClick();\n closeMenu();\n }, [closeMenu, onSearchClick]);\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 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 {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 {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 </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\n return {\n chat,\n isMuted: selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)),\n isPrivate,\n canAddContact,\n canDeleteChat: getCanDeleteChat(chat),\n hasLinkedChat: Boolean(chat?.fullInfo?.linkedChatId),\n };\n },\n)(HeaderMenuContainer));\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState, useLayoutEffect,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiChat } from '../../api/types';\n\nimport { debounce } from '../../util/schedulers';\nimport { selectCurrentTextSearch, selectCurrentChat } from '../../modules/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 } = getDispatch();\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 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>,\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 '../../../lib/teact/teactn';\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 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_IMAGE_CONTENT_TYPES,\n SUPPORTED_VIDEO_CONTENT_TYPES,\n} from '../../../config';\nimport { getFileExtension } from '../../common/helpers/documentInfo';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\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 { 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';\n\nimport './AttachmentModal.scss';\n\nexport type OwnProps = {\n chatId: string;\n threadId: number;\n attachments: ApiAttachment[];\n caption: string;\n isReady?: boolean;\n currentUserId?: string;\n groupChatMembers?: ApiChatMember[];\n recentEmojis: string[];\n baseEmojiKeywords?: Record<string, string[]>;\n emojiKeywords?: Record<string, string[]>;\n addRecentEmoji: AnyToVoidFunction;\n onCaptionUpdate: (html: string) => void;\n onSend: () => void;\n onFileAppend: (files: File[], isQuick: boolean) => void;\n onClear: () => void;\n};\n\nconst DROP_LEAVE_TIMEOUT_MS = 150;\n\nconst AttachmentModal: FC<OwnProps> = ({\n chatId,\n threadId,\n attachments,\n caption,\n isReady,\n currentUserId,\n groupChatMembers,\n recentEmojis,\n baseEmojiKeywords,\n emojiKeywords,\n addRecentEmoji,\n onCaptionUpdate,\n onSend,\n onFileAppend,\n onClear,\n}) => {\n const captionRef = useStateRef(caption);\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 sendAttachments = useCallback(() => {\n if (isOpen) {\n onSend();\n }\n }, [isOpen, onSend]);\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) => a.mimeType.startsWith('audio/'));\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 <Button\n color=\"primary\"\n size=\"smaller\"\n className=\"modal-action-button\"\n onClick={sendAttachments}\n >\n {lang('Send')}\n </Button>\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={onSend}\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 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> = ({ isOpen, onSend, onClear }) => {\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(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(false);\n setSolution('');\n setCorrectOption('');\n setHasErrors(false);\n }\n }, [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 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 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 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={(e) => setQuestion(e.currentTarget.value)}\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 <Checkbox\n label={lang('PollAnonymous')}\n checked={isAnonymous}\n onChange={handleIsAnonymousChange}\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}\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, { FC, memo, useCallback } from '../../../lib/teact/teact';\n\nimport { IS_EMOJI_SUPPORTED } from '../../../util/environment';\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 return (\n <div\n className={`EmojiButton ${focus ? 'focus' : ''}`}\n onMouseDown={handleClick}\n title={`:${emoji.names[0]}:`}\n >\n {IS_EMOJI_SUPPORTED ? emoji.native : <img src={`./img-apple-64/${emoji.image}.png`} alt=\"\" loading=\"lazy\" />}\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 // @ts-ignore\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 '../../../lib/teact/teactn';\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 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') as unknown as Promise<EmojiModule>;\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, { FC, memo, useRef } 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 StickerButton from '../../common/StickerButton';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport buildClassName from '../../../util/buildClassName';\n\ntype OwnProps = {\n stickerSet: StickerSetOrRecent;\n loadAndPlay: boolean;\n index: number;\n observeIntersection: ObserveFn;\n shouldRender: boolean;\n onStickerSelect: (sticker: ApiSticker) => void;\n onStickerUnfave: (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 observeIntersection,\n shouldRender,\n onStickerSelect,\n onStickerUnfave,\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 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 // @ts-ignore\n style={`height: ${height}px;`}\n >\n {shouldRender && stickerSet.stickers && stickerSet.stickers.map((sticker) => (\n <StickerButton\n key={sticker.id}\n sticker={sticker}\n size={STICKER_SIZE_PICKER}\n observeIntersection={observeIntersection}\n noAnimate={!loadAndPlay}\n onClick={onStickerSelect}\n clickArg={sticker}\n onUnfaveClick={stickerSet.id === 'favorite' ? onStickerUnfave : undefined}\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 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) => void;\n};\n\ntype StateProps = {\n recentStickers: ApiSticker[];\n favoriteStickers: ApiSticker[];\n stickerSetsById: Record<string, ApiStickerSet>;\n addedSetIds?: string[];\n shouldPlay?: 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 onStickerSelect,\n}) => {\n const {\n loadRecentStickers,\n addRecentSticker,\n unfaveSticker,\n } = getDispatch();\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) => {\n onStickerSelect(sticker);\n addRecentSticker({ sticker });\n }, [addRecentSticker, onStickerSelect]);\n\n const handleStickerUnfave = useCallback((sticker: ApiSticker) => {\n unfaveSticker({ sticker });\n }, [unfaveSticker]);\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 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 />\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 />\n ))}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n setsById,\n added,\n recent,\n favorite,\n } = global.stickers;\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 };\n },\n)(StickerPicker));\n","import React, {\n FC, memo, useCallback, useRef,\n} from '../../lib/teact/teact';\n\nimport { ApiMediaFormat, ApiVideo } from '../../api/types';\n\nimport buildClassName from '../../util/buildClassName';\nimport { ObserveFn, useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport useMedia from '../../hooks/useMedia';\nimport useVideoCleanup from '../../hooks/useVideoCleanup';\nimport useBuffering from '../../hooks/useBuffering';\nimport useCanvasBlur from '../../hooks/useCanvasBlur';\nimport { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur';\n\nimport Spinner from '../ui/Spinner';\n\nimport './GifButton.scss';\n\ntype OwnProps = {\n gif: ApiVideo;\n observeIntersection: ObserveFn;\n isDisabled?: boolean;\n className?: string;\n onClick: (gif: ApiVideo) => void;\n};\n\nconst GifButton: FC<OwnProps> = ({\n gif, observeIntersection, isDisabled, className, onClick,\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 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 handleClick = useCallback(\n () => onClick({\n ...gif,\n blobUrl: videoData,\n }),\n [onClick, gif, videoData],\n );\n\n const fullClassName = buildClassName(\n 'GifButton',\n gif.width && gif.height && gif.width < gif.height ? 'vertical' : 'horizontal',\n localMediaHash,\n className,\n );\n\n return (\n <div\n ref={ref}\n className={fullClassName}\n onMouseDown={preventMessageInputBlurWithBubbling}\n onClick={handleClick}\n >\n {hasThumbnail && (\n <canvas\n ref={thumbRef}\n className=\"thumbnail\"\n // We need to always render to avoid blur re-calculation\n // @ts-ignore\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 </div>\n );\n};\n\nexport default memo(GifButton);\n","import React, {\n FC, useEffect, memo, useRef,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 { 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) => void;\n};\n\ntype StateProps = {\n savedGifs?: ApiVideo[];\n};\n\nconst INTERSECTION_DEBOUNCE = 300;\n\nconst GifPicker: FC<OwnProps & StateProps> = ({\n className,\n loadAndPlay,\n canSendGifs,\n savedGifs,\n onGifSelect,\n}) => {\n const { loadSavedGifs } = getDispatch();\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 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={onGifSelect}\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 return {\n savedGifs: global.gifs.saved.gifs,\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 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 '../../../lib/teact/teactn';\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: (sticker: ApiSticker, shouldPreserveInput?: boolean) => void;\n onGifSelect: (gif: ApiVideo) => 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) => {\n onStickerSelect(sticker, 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 && 'middle-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 >\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, useCallback } from '../../../lib/teact/teact';\n\nimport { CONTENT_TYPES_WITH_PREVIEW } from '../../../config';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport { openSystemFilesDialog } from '../../../util/systemFilesDialog';\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useLang from '../../../hooks/useLang';\n\nimport Menu from '../../ui/Menu';\nimport MenuItem from '../../ui/MenuItem';\n\nimport './AttachMenu.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n canAttachMedia: boolean;\n canAttachPolls: boolean;\n onFileSelect: (files: File[], isQuick: boolean) => void;\n onPollCreate: () => void;\n onClose: () => void;\n};\n\nconst AttachMenu: FC<OwnProps> = ({\n isOpen, canAttachMedia, canAttachPolls, onFileSelect, onPollCreate, onClose,\n}) => {\n const [handleMouseEnter, handleMouseLeave] = useMouseInside(isOpen, onClose);\n\n const handleFileSelect = useCallback((e: Event, isQuick: boolean) => {\n const { files } = e.target as HTMLInputElement;\n\n if (files && files.length > 0) {\n onFileSelect(Array.from(files), isQuick);\n }\n }, [onFileSelect]);\n\n const handleQuickSelect = useCallback(() => {\n openSystemFilesDialog(\n Array.from(CONTENT_TYPES_WITH_PREVIEW).join(','),\n (e) => handleFileSelect(e, true),\n );\n }, [handleFileSelect]);\n\n const handleDocumentSelect = useCallback(() => {\n openSystemFilesDialog('*', (e) => handleFileSelect(e, false));\n }, [handleFileSelect]);\n\n const lang = useLang();\n\n return (\n <Menu\n isOpen={isOpen}\n autoClose\n positionX=\"right\"\n positionY=\"bottom\"\n onClose={onClose}\n className=\"AttachMenu fluid\"\n onCloseAnimationEnd={onClose}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCloseOnBackdrop={!IS_TOUCH_ENV}\n >\n {/*\n ** Using ternary operator here causes some attributes from first clause\n ** transferring to the fragment content in the second clause\n */}\n {!canAttachMedia && (\n <MenuItem className=\"media-disabled\" disabled>Posting media content is not allowed in this group.</MenuItem>\n )}\n {canAttachMedia && (\n <>\n <MenuItem icon=\"photo\" onClick={handleQuickSelect}>\n {lang('AttachmentMenu.PhotoOrVideo')}\n </MenuItem>\n <MenuItem icon=\"document\" onClick={handleDocumentSelect}>{lang('AttachDocument')}</MenuItem>\n </>\n )}\n {canAttachPolls && (\n <MenuItem icon=\"poll\" onClick={onPollCreate}>{lang('Poll')}</MenuItem>\n )}\n </Menu>\n );\n};\n\nexport default memo(AttachMenu);\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 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\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 { getDispatch } from '../../../lib/teact/teactn';\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 } = getDispatch();\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 >\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiSticker } from '../../../api/types';\n\nimport { STICKER_SIZE_PICKER } from '../../../config';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\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';\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) => void;\n};\n\ntype StateProps = {\n stickers?: ApiSticker[];\n};\n\nconst INTERSECTION_THROTTLE = 200;\n\nconst StickerTooltip: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n isOpen,\n onStickerSelect,\n stickers,\n}) => {\n const { clearStickersForEmoji } = getDispatch();\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 handleMouseEnter = () => {\n document.body.classList.add('no-select');\n };\n\n const handleMouseMove = () => {\n sendMessageAction({ type: 'chooseSticker' });\n };\n\n const handleMouseLeave = () => {\n document.body.classList.remove('no-select');\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 onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\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 />\n ))\n ) : shouldRender ? (\n <Loading />\n ) : undefined}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { stickers } = global.stickers.forEmoji;\n\n return { stickers };\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 onSilentSend?: NoneToVoidFunction;\n onScheduleSend?: NoneToVoidFunction;\n onClose: NoneToVoidFunction;\n onCloseAnimationEnd?: NoneToVoidFunction;\n};\n\nconst CustomSendMenu: FC<OwnProps> = ({\n isOpen, onSilentSend, onScheduleSend, onClose, 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=\"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 {onSilentSend && <MenuItem icon=\"mute\" onClick={onSilentSend}>{lang('SendWithoutSound')}</MenuItem>}\n {onScheduleSend && <MenuItem icon=\"schedule\" onClick={onScheduleSend}>{lang('ScheduleMessage')}</MenuItem>}\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 { IS_TOUCH_ENV } from '../../../util/environment';\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 handleMouseEnter = () => {\n document.body.classList.add('no-select');\n };\n\n const handleMouseLeave = () => {\n document.body.classList.remove('no-select');\n };\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 onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\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 } from '../../../../api/types';\n\nimport { ObserveFn } from '../../../../hooks/useIntersectionObserver';\n\nimport GifButton from '../../../common/GifButton';\n\ntype OwnProps = {\n inlineResult: ApiBotInlineMediaResult;\n observeIntersection: ObserveFn;\n onClick: (result: ApiBotInlineResult) => void;\n};\n\nconst GifResult: FC<OwnProps> = ({\n inlineResult, observeIntersection, onClick,\n}) => {\n const { gif } = inlineResult;\n\n const handleClick = useCallback(() => {\n onClick(inlineResult);\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={handleClick}\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 observeIntersection: ObserveFn;\n onClick: (result: ApiBotInlineResult) => void;\n};\n\nconst StickerResult: FC<OwnProps> = ({ inlineResult, observeIntersection, onClick }) => {\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 />\n );\n};\n\nexport default memo(StickerResult);\n","import React, {\n FC, memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\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';\nimport { getDispatch } from '../../../lib/teact/teactn';\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 onSelectResult: (inlineResult: ApiBotInlineMediaResult | ApiBotInlineResult) => void;\n loadMore: NoneToVoidFunction;\n onClose: NoneToVoidFunction;\n};\n\nconst InlineBotTooltip: FC<OwnProps> = ({\n isOpen,\n botId,\n isGallery,\n inlineBotResults,\n switchPm,\n loadMore,\n onClose,\n onSelectResult,\n}) => {\n const {\n openChat,\n startBot,\n } = getDispatch();\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 />\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 />\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 '../../../modules/helpers';\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useLang from '../../../hooks/useLang';\nimport buildClassName from '../../../util/buildClassName';\nimport { getDispatch, getGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\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 >\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 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 { getDispatch, getGlobal, withGlobal } from '../../lib/teact/teactn';\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 '../../modules/selectors';\nimport {\n getChatTitle,\n getUserFullName,\n isChatChannel,\n} from '../../modules/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 } = getDispatch();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n useHistoryBack(isActive, onClose);\n\n const [viewportIds, getMore] = useInfiniteScroll(searchTextMessagesLocal, foundIds);\n\n const viewportResults = useMemo(() => {\n if (!query || !viewportIds?.length || !messagesById) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return viewportIds.map((id) => {\n const message = messagesById[id];\n if (!message) {\n return undefined;\n }\n\n const senderUser = message.senderId ? selectUser(getGlobal(), message.senderId) : undefined;\n\n let senderChat;\n if (chat && isChatChannel(chat)) {\n senderChat = chat;\n } else if (message.forwardInfo) {\n const { isChannelPost, fromChatId } = message.forwardInfo;\n senderChat = isChannelPost && fromChatId ? selectChat(getGlobal(), fromChatId) : undefined;\n } else {\n senderChat = message.senderId ? selectChat(getGlobal(), message.senderId) : undefined;\n }\n\n return {\n message,\n senderUser,\n senderChat,\n onClick: () => focusMessage({ chatId, threadId, messageId: id }),\n };\n }).filter(Boolean);\n }, [query, viewportIds, messagesById, chat, focusMessage, chatId, threadId]);\n\n const handleKeyDown = useKeyboardListNavigation(containerRef, true, (index) => {\n const foundResult = viewportResults?.[index === -1 ? 0 : index];\n if (foundResult) {\n foundResult.onClick();\n }\n }, '.ListItem-button', true);\n\n const renderSearchResult = ({\n message, senderUser, senderChat, onClick,\n }: {\n message: ApiMessage;\n senderUser?: ApiUser;\n senderChat?: ApiChat;\n onClick: NoneToVoidFunction;\n }) => {\n const title = senderChat ? getChatTitle(lang, senderChat) : getUserFullName(senderUser);\n const text = renderMessageSummary(lang, message, undefined, query);\n\n return (\n <ListItem\n key={message.id}\n teactOrderKey={-message.date}\n className=\"chat-item-clickable search-result-message m-0\"\n onClick={onClick}\n >\n <Avatar chat={senderChat} user={senderUser} />\n <div className=\"info\">\n <div className=\"title\">\n <h3 dir=\"auto\">{title && renderText(title)}</h3>\n <LastMessageMeta message={message} />\n </div>\n <div className=\"subtitle\" dir=\"auto\">\n {text}\n </div>\n </div>\n </ListItem>\n );\n };\n\n const isOnTop = viewportIds?.[0] === foundIds?.[0];\n\n return (\n <InfiniteScroll\n ref={containerRef}\n className=\"RightSearch custom-scroll\"\n items={viewportResults}\n preloadBackwards={0}\n onLoadMore={getMore}\n onKeyDown={handleKeyDown}\n >\n {isOnTop && (\n <p key=\"helper-text\" className=\"helper-text\" dir=\"auto\">\n {!query ? (\n lang('lng_dlg_search_for_messages')\n ) : (totalCount === 0 || !viewportResults.length) ? (\n lang('lng_search_no_results')\n ) : totalCount === 1 ? (\n '1 message found'\n ) : (\n `${(viewportResults.length && (totalCount || viewportResults.length))} messages found`\n )}\n </p>\n )}\n {viewportResults.map(renderSearchResult)}\n </InfiniteScroll>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const messagesById = chat && selectChatMessages(global, chat.id);\n if (!chat || !messagesById) {\n return {};\n }\n\n const { query, results } = selectCurrentTextSearch(global) || {};\n const { totalCount, foundIds } = results || {};\n\n return {\n chat,\n messagesById,\n query,\n totalCount,\n foundIds,\n };\n },\n)(RightSearch));\n","import React, {\n FC, useEffect, memo, useMemo, useCallback,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiStickerSet } from '../../api/types';\nimport { ObserveFn } from '../../hooks/useIntersectionObserver';\n\nimport { STICKER_SIZE_SEARCH } from '../../config';\nimport { selectShouldLoopStickers, selectStickerSet } from '../../modules/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 } = getDispatch();\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 onClick={openModal}\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 { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { throttle } from '../../util/schedulers';\nimport { selectCurrentStickerSearch } from '../../modules/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 } = getDispatch();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE });\n\n // Due to the parent Transition, this component never gets unmounted,\n // that's why we use throttled API call on every update.\n useEffect(() => {\n runThrottled(() => {\n loadFeaturedStickers();\n });\n });\n\n useHistoryBack(isActive, onClose);\n\n function renderContent() {\n if (query === undefined) {\n return undefined;\n }\n\n if (!query && featuredIds) {\n return featuredIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n if (resultIds) {\n if (!resultIds.length) {\n return <p className=\"helper-text\" dir=\"auto\">Nothing found.</p>;\n }\n\n return resultIds.map((id) => (\n <StickerSetResult\n key={id}\n stickerSetId={id}\n observeIntersection={observeIntersection}\n isSomeModalOpen={isModalOpen}\n onModalToggle={setIsModalOpen}\n />\n ));\n }\n\n return <Loading />;\n }\n\n return (\n <div ref={containerRef} className=\"StickerSearch custom-scroll\" dir={lang.isRtl ? 'rtl' : undefined}>\n {renderContent()}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const currentSearch = selectCurrentStickerSearch(global);\n const { query, resultIds } = currentSearch || {};\n const { featured } = global.stickers;\n\n return {\n query,\n featuredIds: featured.setIds,\n resultIds,\n };\n },\n)(StickerSearch));\n","import React, {\n FC, memo, useRef, useCallback,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\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} from '../../modules/selectors';\nimport { getAllowedAttachmentOptions } from '../../modules/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\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};\n\nconst PRELOAD_BACKWARDS = 96; // GIF Search bot results are multiplied by 24\nconst INTERSECTION_DEBOUNCE = 300;\n\nconst GifSearch: FC<OwnProps & StateProps> = ({\n onClose,\n isActive,\n query,\n results,\n chat,\n isChatWithBot,\n}) => {\n const {\n searchMoreGifs,\n sendMessage,\n setGifSearchQuery,\n } = getDispatch();\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 const { canSendGifs } = getAllowedAttachmentOptions(chat, isChatWithBot);\n\n const handleGifClick = useCallback((gif: ApiVideo) => {\n if (canSendGifs) {\n sendMessage({ gif });\n }\n\n if (IS_TOUCH_ENV) {\n setGifSearchQuery({ query: undefined });\n }\n }, [canSendGifs, sendMessage, setGifSearchQuery]);\n\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n function renderContent() {\n if (query === undefined) {\n return undefined;\n }\n\n if (!results) {\n return (\n <Loading />\n );\n }\n\n if (!results.length) {\n return (\n <p className=\"helper-text\" dir=\"auto\">{lang('NoGIFsFound')}</p>\n );\n }\n\n return results.map((gif) => (\n <GifButton\n key={gif.id}\n gif={gif}\n observeIntersection={observeIntersection}\n onClick={handleGifClick}\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 </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const currentSearch = selectCurrentGifSearch(global);\n const { query, results } = currentSearch || {};\n const { chatId } = selectCurrentMessageList(global) || {};\n const chat = chatId ? selectChat(global, chatId) : undefined;\n const isChatWithBot = chat ? selectIsChatWithBot(global, chat) : undefined;\n\n return {\n query,\n results,\n chat,\n isChatWithBot,\n };\n },\n)(GifSearch));\n","import React, {\n FC, useCallback, useState, memo, useEffect,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\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 } = getDispatch();\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 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 '../../lib/teact/teactn';\n\nimport { ApiMessage, ApiChat } from '../../api/types';\nimport { selectChat, selectChatMessage } from '../../modules/selectors';\nimport { buildCollectionByKey } from '../../util/iteratees';\nimport { getMessagePoll } from '../../modules/helpers';\nimport renderText from '../common/helpers/renderText';\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\n\nimport PollAnswerResults from './PollAnswerResults';\nimport Loading from '../ui/Loading';\n\nimport './PollResults.scss';\n\ntype OwnProps = {\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n message?: ApiMessage;\n lastSyncTime?: number;\n};\n\nconst PollResults: FC<OwnProps & StateProps> = ({\n onClose,\n isActive,\n chat,\n message,\n lastSyncTime,\n}) => {\n const lang = useLang();\n useHistoryBack(isActive, onClose);\n\n if (!message || !chat) {\n return <Loading />;\n }\n\n const { summary, results } = getMessagePoll(message)!;\n if (!results.results) {\n return undefined;\n }\n\n const resultsByOption = buildCollectionByKey(results.results, 'option');\n\n return (\n <div className=\"PollResults\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"poll-question\" dir=\"auto\">{renderText(summary.question, ['emoji', 'br'])}</h3>\n <div className=\"poll-results-list custom-scroll\">\n {lastSyncTime && summary.answers.map((answer) => (\n <PollAnswerResults\n key={`${message.id}-${answer.option}`}\n chat={chat}\n message={message}\n answer={answer}\n answerVote={resultsByOption[answer.option]}\n totalVoters={results.totalVoters!}\n />\n ))}\n {!lastSyncTime && <Loading />}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n pollResults: { chatId, messageId },\n lastSyncTime,\n } = global;\n\n if (!chatId || !messageId) {\n return {};\n }\n\n const chat = selectChat(global, chatId);\n const message = selectChatMessage(global, chatId, messageId);\n\n return {\n chat,\n message,\n lastSyncTime,\n };\n },\n)(PollResults));\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiUser } from '../../../api/types';\nimport { ManagementProgress } from '../../../types';\n\nimport {\n selectChat, selectNotifyExceptions, selectNotifySettings, selectUser,\n} from '../../../modules/selectors';\nimport { selectIsChatMuted } from '../../../modules/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 } = getDispatch();\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [error, setError] = useState<string | undefined>();\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n const currentFirstName = user ? (user.firstName || '') : '';\n const currentLastName = user ? (user.lastName || '') : '';\n\n const [firstName, setFirstName] = useState(currentFirstName);\n const [lastName, setLastName] = useState(currentLastName);\n const [isNotificationsEnabled, setIsNotificationsEnabled] = useState(!isMuted);\n\n useEffect(() => {\n setIsNotificationsEnabled(!isMuted);\n }, [isMuted]);\n\n useEffect(() => {\n setIsProfileFieldsTouched(false);\n closeDeleteDialog();\n }, [closeDeleteDialog, userId]);\n\n useEffect(() => {\n setFirstName(currentFirstName);\n setLastName(currentLastName);\n }, [currentFirstName, currentLastName, user]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n closeDeleteDialog();\n }\n }, [closeDeleteDialog, progress]);\n\n const handleFirstNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setFirstName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleLastNameChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setLastName(e.target.value);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleNotificationChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsNotificationsEnabled(e.target.checked);\n setIsProfileFieldsTouched(true);\n }, []);\n\n const handleProfileSave = useCallback(() => {\n const trimmedFirstName = firstName.trim();\n const trimmedLastName = lastName.trim();\n\n if (!trimmedFirstName.length) {\n setError(ERROR_FIRST_NAME_MISSING);\n }\n\n updateContact({\n userId,\n isMuted: !isNotificationsEnabled,\n firstName: trimmedFirstName,\n lastName: trimmedLastName,\n });\n }, [firstName, lastName, updateContact, userId, isNotificationsEnabled]);\n\n const handleDeleteContact = useCallback(() => {\n deleteContact({ userId });\n closeDeleteDialog();\n closeManagement();\n }, [closeDeleteDialog, closeManagement, deleteContact, userId]);\n\n if (!user) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <PrivateChatInfo\n userId={user.id}\n avatarSize=\"jumbo\"\n status=\"original name\"\n withFullInfo\n />\n <InputText\n id=\"user-first-name\"\n label={lang('UserInfo.FirstNamePlaceholder')}\n onChange={handleFirstNameChange}\n value={firstName}\n error={error === ERROR_FIRST_NAME_MISSING ? error : undefined}\n />\n <InputText\n id=\"user-last-name\"\n label={lang('UserInfo.LastNamePlaceholder')}\n onChange={handleLastNameChange}\n value={lastName}\n />\n <div className=\"ListItem no-selection narrow\">\n <Checkbox\n checked={isNotificationsEnabled}\n label={lang('Notifications')}\n subLabel={lang(isNotificationsEnabled\n ? 'UserInfo.NotificationsEnabled'\n : 'UserInfo.NotificationsDisabled')}\n onChange={handleNotificationChange}\n />\n </div>\n </div>\n <div className=\"section\">\n <ListItem icon=\"delete\" ripple destructive onClick={openDeleteDialog}>\n {lang('DeleteContact')}\n </ListItem>\n </div>\n </div>\n <FloatingActionButton\n isShown={isProfileFieldsTouched}\n onClick={handleProfileSave}\n disabled={isLoading}\n ariaLabel={lang('Save')}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n text={lang('AreYouSureDeleteContact')}\n confirmLabel={lang('DeleteContact')}\n confirmHandler={handleDeleteContact}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n const user = selectUser(global, userId);\n const chat = selectChat(global, userId)!;\n const { progress } = global.management;\n const isMuted = selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global));\n\n return {\n user, progress, isMuted,\n };\n },\n)(ManageUser));\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ManagementScreens, ManagementProgress } from '../../../types';\nimport {\n ApiChat, ApiChatBannedRights, ApiExportedInvite, ApiMediaFormat,\n} from '../../../api/types';\n\nimport { getChatAvatarHash, getHasAdminRight, isChatBasicGroup } from '../../../modules/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport { selectChat } from '../../../modules/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 } = getDispatch();\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 lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n if (lastSyncTime && canInvite) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, canInvite, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const handleClickEditType = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatPrivacyType);\n }, [onScreenSelect]);\n\n const handleClickDiscussion = useCallback(() => {\n onScreenSelect(ManagementScreens.Discussion);\n }, [onScreenSelect]);\n\n const handleClickReactions = useCallback(() => {\n onScreenSelect(ManagementScreens.Reactions);\n }, [onScreenSelect]);\n\n const handleClickPermissions = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupPermissions);\n }, [onScreenSelect]);\n\n const handleClickAdministrators = useCallback(() => {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }, [onScreenSelect]);\n\n const handleClickInvites = () => {\n onScreenSelect(ManagementScreens.Invites);\n };\n\n const handleClickRequests = () => {\n onScreenSelect(ManagementScreens.JoinRequests);\n };\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) {\n return undefined;\n }\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <AvatarEditable\n currentAvatarBlobUrl={currentAvatarBlobUrl}\n onChange={handleSetPhoto}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-title\"\n label={lang('GroupName')}\n onChange={handleTitleChange}\n value={title}\n error={error === GROUP_TITLE_EMPTY ? error : undefined}\n disabled={!canChangeInfo}\n />\n <InputText\n id=\"group-about\"\n className=\"mb-2\"\n label={lang('DescriptionPlaceholder')}\n onChange={handleAboutChange}\n value={about}\n disabled={!canChangeInfo}\n />\n {chat.isCreator && (\n <ListItem icon=\"lock\" multiline onClick={handleClickEditType}>\n <span className=\"title\">{lang('GroupType')}</span>\n <span className=\"subtitle\">{chat.username ? lang('TypePublic') : lang('TypePrivate')}</span>\n </ListItem>\n )}\n {hasLinkedChannel && (\n <ListItem\n icon=\"message\"\n multiline\n onClick={handleClickDiscussion}\n >\n <span className=\"title\">{lang('LinkedChannel')}</span>\n <span className=\"subtitle\">{lang('DiscussionUnlink')}</span>\n </ListItem>\n )}\n <ListItem\n icon=\"permissions\"\n multiline\n onClick={handleClickPermissions}\n disabled={!canBanUsers}\n >\n <span className=\"title\">{lang('ChannelPermissions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledPermissionsCount}/{TOTAL_PERMISSIONS_COUNT}\n </span>\n </ListItem>\n\n <ListItem\n icon=\"reactions\"\n multiline\n onClick={handleClickReactions}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Reactions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledReactionsCount}/{availableReactionsCount}\n </span>\n </ListItem>\n <ListItem\n icon=\"admin\"\n multiline\n onClick={handleClickAdministrators}\n >\n <span className=\"title\">{lang('ChannelAdministrators')}</span>\n <span className=\"subtitle\">{formatInteger(adminsCount)}</span>\n </ListItem>\n {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('MemberRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n </div>\n <div className=\"section\">\n <ListItem icon=\"group\" multiline onClick={handleClickMembers}>\n <span className=\"title\">{lang('GroupMembers')}</span>\n <span className=\"subtitle\">{formatInteger(chat.membersCount ?? 0)}</span>\n </ListItem>\n\n {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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ManagementScreens } from '../../../types';\nimport { ApiChat, ApiChatBannedRights, ApiChatMember } from '../../../api/types';\n\nimport useLang from '../../../hooks/useLang';\nimport { selectChat } from '../../../modules/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 } = getDispatch();\n\n const [permissions, setPermissions] = useState<ApiChatBannedRights>({});\n const [havePermissionChanged, setHavePermissionChanged] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n const handleRemovedUsersClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupRemovedUsers);\n }, [onScreenSelect]);\n\n const handleAddExceptionClick = useCallback(() => {\n onScreenSelect(ManagementScreens.GroupUserPermissionsCreate);\n }, [onScreenSelect]);\n\n const handleExceptionMemberClick = useCallback((member: ApiChatMember) => {\n onChatMemberSelect(member.userId, member.promotedByUserId === currentUserId);\n onScreenSelect(ManagementScreens.GroupUserPermissions);\n }, [currentUserId, onChatMemberSelect, onScreenSelect]);\n\n useEffect(() => {\n setPermissions((chat?.defaultBannedRights) || {});\n setHavePermissionChanged(false);\n setTimeout(() => {\n setIsLoading(false);\n }, FLOATING_BUTTON_ANIMATION_TIMEOUT_MS);\n }, [chat]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as Exclude<keyof ApiChatBannedRights, 'untilDate'>]),\n ...(name === 'sendStickers' && {\n sendGifs: getUpdatedPermissionValue(p[name]),\n }),\n }));\n setHavePermissionChanged(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!chat) {\n return;\n }\n\n setIsLoading(true);\n updateChatDefaultBannedRights({ chatId: chat.id, bannedRights: permissions });\n }, [chat, permissions, updateChatDefaultBannedRights]);\n\n const removedUsersCount = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.kickedMembers) {\n return 0;\n }\n\n return chat.fullInfo.kickedMembers.length;\n }, [chat]);\n\n const exceptionMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.members) {\n return [];\n }\n\n return chat.fullInfo.members.filter(({ bannedRights }) => Boolean(bannedRights));\n }, [chat]);\n\n const getMemberExceptions = useCallback((member: ApiChatMember) => {\n const { bannedRights } = member;\n if (!bannedRights || !chat) {\n return undefined;\n }\n\n const { defaultBannedRights } = chat;\n\n return Object.keys(bannedRights).reduce((result, key) => {\n if (\n !bannedRights[key as keyof ApiChatBannedRights]\n || (defaultBannedRights?.[key as keyof ApiChatBannedRights])\n || key === 'sendInline' || key === 'viewMessages' || key === 'sendGames'\n ) {\n return result;\n }\n\n const langKey = getLangKeyForBannedRightKey(key);\n\n if (!langKey) {\n return result;\n }\n\n const translatedString = lang(langKey);\n\n return `${result}${!result.length ? translatedString : `, ${translatedString}`}`;\n }, '');\n }, [chat, lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <h3 className=\"section-heading\" dir=\"auto\">{lang('ChannelPermissionsHeader')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMessages\"\n checked={!permissions.sendMessages}\n label={lang('UserRestrictionsSend')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMedia\"\n checked={!permissions.sendMedia}\n label={lang('UserRestrictionsSendMedia')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendStickers\"\n checked={!permissions.sendStickers && !permissions.sendGifs}\n label={lang('UserRestrictionsSendStickers')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendPolls\"\n checked={!permissions.sendPolls}\n label={lang('UserRestrictionsSendPolls')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"embedLinks\"\n checked={!permissions.embedLinks}\n label={lang('UserRestrictionsEmbedLinks')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={!permissions.inviteUsers}\n label={lang('UserRestrictionsInviteUsers')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={!permissions.pinMessages}\n label={lang('UserRestrictionsPinMessages')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!permissions.changeInfo}\n label={lang('UserRestrictionsChangeInfo')}\n blocking\n onChange={handlePermissionChange}\n />\n </div>\n </div>\n\n <div className=\"section\">\n <ListItem\n icon=\"delete-user\"\n multiline\n narrow\n onClick={handleRemovedUsersClick}\n >\n <span className=\"title\">{lang('ChannelBlockedUsers')}</span>\n <span className=\"subtitle\">{removedUsersCount}</span>\n </ListItem>\n </div>\n\n <div className=\"section\">\n <h3 className=\"section-heading\" dir=\"auto\">{lang('PrivacyExceptions')}</h3>\n\n <ListItem\n icon=\"add-user\"\n onClick={handleAddExceptionClick}\n >\n {lang('ChannelAddException')}\n </ListItem>\n\n {exceptionMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable exceptions-member\"\n 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 { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat } from '../../../api/types';\n\nimport { filterUsersByName } from '../../../modules/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 } = getDispatch();\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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat, ApiChatMember, ApiUser } from '../../../api/types';\n\nimport { selectChat } from '../../../modules/selectors';\nimport { getHasAdminRight, getUserFullName } from '../../../modules/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};\n\nconst ManageGroupRemovedUsers: FC<OwnProps & StateProps> = ({\n chat,\n usersById,\n canDeleteMembers,\n onClose,\n isActive,\n}) => {\n const { updateChatMemberBannedRights } = getDispatch();\n\n const lang = useLang();\n const [isRemoveUserModalOpen, openRemoveUserModal, closeRemoveUserModal] = useFlag();\n\n useHistoryBack(isActive, onClose);\n\n const removedMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.kickedMembers) {\n return [];\n }\n\n return chat.fullInfo.kickedMembers;\n }, [chat]);\n\n const getRemovedBy = useCallback((member: ApiChatMember) => {\n if (!member.kickedByUserId) {\n return undefined;\n }\n\n const kickedByUser = usersById[member.kickedByUserId];\n if (!kickedByUser) {\n return undefined;\n }\n\n return lang('UserRemovedBy', getUserFullName(kickedByUser));\n }, [lang, usersById]);\n\n const getContextActions = useCallback((member: ApiChatMember) => {\n if (!chat) {\n return undefined;\n }\n\n return [{\n title: lang('Unblock'),\n icon: 'delete',\n destructive: true,\n handler: () => updateChatMemberBannedRights({\n chatId: chat.id,\n userId: member.userId,\n bannedRights: {},\n }),\n }];\n }, [lang, chat, updateChatMemberBannedRights]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <p className=\"text-muted\">{lang('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 { chat, usersById, canDeleteMembers };\n },\n)(ManageGroupRemovedUsers));\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ManagementScreens, ManagementProgress } from '../../../types';\nimport { ApiChat, ApiExportedInvite, ApiMediaFormat } from '../../../api/types';\n\nimport { getChatAvatarHash, getHasAdminRight } from '../../../modules/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport useLang from '../../../hooks/useLang';\nimport { selectChat } from '../../../modules/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 } = getDispatch();\n\n const currentTitle = chat ? (chat.title || '') : '';\n const currentAbout = chat?.fullInfo ? (chat.fullInfo.about || '') : '';\n const hasLinkedChat = chat?.fullInfo?.linkedChatId;\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const [isProfileFieldsTouched, setIsProfileFieldsTouched] = useState(false);\n const [title, setTitle] = useState(currentTitle);\n const [about, setAbout] = useState(currentAbout);\n const [photo, setPhoto] = useState<File | undefined>();\n const [error, setError] = useState<string | undefined>();\n const imageHash = chat && getChatAvatarHash(chat);\n const currentAvatarBlobUrl = useMedia(imageHash, false, ApiMediaFormat.BlobUrl);\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n if (lastSyncTime) {\n loadExportedChatInvites({ chatId });\n loadExportedChatInvites({ chatId, isRevoked: true });\n loadChatJoinRequests({ chatId });\n }\n }, [chatId, loadExportedChatInvites, lastSyncTime, loadChatJoinRequests]);\n\n useEffect(() => {\n if (progress === ManagementProgress.Complete) {\n setIsProfileFieldsTouched(false);\n setError(undefined);\n }\n }, [progress]);\n\n const adminsCount = (chat?.fullInfo?.adminMembers?.length) || 0;\n\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 = () => {\n onScreenSelect(ManagementScreens.Invites);\n };\n\n const handleClickRequests = () => {\n onScreenSelect(ManagementScreens.JoinRequests);\n };\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 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) {\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 <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 {canInvite && (\n <ListItem\n icon=\"link\"\n onClick={handleClickInvites}\n multiline\n disabled={!exportedInvites}\n >\n <span className=\"title\">{lang('GroupInfo.InviteLinks')}</span>\n <span className=\"subtitle\">\n {exportedInvites ? formatInteger(exportedInvites.length) : lang('Loading')}\n </span>\n </ListItem>\n )}\n {Boolean(chat.joinRequests?.length) && (\n <ListItem\n icon=\"add-user-filled\"\n onClick={handleClickRequests}\n multiline\n >\n <span className=\"title\">{lang('SubscribeRequests')}</span>\n <span className=\"subtitle\">\n {formatInteger(chat.joinRequests!.length)}\n </span>\n </ListItem>\n )}\n <ListItem\n icon=\"reactions\"\n multiline\n onClick={handleClickReactions}\n disabled={!canChangeInfo}\n >\n <span className=\"title\">{lang('Reactions')}</span>\n <span className=\"subtitle\" dir=\"auto\">\n {enabledReactionsCount}/{availableReactionsCount}\n </span>\n </ListItem>\n <div className=\"ListItem no-selection narrow\">\n <Checkbox\n checked={isSignaturesShown}\n label={lang('ChannelSignMessages')}\n onChange={handleToggleSignatures}\n />\n </div>\n </div>\n <div className=\"section\">\n <ListItem\n icon=\"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 </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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat } from '../../../api/types';\nimport { ManagementProgress } from '../../../types';\n\nimport { selectChat, selectManagement } from '../../../modules/selectors';\nimport { isChatChannel } from '../../../modules/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 } = getDispatch();\n\n const isPublic = Boolean(chat.username);\n const privateLink = chat.fullInfo?.inviteLink;\n\n const [privacyType, setPrivacyType] = useState<PrivacyType>(isPublic ? 'public' : 'private');\n const [username, setUsername] = useState();\n const [isRevokeConfirmDialogOpen, openRevokeConfirmDialog, closeRevokeConfirmDialog] = useFlag();\n\n const canUpdate = Boolean(\n (privacyType === 'public' && username && isUsernameAvailable)\n || (privacyType === 'private' && isPublic),\n );\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n if (privacyType && !privateLink) {\n updatePrivateLink();\n }\n }, [privacyType, privateLink, updatePrivateLink]);\n\n const handleOptionChange = useCallback((value: string) => {\n setPrivacyType(value as PrivacyType);\n }, []);\n\n const handleForwardingOptionChange = useCallback((value: string) => {\n toggleIsProtected({\n chatId: chat.id,\n isProtected: value === 'protected',\n });\n }, [chat.id, toggleIsProtected]);\n\n const handleSave = useCallback(() => {\n updatePublicLink({ username: privacyType === 'public' ? username : '' });\n }, [privacyType, updatePublicLink, username]);\n\n const handleRevokePrivateLink = useCallback(() => {\n closeRevokeConfirmDialog();\n updatePrivateLink();\n }, [closeRevokeConfirmDialog, updatePrivateLink]);\n\n const lang = useLang();\n const langPrefix1 = isChannel ? 'Channel' : 'Mega';\n const langPrefix2 = isChannel ? 'Channel' : 'Group';\n\n const options = [\n { value: 'private', label: lang(`${langPrefix1}Private`), subLabel: lang(`${langPrefix1}PrivateInfo`) },\n { value: 'public', label: lang(`${langPrefix1}Public`), subLabel: lang(`${langPrefix1}PublicInfo`) },\n ];\n\n const forwardingOptions = [{\n value: 'allowed',\n label: lang('ChannelVisibility.Forwarding.Enabled'),\n }, {\n value: 'protected',\n label: lang('ChannelVisibility.Forwarding.Disabled'),\n }];\n\n const isLoading = progress === ManagementProgress.InProgress;\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">{lang(`${langPrefix2}Type`)}</h3>\n <RadioGroup\n selected={privacyType}\n name=\"channel-type\"\n options={options}\n onChange={handleOptionChange}\n />\n </div>\n {privacyType === 'private' ? (\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n {privateLink ? (\n <>\n <SafeLink url={privateLink} className=\"group-link\" text={privateLink} />\n <p className=\"section-info\" dir={lang.isRtl ? 'rtl' : undefined}>\n {lang(`${langPrefix1}PrivateLinkHelp`)}\n </p>\n\n <ListItem icon=\"delete\" ripple destructive onClick={openRevokeConfirmDialog}>\n {lang('RevokeLink')}\n </ListItem>\n <ConfirmDialog\n isOpen={isRevokeConfirmDialogOpen}\n onClose={closeRevokeConfirmDialog}\n text={lang('RevokeAlert')}\n confirmLabel={lang('RevokeButton')}\n confirmHandler={handleRevokePrivateLink}\n confirmIsDestructive\n />\n </>\n ) : (\n <Loading />\n )}\n </div>\n ) : (\n <div className=\"section no-border\">\n <UsernameInput\n asLink\n currentUsername={chat.username}\n isLoading={isLoading}\n isUsernameAvailable={isUsernameAvailable}\n checkUsername={checkPublicLink}\n onChange={setUsername}\n />\n <p className=\"section-info\" dir=\"auto\">\n {lang(`${langPrefix2}.Username.CreatePublicLinkHelp`)}\n </p>\n </div>\n )}\n <div className=\"section\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\">\n {lang(isChannel ? 'ChannelVisibility.Forwarding.ChannelTitle' : 'ChannelVisibility.Forwarding.GroupTitle')}\n </h3>\n <RadioGroup\n selected={isProtected ? 'protected' : 'allowed'}\n name=\"channel-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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { STICKER_SIZE_DISCUSSION_GROUPS } from '../../../config';\nimport { selectChat } from '../../../modules/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 '../../../modules/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 } = getDispatch();\n\n const [linkedGroupId, setLinkedGroupId] = useState<string>();\n const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n const [isConfirmUnlinkGroupDialogOpen, openConfirmUnlinkGroupDialog, closeConfirmUnlinkGroupDialog] = useFlag();\n const [isConfirmLinkGroupDialogOpen, openConfirmLinkGroupDialog, closeConfirmLinkGroupDialog] = useFlag();\n const lang = useLang();\n const linkedChatId = linkedChat?.id;\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n loadGroupsForDiscussion();\n }, [loadGroupsForDiscussion]);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('DiscussionGroups').then(setAnimationData);\n }\n }, [animationData]);\n\n const handleUnlinkGroupSessions = useCallback(() => {\n closeConfirmUnlinkGroupDialog();\n unlinkDiscussionGroup({ channelId: isChannel ? chatId : linkedChatId });\n if (!isChannel) {\n onScreenSelect(ManagementScreens.Initial);\n }\n }, [closeConfirmUnlinkGroupDialog, unlinkDiscussionGroup, isChannel, chatId, linkedChatId, onScreenSelect]);\n\n const handleLinkGroupSessions = useCallback(() => {\n closeConfirmLinkGroupDialog();\n linkDiscussionGroup({ channelId: chatId, chatId: linkedGroupId });\n }, [closeConfirmLinkGroupDialog, linkDiscussionGroup, chatId, linkedGroupId]);\n\n const onDiscussionClick = (groupId: string) => {\n setLinkedGroupId(groupId);\n openConfirmLinkGroupDialog();\n };\n\n function renderUnlinkGroupHeader() {\n return (\n <div className=\"modal-header\">\n <Avatar\n size=\"tiny\"\n chat={linkedChat}\n />\n <div className=\"modal-title\">\n {lang(isChannel ? 'DiscussionUnlinkGroup' : 'DiscussionUnlinkChannel')}\n </div>\n </div>\n );\n }\n\n function renderLinkGroupHeader() {\n const linkedGroup = chatsByIds[linkedGroupId];\n\n if (!linkedGroup) {\n return undefined;\n }\n\n return (\n <div className=\"modal-header\">\n <Avatar\n size=\"tiny\"\n chat={linkedGroup}\n />\n <div className=\"modal-title\">\n {lang('Channel.DiscussionGroup.LinkGroup')}\n </div>\n </div>\n );\n }\n\n function renderLinkGroupConfirmText() {\n const linkedGroup = chatsByIds[linkedGroupId];\n\n if (!linkedGroup) {\n return undefined;\n }\n\n if (linkedGroup.hasPrivateLink) {\n return renderText(\n `Do you want to make **${linkedGroup.title}** the discussion board for **${chat!.title}**?`,\n ['br', 'simple_markdown'],\n );\n // return renderText(\n // lang('DiscussionLinkGroupPublicAlert', linkedChat.title, chat!.title),\n // ['br', 'simple_markdown'],\n // );\n }\n\n return renderText(\n // eslint-disable-next-line max-len\n `Do you want to make **${linkedGroup.title}** the discussion board for **${chat!.title}**?\\n\\nAnyone from the channel will be able to see messages in this group.`,\n ['br', 'simple_markdown'],\n );\n // return renderText(\n // lang('DiscussionLinkGroupPrivateAlert', linkedChat.title, chat!.title),\n // ['br', 'simple_markdown'],\n // );\n }\n\n function renderLinkedGroup() {\n return (\n <div>\n <ListItem\n className=\"chat-item-clickable\"\n inactive\n >\n <GroupChatInfo chatId={linkedChat!.id} />\n </ListItem>\n <ListItem\n icon=\"delete\"\n ripple\n destructive\n onClick={openConfirmUnlinkGroupDialog}\n >\n {lang(isChannel ? 'DiscussionUnlinkGroup' : 'DiscussionUnlinkChannel')}\n </ListItem>\n <ConfirmDialog\n isOpen={isConfirmUnlinkGroupDialogOpen}\n onClose={closeConfirmUnlinkGroupDialog}\n header={renderUnlinkGroupHeader()}\n textParts={renderText(\n lang(isChannel ? 'DiscussionUnlinkChannelAlert' : 'DiscussionUnlinkGroupAlert', linkedChat!.title),\n ['br', 'simple_markdown'],\n )}\n confirmLabel={lang(isChannel ? 'DiscussionUnlinkGroup' : 'DiscussionUnlinkChannel')}\n confirmHandler={handleUnlinkGroupSessions}\n confirmIsDestructive\n />\n </div>\n );\n }\n\n function renderDiscussionGroups() {\n return (\n <div>\n <p className=\"section-help\" dir=\"auto\">{lang('DiscussionChannelHelp')}</p>\n\n <div teactFastList>\n <ListItem\n key=\"create-group\"\n icon=\"group\"\n ripple\n teactOrderKey={0}\n className=\"not-implemented\"\n >\n {lang('DiscussionCreateGroup')}\n </ListItem>\n {forDiscussionIds ? (\n forDiscussionIds.map((id, i) => (\n <ListItem\n key={id}\n teactOrderKey={i + 1}\n className=\"chat-item-clickable scroll-item\"\n 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat, ApiChatBannedRights } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { selectChat } from '../../../modules/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 } = getDispatch();\n\n const [permissions, setPermissions] = useState<ApiChatBannedRights>({});\n const [havePermissionChanged, setHavePermissionChanged] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [isBanConfirmationDialogOpen, openBanConfirmationDialog, closeBanConfirmationDialog] = useFlag();\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n const selectedChatMember = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.members) {\n return undefined;\n }\n\n return chat.fullInfo.members.find(({ userId }) => userId === selectedChatMemberId);\n }, [chat, selectedChatMemberId]);\n\n useEffect(() => {\n if (chat?.fullInfo && selectedChatMemberId && !selectedChatMember) {\n onScreenSelect(ManagementScreens.GroupPermissions);\n }\n }, [chat, onScreenSelect, selectedChatMember, selectedChatMemberId]);\n\n useEffect(() => {\n setPermissions((selectedChatMember?.bannedRights) || (chat?.defaultBannedRights) || {});\n setHavePermissionChanged(false);\n setIsLoading(false);\n }, [chat, selectedChatMember]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as Exclude<keyof ApiChatBannedRights, 'untilDate'>]),\n ...(name === 'sendStickers' && {\n sendGifs: getUpdatedPermissionValue(p[name]),\n }),\n }));\n setHavePermissionChanged(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!chat || !selectedChatMemberId) {\n return;\n }\n\n setIsLoading(true);\n updateChatMemberBannedRights({\n chatId: chat.id,\n userId: selectedChatMemberId,\n bannedRights: permissions,\n });\n }, [chat, selectedChatMemberId, permissions, updateChatMemberBannedRights]);\n\n const handleBanFromGroup = useCallback(() => {\n if (!chat || !selectedChatMemberId) {\n return;\n }\n\n updateChatMemberBannedRights({\n chatId: chat.id,\n userId: selectedChatMemberId,\n bannedRights: {\n viewMessages: true,\n },\n });\n }, [chat, selectedChatMemberId, updateChatMemberBannedRights]);\n\n const getControlIsDisabled = useCallback((key: Exclude<keyof ApiChatBannedRights, 'untilDate'>) => {\n if (isFormFullyDisabled) {\n return true;\n }\n\n if (!chat || !chat.defaultBannedRights) {\n return false;\n }\n\n return chat.defaultBannedRights[key];\n }, [chat, isFormFullyDisabled]);\n\n if (!selectedChatMember) {\n return undefined;\n }\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo userId={selectedChatMember.userId} />\n </ListItem>\n\n <h3 className=\"section-heading mt-4\" dir=\"auto\">{lang('UserRestrictionsCanDo')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMessages\"\n checked={!permissions.sendMessages}\n label={lang('UserRestrictionsSend')}\n blocking\n disabled={getControlIsDisabled('sendMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendMedia\"\n checked={!permissions.sendMedia}\n label={lang('UserRestrictionsSendMedia')}\n blocking\n disabled={getControlIsDisabled('sendMedia')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendStickers\"\n checked={!permissions.sendStickers && !permissions.sendGifs}\n label={lang('UserRestrictionsSendStickers')}\n blocking\n disabled={getControlIsDisabled('sendStickers')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"sendPolls\"\n checked={!permissions.sendPolls}\n label={lang('UserRestrictionsSendPolls')}\n blocking\n disabled={getControlIsDisabled('sendPolls')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"embedLinks\"\n checked={!permissions.embedLinks}\n label={lang('UserRestrictionsEmbedLinks')}\n blocking\n disabled={getControlIsDisabled('embedLinks')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={!permissions.inviteUsers}\n label={lang('UserRestrictionsInviteUsers')}\n blocking\n disabled={getControlIsDisabled('inviteUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={!permissions.pinMessages}\n label={lang('UserRestrictionsPinMessages')}\n blocking\n disabled={getControlIsDisabled('pinMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!permissions.changeInfo}\n label={lang('UserRestrictionsChangeInfo')}\n blocking\n disabled={getControlIsDisabled('changeInfo')}\n onChange={handlePermissionChange}\n />\n </div>\n </div>\n\n {!isFormFullyDisabled && (\n <div className=\"section\">\n <ListItem icon=\"delete-user\" ripple destructive onClick={openBanConfirmationDialog}>\n {lang('UserRestrictionsBlock')}\n </ListItem>\n </div>\n )}\n </div>\n\n <FloatingActionButton\n isShown={havePermissionChanged}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n\n <ConfirmDialog\n isOpen={isBanConfirmationDialogOpen}\n onClose={closeBanConfirmationDialog}\n text=\"Are you sure you want to ban and remove this user from the group?\"\n confirmLabel=\"Remove\"\n confirmHandler={handleBanFromGroup}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, isPromotedByCurrentUser }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const isFormFullyDisabled = !(chat.isCreator || isPromotedByCurrentUser);\n\n return { chat, isFormFullyDisabled };\n },\n)(ManageGroupUserPermissions));\n","import React, {\n FC, memo, useCallback, useMemo,\n} from '../../../lib/teact/teact';\nimport { getGlobal, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ManagementScreens } from '../../../types';\nimport { ApiChat, ApiChatMember } from '../../../api/types';\n\nimport { getUserFullName, isChatChannel } from '../../../modules/helpers';\nimport { selectChat } from '../../../modules/selectors';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport FloatingActionButton from '../../ui/FloatingActionButton';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onChatMemberSelect: (memberId: string, isPromotedByCurrentUser?: boolean) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat: ApiChat;\n currentUserId?: string;\n isChannel: boolean;\n};\n\nconst ManageChatAdministrators: FC<OwnProps & StateProps> = ({\n chat,\n isChannel,\n currentUserId,\n onScreenSelect,\n onChatMemberSelect,\n onClose,\n isActive,\n}) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n function handleRecentActionsClick() {\n onScreenSelect(ManagementScreens.GroupRecentActions);\n }\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 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 '../../../lib/teact/teactn';\n\nimport { ApiChat, ApiChatMember } from '../../../api/types';\nimport useLang from '../../../hooks/useLang';\nimport { selectChat } from '../../../modules/selectors';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport ListItem from '../../ui/ListItem';\nimport Checkbox from '../../ui/Checkbox';\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\n\ntype OwnProps = {\n chatId: string;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n};\n\nconst ManageGroupRecentActions: FC<OwnProps & StateProps> = ({ chat, onClose, isActive }) => {\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n const adminMembers = useMemo(() => {\n if (!chat || !chat.fullInfo || !chat.fullInfo.adminMembers) {\n return [];\n }\n\n return chat.fullInfo.adminMembers.sort((a, b) => {\n if (a.isOwner) {\n return -1;\n } else if (b.isOwner) {\n return 1;\n }\n\n return 0;\n });\n }, [chat]);\n\n const getMemberStatus = useCallback((member: ApiChatMember) => {\n if (member.isOwner) {\n return lang('ChannelCreator');\n }\n\n return lang('ChannelAdmin');\n }, [lang]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section not-implemented\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\" dir=\"auto\">Actions</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogAllEvents')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterNewAdmins')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterNewMembers')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterChannelInfo')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterDeletedMessages')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterEditedMessages')}\n onChange={undefined}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogFilterLeavingMembers')}\n onChange={undefined}\n />\n </div>\n </div>\n\n <div className=\"section not-implemented\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"section-heading\" dir=\"auto\">{lang('Channel.Management.Title')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={!false}\n label={lang('EventLogAllAdmins')}\n onChange={undefined}\n />\n </div>\n\n {adminMembers.map((member) => (\n <ListItem\n key={member.userId}\n className=\"chat-item-clickable picker-list-item\"\n onClick={undefined}\n ripple\n >\n <Checkbox label=\"\" checked={!false} />\n <PrivateChatInfo\n userId={member.userId}\n status={getMemberStatus(member)}\n forceShowSelf\n />\n </ListItem>\n ))}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n\n return { chat };\n },\n)(ManageGroupRecentActions));\n","import React, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat, ApiChatAdminRights, ApiUser } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { selectChat } from '../../../modules/selectors';\nimport { getUserFullName, isChatBasicGroup, isChatChannel } from '../../../modules/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 } = getDispatch();\n\n const [permissions, setPermissions] = useState<ApiChatAdminRights>({});\n const [isTouched, setIsTouched] = useState(Boolean(isNewAdmin));\n const [isLoading, setIsLoading] = useState(false);\n const [isDismissConfirmationDialogOpen, openDismissConfirmationDialog, closeDismissConfirmationDialog] = useFlag();\n const [customTitle, setCustomTitle] = useState('');\n const lang = useLang();\n\n useHistoryBack(isActive, onClose);\n\n const selectedChatMember = useMemo(() => {\n const selectedAdminMember = chat.fullInfo?.adminMembers?.find(({ userId }) => userId === selectedUserId);\n\n // If `selectedAdminMember` variable is filled with a value, then we have already saved the administrator,\n // so now we need to return to the list of administrators\n if (isNewAdmin && (selectedAdminMember || !selectedUserId)) {\n return undefined;\n }\n\n if (isNewAdmin) {\n const user = getGlobal().users.byId[selectedUserId!];\n\n return user ? {\n userId: user.id,\n adminRights: defaultRights,\n customTitle: lang('ChannelAdmin'),\n isOwner: false,\n promotedByUserId: undefined,\n } : undefined;\n }\n\n return selectedAdminMember;\n }, [chat.fullInfo?.adminMembers, defaultRights, isNewAdmin, lang, selectedUserId]);\n\n useEffect(() => {\n if (chat?.fullInfo && selectedUserId && !selectedChatMember) {\n onScreenSelect(ManagementScreens.ChatAdministrators);\n }\n }, [chat, onScreenSelect, selectedChatMember, selectedUserId]);\n\n useEffect(() => {\n setPermissions(selectedChatMember?.adminRights || {});\n setCustomTitle((selectedChatMember?.customTitle || '').substr(0, CUSTOM_TITLE_MAX_LENGTH));\n setIsTouched(Boolean(isNewAdmin));\n setIsLoading(false);\n }, [defaultRights, isNewAdmin, selectedChatMember]);\n\n const handlePermissionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { name } = e.target;\n\n function getUpdatedPermissionValue(value: true | undefined) {\n return value ? undefined : true;\n }\n\n setPermissions((p) => ({\n ...p,\n [name]: getUpdatedPermissionValue(p[name as keyof ApiChatAdminRights]),\n }));\n setIsTouched(true);\n }, []);\n\n const handleSavePermissions = useCallback(() => {\n if (!selectedUserId) {\n return;\n }\n\n setIsLoading(true);\n updateChatAdmin({\n chatId: chat.id,\n userId: selectedUserId,\n adminRights: permissions,\n customTitle,\n });\n }, [selectedUserId, updateChatAdmin, chat.id, permissions, customTitle]);\n\n const handleDismissAdmin = useCallback(() => {\n if (!selectedUserId) {\n return;\n }\n\n updateChatAdmin({\n chatId: chat.id,\n userId: selectedUserId,\n adminRights: {},\n });\n closeDismissConfirmationDialog();\n }, [chat.id, closeDismissConfirmationDialog, selectedUserId, updateChatAdmin]);\n\n const getControlIsDisabled = useCallback((key: keyof ApiChatAdminRights) => {\n if (isChatBasicGroup(chat)) {\n return false;\n }\n\n if (isFormFullyDisabled || !chat.adminRights) {\n return true;\n }\n\n return !chat.adminRights![key];\n }, [chat, isFormFullyDisabled]);\n\n const memberStatus = useMemo(() => {\n if (isNewAdmin || !selectedChatMember) {\n return undefined;\n }\n\n if (selectedChatMember.isOwner) {\n return lang('ChannelCreator');\n }\n\n const promotedByUser = selectedChatMember.promotedByUserId\n ? usersById[selectedChatMember.promotedByUserId]\n : undefined;\n\n if (promotedByUser) {\n return lang('EditAdminPromotedBy', getUserFullName(promotedByUser));\n }\n\n return lang('ChannelAdmin');\n }, [isNewAdmin, selectedChatMember, usersById, lang]);\n\n const handleCustomTitleChange = useCallback((e) => {\n const { value } = e.target;\n setCustomTitle(value);\n setIsTouched(true);\n }, []);\n\n if (!selectedChatMember) {\n return undefined;\n }\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <ListItem inactive className=\"chat-item-clickable\">\n <PrivateChatInfo\n userId={selectedChatMember.userId}\n status={memberStatus}\n forceShowSelf\n />\n </ListItem>\n\n <h3 className=\"section-heading mt-4\" dir=\"auto\">{lang('EditAdminWhatCanDo')}</h3>\n\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"changeInfo\"\n checked={Boolean(permissions.changeInfo)}\n label={lang(isChannel ? 'EditAdminChangeChannelInfo' : 'EditAdminChangeGroupInfo')}\n blocking\n disabled={getControlIsDisabled('changeInfo')}\n onChange={handlePermissionChange}\n />\n </div>\n {isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"postMessages\"\n checked={Boolean(permissions.postMessages)}\n label={lang('EditAdminPostMessages')}\n blocking\n disabled={getControlIsDisabled('postMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n {isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"editMessages\"\n checked={Boolean(permissions.editMessages)}\n label={lang('EditAdminEditMessages')}\n blocking\n disabled={getControlIsDisabled('editMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"deleteMessages\"\n checked={Boolean(permissions.deleteMessages)}\n label={lang(isChannel ? 'EditAdminDeleteMessages' : 'EditAdminGroupDeleteMessages')}\n blocking\n disabled={getControlIsDisabled('deleteMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"banUsers\"\n checked={Boolean(permissions.banUsers)}\n label={lang('EditAdminBanUsers')}\n blocking\n disabled={getControlIsDisabled('banUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"inviteUsers\"\n checked={Boolean(permissions.inviteUsers)}\n label={lang('EditAdminAddUsers')}\n blocking\n disabled={getControlIsDisabled('inviteUsers')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"pinMessages\"\n checked={Boolean(permissions.pinMessages)}\n label={lang('EditAdminPinMessages')}\n blocking\n disabled={getControlIsDisabled('pinMessages')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"addAdmins\"\n checked={Boolean(permissions.addAdmins)}\n label={lang('EditAdminAddAdmins')}\n blocking\n disabled={getControlIsDisabled('addAdmins')}\n onChange={handlePermissionChange}\n />\n </div>\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"manageCall\"\n checked={Boolean(permissions.manageCall)}\n label={lang('StartVoipChatPermission')}\n blocking\n disabled={getControlIsDisabled('manageCall')}\n onChange={handlePermissionChange}\n />\n </div>\n {!isChannel && (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"anonymous\"\n checked={Boolean(permissions.anonymous)}\n label={lang('EditAdminSendAnonymously')}\n blocking\n disabled={getControlIsDisabled('anonymous')}\n onChange={handlePermissionChange}\n />\n </div>\n )}\n\n {isFormFullyDisabled && (\n <p className=\"section-info mb-4\" dir=\"auto\">\n {lang('Channel.EditAdmin.CannotEdit')}\n </p>\n )}\n\n {!isChannel && (\n <InputText\n id=\"admin-title\"\n label={lang('EditAdminRank')}\n onChange={handleCustomTitleChange}\n value={customTitle}\n disabled={isFormFullyDisabled}\n maxLength={CUSTOM_TITLE_MAX_LENGTH}\n />\n )}\n\n {currentUserId !== selectedUserId && !isFormFullyDisabled && !isNewAdmin && (\n <ListItem icon=\"delete\" ripple destructive onClick={openDismissConfirmationDialog}>\n {lang('EditAdminRemoveAdmin')}\n </ListItem>\n )}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isTouched}\n onClick={handleSavePermissions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n\n {!isNewAdmin && (\n <ConfirmDialog\n isOpen={isDismissConfirmationDialogOpen}\n onClose={closeDismissConfirmationDialog}\n text=\"Are you sure you want to dismiss this admin?\"\n confirmLabel={lang('Channel.Admin.Dismiss')}\n confirmHandler={handleDismissAdmin}\n confirmIsDestructive\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, isPromotedByCurrentUser }): StateProps => {\n const chat = selectChat(global, chatId)!;\n const { byId: usersById } = global.users;\n const { currentUserId } = global;\n const isChannel = isChatChannel(chat);\n const isFormFullyDisabled = !(chat.isCreator || isPromotedByCurrentUser);\n\n return {\n chat,\n usersById,\n currentUserId,\n isChannel,\n isFormFullyDisabled,\n defaultRights: chat.adminRights,\n };\n },\n)(ManageGroupAdminRights));\n","import React, {\n FC, memo, useCallback, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChatMember, ApiUserStatus } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { unique } from '../../../util/iteratees';\nimport { selectChat } from '../../../modules/selectors';\nimport {\n sortUserIds, isChatChannel, filterUsersByName, sortChatIds, isUserBot,\n} from '../../../modules/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 { openUserInfo, setUserSearchQuery, loadContactList } = getDispatch();\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 openUserInfo({ id });\n }\n }, [noAdmins, onChatMemberSelect, onScreenSelect, openUserInfo]);\n\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setUserSearchQuery({ query: e.target.value });\n }, [setUserSearchQuery]);\n const handleKeyDown = useKeyboardListNavigation(containerRef, isActive, (index) => {\n if (viewportIds && viewportIds.length > 0) {\n handleMemberClick(viewportIds[index === -1 ? 0 : index]);\n }\n }, '.ListItem-button', true);\n\n useHistoryBack(isActive, onClose);\n\n function renderSearchField() {\n return (\n <div className=\"Management__filter\" dir={lang.isRtl ? 'rtl' : undefined}>\n <InputText\n ref={inputRef}\n value={searchQuery}\n onChange={handleFilterChange}\n placeholder={lang('Search')}\n />\n </div>\n );\n }\n\n return (\n <div className=\"Management\">\n {noAdmins && renderSearchField()}\n <div className=\"custom-scroll\">\n <div className=\"section\">\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"picker-list custom-scroll\"\n items={displayedIds}\n onLoadMore={getMore}\n noScrollRestore={Boolean(searchQuery)}\n ref={containerRef}\n onKeyDown={handleKeyDown}\n >\n {viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable scroll-item\"\n 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 '../../../lib/teact/teactn';\n\nimport { ApiChatMember, ApiUser, ApiUserStatus } from '../../../api/types';\nimport { ManagementScreens } from '../../../types';\n\nimport { selectChat } from '../../../modules/selectors';\nimport { sortUserIds, isChatChannel } from '../../../modules/helpers';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport PrivateChatInfo from '../../common/PrivateChatInfo';\nimport ListItem from '../../ui/ListItem';\nimport NothingFound from '../../common/NothingFound';\n\ntype OwnProps = {\n chatId: string;\n onScreenSelect: (screen: ManagementScreens) => void;\n onChatMemberSelect: (memberId: string) => void;\n onClose: NoneToVoidFunction;\n isActive: boolean;\n};\n\ntype StateProps = {\n usersById: Record<string, ApiUser>;\n userStatusesById: Record<string, ApiUserStatus>;\n members?: ApiChatMember[];\n isChannel?: boolean;\n serverTimeOffset: number;\n};\n\nconst ManageGroupUserPermissionsCreate: FC<OwnProps & StateProps> = ({\n usersById,\n userStatusesById,\n members,\n isChannel,\n onScreenSelect,\n onChatMemberSelect,\n onClose,\n isActive,\n serverTimeOffset,\n}) => {\n useHistoryBack(isActive, onClose);\n\n const memberIds = useMemo(() => {\n if (!members || !usersById) {\n return undefined;\n }\n\n return sortUserIds(\n members.filter((member) => !member.isOwner).map(({ userId }) => userId),\n usersById,\n userStatusesById,\n undefined,\n serverTimeOffset,\n );\n }, [members, serverTimeOffset, usersById, userStatusesById]);\n\n const handleExceptionMemberClick = useCallback((memberId: string) => {\n onChatMemberSelect(memberId);\n onScreenSelect(ManagementScreens.GroupUserPermissions);\n }, [onChatMemberSelect, onScreenSelect]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\" teactFastList>\n {memberIds ? (\n memberIds.map((id, i) => (\n <ListItem\n key={id}\n teactOrderKey={i}\n className=\"chat-item-clickable scroll-item\"\n 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/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 '../../../modules/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 } = getDispatch();\n\n const lang = useLang();\n\n const [isDeleteRevokeAllDialogOpen, openDeleteRevokeAllDialog, closeDeleteRevokeAllDialog] = useFlag();\n const [isRevokeDialogOpen, openRevokeDialog, closeRevokeDialog] = useFlag();\n const [revokingInvite, setRevokingInvite] = useState<ApiExportedInvite | undefined>();\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n const [deletingInvite, setDeletingInvite] = useState<ApiExportedInvite | undefined>();\n\n const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('Invite').then(setAnimationData);\n }\n }, [animationData]);\n\n useHistoryBack(isActive, onClose);\n\n const hasDetailedCountdown = useMemo(() => {\n if (!exportedInvites) return undefined;\n return exportedInvites\n .some(({ expireDate }) => (\n expireDate && (expireDate - getServerTime(serverTimeOffset) < MILLISECONDS_IN_DAY / 1000)\n ));\n }, [exportedInvites, serverTimeOffset]);\n const forceUpdate = useForceUpdate();\n useInterval(() => {\n forceUpdate();\n }, hasDetailedCountdown ? 1000 : undefined);\n\n const primaryInvite = exportedInvites?.find(({ isPermanent }) => isPermanent);\n const primaryInviteLink = chat?.username ? `t.me/${chat.username}` : primaryInvite?.link;\n const temporalInvites = useMemo(() => {\n const invites = chat?.username ? exportedInvites : exportedInvites?.filter(({ isPermanent }) => !isPermanent);\n return invites?.sort(inviteComparator);\n }, [chat?.username, exportedInvites]);\n\n const editInvite = (invite: ApiExportedInvite) => {\n setEditingExportedInvite({ chatId, invite });\n onScreenSelect(ManagementScreens.EditInvite);\n };\n\n const revokeInvite = useCallback((invite: ApiExportedInvite) => {\n const {\n link, title, isRequestNeeded, expireDate, usageLimit,\n } = invite;\n editExportedChatInvite({\n chatId,\n link,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n isRevoked: true,\n });\n }, [chatId, editExportedChatInvite]);\n\n const askToRevoke = useCallback((invite: ApiExportedInvite) => {\n setRevokingInvite(invite);\n openRevokeDialog();\n }, [openRevokeDialog]);\n\n const handleRevoke = useCallback(() => {\n if (!revokingInvite) return;\n revokeInvite(revokingInvite);\n setRevokingInvite(undefined);\n closeRevokeDialog();\n }, [closeRevokeDialog, revokeInvite, revokingInvite]);\n\n const handleCreateNewClick = useCallback(() => {\n onScreenSelect(ManagementScreens.EditInvite);\n }, [onScreenSelect]);\n\n const handlePrimaryRevoke = useCallback(() => {\n if (primaryInvite) {\n askToRevoke(primaryInvite);\n }\n }, [askToRevoke, primaryInvite]);\n\n const handleDeleteAllRevoked = useCallback(() => {\n deleteRevokedExportedChatInvites({ chatId });\n closeDeleteRevokeAllDialog();\n }, [chatId, closeDeleteRevokeAllDialog, deleteRevokedExportedChatInvites]);\n\n const showInviteInfo = useCallback((invite: ApiExportedInvite) => {\n setOpenedInviteInfo({ chatId, invite });\n onScreenSelect(ManagementScreens.InviteInfo);\n }, [chatId, onScreenSelect, setOpenedInviteInfo]);\n\n const deleteInvite = useCallback((invite: ApiExportedInvite) => {\n deleteExportedChatInvite({ chatId, link: invite.link });\n }, [chatId, deleteExportedChatInvite]);\n\n const askToDelete = useCallback((invite: ApiExportedInvite) => {\n setDeletingInvite(invite);\n openDeleteDialog();\n }, [openDeleteDialog]);\n\n const handleDelete = useCallback(() => {\n if (!deletingInvite) return;\n deleteInvite(deletingInvite);\n setDeletingInvite(undefined);\n closeDeleteDialog();\n }, [closeDeleteDialog, deleteInvite, deletingInvite]);\n\n const copyLink = useCallback((link: string) => {\n copyTextToClipboard(link);\n showNotification({\n message: lang('LinkCopied'),\n });\n }, [lang, showNotification]);\n\n const handleCopyPrimaryClicked = useCallback(() => {\n copyLink(primaryInviteLink!);\n }, [copyLink, primaryInviteLink]);\n\n const prepareUsageText = (invite: ApiExportedInvite) => {\n const {\n usage = 0, usageLimit, expireDate, isPermanent, requested, isRevoked,\n } = invite;\n let text = '';\n if (!isRevoked && usageLimit && usage < usageLimit) {\n text = lang('CanJoin', usageLimit - usage);\n } else if (usage) {\n text = lang('PeopleJoined', usage);\n } else {\n text = lang('NoOneJoined');\n }\n\n if (isRevoked) {\n text += ` ${BULLET} ${lang('Revoked')}`;\n return text;\n }\n\n if (requested) {\n text += ` ${BULLET} ${lang('JoinRequests', requested)}`;\n }\n\n if (usageLimit !== undefined && usage === usageLimit) {\n text += ` ${BULLET} ${lang('LinkLimitReached')}`;\n } else if (expireDate) {\n const diff = (expireDate - getServerTime(serverTimeOffset)) * 1000;\n text += ` ${BULLET} `;\n if (diff > 0) {\n text += lang('InviteLink.ExpiresIn', formatCountdown(lang, diff));\n } else {\n text += lang('InviteLink.Expired');\n }\n } else if (isPermanent) {\n text += ` ${BULLET} ${lang('Permanent')}`;\n }\n\n return text;\n };\n\n const prepareContextActions = (invite: ApiExportedInvite) => {\n const actions = [];\n actions.push({\n title: lang('Copy'),\n icon: 'copy',\n handler: () => copyLink(invite.link),\n });\n\n if (!invite.isPermanent && !invite.isRevoked) {\n actions.push({\n title: lang('Edit'),\n icon: 'edit',\n handler: () => editInvite(invite),\n });\n }\n\n if (!invite.isRevoked) {\n actions.push({\n title: lang('RevokeButton'),\n icon: 'delete',\n handler: () => askToRevoke(invite),\n destructive: true,\n });\n } else {\n actions.push({\n title: lang('DeleteLink'),\n icon: 'delete',\n handler: () => askToDelete(invite),\n destructive: true,\n });\n }\n return actions;\n };\n\n const PrimaryLinkMenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : ''}\n onClick={onTrigger}\n ariaLabel=\"Actions\"\n >\n <i className=\"icon-more\" />\n </Button>\n );\n }, []);\n\n return (\n <div className=\"Management ManageInvites\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <div className=\"section-icon\">\n {animationData && (\n <AnimatedSticker\n id=\"inviteDuck\"\n size={STICKER_SIZE_INVITES}\n animationData={animationData}\n play={isAnimationLoaded}\n onLoad={handleAnimationLoad}\n />\n )}\n </div>\n <p className='text-muted'>{isChannel ? lang('PrimaryLinkHelpChannel') : lang('PrimaryLinkHelp')}</p>\n </div>\n {primaryInviteLink && (\n <div className=\"section\">\n <p className=\"text-muted\">\n {chat?.username ? lang('PublicLink') : lang('lng_create_permanent_link_title')}\n </p>\n <div className=\"primary-link\">\n <input\n className=\"form-control primary-link-input\"\n value={primaryInviteLink}\n readOnly\n onClick={handleCopyPrimaryClicked}\n />\n <DropdownMenu\n className=\"primary-link-more-menu\"\n trigger={PrimaryLinkMenuButton}\n positionX=\"right\"\n >\n <MenuItem icon=\"copy\" onClick={handleCopyPrimaryClicked}>{lang('Copy')}</MenuItem>\n {!chat?.username && (\n <MenuItem icon=\"delete\" onClick={handlePrimaryRevoke} destructive>{lang('RevokeButton')}</MenuItem>\n )}\n </DropdownMenu>\n </div>\n <Button onClick={handleCopyPrimaryClicked}>{lang('CopyLink')}</Button>\n </div>\n )}\n <div className=\"section\" teactFastList>\n <Button isText key=\"create\" className=\"create-link\" onClick={handleCreateNewClick}>\n {lang('CreateNewLink')}\n </Button>\n {(!temporalInvites || !temporalInvites.length) && <NothingFound text=\"No links found\" key=\"nothing\" />}\n {temporalInvites?.map((invite) => (\n <ListItem\n icon=\"link\"\n secondaryIcon=\"more\"\n multiline\n 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 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 } = getDispatch();\n\n const lang = useLang();\n const [isCalendarOpened, openCalendar, closeCalendar] = useFlag();\n const [isRequestNeeded, setIsRequestNeeded] = useState(false);\n const [title, setTitle] = useState('');\n const [customExpireDate, setCustomExpireDate] = useState<number>(Date.now() + DEFAULT_CUSTOM_EXPIRE_DATE);\n const [selectedExpireOption, setSelectedExpireOption] = useState('unlimited');\n const [customUsageLimit, setCustomUsageLimit] = useState<number | undefined>(10);\n const [selectedUsageOption, setSelectedUsageOption] = useState('0');\n const [isSubmitBlocked, setIsSubmitBlocked] = useState(false);\n\n useHistoryBack(isActive, onClose);\n\n useOnChange(([oldEditingInvite]) => {\n if (oldEditingInvite === editingInvite) return;\n if (!editingInvite) {\n setTitle('');\n setSelectedExpireOption('unlimited');\n setSelectedUsageOption('0');\n setCustomExpireDate(getServerTime(serverTimeOffset) * 1000 + DEFAULT_CUSTOM_EXPIRE_DATE);\n setCustomUsageLimit(10);\n setIsRequestNeeded(false);\n } else {\n const {\n title: editingTitle, usageLimit, expireDate, isRequestNeeded: editingIsRequestNeeded,\n } = editingInvite;\n if (editingTitle) setTitle(editingTitle);\n if (usageLimit) {\n setSelectedUsageOption(DEFAULT_USAGE_LIMITS.includes(usageLimit) ? usageLimit.toString() : 'custom');\n setCustomUsageLimit(usageLimit);\n }\n if (expireDate) {\n const minSafeDate = getServerTime(serverTimeOffset) + DEFAULT_CUSTOM_EXPIRE_DATE;\n setSelectedExpireOption('custom');\n setCustomExpireDate(Math.max(expireDate, minSafeDate) * 1000);\n }\n if (editingIsRequestNeeded) {\n setIsRequestNeeded(true);\n }\n }\n }, [editingInvite, serverTimeOffset]);\n\n const handleIsRequestChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setIsRequestNeeded(e.target.checked);\n }, []);\n\n const handleTitleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setTitle(e.target.value);\n }, []);\n\n const handleCustomUsageLimitChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setCustomUsageLimit(Number.parseInt(e.target.value, 10));\n }, []);\n\n const handleExpireDateChange = useCallback((date: Date) => {\n setCustomExpireDate(date.getTime());\n closeCalendar();\n }, [closeCalendar]);\n\n const handleSaveClick = useCallback(() => {\n setIsSubmitBlocked(true);\n const usageLimit = selectedUsageOption === 'custom' ? customUsageLimit : selectedUsageOption;\n let expireDate;\n switch (selectedExpireOption) {\n case 'custom':\n expireDate = getServerTime(serverTimeOffset) + (customExpireDate - Date.now()) / 1000;\n break;\n case 'hour':\n case 'day':\n case 'week':\n expireDate = getServerTime(serverTimeOffset) + DEFAULT_EXPIRE_DATE[selectedExpireOption] / 1000;\n break;\n case 'unlimited':\n default:\n expireDate = undefined;\n }\n\n if (editingInvite) {\n editExportedChatInvite({\n link: editingInvite.link,\n chatId,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n });\n } else {\n exportChatInvite({\n chatId,\n title,\n isRequestNeeded,\n expireDate,\n usageLimit,\n });\n }\n onScreenSelect(ManagementScreens.Invites);\n }, [\n chatId, customExpireDate, customUsageLimit, editExportedChatInvite, editingInvite,\n exportChatInvite, isRequestNeeded, selectedExpireOption, selectedUsageOption, title, onScreenSelect,\n serverTimeOffset,\n ]);\n\n return (\n <div className=\"Management ManageInvite\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <Checkbox\n label={lang('ApproveNewMembers')}\n subLabel={lang('ApproveNewMembersDescription')}\n checked={isRequestNeeded}\n onChange={handleIsRequestChange}\n />\n </div>\n <div className=\"section\">\n <InputText\n className=\"link-name\"\n placeholder={lang('LinkNameHint')}\n value={title}\n onChange={handleTitleChange}\n />\n <p className=\"text-muted hint\">{lang('LinkNameHelp')}</p>\n </div>\n <div className=\"section\">\n <div className=\"section-header\">{lang('LimitByPeriod')}</div>\n <RadioGroup\n name=\"expireOptions\"\n options={[\n {\n value: 'hour',\n label: lang('Hours', 1),\n },\n {\n value: 'day',\n label: lang('Days', 1),\n },\n {\n value: 'week',\n label: lang('Weeks', 1),\n },\n {\n value: 'unlimited',\n label: lang('NoLimit'),\n },\n {\n value: 'custom',\n label: lang('lng_group_invite_expire_custom'),\n },\n ]}\n onChange={setSelectedExpireOption}\n selected={selectedExpireOption}\n />\n {selectedExpireOption === 'custom' && (\n <Button className=\"expire-limit\" isText onClick={openCalendar}>\n {formatFullDate(lang, customExpireDate)} {formatTime(lang, customExpireDate)}\n </Button>\n )}\n <p className=\"text-muted hint\">{lang('TimeLimitHelp')}</p>\n </div>\n {!isRequestNeeded && (\n <div className=\"section\">\n <div className=\"section-header\">{lang('LimitNumberOfUses')}</div>\n <RadioGroup\n name=\"usageOptions\"\n options={[\n ...DEFAULT_USAGE_LIMITS.map((n) => ({ value: n.toString(), label: n })),\n {\n value: '0',\n label: lang('NoLimit'),\n },\n {\n value: 'custom',\n label: lang('lng_group_invite_usage_custom'),\n },\n ]}\n onChange={setSelectedUsageOption}\n selected={selectedUsageOption}\n />\n {selectedUsageOption === 'custom' && (\n <input\n className=\"form-control usage-limit\"\n type=\"number\"\n min=\"1\"\n max=\"99999\"\n value={customUsageLimit}\n onChange={handleCustomUsageLimitChange}\n />\n )}\n <p className=\"text-muted hint\">{lang('UsesLimitHelp')}</p>\n </div>\n )}\n <FloatingActionButton\n isShown\n onClick={handleSaveClick}\n disabled={isSubmitBlocked}\n ariaLabel={editingInvite ? lang('SaveLink') : lang('CreateLink')}\n >\n <i className=\"icon-check\" />\n </FloatingActionButton>\n </div>\n <CalendarModal\n isOpen={isCalendarOpened}\n isFutureMode\n withTimePicker\n onClose={closeCalendar}\n onSubmit={handleExpireDateChange}\n selectedAt={customExpireDate}\n submitButtonLabel={lang('Save')}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { editingInvite } = global.management.byChatId[chatId];\n\n return {\n editingInvite,\n serverTimeOffset: global.serverTimeOffset,\n };\n },\n)(ManageInvite));\n","import React, {\n FC, memo, useCallback, useEffect, useState,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiAvailableReaction, ApiChat } from '../../../api/types';\n\nimport { selectChat } from '../../../modules/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 } = getDispatch();\n\n const lang = useLang();\n const [isTouched, setIsTouched] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [localEnabledReactions, setLocalEnabledReactions] = useState(enabledReactions || []);\n\n useHistoryBack(isActive, onClose);\n\n const handleSaveReactions = useCallback(() => {\n if (!chat) return;\n setIsLoading(true);\n\n setChatEnabledReactions({\n chatId: chat.id,\n enabledReactions: localEnabledReactions,\n });\n }, [chat, localEnabledReactions, setChatEnabledReactions]);\n\n useEffect(() => {\n if (enabledReactions) {\n setIsLoading(false);\n setIsTouched(false);\n setLocalEnabledReactions(enabledReactions);\n }\n }, [enabledReactions]);\n\n const handleReactionChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (!chat || !availableReactions) return;\n\n const { name, checked } = e.currentTarget;\n const newEnabledReactions = name === 'all' ? (checked ? availableReactions.map((l) => l.reaction) : [])\n : (!checked\n ? localEnabledReactions.filter((l) => l !== name)\n : [...localEnabledReactions, name]);\n\n setLocalEnabledReactions(newEnabledReactions);\n setIsTouched(true);\n }, [availableReactions, chat, localEnabledReactions]);\n\n return (\n <div className=\"Management\">\n <div className=\"custom-scroll\">\n <div className=\"section\">\n <div className=\"ListItem no-selection\">\n <Checkbox\n name=\"all\"\n checked={!localEnabledReactions || localEnabledReactions.length > 0}\n label={lang('EnableReactions')}\n onChange={handleReactionChange}\n />\n </div>\n {availableReactions?.filter((l) => !l.isInactive).map(({ reaction, title }) => (\n <div className=\"ListItem no-selection\">\n <Checkbox\n name={reaction}\n checked={!localEnabledReactions || localEnabledReactions?.includes(reaction)}\n disabled={localEnabledReactions?.length === 0}\n label={(\n <div className=\"Reaction\">\n <ReactionStaticEmoji reaction={reaction} />\n {title}\n </div>\n )}\n onChange={handleReactionChange}\n />\n </div>\n ))}\n </div>\n </div>\n\n <FloatingActionButton\n isShown={isTouched}\n onClick={handleSaveReactions}\n ariaLabel={lang('Save')}\n disabled={isLoading}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-check\" />\n )}\n </FloatingActionButton>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId)!;\n\n return {\n enabledReactions: chat.fullInfo?.enabledReactions,\n availableReactions: global.availableReactions,\n chat,\n };\n },\n)(ManageReactions));\n","import React, {\n FC, memo, useCallback, useEffect,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\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 '../../../modules/helpers';\nimport { selectChat } from '../../../modules/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 openUserInfo,\n } = getDispatch();\n\n const lang = useLang();\n const {\n usage = 0, usageLimit, link, adminId,\n } = invite || {};\n const expireDate = invite?.expireDate && (invite.expireDate - getServerTime(serverTimeOffset)) * 1000 + Date.now();\n const isExpired = ((invite?.expireDate || 0) - getServerTime(serverTimeOffset)) < 0;\n\n useEffect(() => {\n if (link) {\n loadChatInviteImporters({ chatId, link });\n loadChatInviteRequesters({ chatId, link });\n }\n }, [chatId, link, loadChatInviteImporters, loadChatInviteRequesters]);\n\n const handleCopyClicked = useCallback(() => {\n copyTextToClipboard(invite!.link);\n showNotification({\n message: lang('LinkCopied'),\n });\n }, [invite, lang, showNotification]);\n\n useHistoryBack(isActive, onClose);\n\n const renderImporters = () => {\n if (!importers?.length && requesters?.length) return undefined;\n if (!importers) return <Spinner />;\n return (\n <div className=\"section\">\n <p>{importers.length ? lang('PeopleJoined', usage) : lang('NoOneJoined')}</p>\n <p className=\"text-muted\">\n {!importers.length && (\n usageLimit ? lang('PeopleCanJoinViaLinkCount', usageLimit - usage) : lang('NoOneJoinedYet')\n )}\n {importers.map((importer) => (\n <ListItem\n className=\"chat-item-clickable scroll-item small-icon\"\n onClick={() => openUserInfo({ 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 onClick={() => openUserInfo({ 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 onClick={() => openUserInfo({ 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiUser } from '../../../api/types';\n\nimport useLang from '../../../hooks/useLang';\nimport { getUserFullName } from '../../../modules/helpers';\nimport { selectUser } from '../../../modules/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 { openUserInfo, hideChatJoinRequest } = getDispatch();\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 openUserInfo({ 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 { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChat } from '../../../api/types';\n\nimport { STICKER_SIZE_JOIN_REQUESTS } from '../../../config';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\nimport { selectChat } from '../../../modules/selectors';\nimport { isChatChannel, isUserId } from '../../../modules/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 } = getDispatch();\n const [isAcceptAllDialogOpen, openAcceptAllDialog, closeAcceptAllDialog] = useFlag();\n const [isRejectAllDialogOpen, openRejectAllDialog, closeRejectAllDialog] = useFlag();\n\n const lang = useLang();\n\n const [animationData, setAnimationData] = useState<string>();\n const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);\n const handleAnimationLoad = useCallback(() => setIsAnimationLoaded(true), []);\n\n useEffect(() => {\n if (!animationData) {\n getAnimationData('JoinRequest').then(setAnimationData);\n }\n }, [animationData]);\n\n useHistoryBack(isActive, onClose);\n\n useEffect(() => {\n if (!chat?.joinRequests && !isUserId(chatId)) {\n loadChatJoinRequests({ chatId });\n }\n }, [chat, chatId, loadChatJoinRequests]);\n\n const handleAcceptAllRequests = useCallback(() => {\n hideAllChatJoinRequests({ chatId, isApproved: true });\n closeAcceptAllDialog();\n }, [hideAllChatJoinRequests, chatId, closeAcceptAllDialog]);\n\n const handleRejectAllRequests = useCallback(() => {\n hideAllChatJoinRequests({ chatId, isApproved: false });\n closeRejectAllDialog();\n }, [hideAllChatJoinRequests, chatId, closeRejectAllDialog]);\n\n return (\n <div className=\"Management ManageJoinRequests\">\n <div className=\"section\">\n <div className=\"section-icon\">\n {animationData && (\n <AnimatedSticker\n id=\"joinRequestDucks\"\n size={STICKER_SIZE_JOIN_REQUESTS}\n animationData={animationData}\n play={isAnimationLoaded}\n onLoad={handleAnimationLoad}\n />\n )}\n </div>\n {Boolean(chat?.joinRequests?.length) && (\n <div className=\"bulk-actions\">\n <Button className=\"bulk-action-button\" onClick={openAcceptAllDialog}>Accept all</Button>\n <Button className=\"bulk-action-button\" onClick={openRejectAllDialog} isText>Dismiss all</Button>\n </div>\n )}\n </div>\n <div className=\"section\">\n <div className=\"custom-scroll\" teactFastList>\n <p key=\"title\">\n {!chat?.joinRequests ? lang('Loading') : chat.joinRequests.length\n ? lang('JoinRequests', chat.joinRequests.length) : lang('NoMemberRequests')}\n </p>\n {!chat?.joinRequests && (\n <Spinner key=\"loading\" />\n )}\n {chat?.joinRequests?.length === 0 && (\n <p className=\"text-muted\" key=\"empty\">\n {isChannel ? lang('NoSubscribeRequestsDescription') : lang('NoMemberRequestsDescription')}\n </p>\n )}\n {chat?.joinRequests?.map(({ userId, about, date }) => (\n <JoinRequest\n userId={userId}\n about={about}\n date={date}\n isChannel={isChannel}\n chatId={chatId}\n key={userId}\n />\n ))}\n </div>\n </div>\n <ConfirmDialog\n isOpen={isAcceptAllDialogOpen}\n onClose={closeAcceptAllDialog}\n title=\"Accept all requests?\"\n text=\"Are you sure you want to accept all requests?\"\n confirmHandler={handleAcceptAllRequests}\n />\n <ConfirmDialog\n isOpen={isRejectAllDialogOpen}\n onClose={closeRejectAllDialog}\n title=\"Reject all requests?\"\n text=\"Are you sure you want to reject all requests?\"\n confirmHandler={handleRejectAllRequests}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n\n return {\n chat,\n serverTimeOffset: global.serverTimeOffset,\n isChannel: chat && isChatChannel(chat),\n };\n },\n)(ManageJoinRequests));\n","import React, { FC, memo } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../lib/teact/teactn';\n\nimport { ManagementScreens, ManagementType } from '../../../types';\n\nimport { selectCurrentManagementType } from '../../../modules/selectors';\n\nimport ManageUser from './ManageUser';\nimport ManageGroup from './ManageGroup';\nimport ManageGroupPermissions from './ManageGroupPermissions';\nimport ManageGroupRemovedUsers from './ManageGroupRemovedUsers';\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.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.GroupRemovedUsers:\n return (\n <ManageGroupRemovedUsers\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: any;\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=\"Address1 (Street)\"\n onChange={handleAddress1Change}\n value={state.streetLine1}\n inputMode=\"text\"\n error={formErrors.streetLine1}\n />\n <InputText\n label=\"Address2 (Street)\"\n onChange={handleAddress2Change}\n value={state.streetLine2}\n inputMode=\"text\"\n error={formErrors.streetLine2}\n />\n <InputText\n label=\"City\"\n onChange={handleCityChange}\n value={state.city}\n inputMode=\"text\"\n error={formErrors.city}\n />\n <InputText\n label=\"State\"\n onChange={handleStateChange}\n value={state.state}\n inputMode=\"text\"\n error={formErrors.state}\n />\n <Select\n label=\"Country\"\n placeholder=\"Country\"\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=\"Post Code\"\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=\"Full name\"\n onChange={handleFullNameChange}\n value={state.fullName}\n inputMode=\"text\"\n error={formErrors.fullName}\n />\n ) }\n { needEmail && (\n <InputText\n label=\"Email\"\n onChange={handleEmailChange}\n value={state.email}\n inputMode=\"email\"\n error={formErrors.email}\n />\n ) }\n { needPhone && (\n <InputText\n label=\"Phone number\"\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>Select shipping method</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 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, 'Payment method')}\n {paymentProvider && renderCheckoutItem('stripe-provider', paymentProvider, 'Payment provider')}\n {shippingAddress && renderCheckoutItem('icon-location', shippingAddress, 'Shipping address')}\n {name && renderCheckoutItem('icon-user', name, 'Name')}\n {phone && renderCheckoutItem('icon-phone', phone, 'Phone number')}\n {shippingMethod && renderCheckoutItem('icon-truck', shippingMethod, 'Shipping method')}\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';\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 // 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=\"Expiry date\"\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 useFocusAfterAnimation from '../../hooks/useFocusAfterAnimation';\nimport { formatCardNumber } from '../middle/helpers/inputFormatters';\nimport { detectCardType, CardType } from '../common/helpers/detectCardType';\n\nimport InputText from '../ui/InputText';\n\nimport './CardInput.scss';\n\n// @ts-ignore\nimport mastercardIconPath from '../../assets/mastercard.svg';\n// @ts-ignore\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 // 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=\"Card number\"\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=\"Name on card\"\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=\"CVV code\"\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=\"Country\"\n placeholder=\"Country\"\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=\"Post Code\"\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, {\n FC, memo, useCallback, useEffect, useMemo, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\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';\n\nimport './PaymentModal.scss';\n\nconst DEFAULT_PROVIDER = 'stripe';\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};\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 error,\n}) => {\n const {\n validateRequestedInfo,\n sendPaymentForm,\n setPaymentStep,\n sendCredentialsInfo,\n clearPaymentError,\n } = getDispatch();\n\n const [paymentState, paymentDispatch] = usePaymentReducer();\n const [isLoading, setIsLoading] = useState(false);\n const lang = useLang();\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 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 default:\n return '';\n }\n }, [step, lang]);\n\n const buttonText = useMemo(() => {\n switch (step) {\n case PaymentStep.Checkout:\n return lang('Checkout.PayPrice', formatCurrency(totalPrice, currency, lang.code));\n default:\n return lang('Next');\n }\n }, [step, lang, currency, totalPrice]);\n\n if (isProviderError) {\n return (\n <Modal\n className=\"error\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <p>\n Sorry, Telegram WebZ doesn&apos;t support payments with this provider yet. <br />\n Please use one of our mobile apps to do this.\n </p>\n <Button\n isText\n onClick={onClose}\n >\n {lang('OK')}\n </Button>\n </Modal>\n );\n }\n\n return (\n <Modal\n className=\"PaymentModal\"\n isOpen={isOpen}\n onClose={onClose}\n >\n <div className=\"header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n className=\"close-button\"\n color=\"translucent\"\n round\n size=\"smaller\"\n onClick={onClose}\n ariaLabel=\"Close\"\n >\n <i className=\"icon-close\" />\n </Button>\n <h3>{modalHeader}</h3>\n </div>\n {step !== undefined ? (\n <Transition name=\"slide\" activeKey={step}>\n {() => (\n <div className=\"content custom-scroll\">\n {renderModalContent(step)}\n </div>\n )}\n </Transition>\n ) : (\n <div className=\"empty-content\">\n <Spinner color=\"gray\" />\n </div>\n )}\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 {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 } = global.payment;\n\n const isProviderError = Boolean(invoice && (!nativeProvider || nativeProvider !== DEFAULT_PROVIDER));\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 };\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 '../../lib/teact/teactn';\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,\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 async function handleCropClick() {\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 }\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,\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 function handleAvatarCrop(croppedImg: File) {\n setSelectedFile(undefined);\n onChange(croppedImg);\n\n if (croppedBlobUrl) {\n URL.revokeObjectURL(croppedBlobUrl);\n }\n setCroppedBlobUrl(URL.createObjectURL(croppedImg));\n }\n\n function handleModalClose() {\n setSelectedFile(undefined);\n }\n\n const labelClassName = buildClassName(\n croppedBlobUrl && 'filled',\n disabled && 'disabled',\n );\n\n return (\n <div className=\"AvatarEditable\">\n <label\n className={labelClassName}\n role=\"button\"\n tabIndex={0}\n title={title}\n >\n <input\n type=\"file\"\n onChange={handleSelectFile}\n accept=\"image/png, image/jpeg\"\n />\n <i className=\"icon-camera-add\" />\n {croppedBlobUrl && <img src={croppedBlobUrl} alt=\"Avatar\" />}\n </label>\n <CropModal file={selectedFile} onClose={handleModalClose} onChange={handleAvatarCrop} />\n </div>\n );\n};\n\nexport default memo(AvatarEditable);\n"],"names":["createGhost","source","origin","ghost","document","createElement","classList","add","img","Image","draggable","oncontextmenu","stopEvent","src","HTMLVideoElement","poster","appendChild","MediaViewerOrigin","profileInfo","querySelector","cloneNode","isMessageImageFullyVisible","container","imageEl","messageListElement","imgOffsetTop","offsetTop","closest","id","includes","parentElement","scrollTop","offsetHeight","applyStyles","element","styles","Object","assign","style","getNodes","message","containerSelector","mediaSelector","mediaEls","querySelectorAll","mediaEl","length","applyShape","firstChild","objectFit","memo","withGlobal","global","isDownloading","selectIsDownloading","isProtected","selectIsMessageProtected","mediaData","isVideo","isZoomed","fileName","isAvatar","onCloseMediaViewer","onForward","onZoomToggle","downloadMessageMedia","cancelMessageMediaDownload","getDispatch","loadProgress","downloadProgress","useMediaWithLoadProgress","getMessageMediaHash","handleDownloadClick","useCallback","lang","useLang","MenuButton","useMemo","onTrigger","isOpen","Button","round","size","color","className","undefined","onClick","ariaLabel","IS_SINGLE_COLUMN_LAYOUT","DropdownMenu","trigger","positionX","MenuItem","icon","Math","href","download","ProgressSpinner","progress","noCross","renderDownloadButton","text","isHidden","isForVideo","isMultiline","setIsMultiline","useState","useEffect","footerContent","checkIsMultiline","height","clientHeight","REM","handleResize","throttle","window","addEventListener","removeEventListener","classNames","buildClassName","e","stopPropagation","dir","prop","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","units","bytes","number","floor","log","toFixed","bufferedProgress","currentTime","duration","fileSize","isForceVisible","isForceMobileVersion","isPlayed","isFullscreenSupported","isFullscreen","onChangeFullscreen","onPlayPause","onSeek","isVisible","setVisibility","seekerRef","useRef","isSeeking","timeout","setTimeout","clearTimeout","body","remove","handleSeek","current","width","left","getBoundingClientRect","clientX","MouseEvent","targetTouches","max","min","handleStartSeek","handleStopSeek","captureEvents","onCapture","onRelease","onDrag","isActive","percentagePlayed","percentageBuffered","ref","renderSeekLine","ripple","formatMediaDuration","renderTime","loadedPercent","totalSize","formatFileSize","url","isGif","posterData","posterSize","isMediaViewerOpen","noPlay","onClose","videoRef","setIsPlayed","IS_TOUCH_ENV","IS_IOS","setCurrentTime","isControlsVisible","setIsControlsVisible","setFullscreen","exitFullscreen","elRef","setIsFullscreen","Boolean","useLayoutEffect","listener","listenerEnter","listenerExit","video","PLATFORM_ENV","requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","mozRequestFullScreen","mozCancelFullScreen","webkitCancelFullScreen","webkitExitFullscreen","useFullscreenStatus","isBuffered","bufferingHandlers","useBuffering","shouldRender","shouldRenderSpinner","transitionClassNames","spinnerClassNames","useShowTransition","shouldRenderPlayButton","playButtonClassNames","pause","safePlay","togglePlayState","useVideoCleanup","handleMouseOver","handleMouseOut","handleTimeUpdate","currentTarget","handleEnded","handleFullscreenChange","position","toggleControls","togglePayingStateBySpace","key","preventDefault","wrapperStyle","videoStyle","onMouseOver","onMouseOut","autoPlay","playsInline","loop","muted","onPlay","onEnded","onDoubleClick","onTimeUpdate","join","square","ownProps","chatId","threadId","messageId","avatarOwnerId","profilePhotoIndex","selectChatMessage","senderId","avatarOwner","selectUser","selectChat","selectScheduledMessage","props","animationLevel","onFooterClick","isFooterHidden","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","useBlurSync","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","forceUpdate","useForceUpdate","setIsFooterHidden","setTransform","value","setIsActive","debounceSetMessage","useDebounce","debounceSwipeDirection","debounceActive","handleToggleFooterVisibility","pageX","innerWidth","callback","delay","savedCallback","useTimeout","lastTransform","lastDragOffset","lastZoomCenter","panDelta","initialContentRect","content","lastGestureTime","Date","now","setLastGestureTime","debounce","changeSlide","direction","mId","offset","animateNumber","from","to","timing","timingFunctions","onUpdate","isNotPassive","excludedClosestSelector","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","innerHeight","minOffsetY","top","maxOffsetY","bottom","dirX","nextMessageId","previousMessageId","offsetX","offsetY","getAnimationStyle","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","pageY","onMouseUp","onMouseMove","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","disabled","step","type","onChange","Number","target","mediaViewer","settings","byKey","chatMessages","collectionIds","selectScheduledMessages","selectChatMessages","selectOutlyingIds","selectListedIds","currentSearch","selectCurrentMediaSearch","foundIds","resultsByType","media","openMediaViewer","openForwardMenu","singleMessageId","messageIds","getChatMediaMessageIds","selectedMediaMessageIndex","indexOf","isFirst","isLast","animationKey","prevSenderId","slideAnimation","headerAnimation","canPanZoomWrap","setCanPanZoomWrap","setIsZoomed","setPanDelta","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","matches","getTopOffset","fromTop","fromLeft","fromWidth","fromHeight","uncovered","realWidth","realHeight","srcWidth","srcHeight","uncover","fromTranslateX","fromTranslateY","fromScaleX","fromScaleY","requestAnimationFrame","clearShape","contains","removeChild","animateOpening","toImage","getElementById","targetTop","el","display","rect","windowHeight","isElementInViewport","shouldFadeOut","existingGhost","getElementsByClassName","transition","transformOrigin","opacity","animateClosing","timer","closeZoom","handleZoomToggle","handleZoomValue","level","canCloseZoom","close","handleFooterClick","handleForward","fromChatId","forceOnHeavyAnimation","captureEscKeyListener","stopCurrentAudio","fromId","index","handlePan","renderSenderInfo","useHistoryBack","handleKeyDown","shouldCloseOnVideo","ShowTransition","isRtl","activeKey","name","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","map","i","ListItem","PrivateChatInfo","status","userId","GroupChatInfo","Loading","chats","byId","chatsById","listIds","orderedPinnedIds","activeListIds","active","archivedListIds","archived","pinnedIds","contactIds","contactList","userIds","setForwardChatId","exitForwardMode","loadMoreChats","setFilter","markIsShown","unmarkIsShown","useFlag","chatAndContactIds","priorityIds","unique","chatIds","getCanPostInChat","MAIN_THREAD_ID","usersById","getGlobal","users","sortChatIds","filterChatsByName","filterUsersByName","handleSelectUser","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","handleChangeHours","replace","hours","setHours","hoursStr","handleChangeMinutes","minutes","setMinutes","minutesStr","d","dateCopy","role","tabIndex","handleDateSelect","inputMode","onFocus","onBlur","historyCalendarSelectedAt","searchMessagesByDate","closeHistoryCalendar","handleJumpToDate","timestamp","valueOf","isSchedule","selectCurrentMessageList","canDeleteForAll","selectAllowedMessageActions","contactName","getUserFirstOrLastName","getPrivateChatUserId","willDeleteForCurrentUserOnly","isChatBasicGroup","willDeleteForAll","isChatSuperGroup","album","deleteMessages","deleteScheduledMessages","handleDeleteMessageForAll","messages","shouldDeleteForAll","handleDeleteMessageForSelf","onEnter","isPrivateChat","isChatWithSelf","selectIsChatWithSelf","isChatChannel","isGroup","isSuperGroup","canPinForAll","pinMessage","handlePinMessageForAll","isUnpin","handlePinMessage","isOneSide","isSilent","pinnedMessagesCount","onUnpin","selectedMessageIds","selectedMessages","selectCanDeleteSelectedMessages","selectCurrentChat","exitMessageSelectMode","reportMessages","selectedReason","setSelectedReason","description","setDescription","handleReport","reason","handleSelectReason","handleDescriptionChange","REPORT_OPTIONS","label","RadioGroup","options","selected","messageListType","canDelete","canReport","selectCanReportSelectedMessages","canDownload","selectCanDownloadSelectedMessages","hasProtectedMessage","selectHasProtectedMessage","selectedMessagesCount","selectSelectedMessagesCount","canDeleteMessages","canReportMessages","canDownloadMessages","canPost","openForwardMenuForSelectedMessages","downloadSelectedMessages","isDeleteModalOpen","openDeleteModal","closeDeleteModal","isReportModalOpen","openReportModal","closeReportModal","captureKeyboardListeners","onBackspace","onDelete","onEsc","handleDownload","prevSelectedMessagesCount","renderingSelectedMessagesCount","formattedMessagesCount","renderButton","destructive","seenByModal","memberIds","seenByUserIds","openChat","closeSeenByModal","handleClick","renderingMemberIds","noStatusOrTyping","reactorModal","reactions","reactors","loadReactors","closeReactorListModal","isClosing","startClosing","stopClosing","chosenTab","setChosenTab","canShowFilters","count","results","chatIdRef","handleCloseAnimationEnd","handleClose","handleLoadMore","allReactions","l","reaction","concat","nextOffset","LoadMoreDirection","formatIntegerCompact","find","ReactionStaticEmoji","fullName","getUserFullName","emojiInteraction","animatedEffect","selectAnimatedEmojiEffect","effectAnimationId","localEffectAnimation","keys","ANIMATED_STICKERS_PATHS","isReversed","stopActiveEmojiInteraction","isHiding","startHiding","isPlaying","startPlaying","stop","dispatchHeavyAnimationStop","effectAnimationData","localEffectAnimationData","setLocalEffectAnimationData","getAnimationData","then","data","startSize","AnimatedSticker","animationData","play","quality","IS_ANDROID","noLoop","onLoad","onSelect","buttonRef","activeElement","privateChatUserId","isPinned","selectIsChatPinned","isMuted","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","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","query","handleChatClick","handlePickerItemClick","startsWith","MEMO_EMPTY_ARRAY","contactIdsWithMe","foundContactIds","foundMessages","split","sort","a","b","handleClickShowMoreLocal","handleClickShowMoreGlobal","nothingFound","noScrollRestoreOnTop","noFastList","NothingFound","PickerSelectedItem","chatOrUserId","clickArg","createMapStateToProps","currentType","isVoice","activeDownloads","theme","selectTheme","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","currentUser","loadProfilePhotos","profileId","ProfileInfo","forceShowSelf","ChatExtra","LINK_PREFIX","LINK_PREFIX_REGEX","USERNAME_REGEX","runDebouncedForCheckUsername","currentUsername","asLink","isUsernameAvailable","checkUsername","username","setUsername","langPrefix","usernameSuccess","usernameError","test","handleUsernameChange","newUsername","trim","isValid","isUsernameValid","success","readOnly","ERROR_FIRST_NAME_MISSING","ERROR_BIO_TOO_LONG","profileEdit","firstName","currentFirstName","lastName","currentLastName","fullInfo","bio","currentBio","currentAvatarHash","loadCurrentUser","updateProfile","isUsernameTouched","setIsUsernameTouched","isProfileFieldsTouched","setIsProfileFieldsTouched","setError","setPhoto","setFirstName","setLastName","setBio","currentAvatarBlobUrl","ProfileEditProgress","isUsernameError","isSaveButtonShown","handlePhotoChange","newPhoto","handleFirstNameChange","handleLastNameChange","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","renderAutoDownloadBlock","canAutoLoadFromContacts","canAutoLoadInPrivateChats","canAutoLoadInGroups","canAutoLoadInChannels","Checkbox","checked","onCheck","isChecked","RangeSlider","renderValue","renderContentSizeSlider","runThrottledForLoadRecommended","orderedFolderIds","foldersById","recommended","recommendedChatFolders","onCreateFolder","onEditFolder","loadRecommendedChatFolders","addChatFolder","showDialog","setAnimationData","isAnimationLoaded","setIsAnimationLoaded","handleAnimationLoad","handleCreateFolder","chatsCountByFolderId","useFolderManagerForChatsCount","userFolders","folder","subtitle","getFolderDescriptionText","handleCreateFolderFromRecommended","STICKER_SIZE_FOLDER_SETTINGS","pill","fluid","narrow","multiline","itemName","itemPluralName","ERROR_NO_TITLE","ERROR_NO_CHATS","loadedActiveChatIds","loadedArchivedChatIds","dispatch","onAddIncludedChats","onAddExcludedChats","onBack","editChatFolder","isIncludedChatsListExpanded","setIsIncludedChatsListExpanded","isExcludedChatsListExpanded","setIsExcludedChatsListExpanded","selectedChatIds","includedChatIds","selectedChatTypes","includedChatTypes","selectChatFilters","excludedChatIds","excludedChatTypes","folderId","visibleIncludedChatIds","visibleExcludedChatIds","allLoadedChatsSet","Set","loadedIncludedChatIds","findIntersectionWithSet","loadedExcludedChatIds","listType","renderChats","mode","visibleChatIds","isExpanded","leftChatsCount","clickHandler","chatType","INCLUDED_CHAT_TYPES","typeKey","EXCLUDED_CHAT_TYPES","inactive","renderChatType","isTouched","folderUpdate","selectedIds","filterValue","onSelectedIdsChange","onSelectedChatTypesChange","chatTypes","shouldMinimize","hasMaxChats","focus","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","isGifs","IS_WEBM_SUPPORTED","stickers","firstSticker","isLottie","STICKER_SIZE_GENERAL_SETTINGS","StickerButton","sticker","ANIMATION_LEVEL_OPTIONS","TIME_FORMAT_OPTIONS","stickerSetIds","added","setIds","stickerSetsById","setsById","defaultReaction","appConfig","messageTextSize","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","timeFormat","stickerSettingsRef","observeIntersectionForCovers","setSticker","KEYBOARD_SEND_OPTIONS","subLabel","IS_MAC_OS","handleAnimationLevelChange","newLevel","_","handleMessageTextSizeChange","newSize","documentElement","setProperty","setAttribute","handleTimeFormatChange","newTimeFormat","wasTimeFormatSetManually","setTimeFormat","handleStickerSetClick","stickerSets","installedDate","fromSticker","fileSelector","openSystemFilesDialog","accept","noMultiple","removeAttribute","onchange","click","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","dataUri","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","handleSetColor","handleResetToDefault","backgroundColor","patternColor","DARK_THEME_PATTERN_COLOR","DEFAULT_PATTERN_COLOR","handleWallPaperSelect","currentWallpaper","async","defaultRGB","rgb","canvas","context","getContext","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","handleSettingsChange","peerType","setting","currentIsSilent","currentShouldShowPreviews","shouldShowPreviews","handleContactNotificationChange","volume","playNotifySound","hasPassword","isSensitiveEnabled","canChangeSensitive","privacy","blocked","activeSessions","blockedCount","totalCount","sessionsCount","visibilityPrivacyPhoneNumber","phoneNumber","visibility","visibilityPrivacyLastSeen","lastSeen","visibilityPrivacyProfilePhoto","profilePhoto","visibilityPrivacyForwarding","forwards","visibilityPrivacyGroupChats","chatInvite","loadPrivacySettings","loadBlockedContacts","loadAuthorizations","loadContentSettings","updateContentSettings","getVisibilityValue","languages","language","loadLanguages","selectedLanguage","setSelectedLanguage","markIsLoading","unmarkIsLoading","handleChange","langCode","setLanguage","currentLangCode","navigator","toLowerCase","shortLangCode","substr","nativeName","buildOptions","loadingOption","getPrivacyKey","screen","privacySettings","allowUserIds","allowChatIds","blockUserIds","blockChatIds","setPrivacyVisibility","visibilityOptions","exceptionLists","shouldShowDenied","shouldShowAllowed","privacyKey","headerText","descriptionText","allowedContactsScreen","deniedContactsScreen","allowedCount","reduce","result","membersCount","blockCount","handleVisibilityChange","getLocation","session","region","country","getDeviceEnvironment","deviceModel","platform","systemVersion","terminateAuthorization","terminateAllAuthorizations","isConfirmTerminateAllDialogOpen","openConfirmTerminateAllDialog","closeConfirmTerminateAllDialog","handleTerminateSessionClick","handleTerminateAllSessions","currentSession","isCurrent","otherSessions","appName","ip","sessions","handler","dateActive","blockedIds","userSearch","setUserSearchQuery","blockContact","filteredContactIds","availableContactIds","contactId","firstId","secondId","secondName","localeCompare","handleRemoveUser","accessHash","chatsByIds","usersByIds","countryList","phoneCodes","phoneCodeList","unblockContact","isBlockUserModalOpen","openBlockUserModal","closeBlockUserModal","handleUnblockClick","isPrivate","formatPhoneNumberWithCode","renderContact","animatedEmoji","selectAnimatedEmoji","AnimatedEmoji","expectedPassword","clearError","validationError","setValidationError","shouldShowPassword","setShouldShowPassword","handleSubmit","newPassword","handleClearError","PasswordMonkey","isBig","isPasswordVisible","PasswordForm","onChangePasswordVisibility","onStart","FOCUS_DELAY_TIMEOUT_MS","shouldConfirm","setValue","isConfirmShown","markIsConfirmShown","unmarkIsConfirmShown","codeLength","twoFaSettings","waitingEmailCodeLength","newValue","updatePassword","checkPassword","clearTwoFaError","updateRecoveryEmail","provideTwoFaEmailCode","clearPassword","handleStartWizard","handleNewPassword","handleNewPasswordConfirm","handleNewPasswordHint","handleNewPasswordEmail","onSuccess","handleChangePasswordCurrent","handleChangePasswordNew","handleChangePasswordConfirm","handleChangePasswordHint","handleTurnOff","handleRecoveryEmailCurrentPassword","handleRecoveryEmail","handleEmailCode","getCurrentPrivacySettings","isAllowList","setPrivacySettings","selectedContactIds","setSearchQuery","isSubmitShown","setIsSubmitShown","newSelectedContactIds","setNewSelectedContactIds","isChatGroup","handleSelectedContactIdsChange","contactsIds","Picker","itemIds","searchInputId","availableReactions","selectedReaction","setDefaultReaction","isInactive","TWO_FA_SCREENS","FOLDERS_SCREENS","PRIVACY_SCREENS","PRIVACY_PHONE_NUMBER_SCREENS","PRIVACY_LAST_SEEN_PHONE_SCREENS","PRIVACY_PROFILE_PHOTO_SCREENS","PRIVACY_FORWARDING_SCREENS","PRIVACY_GROUP_CHATS_SCREENS","foldersState","foldersDispatch","shouldSkipTransition","twoFaState","twoFaDispatch","useReducer","handleSaveFilter","renderCurrentSection","isScreenActive","isFrom","currentKey","privacyAllowScreens","isTwoFaScreen","isFoldersScreen","isPrivacyScreen","values","SettingsGeneralBackgroundColor","renderCurrentSectionContent","LAYERS_ANIMATION_NAME","statusesById","userStatusesById","serverTimeOffset","filteredIds","sortUserIds","isSearching","selectedMemberIds","onSelectedMemberIdsChange","onNextStep","setGlobalSearchQuery","canBeInvitedToGroup","isUserBot","handleNextStep","creationProgress","creationError","chatCreation","createGroupChat","createChannel","setTitle","setAbout","chatTitleEmptyError","channelTitleEmptyError","chatTooManyUsersError","ChatCreationProgress","handleTitleChange","handleCreateGroup","handleCreateChannel","renderedError","RENDER_COUNT","LeftColumnContent","onContentChange","newChatMemberIds","setNewChatMemberIds","isStepActive","ChatList","folderType","folderOrderedIds","editChatFolders","initialSelectedFolderIds","pinnedChatIds","selectedFolderIds","setSelectedFolderIds","folders","idsToRemove","idsToAdd","CheckboxGroup","getCopyLabel","hasSelection","scrollLockEl","IGNORED_KEYS","Down","ArrowDown","Up","ArrowUp","Left","ArrowLeft","Right","ArrowRight","PageUp","PageDown","End","Home","Tab","getTouchY","changedTouches","clientY","scrollHeight","preventDefaultForScrollKeys","HTMLElement","tagName","getAttribute","isTextBox","disableScrolling","_excludedClosestSelector","passive","onkeydown","enableScrolling","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","canShowSeenBy","canShowReactionsCount","canRemoveReaction","canShowReactionList","seenByRecentUsers","onReply","onEdit","onPin","onReport","onFaveSticker","onUnfaveSticker","onSend","onReschedule","onCopyLink","onDownload","onShowSeenBy","onShowReactors","menuRef","scrollableRef","copyOptions","afterEffect","getMessageText","canImageBeCopied","hasMessageLocalBlobUrl","CLIPBOARD_ITEM_SUPPORTED","selection","getSelection","Promise","resolve","mediaLoader","copyImageToClipboard","anchorNode","parentNode","clipboardText","getMessageTextWithSpoilers","copyTextToClipboard","getMessageCopyOptions","noReactions","withReactions","markIsReady","unmarkIsReady","getTriggerElement","getRootElement","getMenuElement","getLayout","extraHeightAudioPlayer","pinnedElement","extraHeightPinned","extraPaddingX","extraTopPadding","marginSides","extraMarginTop","handleRemoveReaction","positionY","transformOriginX","transformOriginY","menuStyle","withScroll","useContextMenuPosition","Menu","bubbleStyle","START_SIZE","selectActiveDownloadIds","seenByExpiresAt","seenByMaxChatMembers","noOptions","isScheduled","isOwnMessage","isAction","isActionMessage","areReactionsEmpty","canSeeList","some","isChosen","hasFullInfo","SERVICE_NOTIFICATIONS_USER_ID","chatUsername","setReplyingToId","setEditingId","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","loadSeenBy","openSeenByModal","sendReaction","openReactorListModal","loadFullChat","isMenuOpen","setIsMenuOpen","setIsDeleteModalOpen","setIsReportModalOpen","isPinModalOpen","setIsPinModalOpen","isCalendarOpen","openCalendar","closeCalendar","recentReactions","msg","closeMenu","closePinModal","handleCloseCalendar","handleReply","handleEdit","handlePin","handleUnpin","handleFaveSticker","handleUnfaveSticker","handleSelectMessage","params","childMessageIds","withShift","handleScheduledMessageSend","handleOpenCalendar","handleOpenSeenByModal","handleOpenReactorListModal","handleRescheduleMessage","scheduledAt","handleCopyLink","handleSendReaction","reportMessageIds","scheduledMaxDate","getDayStartAt","stickerSetShortName","currentMessageList","sendOptions","getAllowedAttachmentOptions","canSendStickers","selectStickerSet","stickerSetId","selectStickerSetByShortName","loadStickers","toggleStickerSet","isDisabled","stickerSetAccessHash","isPreloadedGlobally","handleButtonClick","hasCloseButton","STICKER_SIZE_MODAL","isRestricted","canAddContact","getCanAddContact","canDeleteChat","getCanDeleteChat","hasLinkedChat","linkedChatId","withExtraActions","canStartBot","canRestartBot","canSubscribe","canSearch","canCall","canMute","canLeave","canEnterVoiceChat","canCreateVoiceChat","onSubscribeChannel","onSearchClick","updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot","joinGroupCall","createGroupCall","openLinkedChat","addContact","openCallFallbackConfirm","handleStartBot","command","handleRestartBot","handleToggleMuteClick","handleEnterVoiceChatClick","handleLinkedChatClick","handleAddContactClick","handleSubscribe","handleCall","handleSearch","handleSelectMessages","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","selector","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","groupChatMembers","recentEmojis","baseEmojiKeywords","emojiKeywords","addRecentEmoji","onCaptionUpdate","onFileAppend","onClear","captionRef","useStateRef","hideTimeoutRef","prevAttachments","renderingAttachments","isHovered","markHovered","unmarkHovered","isQuick","every","quick","isMentionTooltipOpen","closeMentionTooltip","insertMention","mentionFilteredUsers","useMentionTooltip","EDITABLE_INPUT_MODAL_ID","isEmojiTooltipOpen","closeEmojiTooltip","filteredEmojis","insertEmoji","useEmojiTooltip","sendAttachments","handleFilesDrop","dataTransfer","newFiles","file","CONTENT_TYPES_WITH_PREVIEW","areAllPhotos","SUPPORTED_IMAGE_CONTENT_TYPES","mimeType","areAllVideos","SUPPORTED_VIDEO_CONTENT_TYPES","areAllAudios","renderHeader","onDragEnter","onDrop","onDragOver","onDragLeave","relatedTarget","toTarget","fromTarget","attachment","File","filename","extension","getFileExtension","previewData","emojis","onEmojiSelect","MessageInput","isAttachmentModalInput","html","editableInputId","canAutoFocus","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","option","correct","isPublic","multipleChoice","quiz","entities","parseMessageInput","correctAnswers","solutionEntities","updateOption","removeOption","handleCorrectOptionChange","handleIsAnonymousChange","handleMultipleAnswersChange","handleQuizModeChange","handleKeyPress","keyCode","getQuestionError","getOptionsError","renderOptions","onKeyPress","renderQuizNoOptionError","hidden","emoji","native","names","IS_EMOJI_SUPPORTED","loading","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","onStickerSelect","onStickerUnfave","stickersPerRow","STICKER_SIZE_PICKER","noAnimate","onUnfaveClick","stickerSetIntersections","favorite","recentStickers","favoriteStickers","addedSetIds","shouldPlay","loadRecentStickers","addRecentSticker","activeSetIndex","setActiveSetIndex","sendMessageAction","useSendMessageAction","areAddedLoaded","allSets","noPopulatedSets","set","stickerSetEl","handleStickerSelect","handleStickerUnfave","handleMouseMove","fullClassName","buttonClassName","gif","videoData","shouldRenderVideo","isVideoReady","preventMessageInputBlurWithBubbling","preload","savedGifs","gifs","saved","canSendGifs","onGifSelect","loadSavedGifs","debounceMs","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","canAttachMedia","canAttachPolls","onFileSelect","onPollCreate","handleQuickSelect","handleDocumentSelect","autoClose","withAvatar","botCommand","bot","botCommands","handleSendCommand","botId","selectedCommandIndex","prevCommands","renderedCommands","chatBotCommand","forEmoji","clearStickersForEmoji","prevStickers","displayedStickers","onSilentSend","onScheduleSend","listEmojis","usePrevDuringAnimation","handleSelectEmoji","selectedIndex","setItemVisible","thumbUrl","thumbnailDataUrl","decoding","webThumbnail","isForGallery","inlineResult","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","useOnChange","coverStickerIds","covers","otherStickers","handleAddClick","canRenderStickers","STICKER_SIZE_SEARCH","selectCurrentStickerSearch","resultIds","featured","featuredIds","loadFeaturedStickers","setIsModalOpen","selectCurrentGifSearch","isChatWithBot","selectIsChatWithBot","searchMoreGifs","setGifSearchQuery","handleGifClick","hasResults","answer","voters","offsets","pollResults","answerVote","totalVoters","loadPollOptionResults","closePollResults","prevVotersCount","votersCount","setIsLoading","areVotersLoaded","limit","shouldResetVoters","handleViewMoreClick","handleMemberClick","leftVotersCount","renderViewMoreButton","total","getMessagePoll","resultsByOption","buildCollectionByKey","management","updateContact","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","isRevoked","handleClickEditType","ManagementScreens","handleClickDiscussion","handleClickReactions","handleClickPermissions","handleClickAdministrators","handleSetPhoto","handleAboutChange","handleUpdateGroup","trimmedTitle","trimmedAbout","handleClickMembers","handleTogglePreHistory","isPreHistoryHidden","isEnabled","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","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","openUserInfo","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","useInterval","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","formatFullDate","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","phone","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","handlePhoneChange","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","savedInfo","invoice","nativeProvider","nativeParams","passwordMissing","payment","isProviderError","nameRequested","phoneRequested","emailRequested","shippingAddressRequested","flexible","phoneToProvider","emailToProvider","validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError","paymentState","paymentDispatch","field","handleErrorModalClose","PaymentStep","shippingOption","getShippingPrices","totalPrices","cur","getTotalPrice","detectCardTypeText","findShippingOption","getCheckoutInfo","validateRequest","requestInfo","getRequestInfo","sendCredentials","credentials","expiryMonth","expiryYear","zip","getCredentials","sendForm","shippingOptionId","setStep","nextStep","buttonText","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","err","DEBUG","console","initCropper","ensureCroppie","croppedImg","blobToFile","selectedFile","setSelectedFile","croppedBlobUrl","setCroppedBlobUrl","labelClassName","URL","revokeObjectURL","createObjectURL"],"sourceRoot":""}