mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-13 01:27:37 +01:00
1 line
104 KiB
Plaintext
1 line
104 KiB
Plaintext
{"version":3,"file":"9970.4aa8bfa2e786ad1dbed1.js","mappings":"oNAyBA,MAqCA,GAAeA,EAAAA,EAAAA,KAAKC,EAAAA,EAAAA,KAClB,CAACC,EAAD,KAAoC,IAA3B,OAAEC,GAAyB,EAClC,MAAMC,GAAOC,EAAAA,EAAAA,IAAkBH,GACzBI,EAAOH,IAAUI,EAAAA,EAAAA,IAAWL,EAAQC,GAG1C,MAAO,CACLC,KAAAA,EACAI,YAJkBF,GAAOG,EAAAA,EAAAA,IAAuBH,QAAQI,KAJ1CT,EArCiC,IAM/C,IANgD,OACpDU,EADoD,KAEpDP,EAFoD,OAGpDD,EAHoD,YAIpDK,EAJoD,QAKpDI,GACI,EACJ,MAAM,iBAAEC,IAAqBC,EAAAA,EAAAA,MAEvBC,GAAOC,EAAAA,EAAAA,KAEPC,GAAyBC,EAAAA,EAAAA,KAAY,KACzCL,EAAiB,CAAEM,OAAQf,EAAMgB,GAAIjB,OAAAA,IACrCS,MACC,CAACR,EAAMS,EAAkBD,EAAST,IAErC,GAAKC,GAASD,EAId,OACE,mBAAC,IAAD,CACEQ,OAAQA,EACRC,QAASA,EACTS,QAASJ,EACTK,UAAU,SACVC,MAAOR,EAAK,wBAEZ,6BAAIS,EAAAA,EAAAA,GAAWT,EAAK,8BAA+BP,KACnD,mBAAC,IAAD,CAAQiB,MAAM,SAASH,UAAU,wBAAwBI,QAAM,EAACC,QAASV,GACtEF,EAAK,mBAER,mBAAC,IAAD,CAAQO,UAAU,wBAAwBI,QAAM,EAACC,QAASf,GAAUG,EAAK,iB,qOCX/E,MAGMa,EAA2C,CAC/CR,GAAIS,EAAAA,GACJC,WAAY,IACZC,KAAM,kBACNC,OAAO,EACPC,SAAU,GACVC,YAAa,IAGTC,GAA8BC,EAAAA,EAAAA,KAAUC,GAAOA,KAAM,KAAM,GAC3DC,GAA8BC,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EADrC,MACiDK,EADjD,YACwDlB,EADxD,OACqE/I,GACvE2I,EAEE1I,KAAc0I,EAAOG,eAAe,gBAAmBC,IAAqBA,EAEnE,qBAAXyK,IACE7K,EAAOG,eAAe,cAAgBH,EAAOG,eAAe,cAC9DW,EAAoB,CAClBhP,SAAU+Y,EACV9J,WAAYC,GAAaC,IAElB6J,EACTzK,EAAsB,CAAEyK,MAAAA,EAAOxT,YAAAA,EAAaD,OAAAA,IAE5CgK,EAAmB,CACjBvP,SAAU+Y,EACVlR,UAAWgH,OAAOoK,GAClBnK,UAAWD,OAAOE,GAClBjJ,WAAY0J,EACZhK,YAAAA,EACAD,OAAAA,KAIN,MAEF,IAAK,cAAe,CAClB,MAAM,KACJ0T,EADI,QACEvH,GACJxD,EAEJpG,EAAa,CACX5I,OAAS,IAAGwS,IACZvS,GAAI8Z,IAEN,MAEF,IAAK,KAuBL,IAAK,QACL,IAAK,MAIL,IAAK,QAUL,QAGE,MAnCF,IAAK,OAAQ,CACX,MAAM,OAAEC,GAAWhL,EAEnBO,EAAiB,CAAEjC,KAAM0M,IACzB,MAEF,IAAK,WACL,IAAK,cAAe,CAClB,MAAM,IAAEC,GAAQjL,EAEhBQ,EAAe,CACb/J,eAAgB,CACdgK,UAAWwK,KAGf,MAYF,IAAK,UAAW,CACd,MAAM,KAAE9J,GAASnB,EACjBkB,EAAY,CAAEC,KAAAA,IACd","sources":["webpack://telegram-t/./src/components/right/DeleteMemberModal.tsx","webpack://telegram-t/./src/global/actions/api/chats.ts","webpack://telegram-t/./src/global/actions/ui/calls.ts","webpack://telegram-t/./src/global/reducers/calls.ts","webpack://telegram-t/./src/global/selectors/calls.ts","webpack://telegram-t/./src/util/deeplink.ts"],"sourcesContent":["import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChat } from '../../api/types';\n\nimport { selectCurrentChat, selectUser } from '../../global/selectors';\nimport { getUserFirstOrLastName } from '../../global/helpers';\nimport renderText from '../common/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 userId?: string;\n onClose: () => void;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n contactName?: string;\n};\n\nconst DeleteMemberModal: FC<OwnProps & StateProps> = ({\n isOpen,\n chat,\n userId,\n contactName,\n onClose,\n}) => {\n const { deleteChatMember } = getActions();\n\n const lang = useLang();\n\n const handleDeleteChatMember = useCallback(() => {\n deleteChatMember({ chatId: chat!.id, userId });\n onClose();\n }, [chat, deleteChatMember, onClose, userId]);\n\n if (!chat || !userId) {\n return undefined;\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onClose}\n onEnter={handleDeleteChatMember}\n className=\"delete\"\n title={lang('GroupRemoved.Remove')}\n >\n <p>{renderText(lang('PeerInfo.Confirm.RemovePeer', contactName))}</p>\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteChatMember}>\n {lang('lng_box_remove')}\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, { userId }): StateProps => {\n const chat = selectCurrentChat(global);\n const user = userId && selectUser(global, userId);\n const contactName = user ? getUserFirstOrLastName(user) : undefined;\n\n return {\n chat,\n contactName,\n };\n },\n)(DeleteMemberModal));\n","import {\n addActionHandler, getActions, getGlobal, setGlobal,\n} from '../../index';\n\nimport type {\n ApiChat, ApiUser, ApiChatFolder, ApiError,\n} from '../../../api/types';\nimport { MAIN_THREAD_ID } from '../../../api/types';\nimport { NewChatMembersProgress, ChatCreationProgress, ManagementProgress } from '../../../types';\nimport type { GlobalActions } from '../../types';\n\nimport {\n ARCHIVED_FOLDER_ID,\n TOP_CHAT_MESSAGES_PRELOAD_LIMIT,\n CHAT_LIST_LOAD_SLICE,\n RE_TG_LINK,\n SERVICE_NOTIFICATIONS_USER_ID,\n TMP_CHAT_ID,\n ALL_FOLDER_ID,\n DEBUG,\n} from '../../../config';\nimport { callApi } from '../../../api/gramjs';\nimport {\n addChats, addUsers, addUserStatuses, replaceThreadParam,\n updateChatListIds, updateChats, updateChat, updateChatListSecondaryInfo,\n updateManagementProgress, leaveChat, replaceUsers, replaceUserStatuses,\n replaceChats, replaceChatListIds, addChatMembers,\n} from '../../reducers';\nimport {\n selectChat, selectUser, selectChatListType, selectIsChatPinned,\n selectChatFolder, selectSupportChat, selectChatByUsername, selectThreadTopMessageId,\n selectCurrentMessageList, selectThreadInfo, selectCurrentChat, selectLastServiceNotification,\n selectVisibleUsers, selectUserByPhoneNumber,\n} from '../../selectors';\nimport { buildCollectionByKey, omit } from '../../../util/iteratees';\nimport { debounce, pause, throttle } from '../../../util/schedulers';\nimport {\n isChatSummaryOnly, isChatArchived, isChatBasicGroup, isUserBot, isChatChannel, isChatSuperGroup,\n} from '../../helpers';\nimport { processDeepLink } from '../../../util/deeplink';\nimport { updateGroupCall } from '../../reducers/calls';\nimport { selectGroupCall } from '../../selectors/calls';\nimport { getOrderedIds } from '../../../util/folderManager';\nimport * as langProvider from '../../../util/langProvider';\nimport { selectCurrentLimit } from '../../selectors/limits';\n\nconst TOP_CHAT_MESSAGES_PRELOAD_INTERVAL = 100;\nconst INFINITE_LOOP_MARKER = 100;\n\nconst SERVICE_NOTIFICATIONS_USER_MOCK: ApiUser = {\n id: SERVICE_NOTIFICATIONS_USER_ID,\n accessHash: '0',\n type: 'userTypeRegular',\n isMin: true,\n username: '',\n phoneNumber: '',\n};\n\nconst runThrottledForLoadTopChats = throttle((cb) => cb(), 3000, true);\nconst runDebouncedForLoadFullChat = debounce((cb) => cb(), 500, false, true);\n\naddActionHandler('preloadTopChatMessages', async (global, actions) => {\n const preloadedChatIds = new Set<string>();\n\n for (let i = 0; i < TOP_CHAT_MESSAGES_PRELOAD_LIMIT; i++) {\n await pause(TOP_CHAT_MESSAGES_PRELOAD_INTERVAL);\n\n const { chatId: currentChatId } = selectCurrentMessageList(global) || {};\n const folderAllOrderedIds = getOrderedIds(ALL_FOLDER_ID);\n const nextChatId = folderAllOrderedIds?.find((id) => id !== currentChatId && !preloadedChatIds.has(id));\n if (!nextChatId) {\n return;\n }\n\n preloadedChatIds.add(nextChatId);\n\n actions.loadViewportMessages({ chatId: nextChatId, threadId: MAIN_THREAD_ID });\n }\n});\n\naddActionHandler('openChat', (global, actions, payload) => {\n const { id, threadId = MAIN_THREAD_ID } = payload;\n if (!id) {\n return;\n }\n\n const { currentUserId } = global;\n const chat = selectChat(global, id);\n\n if (chat?.hasUnreadMark) {\n actions.toggleChatUnread({ id });\n }\n\n // Please telegram send us some updates about linked chat 🙏\n if (chat?.lastMessage?.threadInfo) {\n actions.requestThreadInfoUpdate({\n chatId: chat.lastMessage.threadInfo.chatId,\n threadId: chat.lastMessage.threadInfo.threadId,\n });\n }\n\n if (!chat) {\n if (id === currentUserId) {\n void callApi('fetchChat', { type: 'self' });\n } else {\n const user = selectUser(global, id);\n if (user) {\n void callApi('fetchChat', { type: 'user', user });\n }\n }\n } else if (isChatSummaryOnly(chat) && !chat.isMin) {\n actions.requestChatUpdate({ chatId: id });\n }\n\n if (threadId !== MAIN_THREAD_ID) {\n const topMessageId = selectThreadTopMessageId(global, id, threadId);\n if (!topMessageId) {\n actions.requestThreadInfoUpdate({ chatId: id, threadId });\n }\n }\n});\n\naddActionHandler('openLinkedChat', async (global, actions, payload) => {\n const { id } = payload!;\n const chat = selectChat(global, id);\n if (!chat) {\n return;\n }\n\n const chatFullInfo = await callApi('fetchFullChat', chat);\n\n if (chatFullInfo?.fullInfo?.linkedChatId) {\n actions.openChat({ id: chatFullInfo.fullInfo.linkedChatId });\n }\n});\n\naddActionHandler('focusMessageInComments', async (global, actions, payload) => {\n const { chatId, threadId, messageId } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const result = await callApi('requestThreadInfoUpdate', { chat, threadId });\n if (!result) {\n return;\n }\n\n actions.focusMessage({ chatId, threadId, messageId });\n});\n\naddActionHandler('openSupportChat', async (global, actions) => {\n const chat = selectSupportChat(global);\n if (chat) {\n actions.openChat({ id: chat.id, shouldReplaceHistory: true });\n return;\n }\n\n actions.openChat({ id: TMP_CHAT_ID, shouldReplaceHistory: true });\n\n const result = await callApi('fetchChat', { type: 'support' });\n if (result) {\n actions.openChat({ id: result.chatId, shouldReplaceHistory: true });\n }\n});\n\naddActionHandler('loadAllChats', async (global, actions, payload) => {\n const listType = payload.listType as 'active' | 'archived';\n const { onReplace } = payload;\n let { shouldReplace } = payload;\n let i = 0;\n\n while (shouldReplace || !getGlobal().chats.isFullyLoaded[listType]) {\n if (i++ >= INFINITE_LOOP_MARKER) {\n if (DEBUG) {\n // eslint-disable-next-line no-console\n console.error('`actions/loadAllChats`: Infinite loop detected');\n }\n\n return;\n }\n\n global = getGlobal();\n\n if (global.connectionState !== 'connectionStateReady' || global.authState !== 'authorizationStateReady') {\n return;\n }\n\n const listIds = !shouldReplace && global.chats.listIds[listType];\n const oldestChat = listIds\n ? listIds\n /* eslint-disable @typescript-eslint/no-loop-func */\n .map((id) => global.chats.byId[id])\n .filter((chat) => (\n Boolean(chat?.lastMessage)\n && chat.id !== SERVICE_NOTIFICATIONS_USER_ID\n && !selectIsChatPinned(global, chat.id)\n ))\n /* eslint-enable @typescript-eslint/no-loop-func */\n .sort((chat1, chat2) => (chat1.lastMessage!.date - chat2.lastMessage!.date))[0]\n : undefined;\n\n await loadChats(listType, oldestChat?.id, oldestChat?.lastMessage!.date, shouldReplace);\n\n if (shouldReplace) {\n onReplace?.();\n shouldReplace = false;\n }\n }\n});\n\naddActionHandler('loadFullChat', (global, actions, payload) => {\n const { chatId, force } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n if (force) {\n loadFullChat(chat);\n } else {\n runDebouncedForLoadFullChat(() => loadFullChat(chat));\n }\n});\n\naddActionHandler('loadTopChats', () => {\n runThrottledForLoadTopChats(() => loadChats('active'));\n});\n\naddActionHandler('requestChatUpdate', (global, actions, payload) => {\n const { serverTimeOffset } = global;\n const { chatId } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n void callApi('requestChatUpdate', {\n chat,\n serverTimeOffset,\n ...(chatId === SERVICE_NOTIFICATIONS_USER_ID && {\n lastLocalMessage: selectLastServiceNotification(global)?.message,\n }),\n });\n});\n\naddActionHandler('updateChatMutedState', (global, actions, payload) => {\n const { serverTimeOffset } = global;\n const { chatId, isMuted } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n setGlobal(updateChat(global, chatId, { isMuted }));\n void callApi('updateChatMutedState', { chat, isMuted, serverTimeOffset });\n});\n\naddActionHandler('createChannel', (global, actions, payload) => {\n const {\n title, about, photo, memberIds,\n } = payload!;\n\n const members = (memberIds as string[])\n .map((id) => selectUser(global, id))\n .filter<ApiUser>(Boolean as any);\n\n void createChannel(title, members, about, photo);\n});\n\naddActionHandler('joinChannel', (global, actions, payload) => {\n const { chatId } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const { id: channelId, accessHash } = chat;\n\n if (!(channelId && accessHash)) {\n return;\n }\n\n void joinChannel(channelId, accessHash);\n});\n\naddActionHandler('deleteChatUser', (global, actions, payload) => {\n const { chatId, userId }: { chatId: string; userId: string } = payload!;\n const chat = selectChat(global, chatId);\n const user = selectUser(global, userId);\n if (!chat || !user) {\n return;\n }\n\n global = leaveChat(global, chatId);\n setGlobal(global);\n\n if (selectCurrentMessageList(global)?.chatId === chatId) {\n actions.openChat({ id: undefined });\n }\n\n void callApi('deleteChatUser', { chat, user });\n});\n\naddActionHandler('deleteChat', (global, actions, payload) => {\n const { chatId }: { chatId: string } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n global = leaveChat(global, chatId);\n setGlobal(global);\n\n if (selectCurrentMessageList(global)?.chatId === chatId) {\n actions.openChat({ id: undefined });\n }\n\n void callApi('deleteChat', { chatId: chat.id });\n});\n\naddActionHandler('leaveChannel', (global, actions, payload) => {\n const { chatId } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n global = leaveChat(global, chatId);\n setGlobal(global);\n\n if (selectCurrentMessageList(global)?.chatId === chatId) {\n actions.openChat({ id: undefined });\n }\n\n const { id: channelId, accessHash } = chat;\n if (channelId && accessHash) {\n void callApi('leaveChannel', { channelId, accessHash });\n }\n});\n\naddActionHandler('deleteChannel', (global, actions, payload) => {\n const { chatId } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n global = leaveChat(global, chatId);\n setGlobal(global);\n\n if (selectCurrentMessageList(global)?.chatId === chatId) {\n actions.openChat({ id: undefined });\n }\n\n const { id: channelId, accessHash } = chat;\n if (channelId && accessHash) {\n void callApi('deleteChannel', { channelId, accessHash });\n }\n});\n\naddActionHandler('createGroupChat', (global, actions, payload) => {\n const { title, memberIds, photo } = payload!;\n const members = (memberIds as string[])\n .map((id) => selectUser(global, id))\n .filter<ApiUser>(Boolean as any);\n\n void createGroupChat(title, members, photo);\n});\n\naddActionHandler('toggleChatPinned', (global, actions, payload) => {\n const { id, folderId } = payload!;\n const chat = selectChat(global, id);\n if (!chat) {\n return;\n }\n\n const limit = selectCurrentLimit(global, 'dialogFolderPinned');\n\n if (folderId) {\n const folder = selectChatFolder(global, folderId);\n if (folder) {\n const shouldBePinned = !selectIsChatPinned(global, id, folderId);\n\n const { pinnedChatIds, includedChatIds } = folder;\n const newPinnedIds = shouldBePinned\n ? [id, ...(pinnedChatIds || [])]\n : (pinnedChatIds || []).filter((pinnedId) => pinnedId !== id);\n\n // With both Pin and Unpin we need to re-add a user to the included group\n const newIncludedChatIds = [id, ...includedChatIds];\n\n void callApi('editChatFolder', {\n id: folderId,\n folderUpdate: {\n ...folder,\n pinnedChatIds: newPinnedIds,\n includedChatIds: newIncludedChatIds,\n },\n });\n }\n } else {\n const listType = selectChatListType(global, id);\n const isPinned = selectIsChatPinned(global, id, listType === 'archived' ? ARCHIVED_FOLDER_ID : undefined);\n\n const ids = global.chats.orderedPinnedIds[listType === 'archived' ? 'archived' : 'active'];\n if ((ids?.length || 0) >= limit && !isPinned) {\n actions.openLimitReachedModal({\n limit: 'dialogFolderPinned',\n });\n return;\n }\n void callApi('toggleChatPinned', { chat, shouldBePinned: !isPinned });\n }\n});\n\naddActionHandler('toggleChatArchived', (global, actions, payload) => {\n const { id } = payload!;\n const chat = selectChat(global, id);\n if (chat) {\n void callApi('toggleChatArchived', {\n chat,\n folderId: isChatArchived(chat) ? 0 : ARCHIVED_FOLDER_ID,\n });\n }\n});\n\naddActionHandler('loadChatFolders', () => {\n void loadChatFolders();\n});\n\naddActionHandler('loadRecommendedChatFolders', () => {\n void loadRecommendedChatFolders();\n});\n\naddActionHandler('editChatFolders', (global, actions, payload) => {\n const { chatId, idsToRemove, idsToAdd } = payload!;\n const limit = selectCurrentLimit(global, 'dialogFiltersChats');\n\n const isLimitReached = (idsToAdd as number[])\n .some((id) => selectChatFolder(global, id)!.includedChatIds.length >= limit);\n if (isLimitReached) {\n actions.openLimitReachedModal({ limit: 'dialogFiltersChats' });\n return;\n }\n\n (idsToRemove as number[]).forEach(async (id) => {\n const folder = selectChatFolder(global, id);\n if (folder) {\n await callApi('editChatFolder', {\n id,\n folderUpdate: {\n ...folder,\n pinnedChatIds: folder.pinnedChatIds?.filter((pinnedId) => pinnedId !== chatId),\n includedChatIds: folder.includedChatIds.filter((includedId) => includedId !== chatId),\n },\n });\n }\n });\n\n (idsToAdd as number[]).forEach(async (id) => {\n const folder = selectChatFolder(global, id);\n if (folder) {\n await callApi('editChatFolder', {\n id,\n folderUpdate: {\n ...folder,\n includedChatIds: folder.includedChatIds.concat(chatId),\n },\n });\n }\n });\n});\n\naddActionHandler('editChatFolder', (global, actions, payload) => {\n const { id, folderUpdate } = payload!;\n const folder = selectChatFolder(global, id);\n\n if (folder) {\n void callApi('editChatFolder', {\n id,\n folderUpdate: {\n id,\n emoticon: folder.emoticon,\n pinnedChatIds: folder.pinnedChatIds,\n ...folderUpdate,\n },\n });\n }\n});\n\naddActionHandler('addChatFolder', (global, actions, payload) => {\n const { folder } = payload!;\n const { orderedIds, byId } = global.chatFolders;\n\n const limit = selectCurrentLimit(global, 'dialogFilters');\n if (Object.keys(byId).length >= limit) {\n actions.openLimitReachedModal({\n limit: 'dialogFilters',\n });\n return;\n }\n\n const maxId = Math.max(...(orderedIds || []), ARCHIVED_FOLDER_ID);\n\n void createChatFolder(folder, maxId);\n});\n\naddActionHandler('sortChatFolders', async (global, actions, payload) => {\n const { folderIds } = payload!;\n\n const result = await callApi('sortChatFolders', folderIds);\n if (result) {\n global = getGlobal();\n setGlobal({\n ...global,\n chatFolders: {\n ...global.chatFolders,\n orderedIds: folderIds,\n },\n });\n }\n});\n\naddActionHandler('deleteChatFolder', (global, actions, payload) => {\n const { id } = payload!;\n const folder = selectChatFolder(global, id);\n\n if (folder) {\n void deleteChatFolder(id);\n }\n});\n\naddActionHandler('toggleChatUnread', (global, actions, payload) => {\n const { id } = payload!;\n const { serverTimeOffset } = global;\n const chat = selectChat(global, id);\n if (chat) {\n if (chat.unreadCount) {\n void callApi('markMessageListRead', { serverTimeOffset, chat, threadId: MAIN_THREAD_ID });\n } else {\n void callApi('toggleDialogUnread', {\n chat,\n hasUnreadMark: !chat.hasUnreadMark,\n });\n }\n }\n});\n\naddActionHandler('openChatByInvite', async (global, actions, payload) => {\n const { hash } = payload!;\n\n const result = await callApi('openChatByInvite', hash);\n if (!result) {\n return;\n }\n\n actions.openChat({ id: result.chatId });\n});\n\naddActionHandler('openChatByPhoneNumber', async (global, actions, payload) => {\n const { phoneNumber, startAttach, attach } = payload!;\n\n // Open temporary empty chat to make the click response feel faster\n actions.openChat({ id: TMP_CHAT_ID });\n\n const chat = await fetchChatByPhoneNumber(phoneNumber);\n if (!chat) {\n actions.openPreviousChat();\n actions.showNotification({\n message: langProvider.getTranslation('lng_username_by_phone_not_found').replace('{phone}', phoneNumber),\n });\n return;\n }\n\n actions.openChat({ id: chat.id });\n\n if (attach) {\n openAttachMenuFromLink(actions, chat.id, attach, startAttach);\n }\n});\n\naddActionHandler('openTelegramLink', (global, actions, payload) => {\n const { url } = payload!;\n\n const tgLinkMatch = url.match(RE_TG_LINK);\n if (tgLinkMatch) {\n processDeepLink(tgLinkMatch[0]);\n return;\n }\n\n const uri = new URL(url.startsWith('http') ? url : `https://${url}`);\n if (uri.hostname === 't.me' && uri.pathname === '/') {\n window.open(uri.toString(), '_blank', 'noopener');\n return;\n }\n\n const hostParts = uri.hostname.split('.');\n if (hostParts.length > 3) return;\n const pathname = hostParts.length === 3 ? `${hostParts[0]}/${uri.pathname}` : uri.pathname;\n const [part1, part2, part3] = pathname.split('/').filter(Boolean).map((l) => decodeURI(l));\n const params = Object.fromEntries(uri.searchParams);\n\n let hash: string | undefined;\n if (part1 === 'joinchat') {\n hash = part2;\n }\n\n const startAttach = params.hasOwnProperty('startattach') && !params.startattach ? true : params.startattach;\n\n if (part1.match(/^\\+([0-9]+)(\\?|$)/)) {\n actions.openChatByPhoneNumber({\n phoneNumber: part1.substr(1, part1.length - 1),\n startAttach,\n attach: params.attach,\n });\n return;\n }\n\n if (part1.startsWith(' ') || part1.startsWith('+')) {\n hash = part1.substr(1, part1.length - 1);\n }\n\n if (hash) {\n actions.openChatByInvite({ hash });\n return;\n }\n\n if (part1 === 'addstickers' || part1 === 'addemoji') {\n actions.openStickerSet({\n stickerSetInfo: {\n shortName: part2,\n },\n });\n return;\n }\n\n const chatOrChannelPostId = part2 || undefined;\n const messageId = part3 ? Number(part3) : undefined;\n const commentId = params.comment ? Number(params.comment) : undefined;\n\n if (params.hasOwnProperty('voicechat') || params.hasOwnProperty('livestream')) {\n actions.joinVoiceChatByLink({\n username: part1,\n inviteHash: params.voicechat || params.livestream,\n });\n } else if (part1 === 'c' && chatOrChannelPostId && messageId) {\n const chatId = `-${chatOrChannelPostId}`;\n const chat = selectChat(global, chatId);\n if (!chat) {\n actions.showNotification({ message: 'Chat does not exist' });\n return;\n }\n\n actions.focusMessage({\n chatId,\n messageId,\n });\n } else if (part1.startsWith('$')) {\n actions.openInvoice({\n slug: part1.substring(1),\n });\n } else if (part1 === 'invoice') {\n actions.openInvoice({\n slug: part2,\n });\n } else {\n actions.openChatByUsername({\n username: part1,\n messageId: messageId || Number(chatOrChannelPostId),\n commentId,\n startParam: params.start,\n startAttach,\n attach: params.attach,\n });\n }\n});\n\naddActionHandler('acceptInviteConfirmation', async (global, actions, payload) => {\n const { hash } = payload!;\n const result = await callApi('importChatInvite', { hash });\n if (!result) {\n return;\n }\n\n actions.openChat({ id: result.id });\n});\n\naddActionHandler('openChatByUsername', async (global, actions, payload) => {\n const {\n username, messageId, commentId, startParam, startAttach, attach,\n } = payload!;\n\n const chat = selectCurrentChat(global);\n\n if (!commentId) {\n if (chat && chat.username === username && !startAttach && !startParam) {\n actions.focusMessage({ chatId: chat.id, messageId });\n return;\n }\n await openChatByUsername(actions, username, messageId, startParam, startAttach, attach);\n return;\n }\n\n const { chatId, type } = selectCurrentMessageList(global) || {};\n const usernameChat = selectChatByUsername(global, username);\n if (chatId && usernameChat && type === 'thread') {\n const threadInfo = selectThreadInfo(global, chatId, messageId);\n\n if (threadInfo && threadInfo.chatId === chatId) {\n actions.focusMessage({\n chatId: threadInfo.chatId,\n threadId: threadInfo.threadId,\n messageId: commentId,\n });\n return;\n }\n }\n\n if (!messageId) return;\n\n void openCommentsByUsername(actions, username, messageId, commentId);\n});\n\naddActionHandler('togglePreHistoryHidden', async (global, actions, payload) => {\n const { chatId, isEnabled } = payload!;\n\n let chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n if (isChatBasicGroup(chat)) {\n chat = await migrateChat(chat);\n\n if (!chat) {\n return;\n }\n\n actions.openChat({ id: chat.id });\n }\n\n void callApi('togglePreHistoryHidden', { chat, isEnabled });\n});\n\naddActionHandler('updateChatDefaultBannedRights', (global, actions, payload) => {\n const { chatId, bannedRights } = payload!;\n const chat = selectChat(global, chatId);\n\n if (!chat) {\n return;\n }\n\n void callApi('updateChatDefaultBannedRights', { chat, bannedRights });\n});\n\naddActionHandler('updateChatMemberBannedRights', async (global, actions, payload) => {\n const { chatId, userId, bannedRights } = payload!;\n let chat = selectChat(global, chatId);\n const user = selectUser(global, userId);\n\n if (!chat || !user) {\n return;\n }\n\n if (isChatBasicGroup(chat)) {\n chat = await migrateChat(chat);\n\n if (!chat) {\n return;\n }\n\n actions.openChat({ id: chat.id });\n }\n\n await callApi('updateChatMemberBannedRights', { chat, user, bannedRights });\n\n global = getGlobal();\n\n const chatAfterUpdate = selectChat(global, chatId);\n\n if (!chatAfterUpdate || !chatAfterUpdate.fullInfo) {\n return;\n }\n\n const { members, kickedMembers } = chatAfterUpdate.fullInfo;\n\n const isBanned = Boolean(bannedRights.viewMessages);\n const isUnblocked = !Object.keys(bannedRights).length;\n\n setGlobal(updateChat(global, chatId, {\n fullInfo: {\n ...chatAfterUpdate.fullInfo,\n ...(members && isBanned && {\n members: members.filter((m) => m.userId !== userId),\n }),\n ...(members && !isBanned && {\n members: members.map((m) => (\n m.userId === userId\n ? { ...m, bannedRights }\n : m\n )),\n }),\n ...(isUnblocked && kickedMembers && {\n kickedMembers: kickedMembers.filter((m) => m.userId !== userId),\n }),\n },\n }));\n});\n\naddActionHandler('updateChatAdmin', async (global, actions, payload) => {\n const {\n chatId, userId, adminRights, customTitle,\n } = payload!;\n\n let chat = selectChat(global, chatId);\n const user = selectUser(global, userId);\n if (!chat || !user) {\n return;\n }\n\n if (isChatBasicGroup(chat)) {\n chat = await migrateChat(chat);\n if (!chat) {\n return;\n }\n\n actions.openChat({ id: chat.id });\n }\n\n await callApi('updateChatAdmin', {\n chat, user, adminRights, customTitle,\n });\n\n const chatAfterUpdate = await callApi('fetchFullChat', chat);\n if (!chatAfterUpdate?.fullInfo) {\n return;\n }\n\n const { adminMembers } = chatAfterUpdate.fullInfo;\n const isDismissed = !Object.keys(adminRights).length;\n\n global = getGlobal();\n\n setGlobal(updateChat(global, chatId, {\n fullInfo: {\n ...chatAfterUpdate.fullInfo,\n ...(adminMembers && isDismissed && {\n adminMembers: adminMembers.filter((m) => m.userId !== userId),\n }),\n ...(adminMembers && !isDismissed && {\n adminMembers: adminMembers.map((m) => (\n m.userId === userId\n ? { ...m, adminRights, customTitle }\n : m\n )),\n }),\n },\n }));\n});\n\naddActionHandler('updateChat', async (global, actions, payload) => {\n const {\n chatId, title, about, photo,\n } = payload!;\n\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n setGlobal(updateManagementProgress(getGlobal(), ManagementProgress.InProgress));\n\n await Promise.all([\n chat.title !== title\n ? callApi('updateChatTitle', chat, title)\n : undefined,\n chat.fullInfo && chat.fullInfo.about !== about\n ? callApi('updateChatAbout', chat, about)\n : undefined,\n photo\n ? callApi('editChatPhoto', { chatId, accessHash: chat.accessHash, photo })\n : undefined,\n ]);\n\n setGlobal(updateManagementProgress(getGlobal(), ManagementProgress.Complete));\n});\n\naddActionHandler('toggleSignatures', (global, actions, payload) => {\n const { chatId, isEnabled } = payload!;\n const chat = selectChat(global, chatId);\n\n if (!chat) {\n return;\n }\n\n void callApi('toggleSignatures', { chat, isEnabled });\n});\n\naddActionHandler('loadGroupsForDiscussion', async (global) => {\n const groups = await callApi('fetchGroupsForDiscussion');\n if (!groups) {\n return;\n }\n\n const addedById = groups.reduce((result, group) => {\n if (group) {\n result[group.id] = group;\n }\n\n return result;\n }, {} as Record<string, ApiChat>);\n\n global = getGlobal();\n global = addChats(global, addedById);\n setGlobal({\n ...global,\n chats: {\n ...global.chats,\n forDiscussionIds: Object.keys(addedById),\n },\n });\n});\n\naddActionHandler('linkDiscussionGroup', async (global, actions, payload) => {\n const { channelId, chatId } = payload!;\n\n const channel = selectChat(global, channelId);\n let chat = selectChat(global, chatId);\n if (!channel || !chat) {\n return;\n }\n\n if (isChatBasicGroup(chat)) {\n chat = await migrateChat(chat);\n\n if (!chat) {\n return;\n }\n\n actions.openChat({ id: chat.id });\n }\n\n let { fullInfo } = chat;\n if (!fullInfo) {\n const fullChat = await callApi('fetchFullChat', chat);\n if (!fullChat) {\n return;\n }\n\n fullInfo = fullChat.fullInfo;\n }\n\n if (fullInfo!.isPreHistoryHidden) {\n await callApi('togglePreHistoryHidden', { chat, isEnabled: false });\n }\n\n void callApi('setDiscussionGroup', { channel, chat });\n});\n\naddActionHandler('unlinkDiscussionGroup', async (global, actions, payload) => {\n const { channelId } = payload!;\n\n const channel = selectChat(global, channelId);\n if (!channel) {\n return;\n }\n\n let chat: ApiChat | undefined;\n if (channel.fullInfo?.linkedChatId) {\n chat = selectChat(global, channel.fullInfo.linkedChatId);\n }\n\n await callApi('setDiscussionGroup', { channel });\n if (chat) {\n loadFullChat(chat);\n }\n});\n\naddActionHandler('setActiveChatFolder', (global, actions, payload) => {\n const maxFolders = selectCurrentLimit(global, 'dialogFilters');\n\n const isBlocked = payload + 1 > maxFolders;\n\n if (isBlocked) {\n actions.openLimitReachedModal({\n limit: 'dialogFilters',\n });\n return undefined;\n }\n\n return {\n ...global,\n chatFolders: {\n ...global.chatFolders,\n activeChatFolder: payload,\n },\n };\n});\n\naddActionHandler('resetOpenChatWithText', (global) => {\n return {\n ...global,\n openChatWithText: undefined,\n };\n});\n\naddActionHandler('loadMoreMembers', async (global) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n const chat = chatId ? selectChat(global, chatId) : undefined;\n if (!chat || isChatBasicGroup(chat)) {\n return;\n }\n\n const offset = (chat.fullInfo?.members?.length) || undefined;\n const result = await callApi('fetchMembers', chat.id, chat.accessHash!, 'recent', offset);\n if (!result) {\n return;\n }\n\n const { members, users, userStatusesById } = result;\n if (!members || !members.length) {\n return;\n }\n\n global = getGlobal();\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = addUserStatuses(global, userStatusesById);\n global = addChatMembers(global, chat, members);\n setGlobal(global);\n});\n\naddActionHandler('addChatMembers', async (global, actions, payload) => {\n const { chatId, memberIds } = payload;\n const chat = selectChat(global, chatId);\n const users = (memberIds as string[]).map((userId) => selectUser(global, userId)).filter<ApiUser>(Boolean as any);\n\n if (!chat || !users.length) {\n return;\n }\n\n actions.setNewChatMembersDialogState(NewChatMembersProgress.Loading);\n await callApi('addChatMembers', chat, users);\n actions.setNewChatMembersDialogState(NewChatMembersProgress.Closed);\n loadFullChat(chat);\n});\n\naddActionHandler('deleteChatMember', async (global, actions, payload) => {\n const { chatId, userId } = payload;\n const chat = selectChat(global, chatId);\n const user = selectUser(global, userId);\n\n if (!chat || !user) {\n return;\n }\n\n await callApi('deleteChatMember', chat, user);\n loadFullChat(chat);\n});\n\naddActionHandler('toggleIsProtected', (global, actions, payload) => {\n const { chatId, isProtected } = payload;\n const chat = selectChat(global, chatId);\n\n if (!chat) {\n return;\n }\n\n void callApi('toggleIsProtected', { chat, isProtected });\n});\n\naddActionHandler('setChatEnabledReactions', async (global, actions, payload) => {\n const { chatId, enabledReactions } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) return;\n\n await callApi('setChatEnabledReactions', {\n chat,\n enabledReactions,\n });\n\n void loadFullChat(chat);\n});\n\naddActionHandler('loadChatSettings', async (global, actions, payload) => {\n const { chatId } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) return;\n\n const settings = await callApi('fetchChatSettings', chat);\n if (!settings) return;\n\n setGlobal(updateChat(getGlobal(), chat.id, { settings }));\n});\n\naddActionHandler('toggleJoinToSend', async (global, actions, payload) => {\n const { chatId, isEnabled } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) return;\n if (!isChatSuperGroup(chat) && !isChatChannel(chat)) return;\n\n await callApi('toggleJoinToSend', chat, isEnabled);\n});\n\naddActionHandler('toggleJoinRequest', async (global, actions, payload) => {\n const { chatId, isEnabled } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) return;\n if (!isChatSuperGroup(chat) && !isChatChannel(chat)) return;\n\n await callApi('toggleJoinRequest', chat, isEnabled);\n});\n\nasync function loadChats(\n listType: 'active' | 'archived', offsetId?: string, offsetDate?: number, shouldReplace = false,\n) {\n let global = getGlobal();\n const lastLocalServiceMessage = selectLastServiceNotification(global)?.message;\n const result = await callApi('fetchChats', {\n limit: CHAT_LIST_LOAD_SLICE,\n offsetDate,\n archived: listType === 'archived',\n withPinned: shouldReplace,\n serverTimeOffset: global.serverTimeOffset,\n lastLocalServiceMessage,\n });\n\n if (!result) {\n return;\n }\n\n const { chatIds } = result;\n\n if (chatIds.length > 0 && chatIds[0] === offsetId) {\n chatIds.shift();\n }\n\n global = getGlobal();\n\n if (shouldReplace && listType === 'active') {\n // Always include service notifications chat\n if (!chatIds.includes(SERVICE_NOTIFICATIONS_USER_ID)) {\n const result2 = await callApi('fetchChat', {\n type: 'user',\n user: SERVICE_NOTIFICATIONS_USER_MOCK,\n });\n\n global = getGlobal();\n\n const notificationsChat = result2 && selectChat(global, result2.chatId);\n if (notificationsChat) {\n chatIds.unshift(notificationsChat.id);\n result.chats.unshift(notificationsChat);\n if (lastLocalServiceMessage) {\n notificationsChat.lastMessage = lastLocalServiceMessage;\n }\n }\n }\n\n const currentChat = selectCurrentChat(global);\n const visibleChats = currentChat ? [currentChat] : [];\n\n const visibleUsers = selectVisibleUsers(global) || [];\n if (global.currentUserId && global.users.byId[global.currentUserId]) {\n visibleUsers.push(global.users.byId[global.currentUserId]);\n }\n\n global = replaceUsers(global, buildCollectionByKey(visibleUsers.concat(result.users), 'id'));\n global = replaceUserStatuses(global, result.userStatusesById);\n global = replaceChats(global, buildCollectionByKey(visibleChats.concat(result.chats), 'id'));\n global = replaceChatListIds(global, listType, chatIds);\n } else if (shouldReplace && listType === 'archived') {\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n global = addUserStatuses(global, result.userStatusesById);\n global = updateChats(global, buildCollectionByKey(result.chats, 'id'));\n global = replaceChatListIds(global, listType, chatIds);\n } else {\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n global = addUserStatuses(global, result.userStatusesById);\n global = updateChats(global, buildCollectionByKey(result.chats, 'id'));\n global = updateChatListIds(global, listType, chatIds);\n }\n\n global = updateChatListSecondaryInfo(global, listType, result);\n\n Object.keys(result.draftsById).forEach((chatId) => {\n global = replaceThreadParam(\n global, chatId, MAIN_THREAD_ID, 'draft', result.draftsById[chatId],\n );\n });\n\n Object.keys(result.replyingToById).forEach((chatId) => {\n global = replaceThreadParam(\n global, chatId, MAIN_THREAD_ID, 'replyingToId', result.replyingToById[chatId],\n );\n });\n\n if (chatIds.length === 0 && !global.chats.isFullyLoaded[listType]) {\n global = {\n ...global,\n chats: {\n ...global.chats,\n isFullyLoaded: {\n ...global.chats.isFullyLoaded,\n [listType]: true,\n },\n },\n };\n }\n\n setGlobal(global);\n}\n\nexport async function loadFullChat(chat: ApiChat) {\n const result = await callApi('fetchFullChat', chat);\n if (!result) {\n return undefined;\n }\n\n const {\n users, userStatusesById, fullInfo, groupCall, membersCount,\n } = result;\n\n let global = getGlobal();\n if (users) {\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n }\n\n if (userStatusesById) {\n global = addUserStatuses(global, userStatusesById);\n }\n\n if (groupCall) {\n const existingGroupCall = selectGroupCall(global, groupCall.id!);\n global = updateGroupCall(\n global,\n groupCall.id!,\n omit(groupCall, ['connectionState']),\n undefined,\n existingGroupCall ? undefined : groupCall.participantsCount,\n );\n }\n\n global = updateChat(global, chat.id, {\n fullInfo,\n ...(membersCount && { membersCount }),\n });\n\n setGlobal(global);\n\n const stickerSet = fullInfo.stickerSet;\n if (stickerSet) {\n getActions().loadStickers({\n stickerSetInfo: {\n id: stickerSet.id,\n accessHash: stickerSet.accessHash,\n },\n });\n }\n\n return result;\n}\n\nasync function createChannel(title: string, users: ApiUser[], about?: string, photo?: File) {\n setGlobal({\n ...getGlobal(),\n chatCreation: {\n progress: ChatCreationProgress.InProgress,\n },\n });\n\n let createdChannel: ApiChat | undefined;\n\n try {\n createdChannel = await callApi('createChannel', { title, about, users });\n } catch (error) {\n const global = getGlobal();\n\n setGlobal({\n ...global,\n chatCreation: {\n progress: ChatCreationProgress.Error,\n },\n });\n\n if ((error as ApiError).message === 'CHANNELS_TOO_MUCH') {\n getActions().openLimitReachedModal({ limit: 'channels' });\n } else {\n getActions().showDialog({ data: { ...(error as ApiError), hasErrorKey: true } });\n }\n }\n\n if (!createdChannel) {\n return;\n }\n\n const { id: channelId, accessHash } = createdChannel;\n\n let global = getGlobal();\n global = updateChat(global, channelId, createdChannel);\n global = {\n ...global,\n chatCreation: {\n ...global.chatCreation,\n progress: createdChannel ? ChatCreationProgress.Complete : ChatCreationProgress.Error,\n },\n };\n setGlobal(global);\n getActions().openChat({ id: channelId, shouldReplaceHistory: true });\n\n if (channelId && accessHash && photo) {\n await callApi('editChatPhoto', { chatId: channelId, accessHash, photo });\n }\n}\n\nasync function joinChannel(channelId: string, accessHash: string) {\n try {\n await callApi('joinChannel', { channelId, accessHash });\n } catch (error) {\n if ((error as ApiError).message === 'CHANNELS_TOO_MUCH') {\n getActions().openLimitReachedModal({ limit: 'channels' });\n } else {\n getActions().showDialog({ data: { ...(error as ApiError), hasErrorKey: true } });\n }\n }\n}\n\nasync function createGroupChat(title: string, users: ApiUser[], photo?: File) {\n setGlobal({\n ...getGlobal(),\n chatCreation: {\n progress: ChatCreationProgress.InProgress,\n },\n });\n\n try {\n const createdChat = await callApi('createGroupChat', {\n title,\n users,\n });\n\n if (!createdChat) {\n return;\n }\n\n const { id: chatId } = createdChat;\n\n let global = getGlobal();\n global = updateChat(global, chatId, createdChat);\n global = {\n ...global,\n chatCreation: {\n ...global.chatCreation,\n progress: createdChat ? ChatCreationProgress.Complete : ChatCreationProgress.Error,\n },\n };\n setGlobal(global);\n getActions()\n .openChat({\n id: chatId,\n shouldReplaceHistory: true,\n });\n\n if (chatId && photo) {\n await callApi('editChatPhoto', {\n chatId,\n photo,\n });\n }\n } catch (e: any) {\n if (e.message === 'USERS_TOO_FEW') {\n const global = getGlobal();\n setGlobal({\n ...global,\n chatCreation: {\n ...global.chatCreation,\n progress: ChatCreationProgress.Error,\n error: 'CreateGroupError',\n },\n });\n }\n }\n}\n\nexport async function migrateChat(chat: ApiChat): Promise<ApiChat | undefined> {\n try {\n const supergroup = await callApi('migrateChat', chat);\n\n return supergroup;\n } catch (error) {\n if ((error as ApiError).message === 'CHANNELS_TOO_MUCH') {\n getActions().openLimitReachedModal({ limit: 'channels' });\n } else {\n getActions().showDialog({ data: { ...(error as ApiError), hasErrorKey: true } });\n }\n\n return undefined;\n }\n}\n\nasync function loadChatFolders() {\n const chatFolders = await callApi('fetchChatFolders');\n\n if (chatFolders) {\n const global = getGlobal();\n\n setGlobal({\n ...global,\n chatFolders: {\n ...global.chatFolders,\n ...chatFolders,\n },\n });\n }\n}\n\nasync function loadRecommendedChatFolders() {\n const recommendedChatFolders = await callApi('fetchRecommendedChatFolders');\n\n if (recommendedChatFolders) {\n const global = getGlobal();\n\n setGlobal({\n ...global,\n chatFolders: {\n ...global.chatFolders,\n recommended: recommendedChatFolders,\n },\n });\n }\n}\n\nasync function createChatFolder(folder: ApiChatFolder, maxId: number) {\n // Clear fields from recommended folders\n const { id: recommendedId, description, ...newFolder } = folder;\n\n await callApi('editChatFolder', {\n id: maxId + 1,\n folderUpdate: {\n id: maxId + 1,\n ...newFolder,\n },\n });\n\n if (!description) {\n return;\n }\n\n const global = getGlobal();\n const { recommended } = global.chatFolders;\n\n if (recommended) {\n setGlobal({\n ...global,\n chatFolders: {\n ...global.chatFolders,\n recommended: recommended.filter(({ id }) => id !== recommendedId),\n },\n });\n }\n}\n\nasync function deleteChatFolder(id: number) {\n await callApi('deleteChatFolder', id);\n}\n\nexport async function fetchChatByUsername(\n username: string,\n) {\n const global = getGlobal();\n const localChat = selectChatByUsername(global, username);\n if (localChat && !localChat.isMin) {\n return localChat;\n }\n\n const chat = await callApi('getChatByUsername', username);\n if (!chat) {\n return undefined;\n }\n\n setGlobal(updateChat(getGlobal(), chat.id, chat));\n\n return chat;\n}\n\nexport async function fetchChatByPhoneNumber(phoneNumber: string) {\n const global = getGlobal();\n const localUser = selectUserByPhoneNumber(global, phoneNumber);\n if (localUser && !localUser.isMin) {\n return selectChat(global, localUser.id);\n }\n\n const chat = await callApi('getChatByPhoneNumber', phoneNumber);\n if (!chat) {\n return undefined;\n }\n\n setGlobal(updateChat(getGlobal(), chat.id, chat));\n\n return chat;\n}\n\nasync function openChatByUsername(\n actions: GlobalActions,\n username: string,\n channelPostId?: number,\n startParam?: string,\n startAttach?: string | boolean,\n attach?: string,\n) {\n let global = getGlobal();\n const currentChat = selectCurrentChat(global);\n\n // Attach in the current chat\n if (startAttach && !attach) {\n const chat = await fetchChatByUsername(username);\n if (!chat) return;\n\n global = getGlobal();\n\n const user = selectUser(global, chat.id);\n if (!user) return;\n\n const isBot = isUserBot(user);\n if (!isBot || !user.isAttachMenuBot) {\n actions.showNotification({ message: langProvider.getTranslation('WebApp.AddToAttachmentUnavailableError') });\n\n return;\n }\n\n if (!currentChat) return;\n\n actions.callAttachMenuBot({\n botId: user.id,\n chatId: currentChat.id,\n ...(typeof startAttach === 'string' && { startParam: startAttach }),\n });\n\n return;\n }\n\n const isCurrentChat = currentChat?.username === username;\n\n if (!isCurrentChat) {\n // Open temporary empty chat to make the click response feel faster\n actions.openChat({ id: TMP_CHAT_ID });\n }\n\n const chat = await fetchChatByUsername(username);\n if (!chat) {\n if (!isCurrentChat) {\n actions.openPreviousChat();\n actions.showNotification({ message: 'User does not exist' });\n }\n\n return;\n }\n\n if (channelPostId) {\n actions.focusMessage({ chatId: chat.id, messageId: channelPostId });\n } else if (!isCurrentChat) {\n actions.openChat({ id: chat.id });\n }\n\n if (startParam) {\n actions.startBot({ botId: chat.id, param: startParam });\n }\n\n if (attach) {\n openAttachMenuFromLink(actions, chat.id, attach, startAttach);\n }\n}\n\nasync function openAttachMenuFromLink(\n actions: GlobalActions,\n chatId: string, attach: string, startAttach?: string | boolean,\n) {\n const botChat = await fetchChatByUsername(attach);\n if (!botChat) return;\n const botUser = selectUser(getGlobal(), botChat.id);\n if (!botUser || !botUser.isAttachMenuBot) {\n actions.showNotification({ message: langProvider.getTranslation('WebApp.AddToAttachmentUnavailableError') });\n return;\n }\n\n actions.callAttachMenuBot({\n botId: botUser.id,\n chatId,\n ...(typeof startAttach === 'string' && { startParam: startAttach }),\n });\n}\n\nasync function openCommentsByUsername(\n actions: GlobalActions,\n username: string,\n messageId: number,\n commentId: number,\n) {\n actions.openChat({ id: TMP_CHAT_ID });\n\n const chat = await fetchChatByUsername(username);\n\n if (!chat) return;\n\n const global = getGlobal();\n\n const threadInfo = selectThreadInfo(global, chat.id, messageId);\n let discussionChatId: string | undefined;\n\n if (!threadInfo) {\n const result = await callApi('requestThreadInfoUpdate', { chat, threadId: messageId });\n if (!result) return;\n\n discussionChatId = result.discussionChatId;\n } else {\n discussionChatId = threadInfo.chatId;\n }\n\n if (!discussionChatId) return;\n\n actions.focusMessage({\n chatId: discussionChatId,\n threadId: messageId,\n messageId: Number(commentId),\n });\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\nimport { selectActiveGroupCall, selectChatGroupCall, selectGroupCall } from '../../selectors/calls';\nimport { callApi } from '../../../api/gramjs';\nimport { selectChat, selectUser } from '../../selectors';\nimport { copyTextToClipboard } from '../../../util/clipboard';\nimport type { ApiGroupCall } from '../../../api/types';\nimport { updateGroupCall } from '../../reducers/calls';\nimport { buildCollectionByKey, omit } from '../../../util/iteratees';\nimport { addChats, addUsers } from '../../reducers';\nimport { fetchChatByUsername, loadFullChat } from '../api/chats';\nimport safePlay from '../../../util/safePlay';\nimport { ARE_CALLS_SUPPORTED } from '../../../util/environment';\nimport * as langProvider from '../../../util/langProvider';\nimport type { CallSound } from '../../types';\n\n// Workaround for Safari not playing audio without user interaction\nlet audioElement: HTMLAudioElement | undefined;\nlet audioContext: AudioContext | undefined;\n\nlet sounds: Record<CallSound, HTMLAudioElement>;\nlet initializationPromise: Promise<void> | undefined = Promise.resolve();\n\nexport const initializeSoundsForSafari = () => {\n if (!initializationPromise) return Promise.resolve();\n\n const joinAudio = new Audio('./voicechat_join.mp3');\n const connectingAudio = new Audio('./voicechat_connecting.mp3');\n connectingAudio.loop = true;\n const leaveAudio = new Audio('./voicechat_leave.mp3');\n const allowTalkAudio = new Audio('./voicechat_onallowtalk.mp3');\n const busyAudio = new Audio('./call_busy.mp3');\n const connectAudio = new Audio('./call_connect.mp3');\n const endAudio = new Audio('./call_end.mp3');\n const incomingAudio = new Audio('./call_incoming.mp3');\n incomingAudio.loop = true;\n const ringingAudio = new Audio('./call_ringing.mp3');\n ringingAudio.loop = true;\n\n sounds = {\n join: joinAudio,\n allowTalk: allowTalkAudio,\n leave: leaveAudio,\n connecting: connectingAudio,\n incoming: incomingAudio,\n end: endAudio,\n connect: connectAudio,\n busy: busyAudio,\n ringing: ringingAudio,\n };\n\n initializationPromise = Promise.all(Object.values(sounds).map((l) => {\n l.muted = true;\n l.volume = 0.0001;\n return l.play().then(() => {\n l.pause();\n l.volume = 1;\n l.currentTime = 0;\n l.muted = false;\n });\n })).then(() => {\n initializationPromise = undefined;\n });\n\n return initializationPromise;\n};\n\nasync function fetchGroupCall(groupCall: Partial<ApiGroupCall>) {\n const result = await callApi('getGroupCall', {\n call: groupCall,\n });\n\n if (!result) return undefined;\n\n let global = getGlobal();\n\n const existingGroupCall = selectGroupCall(global, groupCall.id!);\n\n global = updateGroupCall(\n global,\n groupCall.id!,\n omit(result.groupCall, ['connectionState']),\n undefined,\n existingGroupCall?.isLoaded ? undefined : result.groupCall.participantsCount,\n );\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n global = addChats(global, buildCollectionByKey(result.chats, 'id'));\n\n setGlobal(global);\n\n return result.groupCall;\n}\n\nasync function fetchGroupCallParticipants(groupCall: Partial<ApiGroupCall>, nextOffset?: string) {\n const result = await callApi('fetchGroupCallParticipants', {\n call: groupCall as ApiGroupCall,\n offset: nextOffset,\n });\n\n if (!result) return;\n\n let global = getGlobal();\n\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n global = addChats(global, buildCollectionByKey(result.chats, 'id'));\n\n setGlobal(global);\n}\n\naddActionHandler('toggleGroupCallPanel', (global) => {\n return {\n ...global,\n isCallPanelVisible: !global.isCallPanelVisible,\n };\n});\n\naddActionHandler('subscribeToGroupCallUpdates', async (global, actions, payload) => {\n const { subscribed, id } = payload!;\n const groupCall = selectGroupCall(global, id);\n\n if (!groupCall) return;\n\n if (subscribed) {\n await fetchGroupCall(groupCall);\n await fetchGroupCallParticipants(groupCall);\n }\n\n await callApi('toggleGroupCallStartSubscription', {\n subscribed,\n call: groupCall,\n });\n});\n\naddActionHandler('createGroupCall', async (global, actions, payload) => {\n const { chatId } = payload;\n\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const result = await callApi('createGroupCall', {\n peer: chat,\n });\n\n if (!result) return;\n\n global = getGlobal();\n setGlobal(updateGroupCall(global, result.id, {\n ...result,\n chatId,\n }));\n\n actions.joinGroupCall({ id: result.id, accessHash: result.accessHash });\n});\n\naddActionHandler('createGroupCallInviteLink', async (global, actions) => {\n const groupCall = selectActiveGroupCall(global);\n\n if (!groupCall || !groupCall.chatId) {\n return;\n }\n\n const chat = selectChat(global, groupCall.chatId);\n if (!chat) {\n return;\n }\n\n const canInvite = Boolean(chat.username);\n\n let { inviteLink } = chat.fullInfo!;\n if (canInvite) {\n inviteLink = await callApi('exportGroupCallInvite', {\n call: groupCall,\n canSelfUnmute: false,\n });\n }\n\n if (!inviteLink) {\n return;\n }\n\n copyTextToClipboard(inviteLink);\n actions.showNotification({\n message: 'Link copied to clipboard',\n });\n});\n\naddActionHandler('joinVoiceChatByLink', async (global, actions, payload) => {\n const { username, inviteHash } = payload!;\n\n const chat = await fetchChatByUsername(username);\n\n if (!chat) {\n actions.showNotification({ message: langProvider.getTranslation('NoUsernameFound') });\n return;\n }\n\n const full = await loadFullChat(chat);\n\n if (full?.groupCall) {\n actions.joinGroupCall({ id: full.groupCall.id, accessHash: full.groupCall.accessHash, inviteHash });\n }\n});\n\naddActionHandler('joinGroupCall', async (global, actions, payload) => {\n if (!ARE_CALLS_SUPPORTED) return;\n\n if (global.phoneCall) {\n actions.toggleGroupCallPanel();\n return;\n }\n\n const {\n chatId, id, accessHash, inviteHash,\n } = payload;\n\n createAudioElement();\n\n await initializeSoundsForSafari();\n const { groupCalls: { activeGroupCallId } } = global;\n let groupCall = id ? selectGroupCall(global, id) : selectChatGroupCall(global, chatId);\n\n if (groupCall?.id === activeGroupCallId) {\n actions.toggleGroupCallPanel();\n return;\n }\n\n if (activeGroupCallId) {\n actions.leaveGroupCall({\n rejoin: payload,\n });\n return;\n }\n\n if (groupCall && activeGroupCallId === groupCall.id) {\n actions.toggleGroupCallPanel();\n return;\n }\n\n if (!groupCall && (!id || !accessHash)) {\n groupCall = await fetchGroupCall({\n id,\n accessHash,\n });\n }\n\n if (!groupCall) return;\n\n global = getGlobal();\n global = updateGroupCall(\n global,\n groupCall.id,\n {\n ...groupCall,\n inviteHash,\n },\n undefined,\n groupCall.participantsCount + 1,\n );\n global = {\n ...global,\n groupCalls: {\n ...global.groupCalls,\n activeGroupCallId: groupCall.id,\n },\n isCallPanelVisible: false,\n };\n setGlobal(global);\n});\n\naddActionHandler('playGroupCallSound', (global, actions, payload) => {\n const { sound } = payload!;\n\n if (!sounds[sound]) {\n return;\n }\n\n const doPlay = () => {\n if (sound !== 'connecting') {\n sounds.connecting.pause();\n }\n if (sound !== 'incoming') {\n sounds.incoming.pause();\n }\n if (sound !== 'ringing') {\n sounds.ringing.pause();\n }\n safePlay(sounds[sound]);\n };\n\n if (initializationPromise) {\n initializationPromise.then(doPlay);\n } else {\n doPlay();\n }\n});\n\naddActionHandler('loadMoreGroupCallParticipants', (global) => {\n const groupCall = selectActiveGroupCall(global);\n if (!groupCall) {\n return;\n }\n\n void fetchGroupCallParticipants(groupCall, groupCall.nextOffset);\n});\n\naddActionHandler('requestCall', async (global, actions, payload) => {\n const { userId, isVideo } = payload;\n\n if (global.phoneCall) {\n actions.toggleGroupCallPanel();\n return;\n }\n\n const user = selectUser(global, userId);\n\n if (!user) {\n return;\n }\n\n await initializeSoundsForSafari();\n\n setGlobal({\n ...getGlobal(),\n phoneCall: {\n id: '',\n state: 'requesting',\n participantId: userId,\n isVideo,\n adminId: global.currentUserId,\n },\n isCallPanelVisible: false,\n });\n});\n\nfunction createAudioContext() {\n return (new (window.AudioContext || (window as any).webkitAudioContext)());\n}\n\nconst silence = (ctx: AudioContext) => {\n const oscillator = ctx.createOscillator();\n const dst = oscillator.connect(ctx.createMediaStreamDestination());\n oscillator.start();\n return new MediaStream([Object.assign((dst as any).stream.getAudioTracks()[0], { enabled: false })]);\n};\n\nfunction createAudioElement() {\n const ctx = createAudioContext();\n audioElement = new Audio();\n audioContext = ctx;\n audioElement.srcObject = silence(ctx);\n safePlay(audioElement);\n}\n\nexport function getGroupCallAudioElement() {\n return audioElement;\n}\n\nexport function getGroupCallAudioContext() {\n return audioContext;\n}\n\nexport function removeGroupCallAudioElement() {\n audioElement?.pause();\n audioContext = undefined;\n audioElement = undefined;\n}\n","import type { GroupCallParticipant } from '../../lib/secret-sauce';\nimport type { GlobalState } from '../types';\nimport type { ApiGroupCall } from '../../api/types';\nimport { selectGroupCall } from '../selectors/calls';\nimport { omit } from '../../util/iteratees';\nimport { updateChat } from './chats';\nimport { selectChat } from '../selectors';\n\nexport function updateGroupCall(\n global: GlobalState,\n groupCallId: string,\n groupCallUpdate: Partial<ApiGroupCall>,\n addToParticipantCount?: number,\n resetParticipantCount?: number,\n): GlobalState {\n const unfiltered = Object.values({\n ...global.groupCalls.byId[groupCallId]?.participants,\n ...groupCallUpdate.participants,\n });\n const filtered = unfiltered.filter((l) => !l.isLeft);\n const participants = filtered.reduce((acc: Record<string, GroupCallParticipant>, el) => {\n acc[el.id] = el;\n return acc;\n }, {});\n\n return {\n ...global,\n groupCalls: {\n ...global.groupCalls,\n byId: {\n ...global.groupCalls.byId,\n [groupCallId]: {\n ...global.groupCalls.byId[groupCallId],\n ...omit(groupCallUpdate, ['participantsCount']),\n ...(addToParticipantCount && {\n participantsCount: global.groupCalls.byId[groupCallId].participantsCount + addToParticipantCount,\n }),\n ...(resetParticipantCount !== undefined && {\n participantsCount: resetParticipantCount,\n }),\n participants,\n },\n },\n },\n };\n}\n\nexport function removeGroupCall(\n global: GlobalState,\n groupCallId: string,\n): GlobalState {\n const groupCall = selectGroupCall(global, groupCallId);\n if (groupCall && groupCall.chatId) {\n const chat = selectChat(global, groupCall.chatId);\n if (chat) {\n global = updateChat(global, groupCall.chatId, {\n fullInfo: {\n ...chat.fullInfo,\n groupCallId: undefined,\n },\n });\n }\n }\n\n return {\n ...global,\n groupCalls: {\n ...global.groupCalls,\n byId: {\n ...omit(global.groupCalls.byId, [groupCallId.toString()]),\n },\n },\n };\n}\n\nexport function updateActiveGroupCall(\n global: GlobalState,\n groupCallUpdate: Partial<ApiGroupCall>,\n resetParticipantCount?: number,\n): GlobalState {\n if (!global.groupCalls.activeGroupCallId) {\n return global;\n }\n\n return updateGroupCall(global,\n global.groupCalls.activeGroupCallId,\n groupCallUpdate,\n undefined,\n resetParticipantCount);\n}\n\nexport function updateGroupCallParticipant(\n global: GlobalState,\n groupCallId: string,\n userId: string,\n participantUpdate: Partial<GroupCallParticipant>,\n noUpdateCount = false,\n) {\n const groupCall = selectGroupCall(global, groupCallId);\n if (!groupCall) {\n return global;\n }\n\n return updateGroupCall(global, groupCallId, {\n participants: {\n ...groupCall.participants,\n [userId]: {\n ...groupCall.participants[userId],\n ...participantUpdate,\n },\n },\n }, participantUpdate.isLeft\n ? (noUpdateCount ? 0 : -1)\n : (groupCall.participants[userId] || noUpdateCount ? 0 : 1));\n}\n","import type { GlobalState } from '../types';\nimport { selectChat } from './chats';\nimport { isChatBasicGroup } from '../helpers';\nimport { selectUser } from './users';\n\nexport function selectChatGroupCall(global: GlobalState, chatId: string) {\n const chat = selectChat(global, chatId);\n if (!chat || !chat.fullInfo || !chat.fullInfo.groupCallId) return undefined;\n\n return selectGroupCall(global, chat.fullInfo.groupCallId);\n}\n\nexport function selectGroupCall(global: GlobalState, groupCallId: string) {\n return global.groupCalls.byId[groupCallId];\n}\n\nexport function selectGroupCallParticipant(global: GlobalState, groupCallId: string, participantId: string) {\n return selectGroupCall(global, groupCallId)?.participants[participantId];\n}\n\nexport function selectIsAdminInActiveGroupCall(global: GlobalState): boolean {\n const chatId = selectActiveGroupCall(global)?.chatId;\n\n if (!chatId) return false;\n\n const chat = selectChat(global, chatId);\n if (!chat) return false;\n\n return (isChatBasicGroup(chat) && chat.isCreator) || Boolean(chat.adminRights?.manageCall);\n}\n\nexport function selectActiveGroupCall(global: GlobalState) {\n const { groupCalls: { activeGroupCallId } } = global;\n if (!activeGroupCallId) {\n return undefined;\n }\n\n return selectGroupCall(global, activeGroupCallId);\n}\n\nexport function selectPhoneCallUser(global: GlobalState) {\n const { phoneCall, currentUserId } = global;\n if (!phoneCall || !phoneCall.participantId || !phoneCall.adminId) {\n return undefined;\n }\n\n const id = phoneCall.adminId === currentUserId ? phoneCall.participantId : phoneCall.adminId;\n return selectUser(global, id);\n}\n","import { getActions } from '../global';\nimport { IS_SAFARI } from './environment';\n\ntype DeepLinkMethod = 'resolve' | 'login' | 'passport' | 'settings' | 'join' | 'addstickers' | 'addemoji' |\n'setlanguage' | 'addtheme' | 'confirmphone' | 'socks' | 'proxy' | 'privatepost' | 'bg' | 'share' | 'msg' | 'msg_url' |\n'invoice';\n\nexport const processDeepLink = (url: string) => {\n const {\n protocol, searchParams, pathname, hostname,\n } = new URL(url);\n\n if (protocol !== 'tg:') return;\n\n const {\n openChatByInvite,\n openChatByUsername,\n openChatByPhoneNumber,\n openStickerSet,\n focusMessage,\n joinVoiceChatByLink,\n openInvoice,\n } = getActions();\n\n // Safari thinks the path in tg://path links is hostname for some reason\n const method = (IS_SAFARI ? hostname : pathname).replace(/^\\/\\//, '') as DeepLinkMethod;\n const params: Record<string, string> = {};\n searchParams.forEach((value, key) => {\n params[key] = value;\n });\n\n switch (method) {\n case 'resolve': {\n const {\n domain, phone, post, comment, voicechat, livestream, start, startattach, attach,\n } = params;\n\n const startAttach = params.hasOwnProperty('startattach') && !startattach ? true : startattach;\n\n if (domain !== 'telegrampassport') {\n if (params.hasOwnProperty('voicechat') || params.hasOwnProperty('livestream')) {\n joinVoiceChatByLink({\n username: domain,\n inviteHash: voicechat || livestream,\n });\n } else if (phone) {\n openChatByPhoneNumber({ phone, startAttach, attach });\n } else {\n openChatByUsername({\n username: domain,\n messageId: Number(post),\n commentId: Number(comment),\n startParam: start,\n startAttach,\n attach,\n });\n }\n }\n break;\n }\n case 'privatepost': {\n const {\n post, channel,\n } = params;\n\n focusMessage({\n chatId: `-${channel}`,\n id: post,\n });\n break;\n }\n case 'bg': {\n // const {\n // slug, color, rotation, mode, intensity, bg_color: bgColor, gradient,\n // } = params;\n break;\n }\n case 'join': {\n const { invite } = params;\n\n openChatByInvite({ hash: invite });\n break;\n }\n case 'addemoji':\n case 'addstickers': {\n const { set } = params;\n\n openStickerSet({\n stickerSetInfo: {\n shortName: set,\n },\n });\n break;\n }\n case 'share':\n case 'msg': {\n // const { url, text } = params;\n break;\n }\n case 'login': {\n // const { code, token } = params;\n break;\n }\n\n case 'invoice': {\n const { slug } = params;\n openInvoice({ slug });\n break;\n }\n default:\n // Unsupported deeplink\n\n break;\n }\n};\n"],"names":["memo","withGlobal","global","userId","chat","selectCurrentChat","user","selectUser","contactName","getUserFirstOrLastName","undefined","isOpen","onClose","deleteChatMember","getActions","lang","useLang","handleDeleteChatMember","useCallback","chatId","id","onEnter","className","title","renderText","color","isText","onClick","SERVICE_NOTIFICATIONS_USER_MOCK","SERVICE_NOTIFICATIONS_USER_ID","accessHash","type","isMin","username","phoneNumber","runThrottledForLoadTopChats","throttle","cb","runDebouncedForLoadFullChat","debounce","async","loadChats","listType","offsetId","offsetDate","shouldReplace","getGlobal","lastLocalServiceMessage","selectLastServiceNotification","message","result","callApi","limit","CHAT_LIST_LOAD_SLICE","archived","withPinned","serverTimeOffset","chatIds","length","shift","includes","result2","notificationsChat","selectChat","unshift","chats","lastMessage","currentChat","visibleChats","visibleUsers","selectVisibleUsers","currentUserId","users","byId","push","replaceUsers","buildCollectionByKey","concat","replaceUserStatuses","userStatusesById","replaceChats","replaceChatListIds","addUsers","addUserStatuses","updateChats","updateChatListIds","updateChatListSecondaryInfo","Object","keys","draftsById","forEach","replaceThreadParam","MAIN_THREAD_ID","replyingToById","isFullyLoaded","setGlobal","loadFullChat","fullInfo","groupCall","membersCount","existingGroupCall","selectGroupCall","updateGroupCall","omit","participantsCount","updateChat","stickerSet","loadStickers","stickerSetInfo","migrateChat","error","openLimitReachedModal","showDialog","data","hasErrorKey","fetchChatByUsername","localChat","selectChatByUsername","openAttachMenuFromLink","actions","attach","startAttach","botChat","botUser","isAttachMenuBot","callAttachMenuBot","botId","startParam","showNotification","langProvider","addActionHandler","preloadedChatIds","Set","i","TOP_CHAT_MESSAGES_PRELOAD_LIMIT","pause","currentChatId","selectCurrentMessageList","folderAllOrderedIds","getOrderedIds","ALL_FOLDER_ID","nextChatId","find","has","add","loadViewportMessages","threadId","payload","hasUnreadMark","toggleChatUnread","threadInfo","requestThreadInfoUpdate","isChatSummaryOnly","requestChatUpdate","selectThreadTopMessageId","chatFullInfo","linkedChatId","openChat","messageId","focusMessage","selectSupportChat","shouldReplaceHistory","TMP_CHAT_ID","onReplace","DEBUG","console","connectionState","authState","listIds","oldestChat","map","filter","Boolean","selectIsChatPinned","sort","chat1","chat2","date","force","lastLocalMessage","isMuted","about","photo","memberIds","createdChannel","chatCreation","progress","ChatCreationProgress","channelId","createChannel","joinChannel","leaveChat","createdChat","e","createGroupChat","folderId","selectCurrentLimit","folder","selectChatFolder","shouldBePinned","pinnedChatIds","includedChatIds","newPinnedIds","pinnedId","newIncludedChatIds","folderUpdate","selectChatListType","isPinned","ARCHIVED_FOLDER_ID","ids","orderedPinnedIds","isChatArchived","chatFolders","loadChatFolders","recommendedChatFolders","recommended","loadRecommendedChatFolders","idsToRemove","idsToAdd","some","includedId","emoticon","orderedIds","maxId","recommendedId","description","newFolder","createChatFolder","Math","max","folderIds","deleteChatFolder","unreadCount","hash","localUser","selectUserByPhoneNumber","fetchChatByPhoneNumber","openPreviousChat","replace","url","tgLinkMatch","match","RE_TG_LINK","processDeepLink","uri","URL","startsWith","hostname","pathname","window","open","toString","hostParts","split","part1","part2","part3","l","decodeURI","params","fromEntries","searchParams","hasOwnProperty","startattach","openChatByPhoneNumber","substr","openChatByInvite","openStickerSet","shortName","chatOrChannelPostId","Number","commentId","comment","joinVoiceChatByLink","inviteHash","voicechat","livestream","openInvoice","slug","substring","openChatByUsername","start","channelPostId","isUserBot","isCurrentChat","startBot","param","usernameChat","selectThreadInfo","discussionChatId","openCommentsByUsername","isEnabled","isChatBasicGroup","bannedRights","chatAfterUpdate","members","kickedMembers","isBanned","viewMessages","isUnblocked","m","adminRights","customTitle","adminMembers","isDismissed","updateManagementProgress","ManagementProgress","Promise","all","groups","addedById","reduce","group","addChats","forDiscussionIds","channel","fullChat","isPreHistoryHidden","activeChatFolder","openChatWithText","offset","addChatMembers","setNewChatMembersDialogState","NewChatMembersProgress","isProtected","enabledReactions","settings","isChatSuperGroup","isChatChannel","audioElement","audioContext","sounds","initializationPromise","resolve","initializeSoundsForSafari","joinAudio","Audio","connectingAudio","loop","leaveAudio","allowTalkAudio","busyAudio","connectAudio","endAudio","incomingAudio","ringingAudio","join","allowTalk","leave","connecting","incoming","end","connect","busy","ringing","values","muted","volume","play","then","currentTime","fetchGroupCall","call","isLoaded","fetchGroupCallParticipants","nextOffset","getGroupCallAudioElement","getGroupCallAudioContext","removeGroupCallAudioElement","isCallPanelVisible","subscribed","peer","joinGroupCall","selectActiveGroupCall","canInvite","inviteLink","canSelfUnmute","copyTextToClipboard","full","ARE_CALLS_SUPPORTED","phoneCall","toggleGroupCallPanel","ctx","AudioContext","webkitAudioContext","srcObject","oscillator","createOscillator","dst","createMediaStreamDestination","MediaStream","assign","stream","getAudioTracks","enabled","silence","safePlay","createAudioElement","groupCalls","activeGroupCallId","selectChatGroupCall","leaveGroupCall","rejoin","sound","doPlay","isVideo","state","participantId","adminId","groupCallId","groupCallUpdate","addToParticipantCount","resetParticipantCount","participants","isLeft","acc","el","removeGroupCall","updateActiveGroupCall","updateGroupCallParticipant","participantUpdate","noUpdateCount","selectGroupCallParticipant","selectIsAdminInActiveGroupCall","isCreator","manageCall","selectPhoneCallUser","protocol","method","IS_SAFARI","value","key","domain","phone","post","invite","set"],"sourceRoot":""} |