mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-10 06:48:35 +01:00
1 line
103 KiB
Plaintext
1 line
103 KiB
Plaintext
{"version":3,"file":"9970.964e193d8151fd02d513.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,qOCb/E,MAGMa,GAA8BC,EAAAA,EAAAA,KAAUC,GAAOA,KAAM,KAAM,GAC3DC,GAA8BC,EAAAA,EAAAA,KAAUF,GAAOA,KAAM,KAAK,GAAO,GA4gCvEG,eAAeC,EACbC,EAAiCC,EAAmBC,GACpD,UADyEC,EACzE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AAiB,CAAE7B,KAAMuM,IACzB,MAEF,IAAK,cAAe,CAClB,MAAM,IAAEC,GAAQlL,EAEhBQ,EAAwB,CACtBhK,oBAAqB0U,IAEvB,MAYF,IAAK,UAAW,CACd,MAAM,KAAEhK,GAASlB,EACjBiB,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, ALL_FOLDER_ID, DEBUG, SERVICE_NOTIFICATIONS_NUMBER,\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 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) => Boolean(chat?.lastMessage) && !selectIsChatPinned(global, chat.id))\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 const [part1, part2, part3] = uri.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') {\n actions.openStickerSetShortName({\n stickerSetShortName: part2,\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 === '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 chat = await callApi('getChatByPhoneNumber', SERVICE_NOTIFICATIONS_NUMBER);\n global = getGlobal();\n if (chat) {\n chatIds.unshift(chat.id);\n result.chats.unshift(chat);\n if (lastLocalServiceMessage) {\n chat.lastMessage = lastLocalServiceMessage;\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 stickerSetId: stickerSet.id,\n stickerSetAccessHash: stickerSet.accessHash,\n stickerSetShortName: stickerSet.shortName,\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' | 'setlanguage' |\n'addtheme' | 'confirmphone' | 'socks' | 'proxy' | 'privatepost' | 'bg' | 'share' | 'msg' | 'msg_url' | '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 openStickerSetShortName,\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 'addstickers': {\n const { set } = params;\n\n openStickerSetShortName({\n stickerSetShortName: set,\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","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","SERVICE_NOTIFICATIONS_USER_ID","SERVICE_NOTIFICATIONS_NUMBER","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","stickerSetId","stickerSetAccessHash","accessHash","stickerSetShortName","shortName","migrateChat","error","openLimitReachedModal","showDialog","data","hasErrorKey","fetchChatByUsername","username","localChat","selectChatByUsername","isMin","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","selectChat","hasUnreadMark","toggleChatUnread","threadInfo","requestThreadInfoUpdate","isChatSummaryOnly","requestChatUpdate","type","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","phoneNumber","localUser","selectUserByPhoneNumber","fetchChatByPhoneNumber","openPreviousChat","replace","url","tgLinkMatch","match","RE_TG_LINK","processDeepLink","uri","URL","startsWith","part1","part2","part3","pathname","split","l","decodeURI","params","fromEntries","searchParams","hasOwnProperty","startattach","openChatByPhoneNumber","substr","openChatByInvite","openStickerSetShortName","chatOrChannelPostId","Number","commentId","comment","joinVoiceChatByLink","inviteHash","voicechat","livestream","openInvoice","slug","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","window","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","toString","updateActiveGroupCall","updateGroupCallParticipant","participantUpdate","noUpdateCount","selectGroupCallParticipant","selectIsAdminInActiveGroupCall","isCreator","manageCall","selectPhoneCallUser","protocol","hostname","method","IS_SAFARI","value","key","domain","phone","post","invite","set"],"sourceRoot":""} |