telegram-tt/dist/347.b7e411d2828cadec556d.js.map
Alexander Zinchuk 52f3b8186c [Build]
2022-02-27 18:30:43 +02:00

1 line
467 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"347.b7e411d2828cadec556d.js","mappings":"qNAgCA,MAuEA,GAAeA,EAAAA,EAAAA,KArEqB,IAY9B,UAZ+B,QACnCC,EADmC,OAEnCC,EAFmC,MAGnCC,EAHmC,QAInCC,EAJmC,KAKnCC,EAAO,SAL4B,oBAMnCC,EANmC,aAOnCC,EAPmC,iBAQnCC,EARmC,UASnCC,EATmC,OAUnCC,EAVmC,wBAWnCC,GACI,EACJ,MAAM,oBACJC,EADI,kBAEJC,EAFI,IAGJC,EAHI,MAIJC,EAJI,MAKJC,EALI,YAMJC,EANI,QAOJC,IACEC,EAAAA,EAAAA,GAAiBd,EAAMK,EAAQD,EAAWL,EAASO,EAAyBR,OAAOiB,EAAWlB,MAAAA,OAA9E,EAA8EA,EAAQmB,OAEpGC,EAAkB,UAASrB,EAAQsB,KAEnCC,GAAiBC,EAAAA,EAAAA,IAAkBX,EAAKR,GAExCoB,EAAY,UAAGzB,EAAQ0B,iBAAX,aAAG,EAAmBC,QAClCC,GAAiBC,EAAAA,EAAAA,GACpB,GAAER,YACFE,IAAmBhB,EACpBuB,EAAAA,GAAAA,QACAxB,GAEIyB,GAAuBC,EAAAA,EAAAA,GAAmBJ,GAE1CK,GAAYJ,EAAAA,EAAAA,GAASR,GAAiBE,EAAgBO,EAAAA,GAAAA,OAAuBxB,GAC7E4B,EAAgBC,QAAQF,GAE9B,OACE,0BACEpB,IAAKA,EACLuB,WAAWC,EAAAA,EAAAA,GAAe,4BAA6BrC,EAAQsB,KAAOgB,EAAAA,IAAmB,sBACzFvB,MAAOA,EACPwB,QAASvB,IAEPJ,GAAqBa,GACrB,0BAAKe,IAAKf,EAAcgB,IAAI,M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zB,QAAQyzB,yBAA2B,OAiB3CF,EAAQ3oC,iBAAiB,YAhBzB,SAAS8vB,IACF6Y,EAAQrZ,SAAS3yC,SAGtBgsD,EAAQld,YAAckd,EAAQ3lD,SAAW,EACzC2lD,EAAQ3oC,iBAAiB,YAAY,YAC5B2oC,EAAQvzB,QAAQyzB,yBACvBF,EAAQld,YAAcyZ,EAClByD,EAAQnb,SAAWmb,EAAQvzB,QAAQuoB,uBACrCgL,EAAQ3sD,SAET,CAAEikB,MAAM,IAEX0oC,EAAQtgC,oBAAoB,WAAYynB,SAIzC,CAAE7vB,MAAM,IAEX0oC,EAAQvzB,QAAQwzB,iBAAmB,QAG9B,SAASjb,EAAwBgb,GACtC,OAAOrtD,QAAQqtD,EAAQvzB,QAAQyzB,0B,0DClCjC,MAKA,EALmBzjD,IACjBA,EAAEM,kBACFN,EAAE6U","sources":["webpack://telegram-t/./src/components/common/AnimatedEmoji.tsx","webpack://telegram-t/./src/components/common/helpers/waveform.ts","webpack://telegram-t/./src/util/waveform.ts","webpack://telegram-t/./src/components/common/Audio.tsx","webpack://telegram-t/./src/components/common/ChatExtra.tsx","webpack://telegram-t/./src/components/common/DeleteChatModal.tsx","webpack://telegram-t/./src/components/common/Document.tsx","webpack://telegram-t/./src/components/common/DotAnimation.tsx","webpack://telegram-t/./src/components/common/File.tsx","webpack://telegram-t/./src/components/common/GroupChatInfo.tsx","webpack://telegram-t/./src/components/common/LastMessageMeta.tsx","webpack://telegram-t/./src/components/common/Media.tsx","webpack://telegram-t/./src/components/common/MessageOutgoingStatus.tsx","webpack://telegram-t/./src/components/common/NothingFound.tsx","webpack://telegram-t/./src/components/common/Picker.tsx","webpack://telegram-t/./src/components/common/PickerSelectedItem.tsx","webpack://telegram-t/./src/components/common/PrivateChatInfo.tsx","webpack://telegram-t/./src/components/common/ProfilePhoto.tsx","webpack://telegram-t/./src/components/common/ProfileInfo.tsx","webpack://telegram-t/./src/components/common/hooks/usePhotosPreload.ts","webpack://telegram-t/./src/components/common/ReactionStaticEmoji.tsx","webpack://telegram-t/./src/components/common/StickerButton.tsx","webpack://telegram-t/./src/components/common/StickerSetModal.async.tsx","webpack://telegram-t/./src/components/common/TypingStatus.tsx","webpack://telegram-t/./src/components/common/VerifiedIcon.tsx","webpack://telegram-t/./src/components/common/WebLink.tsx","webpack://telegram-t/./src/components/common/helpers/mediaDimensions.ts","webpack://telegram-t/./src/components/common/hooks/useAnimatedEmoji.ts","webpack://telegram-t/./src/components/left/ChatFolderModal.async.tsx","webpack://telegram-t/./src/components/left/main/hooks/useChatAnimationType.ts","webpack://telegram-t/./src/components/left/main/Badge.tsx","webpack://telegram-t/./src/components/left/main/ChatCallStatus.tsx","webpack://telegram-t/./src/components/left/main/Chat.tsx","webpack://telegram-t/./src/components/left/main/EmptyFolder.tsx","webpack://telegram-t/./src/components/left/main/ChatList.tsx","webpack://telegram-t/./src/components/left/search/helpers/getSenderName.ts","webpack://telegram-t/./src/components/middle/composer/DropTarget.tsx","webpack://telegram-t/./src/components/middle/composer/DropArea.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiTooltip.async.tsx","webpack://telegram-t/./src/components/middle/composer/MessageInput.tsx","webpack://telegram-t/./src/components/middle/composer/TextFormatter.tsx","webpack://telegram-t/./src/components/middle/composer/helpers/getFilesFromDataTransferItems.ts","webpack://telegram-t/./src/components/middle/composer/helpers/prepareForRegExp.ts","webpack://telegram-t/./src/components/middle/composer/helpers/selection.ts","webpack://telegram-t/./src/util/memoized.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useEmojiTooltip.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useMentionTooltip.ts","webpack://telegram-t/./src/components/right/hooks/useAsyncRendering.ts","webpack://telegram-t/./src/components/ui/CheckboxGroup.tsx","webpack://telegram-t/./src/components/ui/FloatingActionButton.tsx","webpack://telegram-t/./src/components/ui/ListItem.tsx","webpack://telegram-t/./src/components/ui/Notification.tsx","webpack://telegram-t/./src/components/ui/ProgressSpinner.tsx","webpack://telegram-t/./src/components/ui/Radio.tsx","webpack://telegram-t/./src/components/ui/RadioGroup.tsx","webpack://telegram-t/./src/components/ui/RangeSlider.tsx","webpack://telegram-t/./src/components/ui/SearchInput.tsx","webpack://telegram-t/./src/components/ui/ShowTransition.tsx","webpack://telegram-t/./src/components/ui/Switcher.tsx","webpack://telegram-t/./src/components/ui/Tab.tsx","webpack://telegram-t/./src/components/ui/TabList.tsx","webpack://telegram-t/./src/components/ui/Transition.tsx","webpack://telegram-t/./src/hooks/reducers/useFoldersReducer.ts","webpack://telegram-t/./src/hooks/useAudioPlayer.ts","webpack://telegram-t/./src/hooks/useBlur.ts","webpack://telegram-t/./src/hooks/useBlurSync.ts","webpack://telegram-t/./src/hooks/useBuffering.ts","webpack://telegram-t/./src/hooks/useCanvasBlur.ts","webpack://telegram-t/./src/hooks/useChatContextActions.ts","webpack://telegram-t/./src/hooks/useContextMenuHandlers.ts","webpack://telegram-t/./src/hooks/useContextMenuPosition.ts","webpack://telegram-t/./src/hooks/useDebounce.ts","webpack://telegram-t/./src/hooks/useEnsureMessage.ts","webpack://telegram-t/./src/hooks/useFolderManager.ts","webpack://telegram-t/./src/hooks/useHorizontalScroll.ts","webpack://telegram-t/./src/hooks/useInputFocusOnOpen.ts","webpack://telegram-t/./src/hooks/useIntersectionObserver.ts","webpack://telegram-t/./src/hooks/useInterval.ts","webpack://telegram-t/./src/hooks/useLayoutEffectWithPrevDeps.ts","webpack://telegram-t/./src/hooks/useMediaTransition.ts","webpack://telegram-t/./src/hooks/useUniqueId.ts","webpack://telegram-t/./src/hooks/useMediaWithLoadProgress.ts","webpack://telegram-t/./src/hooks/useMouseInside.ts","webpack://telegram-t/./src/hooks/usePrevDuringAnimation.ts","webpack://telegram-t/./src/hooks/useReducer.ts","webpack://telegram-t/./src/hooks/useSendMessageAction.ts","webpack://telegram-t/./src/hooks/useStateRef.ts","webpack://telegram-t/./src/hooks/useVideoCleanup.ts","webpack://telegram-t/./src/lib/fastBlur.js","webpack://telegram-t/./src/util/audioPlayer.ts","webpack://telegram-t/./src/util/captureEvents.ts","webpack://telegram-t/./src/util/cssAnimationEndListeners.ts","webpack://telegram-t/./src/util/cycleRestrict.ts","webpack://telegram-t/./src/util/fastSmoothScroll.ts","webpack://telegram-t/./src/util/fastSmoothScrollHorizontal.ts","webpack://telegram-t/./src/util/focusEditableElement.ts","webpack://telegram-t/./src/util/getKeyFromEvent.ts","webpack://telegram-t/./src/util/getMessageIdsForSelectedText.ts","webpack://telegram-t/./src/util/mediaSession.ts","webpack://telegram-t/./src/util/parseMessageInput.ts","webpack://telegram-t/./src/util/patchSafariProgressiveAudio.ts","webpack://telegram-t/./src/util/stopEvent.ts"],"sourcesContent":["import React, {\n FC, memo,\n} from '../../lib/teact/teact';\n\nimport { ApiMediaFormat, ApiSticker } from '../../api/types';\nimport { ActiveEmojiInteraction } from '../../global/types';\n\nimport buildClassName from '../../util/buildClassName';\nimport { ObserveFn, useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport useMedia from '../../hooks/useMedia';\nimport useMediaTransition from '../../hooks/useMediaTransition';\nimport useAnimatedEmoji from './hooks/useAnimatedEmoji';\nimport { LIKE_STICKER_ID } from './helpers/mediaDimensions';\n\nimport AnimatedSticker from './AnimatedSticker';\n\nimport './AnimatedEmoji.scss';\n\ntype OwnProps = {\n sticker: ApiSticker;\n effect?: ApiSticker;\n isOwn?: boolean;\n soundId?: string;\n observeIntersection?: ObserveFn;\n size?: 'large' | 'medium' | 'small';\n lastSyncTime?: number;\n forceLoadPreview?: boolean;\n messageId?: number;\n chatId?: string;\n activeEmojiInteractions?: ActiveEmojiInteraction[];\n};\n\nconst QUALITY = 1;\n\nconst AnimatedEmoji: FC<OwnProps> = ({\n sticker,\n effect,\n isOwn,\n soundId,\n size = 'medium',\n observeIntersection,\n lastSyncTime,\n forceLoadPreview,\n messageId,\n chatId,\n activeEmojiInteractions,\n}) => {\n const {\n markAnimationLoaded,\n isAnimationLoaded,\n ref,\n width,\n style,\n handleClick,\n playKey,\n } = useAnimatedEmoji(size, chatId, messageId, soundId, activeEmojiInteractions, isOwn, undefined, effect?.emoji);\n\n const localMediaHash = `sticker${sticker.id}`;\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const thumbDataUri = sticker.thumbnail?.dataUri;\n const previewBlobUrl = useMedia(\n `${localMediaHash}?size=m`,\n !isIntersecting && !forceLoadPreview,\n ApiMediaFormat.BlobUrl,\n lastSyncTime,\n );\n const transitionClassNames = useMediaTransition(previewBlobUrl);\n\n const mediaData = useMedia(localMediaHash, !isIntersecting, ApiMediaFormat.Lottie, lastSyncTime);\n const isMediaLoaded = Boolean(mediaData);\n\n return (\n <div\n ref={ref}\n className={buildClassName('AnimatedEmoji media-inner', sticker.id === LIKE_STICKER_ID && 'like-sticker-thumb')}\n style={style}\n onClick={handleClick}\n >\n {!isAnimationLoaded && thumbDataUri && (\n <img src={thumbDataUri} alt=\"\" />\n )}\n {!isAnimationLoaded && previewBlobUrl && (\n <img src={previewBlobUrl} className={transitionClassNames} alt=\"\" />\n )}\n {isMediaLoaded && localMediaHash && (\n <AnimatedSticker\n key={localMediaHash}\n id={localMediaHash}\n animationData={mediaData!}\n size={width}\n quality={QUALITY}\n play={isIntersecting && playKey}\n forceOnHeavyAnimation\n noLoop\n onLoad={markAnimationLoaded}\n />\n )}\n </div>\n );\n};\n\nexport default memo(AnimatedEmoji);\n","type IWaveformProps = {\n peak: number;\n fillStyle: string;\n progressFillStyle: string;\n};\n\nexport const MAX_EMPTY_WAVEFORM_POINTS = 30;\nconst SPIKE_WIDTH = 2;\nconst SPIKE_STEP = 4;\nconst SPIKE_RADIUS = 1;\nconst HEIGHT = 23;\n\nexport function renderWaveform(\n canvas: HTMLCanvasElement,\n spikes: number[],\n progress: number,\n {\n peak, fillStyle, progressFillStyle,\n }: IWaveformProps,\n) {\n const width = spikes.length * SPIKE_STEP;\n const height = HEIGHT;\n\n canvas.width = width * 2;\n canvas.height = height * 2;\n canvas.style.width = `${width}px`;\n canvas.style.height = `${height}px`;\n\n const ctx = canvas.getContext('2d')!;\n ctx.scale(2, 2);\n\n spikes.forEach((item, i) => {\n ctx.globalAlpha = (i / spikes.length >= progress) ? 0.5 : 1;\n ctx.fillStyle = progress > i / spikes.length ? progressFillStyle : fillStyle;\n const spikeHeight = Math.max(2, HEIGHT * (item / Math.max(1, peak)));\n roundedRectangle(ctx, i * SPIKE_STEP, height, SPIKE_WIDTH, spikeHeight, SPIKE_RADIUS);\n ctx.fill();\n });\n}\n\nfunction roundedRectangle(\n ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number,\n) {\n if (width < 2 * radius) {\n radius = width / 2;\n }\n if (height < 2 * radius) {\n radius = height / 2;\n }\n\n ctx.beginPath();\n ctx.moveTo(x + radius, y);\n ctx.arcTo(x + width, y, x + width, y - height, radius);\n ctx.arcTo(x + width, y - height, x, y - height, radius);\n ctx.arcTo(x, y - height, x, y, radius);\n ctx.arcTo(x, y, x + width, y, radius);\n ctx.closePath();\n}\n","/* eslint-disable no-bitwise */\n\n// eslint-disable-next-line max-len\n// Ref: https://github.com/telegramdesktop/tdesktop/blob/0743e71ab6b928d2ee5bae1aed991849b1e2b291/Telegram/SourceFiles/data/data_document.cpp#L1018\nexport function decodeWaveform(encoded5bit: Uint8Array) {\n const bitsCount = encoded5bit.length * 8;\n const valuesCount = Math.floor(bitsCount / 5);\n if (!valuesCount) {\n return [];\n }\n\n // Read each 5 bit of encoded5bit as 0-31 unsigned char.\n // We count the index of the byte in which the desired 5-bit sequence starts.\n // And then we read a uint16 starting from that byte to guarantee to get all of those 5 bits.\n //\n // BUT! if it is the last byte we have, we're not allowed to read a uint16 starting with it.\n // Because it will be an overflow (we'll access one byte after the available memory).\n // We see, that only the last 5 bits could start in the last available byte and be problematic.\n // So we read in a general way all the entries in a general way except the last one.\n const result = Array(valuesCount);\n const bitsData = encoded5bit;\n for (let i = 0, l = valuesCount - 1; i !== l; ++i) {\n const byteIndex = Math.floor((i * 5) / 8);\n const bitShift = Math.floor((i * 5) % 8);\n const value = bitsData[byteIndex] + (bitsData[byteIndex + 1] << 8);\n result[i] = ((value >> bitShift) & 0x1F);\n }\n const lastByteIndex = Math.floor(((valuesCount - 1) * 5) / 8);\n const lastBitShift = Math.floor(((valuesCount - 1) * 5) % 8);\n const lastValue = bitsData[lastByteIndex] + (bitsData[lastByteIndex + 1] << 8);\n result[valuesCount - 1] = (lastValue >> lastBitShift) & 0x1F;\n\n return result;\n}\n\nexport function interpolateArray(data: number[], fitCount: number) {\n let peak = 0;\n const newData = new Array(fitCount);\n const springFactor = data.length / fitCount;\n const leftFiller = data[0];\n const rightFiller = data[data.length - 1];\n for (let i = 0; i < fitCount; i++) {\n const idx = Math.floor(i * springFactor);\n const val = ((data[idx - 1] ?? leftFiller) + (data[idx] ?? leftFiller) + (data[idx + 1] ?? rightFiller)) / 3;\n newData[i] = val;\n if (peak < val) {\n peak = val;\n }\n }\n return { data: newData, peak };\n}\n","import React, {\n FC, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch } from '../../lib/teact/teactn';\n\nimport {\n ApiAudio, ApiMediaFormat, ApiMessage, ApiVoice,\n} from '../../api/types';\nimport { AudioOrigin, ISettings } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { formatMediaDateTime, formatMediaDuration, formatPastTimeShort } from '../../util/dateFormat';\nimport {\n getMediaDuration,\n getMediaTransferState,\n getMessageMediaFormat,\n getMessageMediaHash,\n isMessageLocal,\n isOwnMessage,\n} from '../../modules/helpers';\nimport { MAX_EMPTY_WAVEFORM_POINTS, renderWaveform } from './helpers/waveform';\nimport buildClassName from '../../util/buildClassName';\nimport renderText from './helpers/renderText';\nimport { getFileSizeString } from './helpers/documentInfo';\nimport { decodeWaveform, interpolateArray } from '../../util/waveform';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useBuffering from '../../hooks/useBuffering';\nimport useAudioPlayer from '../../hooks/useAudioPlayer';\nimport useLang, { LangFn } from '../../hooks/useLang';\nimport { captureEvents } from '../../util/captureEvents';\nimport useMedia from '../../hooks/useMedia';\nimport { makeTrackId } from '../../util/audioPlayer';\nimport { getTranslation } from '../../util/langProvider';\n\nimport Button from '../ui/Button';\nimport ProgressSpinner from '../ui/ProgressSpinner';\nimport Link from '../ui/Link';\n\nimport './Audio.scss';\n\ntype OwnProps = {\n theme: ISettings['theme'];\n message: ApiMessage;\n senderTitle?: string;\n uploadProgress?: number;\n origin: AudioOrigin;\n date?: number;\n lastSyncTime?: number;\n className?: string;\n isSelectable?: boolean;\n isSelected?: boolean;\n isDownloading: boolean;\n onPlay: (messageId: number, chatId: string) => void;\n onReadMedia?: () => void;\n onCancelUpload?: () => void;\n onDateClick?: (messageId: number, chatId: string) => void;\n};\n\nconst AVG_VOICE_DURATION = 10;\nconst MIN_SPIKES = IS_SINGLE_COLUMN_LAYOUT ? 20 : 25;\nconst MAX_SPIKES = IS_SINGLE_COLUMN_LAYOUT ? 50 : 75;\n// This is needed for browsers requiring user interaction before playing.\nconst PRELOAD = true;\n\nconst Audio: FC<OwnProps> = ({\n theme,\n message,\n senderTitle,\n uploadProgress,\n origin,\n date,\n lastSyncTime,\n className,\n isSelectable,\n isSelected,\n isDownloading,\n onPlay,\n onReadMedia,\n onCancelUpload,\n onDateClick,\n}) => {\n const { content: { audio, voice, video }, isMediaUnread } = message;\n const isVoice = Boolean(voice || video);\n const isSeeking = useRef<boolean>(false);\n const playStateBeforeSeeking = useRef<boolean>(false);\n // eslint-disable-next-line no-null/no-null\n const seekerRef = useRef<HTMLDivElement>(null);\n const lang = useLang();\n const { isRtl } = lang;\n const dispatch = getDispatch();\n\n const [isActivated, setIsActivated] = useState(false);\n const shouldLoad = (isActivated || PRELOAD) && lastSyncTime;\n const coverHash = getMessageMediaHash(message, 'pictogram');\n const coverBlobUrl = useMedia(coverHash, false, ApiMediaFormat.BlobUrl);\n\n const mediaData = useMedia(\n getMessageMediaHash(message, 'inline'),\n !shouldLoad,\n getMessageMediaFormat(message, 'inline'),\n );\n\n const { loadProgress: downloadProgress } = useMediaWithLoadProgress(\n getMessageMediaHash(message, 'download'),\n !isDownloading,\n );\n\n const handleForcePlay = useCallback(() => {\n setIsActivated(true);\n onPlay(message.id, message.chatId);\n }, [message, onPlay]);\n\n const handleTrackChange = useCallback(() => {\n setIsActivated(false);\n }, []);\n\n const {\n isBuffered, bufferedProgress, bufferingHandlers, checkBuffering,\n } = useBuffering();\n\n const {\n isPlaying, playProgress, playPause, play, pause, setCurrentTime, duration,\n } = useAudioPlayer(\n makeTrackId(message),\n getMediaDuration(message)!,\n isVoice ? 'voice' : 'audio',\n mediaData,\n bufferingHandlers,\n undefined,\n checkBuffering,\n isActivated,\n handleForcePlay,\n handleTrackChange,\n isMessageLocal(message),\n );\n\n const isOwn = isOwnMessage(message);\n const waveformCanvasRef = useWaveformCanvas(theme, voice, (isMediaUnread && !isOwn) ? 1 : playProgress, isOwn);\n\n const withSeekline = isPlaying || (playProgress > 0 && playProgress < 1);\n\n useEffect(() => {\n setIsActivated(isPlaying);\n }, [isPlaying]);\n\n const isLoadingForPlaying = isActivated && !isBuffered;\n\n const {\n isUploading, isTransferring, transferProgress,\n } = getMediaTransferState(\n message,\n uploadProgress || downloadProgress,\n isLoadingForPlaying || isDownloading,\n );\n\n const {\n shouldRender: shouldRenderSpinner,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(isTransferring);\n\n const shouldRenderCross = shouldRenderSpinner && (isLoadingForPlaying || isUploading);\n\n const handleButtonClick = useCallback(() => {\n if (isUploading) {\n onCancelUpload?.();\n return;\n }\n\n if (!isPlaying) {\n onPlay(message.id, message.chatId);\n }\n\n getDispatch().setAudioPlayerOrigin({ origin });\n setIsActivated(!isActivated);\n playPause();\n }, [isUploading, isPlaying, isActivated, playPause, onCancelUpload, onPlay, message.id, message.chatId, origin]);\n\n useEffect(() => {\n if (onReadMedia && isMediaUnread && (isPlaying || isDownloading)) {\n onReadMedia();\n }\n }, [isPlaying, isMediaUnread, onReadMedia, isDownloading]);\n\n const handleDownloadClick = useCallback(() => {\n if (isDownloading) {\n dispatch.cancelMessageMediaDownload({ message });\n } else {\n dispatch.downloadMessageMedia({ message });\n }\n }, [dispatch, isDownloading, message]);\n\n const handleSeek = useCallback((e: MouseEvent | TouchEvent) => {\n if (isSeeking.current && seekerRef.current) {\n const { width, left } = seekerRef.current.getBoundingClientRect();\n const clientX = e instanceof MouseEvent ? e.clientX : e.targetTouches[0].clientX;\n e.stopPropagation(); // Prevent Slide-to-Reply activation\n // Prevent track skipping while seeking near end\n setCurrentTime(Math.max(Math.min(duration * ((clientX - left) / width), duration - 0.1), 0.001));\n }\n }, [duration, setCurrentTime]);\n\n const handleStartSeek = useCallback((e: MouseEvent | TouchEvent) => {\n if (e instanceof MouseEvent && e.button === 2) return;\n isSeeking.current = true;\n playStateBeforeSeeking.current = isPlaying;\n pause();\n handleSeek(e);\n }, [handleSeek, pause, isPlaying]);\n\n const handleStopSeek = useCallback(() => {\n isSeeking.current = false;\n if (playStateBeforeSeeking.current) play();\n }, [play]);\n\n const handleDateClick = useCallback(() => {\n onDateClick!(message.id, message.chatId);\n }, [onDateClick, message.id, message.chatId]);\n\n useEffect(() => {\n if (!seekerRef.current || !withSeekline) return undefined;\n return captureEvents(seekerRef.current, {\n onCapture: handleStartSeek,\n onRelease: handleStopSeek,\n onClick: handleStopSeek,\n onDrag: handleSeek,\n });\n }, [withSeekline, handleStartSeek, handleSeek, handleStopSeek]);\n\n function renderFirstLine() {\n if (isVoice) {\n return senderTitle || 'Voice';\n }\n\n const { title, fileName } = audio!;\n\n return title || fileName;\n }\n\n function renderSecondLine() {\n if (isVoice) {\n return (\n <div className=\"meta\" dir={isRtl ? 'rtl' : undefined}>\n {formatMediaDuration((voice || video)!.duration)}\n </div>\n );\n }\n\n const { performer } = audio!;\n\n return (\n <div className=\"meta\" dir={isRtl ? 'rtl' : undefined}>\n {formatMediaDuration(duration)}\n <span className=\"bullet\">&bull;</span>\n {performer && <span className=\"performer\" title={performer}>{renderText(performer)}</span>}\n {performer && senderTitle && <span className=\"bullet\">&bull;</span>}\n {senderTitle && <span title={senderTitle}>{renderText(senderTitle)}</span>}\n </div>\n );\n }\n\n const fullClassName = buildClassName(\n 'Audio',\n className,\n isOwn && origin === AudioOrigin.Inline && 'own',\n (origin === AudioOrigin.Search || origin === AudioOrigin.SharedMedia) && 'bigger',\n isSelected && 'audio-is-selected',\n );\n\n const buttonClassNames = ['toggle-play'];\n if (shouldRenderCross) {\n buttonClassNames.push('loading');\n } else if (isPlaying) {\n buttonClassNames.push('pause');\n } else if (!isPlaying) {\n buttonClassNames.push('play');\n }\n\n const contentClassName = buildClassName('content', withSeekline && 'with-seekline');\n\n function renderWithTitle() {\n return (\n <>\n <div className={contentClassName}>\n <div className=\"content-row\">\n <p className=\"title\" dir=\"auto\" title={renderFirstLine()}>{renderText(renderFirstLine())}</p>\n\n <div className=\"message-date\">\n {date && (\n <Link\n className=\"date\"\n onClick={handleDateClick}\n >\n {formatPastTimeShort(lang, date * 1000)}\n </Link>\n )}\n </div>\n </div>\n\n {withSeekline && (\n <div className=\"meta search-result\" dir={isRtl ? 'rtl' : undefined}>\n <span className=\"duration with-seekline\" dir=\"auto\">\n {playProgress < 1 && `${formatMediaDuration(duration * playProgress, duration)}`}\n </span>\n {renderSeekline(playProgress, bufferedProgress, seekerRef)}\n </div>\n )}\n {!withSeekline && renderSecondLine()}\n </div>\n </>\n );\n }\n\n return (\n <div className={fullClassName} dir={lang.isRtl ? 'rtl' : 'ltr'}>\n {isSelectable && (\n <div className=\"message-select-control\">\n {isSelected && <i className=\"icon-select\" />}\n </div>\n )}\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color={coverBlobUrl ? 'translucent-white' : 'primary'}\n className={buttonClassNames.join(' ')}\n ariaLabel={isPlaying ? 'Pause audio' : 'Play audio'}\n onClick={handleButtonClick}\n isRtl={lang.isRtl}\n backgroundImage={coverBlobUrl}\n >\n <i className=\"icon-play\" />\n <i className=\"icon-pause\" />\n </Button>\n {shouldRenderSpinner && (\n <div className={buildClassName('media-loading', spinnerClassNames, shouldRenderCross && 'interactive')}>\n <ProgressSpinner\n progress={transferProgress}\n transparent\n size=\"m\"\n onClick={shouldRenderCross ? handleButtonClick : undefined}\n noCross={!shouldRenderCross}\n />\n </div>\n )}\n {audio && !isUploading && (\n <Button\n round\n size=\"tiny\"\n className=\"download-button\"\n ariaLabel={isDownloading ? 'Cancel download' : 'Download'}\n onClick={handleDownloadClick}\n >\n <i className={isDownloading ? 'icon-close' : 'icon-arrow-down'} />\n </Button>\n )}\n {origin === AudioOrigin.Search && renderWithTitle()}\n {origin !== AudioOrigin.Search && audio && renderAudio(\n lang, audio, duration, isPlaying, playProgress, bufferedProgress, seekerRef,\n (isDownloading || isUploading), date, transferProgress, onDateClick ? handleDateClick : undefined,\n )}\n {origin === AudioOrigin.SharedMedia && (voice || video) && renderWithTitle()}\n {origin === AudioOrigin.Inline && voice && (\n renderVoice(voice, seekerRef, waveformCanvasRef, playProgress, isMediaUnread)\n )}\n </div>\n );\n};\n\nfunction renderAudio(\n lang: LangFn,\n audio: ApiAudio,\n duration: number,\n isPlaying: boolean,\n playProgress: number,\n bufferedProgress: number,\n seekerRef: React.Ref<HTMLElement>,\n showProgress?: boolean,\n date?: number,\n progress?: number,\n handleDateClick?: NoneToVoidFunction,\n) {\n const {\n title, performer, fileName,\n } = audio;\n const showSeekline = isPlaying || (playProgress > 0 && playProgress < 1);\n const { isRtl } = getTranslation;\n\n return (\n <div className=\"content\">\n <p className=\"title\" dir=\"auto\" title={title}>{renderText(title || fileName)}</p>\n {showSeekline && (\n <div className=\"meta\" dir={isRtl ? 'rtl' : undefined}>\n <span className=\"duration with-seekline\" dir=\"auto\">\n {formatMediaDuration(duration * playProgress, duration)}\n </span>\n {renderSeekline(playProgress, bufferedProgress, seekerRef)}\n </div>\n )}\n {!showSeekline && showProgress && (\n <div className=\"meta\" dir={isRtl ? 'rtl' : undefined}>\n {progress ? `${getFileSizeString(audio!.size * progress)} / ` : undefined}{getFileSizeString(audio!.size)}\n </div>\n )}\n {!showSeekline && !showProgress && (\n <div className=\"meta\" dir={isRtl ? 'rtl' : undefined}>\n <span className=\"duration\" dir=\"auto\">{formatMediaDuration(duration)}</span>\n <span className=\"bullet\">&bull;</span>\n <span className=\"performer\" dir=\"auto\" title={performer}>{renderText(performer || 'Unknown')}</span>\n {date && (\n <>\n <span className=\"bullet\">&bull;</span>\n <Link className=\"date\" onClick={handleDateClick}>\n {formatMediaDateTime(lang, date * 1000, true)}\n </Link>\n </>\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction renderVoice(\n voice: ApiVoice,\n seekerRef: React.Ref<HTMLDivElement>,\n waveformCanvasRef: React.Ref<HTMLCanvasElement>,\n playProgress: number,\n isMediaUnread?: boolean,\n) {\n return (\n <div className=\"content\">\n <div\n className=\"waveform\"\n draggable={false}\n ref={seekerRef}\n >\n <canvas ref={waveformCanvasRef} />\n </div>\n <p className={buildClassName('voice-duration', isMediaUnread && 'unread')} dir=\"auto\">\n {playProgress === 0 ? formatMediaDuration(voice.duration) : formatMediaDuration(voice.duration * playProgress)}\n </p>\n </div>\n );\n}\n\nfunction useWaveformCanvas(\n theme: ISettings['theme'],\n voice?: ApiVoice,\n playProgress = 0,\n isOwn = false,\n) {\n // eslint-disable-next-line no-null/no-null\n const canvasRef = useRef<HTMLCanvasElement>(null);\n\n const { data: spikes, peak } = useMemo(() => {\n if (!voice) {\n return undefined;\n }\n\n const { waveform, duration } = voice;\n if (!waveform) {\n return {\n data: new Array(Math.min(duration, MAX_EMPTY_WAVEFORM_POINTS)).fill(0),\n peak: 0,\n };\n }\n\n const durationFactor = Math.min(duration / AVG_VOICE_DURATION, 1);\n const spikesCount = Math.round(MIN_SPIKES + (MAX_SPIKES - MIN_SPIKES) * durationFactor);\n const decodedWaveform = decodeWaveform(new Uint8Array(waveform));\n\n return interpolateArray(decodedWaveform, spikesCount);\n }, [voice]) || {};\n\n useLayoutEffect(() => {\n const canvas = canvasRef.current;\n\n if (!canvas || !spikes || peak === undefined) {\n return;\n }\n\n const fillColor = theme === 'dark' ? '#494A78' : '#ADD3F7';\n const fillOwnColor = theme === 'dark' ? '#B7ABED' : '#AEDFA4';\n const progressFillColor = theme === 'dark' ? '#8774E1' : '#3390EC';\n const progressFillOwnColor = theme === 'dark' ? '#FFFFFF' : '#4FAE4E';\n\n renderWaveform(canvas, spikes, playProgress, {\n peak,\n fillStyle: isOwn ? fillOwnColor : fillColor,\n progressFillStyle: isOwn ? progressFillOwnColor : progressFillColor,\n });\n }, [isOwn, peak, playProgress, spikes, theme]);\n\n return canvasRef;\n}\n\nfunction renderSeekline(\n playProgress: number,\n bufferedProgress: number,\n seekerRef: React.Ref<HTMLElement>,\n) {\n return (\n <div\n className=\"seekline no-selection\"\n ref={seekerRef as React.Ref<HTMLDivElement>}\n >\n <span className=\"seekline-buffered-progress\">\n <i\n style={`transform: translateX(${bufferedProgress * 100}%)`}\n />\n </span>\n <span className=\"seekline-play-progress\">\n <i\n style={`transform: translateX(${playProgress * 100}%)`}\n />\n </span>\n <span className=\"seekline-thumb\">\n <i\n style={`transform: translateX(${playProgress * 100}%)`}\n />\n </span>\n </div>\n );\n}\n\nexport default memo(Audio);\n","import React, {\n FC, memo, useCallback, useEffect,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { GlobalState } from '../../global/types';\nimport { ApiChat, ApiCountryCode, ApiUser } from '../../api/types';\n\nimport {\n selectChat, selectNotifyExceptions, selectNotifySettings, selectUser,\n} from '../../modules/selectors';\nimport {\n getChatDescription, getChatLink, getHasAdminRight, isChatChannel, isUserId, isUserRightBanned, selectIsChatMuted,\n} from '../../modules/helpers';\nimport renderText from './helpers/renderText';\nimport { copyTextToClipboard } from '../../util/clipboard';\nimport { formatPhoneNumberWithCode } from '../../util/phoneNumber';\nimport useLang from '../../hooks/useLang';\n\nimport ListItem from '../ui/ListItem';\nimport Switcher from '../ui/Switcher';\n\ntype OwnProps = {\n chatOrUserId: string;\n forceShowSelf?: boolean;\n};\n\ntype StateProps =\n {\n user?: ApiUser;\n chat?: ApiChat;\n canInviteUsers?: boolean;\n isMuted?: boolean;\n phoneCodeList: ApiCountryCode[];\n }\n & Pick<GlobalState, 'lastSyncTime'>;\n\nconst ChatExtra: FC<OwnProps & StateProps> = ({\n lastSyncTime,\n user,\n chat,\n forceShowSelf,\n canInviteUsers,\n isMuted,\n phoneCodeList,\n}) => {\n const {\n loadFullUser,\n showNotification,\n updateChatMutedState,\n } = getDispatch();\n\n const {\n id: userId,\n fullInfo,\n username,\n phoneNumber,\n isSelf,\n } = user || {};\n const { id: chatId } = chat || {};\n const lang = useLang();\n\n useEffect(() => {\n if (lastSyncTime && userId) {\n loadFullUser({ userId });\n }\n }, [loadFullUser, userId, lastSyncTime]);\n\n const handleNotificationChange = useCallback(() => {\n updateChatMutedState({ chatId, isMuted: !isMuted });\n }, [chatId, isMuted, updateChatMutedState]);\n\n if (!chat || chat.isRestricted || (isSelf && !forceShowSelf)) {\n return undefined;\n }\n\n function copy(text: string, entity: string) {\n copyTextToClipboard(text);\n showNotification({ message: `${entity} was copied` });\n }\n\n const formattedNumber = phoneNumber && formatPhoneNumberWithCode(phoneCodeList, phoneNumber);\n const link = getChatLink(chat);\n const description = (fullInfo?.bio) || getChatDescription(chat);\n\n return (\n <div className=\"ChatExtra\">\n {formattedNumber && Boolean(formattedNumber.length) && (\n <ListItem icon=\"phone\" multiline narrow ripple onClick={() => copy(formattedNumber, lang('Phone'))}>\n <span className=\"title\" dir=\"auto\">{formattedNumber}</span>\n <span className=\"subtitle\">{lang('Phone')}</span>\n </ListItem>\n )}\n {username && (\n <ListItem\n icon=\"mention\"\n multiline\n narrow\n ripple\n onClick={() => copy(`@${username}`, lang('Username'))}\n >\n <span className=\"title\" dir=\"auto\">{renderText(username)}</span>\n <span className=\"subtitle\">{lang('Username')}</span>\n </ListItem>\n )}\n {description && Boolean(description.length) && (\n <ListItem\n icon=\"info\"\n multiline\n narrow\n isStatic\n >\n <span className=\"title\" dir=\"auto\">\n {renderText(description, ['br', 'links', 'emoji'])}\n </span>\n <span className=\"subtitle\">{lang(userId ? 'UserBio' : 'Info')}</span>\n </ListItem>\n )}\n {(canInviteUsers || !username) && link && (\n <ListItem\n icon={chat.username ? 'mention' : 'link'}\n multiline\n narrow\n ripple\n onClick={() => copy(link, lang('SetUrlPlaceholder'))}\n >\n <div className=\"title\">{link}</div>\n <span className=\"subtitle\">{lang('SetUrlPlaceholder')}</span>\n </ListItem>\n )}\n {!forceShowSelf && (\n <ListItem icon=\"unmute\" ripple onClick={handleNotificationChange}>\n <span>{lang('Notifications')}</span>\n <Switcher\n id=\"group-notifications\"\n label={userId ? 'Toggle User Notifications' : 'Toggle Chat Notifications'}\n checked={!isMuted}\n inactive\n />\n </ListItem>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatOrUserId }): StateProps => {\n const { lastSyncTime, countryList: { phoneCodes: phoneCodeList } } = global;\n\n const chat = chatOrUserId ? selectChat(global, chatOrUserId) : undefined;\n const user = isUserId(chatOrUserId) ? selectUser(global, chatOrUserId) : undefined;\n const isMuted = chat && selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global));\n\n const canInviteUsers = chat && !user && (\n (!isChatChannel(chat) && !isUserRightBanned(chat, 'inviteUsers'))\n || getHasAdminRight(chat, 'inviteUsers')\n );\n\n return {\n lastSyncTime, phoneCodeList, chat, user, canInviteUsers, isMuted,\n };\n },\n)(ChatExtra));\n","import React, { FC, useCallback, memo } from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiChat } from '../../api/types';\n\nimport { selectIsChatWithSelf, selectUser } from '../../modules/selectors';\nimport {\n isUserId,\n isUserBot,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n isChatChannel,\n getChatTitle,\n} from '../../modules/helpers';\nimport useLang from '../../hooks/useLang';\nimport renderText from './helpers/renderText';\n\nimport Avatar from './Avatar';\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nimport './DeleteChatModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n chat: ApiChat;\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n};\n\ntype StateProps = {\n isChannel: boolean;\n isChatWithSelf?: boolean;\n isBot?: boolean;\n isPrivateChat: boolean;\n isBasicGroup: boolean;\n isSuperGroup: boolean;\n currentUserId: string | undefined;\n canDeleteForAll?: boolean;\n contactName?: string;\n};\n\nconst DeleteChatModal: FC<OwnProps & StateProps> = ({\n isOpen,\n chat,\n isChannel,\n isPrivateChat,\n isChatWithSelf,\n isBot,\n isBasicGroup,\n isSuperGroup,\n currentUserId,\n canDeleteForAll,\n contactName,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const {\n leaveChannel,\n deleteHistory,\n deleteChannel,\n deleteChatUser,\n blockContact,\n } = getDispatch();\n\n const lang = useLang();\n const chatTitle = getChatTitle(lang, chat);\n\n const handleDeleteMessageForAll = useCallback(() => {\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: true });\n\n onClose();\n }, [deleteHistory, chat.id, onClose]);\n\n const handleDeleteAndStop = useCallback(() => {\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: true });\n blockContact({ contactId: chat.id, accessHash: chat.accessHash });\n\n onClose();\n }, [deleteHistory, chat.id, chat.accessHash, blockContact, onClose]);\n\n const handleDeleteChat = useCallback(() => {\n if (isPrivateChat) {\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: false });\n } else if (isBasicGroup) {\n deleteChatUser({ chatId: chat.id, userId: currentUserId });\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: false });\n } else if ((isChannel || isSuperGroup) && !chat.isCreator) {\n leaveChannel({ chatId: chat.id });\n } else if ((isChannel || isSuperGroup) && chat.isCreator) {\n deleteChannel({ chatId: chat.id });\n }\n onClose();\n }, [\n isPrivateChat,\n isBasicGroup,\n isChannel,\n isSuperGroup,\n currentUserId,\n chat.isCreator,\n chat.id,\n onClose,\n deleteHistory,\n deleteChatUser,\n leaveChannel,\n deleteChannel,\n ]);\n\n function renderHeader() {\n return (\n <div className=\"modal-header\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Avatar\n size=\"tiny\"\n chat={chat}\n isSavedMessages={isChatWithSelf}\n />\n <h3 className=\"modal-title\">{lang(renderTitle())}</h3>\n </div>\n );\n }\n\n function renderTitle() {\n if (isChannel && !chat.isCreator) {\n return 'LeaveChannel';\n }\n\n if (isChannel && chat.isCreator) {\n return 'ChannelDelete';\n }\n\n if (isBasicGroup || isSuperGroup) {\n return 'Group.LeaveGroup';\n }\n\n return 'DeleteChatUser';\n }\n\n function renderMessage() {\n if (isChannel && chat.isCreator) {\n return <p>{renderText(lang('ChatList.DeleteAndLeaveGroupConfirmation', chatTitle), ['simple_markdown'])}</p>;\n }\n\n if ((isChannel && !chat.isCreator) || isBasicGroup || isSuperGroup) {\n return <p>{renderText(lang('ChannelLeaveAlertWithName', chatTitle), ['simple_markdown'])}</p>;\n }\n\n return <p>{renderText(lang('ChatList.DeleteChatConfirmation', contactName), ['simple_markdown'])}</p>;\n }\n\n function renderActionText() {\n if (isChannel && !chat.isCreator) {\n return 'LeaveChannel';\n }\n if (isChannel && chat.isCreator) {\n return 'Chat.Input.Delete';\n }\n\n if (isBasicGroup || isSuperGroup) {\n return 'Group.LeaveGroup';\n }\n\n return canDeleteForAll ? 'ChatList.DeleteForCurrentUser' : 'Delete';\n }\n\n return (\n <Modal\n isOpen={isOpen}\n className=\"DeleteChatModal\"\n header={renderHeader()}\n onClose={onClose}\n onCloseAnimationEnd={onCloseAnimationEnd}\n >\n {renderMessage()}\n {isBot && (\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteAndStop}>\n {lang('DeleteAndStop')}\n </Button>\n )}\n {canDeleteForAll && (\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteMessageForAll}>\n {contactName ? renderText(lang('ChatList.DeleteForEveryone', contactName)) : lang('DeleteForAll')}\n </Button>\n )}\n <Button color=\"danger\" className=\"confirm-dialog-button\" isText onClick={handleDeleteChat}>\n {lang(renderActionText())}\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, { chat }): StateProps => {\n const isPrivateChat = isUserId(chat.id);\n const isChatWithSelf = selectIsChatWithSelf(global, chat.id);\n const user = isPrivateChat && selectUser(global, getPrivateChatUserId(chat)!);\n const isBot = user && isUserBot(user) && !chat.isSupport;\n const canDeleteForAll = (isPrivateChat && !isChatWithSelf && !isBot);\n const contactName = isPrivateChat\n ? getUserFirstOrLastName(selectUser(global, getPrivateChatUserId(chat)!))\n : undefined;\n\n return {\n isPrivateChat,\n isChatWithSelf,\n isBot,\n isChannel: isChatChannel(chat),\n isBasicGroup: isChatBasicGroup(chat),\n isSuperGroup: isChatSuperGroup(chat),\n currentUserId: global.currentUserId,\n canDeleteForAll,\n contactName,\n };\n },\n)(DeleteChatModal));\n","import React, {\n FC, useCallback, memo, useRef, useEffect, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch } from '../../lib/teact/teactn';\n\nimport { ApiMessage } from '../../api/types';\n\nimport { getDocumentExtension, getDocumentHasPreview } from './helpers/documentInfo';\nimport {\n getMediaTransferState,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n isMessageDocumentVideo,\n} from '../../modules/helpers';\nimport { ObserveFn, useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport useMedia from '../../hooks/useMedia';\nimport useFlag from '../../hooks/useFlag';\n\nimport File from './File';\n\ntype OwnProps = {\n message: ApiMessage;\n observeIntersection?: ObserveFn;\n smaller?: boolean;\n isSelected?: boolean;\n isSelectable?: boolean;\n canAutoLoad?: boolean;\n uploadProgress?: number;\n withDate?: boolean;\n datetime?: number;\n className?: string;\n sender?: string;\n autoLoadFileMaxSizeMb?: number;\n isDownloading: boolean;\n onCancelUpload?: () => void;\n onMediaClick?: () => void;\n onDateClick?: (messageId: number, chatId: string) => void;\n};\n\nconst BYTES_PER_MB = 1024 * 1024;\n\nconst Document: FC<OwnProps> = ({\n message,\n observeIntersection,\n smaller,\n canAutoLoad,\n autoLoadFileMaxSizeMb,\n uploadProgress,\n withDate,\n datetime,\n className,\n sender,\n isSelected,\n isSelectable,\n onCancelUpload,\n onMediaClick,\n onDateClick,\n isDownloading,\n}) => {\n const dispatch = getDispatch();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const document = message.content.document!;\n const { fileName, size, timestamp } = document;\n const extension = getDocumentExtension(document) || '';\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n const [wasIntersected, markIntersected] = useFlag();\n useEffect(() => {\n if (isIntersecting) {\n markIntersected();\n }\n }, [isIntersecting, markIntersected]);\n\n // Auto-loading does not use global download manager because requires additional click to save files locally\n const [isLoadAllowed, setIsLoadAllowed] = useState(\n canAutoLoad && (!autoLoadFileMaxSizeMb || size <= autoLoadFileMaxSizeMb * BYTES_PER_MB),\n );\n\n const shouldDownload = Boolean(isDownloading || (isLoadAllowed && wasIntersected));\n\n const documentHash = getMessageMediaHash(message, 'download');\n const { loadProgress: downloadProgress, mediaData } = useMediaWithLoadProgress(\n documentHash, !shouldDownload, undefined, undefined, undefined, true,\n );\n const isLoaded = Boolean(mediaData);\n\n const {\n isUploading, isTransferring, transferProgress,\n } = getMediaTransferState(message, uploadProgress || downloadProgress, shouldDownload && !isLoaded);\n\n const hasPreview = getDocumentHasPreview(document);\n const thumbDataUri = hasPreview ? getMessageMediaThumbDataUri(message) : undefined;\n const localBlobUrl = hasPreview ? document.previewBlobUrl : undefined;\n const previewData = useMedia(getMessageMediaHash(message, 'pictogram'), !isIntersecting);\n\n const withMediaViewer = onMediaClick && Boolean(document.mediaType);\n\n const handleClick = useCallback(() => {\n if (isUploading) {\n if (onCancelUpload) {\n onCancelUpload();\n }\n return;\n }\n\n if (isDownloading) {\n dispatch.cancelMessageMediaDownload({ message });\n return;\n }\n\n if (isTransferring) {\n setIsLoadAllowed(false);\n return;\n }\n\n if (withMediaViewer) {\n onMediaClick!();\n } else {\n dispatch.downloadMessageMedia({ message });\n }\n }, [\n isUploading, isDownloading, isTransferring, withMediaViewer, onCancelUpload, dispatch, message, onMediaClick,\n ]);\n\n const handleDateClick = useCallback(() => {\n onDateClick!(message.id, message.chatId);\n }, [onDateClick, message.id, message.chatId]);\n\n return (\n <File\n ref={ref}\n name={fileName}\n extension={extension}\n size={size}\n timestamp={withDate ? datetime || timestamp : undefined}\n thumbnailDataUri={thumbDataUri}\n previewData={localBlobUrl || previewData}\n smaller={smaller}\n isTransferring={isTransferring}\n isUploading={isUploading}\n transferProgress={transferProgress}\n className={className}\n sender={sender}\n isSelectable={isSelectable}\n isSelected={isSelected}\n actionIcon={withMediaViewer ? (isMessageDocumentVideo(message) ? 'icon-play' : 'icon-eye') : 'icon-download'}\n onClick={handleClick}\n onDateClick={onDateClick ? handleDateClick : undefined}\n />\n );\n};\n\nexport default memo(Document);\n","import React, { FC } from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\nimport buildClassName from '../../util/buildClassName';\n\nimport './DotAnimation.scss';\n\ntype OwnProps = {\n content: string;\n className?: string;\n};\n\nconst DotAnimation: FC<OwnProps> = ({ content, className }) => {\n const lang = useLang();\n return (\n <span className={buildClassName('DotAnimation', className)} dir={lang.isRtl ? 'rtl' : 'auto'}>\n {content}\n <span className=\"ellipsis\" />\n </span>\n );\n};\n\nexport default DotAnimation;\n","import { RefObject } from 'react';\nimport React, { FC, memo, useRef } from '../../lib/teact/teact';\n\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useMediaTransition from '../../hooks/useMediaTransition';\nimport buildClassName from '../../util/buildClassName';\nimport { formatMediaDateTime, formatPastTimeShort } from '../../util/dateFormat';\nimport { getColorFromExtension, getFileSizeString } from './helpers/documentInfo';\nimport { getDocumentThumbnailDimensions } from './helpers/mediaDimensions';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport ProgressSpinner from '../ui/ProgressSpinner';\nimport Link from '../ui/Link';\n\nimport './File.scss';\n\ntype OwnProps = {\n ref?: RefObject<HTMLDivElement>;\n name: string;\n extension?: string;\n size: number;\n timestamp?: number;\n sender?: string;\n thumbnailDataUri?: string;\n previewData?: string;\n className?: string;\n smaller?: boolean;\n isTransferring?: boolean;\n isUploading?: boolean;\n isSelectable?: boolean;\n isSelected?: boolean;\n transferProgress?: number;\n actionIcon?: string;\n onClick?: () => void;\n onDateClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;\n};\n\nconst File: FC<OwnProps> = ({\n ref,\n name,\n size,\n extension = '',\n timestamp,\n sender,\n thumbnailDataUri,\n previewData,\n className,\n smaller,\n isTransferring,\n isUploading,\n isSelectable,\n isSelected,\n transferProgress,\n actionIcon,\n onClick,\n onDateClick,\n}) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n let elementRef = useRef<HTMLDivElement>(null);\n if (ref) {\n elementRef = ref;\n }\n\n const transitionClassNames = useMediaTransition(previewData);\n const {\n shouldRender: shouldSpinnerRender,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(isTransferring, undefined, true);\n\n const color = getColorFromExtension(extension);\n const sizeString = getFileSizeString(size);\n\n const { width, height } = getDocumentThumbnailDimensions(smaller);\n\n const fullClassName = buildClassName(\n 'File',\n className,\n smaller && 'smaller',\n onClick && !isUploading && 'interactive',\n isSelected && 'file-is-selected',\n );\n\n return (\n <div ref={elementRef} className={fullClassName} dir={lang.isRtl ? 'rtl' : undefined}>\n {isSelectable && (\n <div className=\"message-select-control\">\n {isSelected && <i className=\"icon-select\" />}\n </div>\n )}\n <div className=\"file-icon-container\" onClick={isUploading ? undefined : onClick}>\n {thumbnailDataUri || previewData ? (\n <div className=\"file-preview media-inner\">\n <img\n src={thumbnailDataUri}\n width={width}\n height={height}\n className=\"thumbnail\"\n alt=\"\"\n />\n <img\n src={previewData}\n className={buildClassName('full-media', transitionClassNames)}\n width={width}\n height={height}\n alt=\"\"\n />\n </div>\n ) : (\n <div className={`file-icon ${color}`}>\n {extension.length <= 4 && (\n <span className=\"file-ext\" dir=\"auto\">{extension}</span>\n )}\n </div>\n )}\n {shouldSpinnerRender && (\n <div className={buildClassName('file-progress', color, spinnerClassNames)}>\n <ProgressSpinner\n progress={transferProgress}\n size={smaller ? 's' : 'm'}\n onClick={isUploading ? onClick : undefined}\n />\n </div>\n )}\n {onClick && (\n <i\n className={buildClassName(\n 'action-icon',\n actionIcon || 'icon-download',\n shouldSpinnerRender && 'hidden',\n )}\n />\n )}\n </div>\n <div className=\"file-info\">\n <div className=\"file-title\" dir=\"auto\">{renderText(name)}</div>\n <div className=\"file-subtitle\" dir=\"auto\">\n <span>\n {isTransferring && transferProgress ? `${Math.round(transferProgress * 100)}%` : sizeString}\n </span>\n {sender && <span className=\"file-sender\">{renderText(sender)}</span>}\n {!sender && timestamp && (\n <>\n <span className=\"bullet\" />\n <Link onClick={onDateClick}>{formatMediaDateTime(lang, timestamp * 1000, true)}</Link>\n </>\n )}\n </div>\n </div>\n {sender && timestamp && (\n <Link onClick={onDateClick}>{formatPastTimeShort(lang, timestamp * 1000)}</Link>\n )}\n </div>\n );\n};\n\nexport default memo(File);\n","import { MouseEvent as ReactMouseEvent } from 'react';\nimport React, {\n FC, useEffect, useCallback, memo,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiChat, ApiTypingStatus } from '../../api/types';\nimport { GlobalState } from '../../global/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport {\n getChatTypeString,\n getChatTitle,\n isChatSuperGroup,\n} from '../../modules/helpers';\nimport { selectChat, selectChatMessages, selectChatOnlineCount } from '../../modules/selectors';\nimport renderText from './helpers/renderText';\nimport useLang, { LangFn } from '../../hooks/useLang';\n\nimport Avatar from './Avatar';\nimport VerifiedIcon from './VerifiedIcon';\nimport TypingStatus from './TypingStatus';\nimport DotAnimation from './DotAnimation';\n\ntype OwnProps = {\n chatId: string;\n typingStatus?: ApiTypingStatus;\n avatarSize?: 'small' | 'medium' | 'large' | 'jumbo';\n status?: string;\n withDots?: boolean;\n withMediaViewer?: boolean;\n withUsername?: boolean;\n withFullInfo?: boolean;\n withUpdatingStatus?: boolean;\n withChatType?: boolean;\n noRtl?: boolean;\n};\n\ntype StateProps =\n {\n chat?: ApiChat;\n onlineCount?: number;\n areMessagesLoaded: boolean;\n }\n & Pick<GlobalState, 'lastSyncTime'>;\n\nconst GroupChatInfo: FC<OwnProps & StateProps> = ({\n typingStatus,\n avatarSize = 'medium',\n status,\n withDots,\n withMediaViewer,\n withUsername,\n withFullInfo,\n withUpdatingStatus,\n withChatType,\n noRtl,\n chat,\n onlineCount,\n areMessagesLoaded,\n lastSyncTime,\n}) => {\n const {\n loadFullChat,\n openMediaViewer,\n } = getDispatch();\n\n const isSuperGroup = chat && isChatSuperGroup(chat);\n const { id: chatId, isMin, isRestricted } = chat || {};\n\n useEffect(() => {\n if (chatId && !isMin && withFullInfo && lastSyncTime) {\n loadFullChat({ chatId });\n }\n }, [chatId, isMin, lastSyncTime, withFullInfo, loadFullChat, isSuperGroup]);\n\n const handleAvatarViewerOpen = useCallback((e: ReactMouseEvent<HTMLDivElement, MouseEvent>, hasPhoto: boolean) => {\n if (chat && hasPhoto) {\n e.stopPropagation();\n openMediaViewer({\n avatarOwnerId: chat.id,\n origin: avatarSize === 'jumbo' ? MediaViewerOrigin.ProfileAvatar : MediaViewerOrigin.MiddleHeaderAvatar,\n });\n }\n }, [chat, avatarSize, openMediaViewer]);\n\n const lang = useLang();\n\n if (!chat) {\n return undefined;\n }\n\n function renderStatusOrTyping() {\n if (status) {\n return withDots ? (\n <DotAnimation className=\"status\" content={status} />\n ) : (\n <span className=\"status\" dir=\"auto\">{status}</span>\n );\n }\n\n if (withUpdatingStatus && !areMessagesLoaded && !isRestricted) {\n return (\n <DotAnimation className=\"status\" content={lang('Updating')} />\n );\n }\n\n if (!chat) {\n return undefined;\n }\n\n if (typingStatus) {\n return <TypingStatus typingStatus={typingStatus} />;\n }\n\n if (withChatType) {\n return (\n <span className=\"status\" dir=\"auto\">{lang(getChatTypeString(chat))}</span>\n );\n }\n\n const handle = withUsername ? chat.username : undefined;\n const groupStatus = getGroupStatus(lang, chat);\n const onlineStatus = onlineCount ? `, ${lang('OnlineCount', onlineCount, 'i')}` : undefined;\n\n return (\n <span className=\"status\">\n {handle && <span className=\"handle\">{handle}</span>}\n <span className=\"group-status\">{groupStatus}</span>\n {onlineStatus && <span className=\"online-status\">{onlineStatus}</span>}\n </span>\n );\n }\n\n return (\n <div className=\"ChatInfo\" dir={!noRtl && lang.isRtl ? 'rtl' : undefined}>\n <Avatar\n key={chat.id}\n size={avatarSize}\n chat={chat}\n onClick={withMediaViewer ? handleAvatarViewerOpen : undefined}\n />\n <div className=\"info\">\n <div className=\"title\">\n <h3 dir=\"auto\">{renderText(getChatTitle(lang, chat))}</h3>\n {chat.isVerified && <VerifiedIcon />}\n </div>\n {renderStatusOrTyping()}\n </div>\n </div>\n );\n};\n\nfunction getGroupStatus(lang: LangFn, chat: ApiChat) {\n const chatTypeString = lang(getChatTypeString(chat));\n const { membersCount } = chat;\n\n if (chat.isRestricted) {\n return chatTypeString === 'Channel' ? 'channel is inaccessible' : 'group is inaccessible';\n }\n\n if (!membersCount) {\n return chatTypeString;\n }\n\n return chatTypeString === 'Channel'\n ? lang('Subscribers', membersCount, 'i')\n : lang('Members', membersCount, 'i');\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const { lastSyncTime } = global;\n const chat = selectChat(global, chatId);\n const onlineCount = chat ? selectChatOnlineCount(global, chat) : undefined;\n const areMessagesLoaded = Boolean(selectChatMessages(global, chatId));\n\n return {\n lastSyncTime, chat, onlineCount, areMessagesLoaded,\n };\n },\n)(GroupChatInfo));\n","import React, { FC, memo } from '../../lib/teact/teact';\n\nimport { ApiMessage, ApiMessageOutgoingStatus } from '../../api/types';\n\nimport { formatPastTimeShort } from '../../util/dateFormat';\nimport useLang from '../../hooks/useLang';\n\nimport MessageOutgoingStatus from './MessageOutgoingStatus';\n\nimport './LastMessageMeta.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n outgoingStatus?: ApiMessageOutgoingStatus;\n};\n\nconst LastMessageMeta: FC<OwnProps> = ({ message, outgoingStatus }) => {\n const lang = useLang();\n return (\n <div className=\"LastMessageMeta\">\n {outgoingStatus && (\n <MessageOutgoingStatus status={outgoingStatus} />\n )}\n <span className=\"time\">{formatPastTimeShort(lang, message.date * 1000)}</span>\n </div>\n );\n};\n\nexport default memo(LastMessageMeta);\n","import React, { FC, memo, useCallback, useRef } from '../../lib/teact/teact';\n\nimport { ApiMessage } from '../../api/types';\n\nimport { formatMediaDuration } from '../../util/dateFormat';\nimport stopEvent from '../../util/stopEvent';\nimport {\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessageVideo,\n} from '../../modules/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport useMedia from '../../hooks/useMedia';\nimport useMediaTransition from '../../hooks/useMediaTransition';\nimport { ObserveFn, useIsIntersecting } from '../../hooks/useIntersectionObserver';\n\nimport './Media.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n idPrefix?: string;\n isProtected?: boolean;\n observeIntersection?: ObserveFn;\n onClick?: (messageId: number, chatId: string) => void;\n};\n\nconst Media: FC<OwnProps> = ({\n message,\n idPrefix = 'shared-media',\n isProtected,\n observeIntersection,\n onClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n const thumbDataUri = getMessageMediaThumbDataUri(message);\n const mediaBlobUrl = useMedia(getMessageMediaHash(message, 'pictogram'), !isIntersecting);\n const transitionClassNames = useMediaTransition(mediaBlobUrl);\n\n const video = getMessageVideo(message);\n\n const handleClick = useCallback(() => {\n onClick!(message.id, message.chatId);\n }, [message.id, message.chatId, onClick]);\n\n return (\n <div\n ref={ref}\n id={`${idPrefix}${message.id}`}\n className=\"Media scroll-item\"\n onClick={onClick ? handleClick : undefined}\n >\n <img\n src={thumbDataUri}\n alt=\"\"\n draggable={!isProtected}\n decoding=\"async\"\n onContextMenu={isProtected ? stopEvent : undefined}\n />\n <img\n src={mediaBlobUrl}\n className={buildClassName('full-media', transitionClassNames)}\n alt=\"\"\n draggable={!isProtected}\n decoding=\"async\"\n onContextMenu={isProtected ? stopEvent : undefined}\n />\n {video && <span className=\"video-duration\">{video.isGif ? 'GIF' : formatMediaDuration(video.duration)}</span>}\n {isProtected && <span className=\"protector\" />}\n </div>\n );\n};\n\nexport default memo(Media);\n","import React, { FC, memo } from '../../lib/teact/teact';\n\nimport { ApiMessageOutgoingStatus } from '../../api/types';\n\nimport Transition from '../ui/Transition';\n\nimport './MessageOutgoingStatus.scss';\n\ntype OwnProps = {\n status: ApiMessageOutgoingStatus;\n};\n\nenum Keys {\n failed, pending, succeeded, read,\n}\n\nconst MessageOutgoingStatus: FC<OwnProps> = ({ status }) => {\n return (\n <div className=\"MessageOutgoingStatus\">\n <Transition name=\"reveal\" activeKey={Keys[status]}>\n <i className={`icon-message-${status}`} />\n </Transition>\n </div>\n );\n};\n\nexport default memo(MessageOutgoingStatus);\n","import React, { FC, memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport './NothingFound.scss';\n\ninterface OwnProps {\n text?: string;\n description?: string;\n}\n\nconst DEFAULT_TEXT = 'Nothing found.';\n\nconst NothingFound: FC<OwnProps> = ({ text = DEFAULT_TEXT, description }) => {\n const lang = useLang();\n const { transitionClassNames } = useShowTransition(true);\n\n return (\n <div className={buildClassName('NothingFound', transitionClassNames, description && 'with-description')}>\n {text}\n {description && <p className=\"description\">{renderText(lang(description), ['br'])}</p>}\n </div>\n );\n};\n\nexport default memo(NothingFound);\n","import React, {\n FC, useCallback, useRef, useEffect, memo,\n} from '../../lib/teact/teact';\n\nimport { isUserId } from '../../modules/helpers';\n\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport Checkbox from '../ui/Checkbox';\nimport InputText from '../ui/InputText';\nimport ListItem from '../ui/ListItem';\nimport PrivateChatInfo from './PrivateChatInfo';\nimport GroupChatInfo from './GroupChatInfo';\nimport PickerSelectedItem from './PickerSelectedItem';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport useLang from '../../hooks/useLang';\n\nimport Loading from '../ui/Loading';\n\nimport './Picker.scss';\n\ntype OwnProps = {\n itemIds: string[];\n selectedIds: string[];\n filterValue?: string;\n filterPlaceholder?: string;\n notFoundText?: string;\n searchInputId?: string;\n isLoading?: boolean;\n noScrollRestore?: boolean;\n onSelectedIdsChange: (ids: string[]) => void;\n onFilterChange: (value: string) => void;\n onLoadMore?: () => void;\n};\n\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 500;\n\nconst MAX_FULL_ITEMS = 10;\nconst ALWAYS_FULL_ITEMS_COUNT = 5;\n\nconst Picker: FC<OwnProps> = ({\n itemIds,\n selectedIds,\n filterValue,\n filterPlaceholder,\n notFoundText,\n searchInputId,\n isLoading,\n noScrollRestore,\n onSelectedIdsChange,\n onFilterChange,\n onLoadMore,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLInputElement>(null);\n const shouldMinimize = selectedIds.length > MAX_FULL_ITEMS;\n\n useEffect(() => {\n setTimeout(() => {\n requestAnimationFrame(() => {\n inputRef.current!.focus();\n });\n }, FOCUS_DELAY_MS);\n }, []);\n\n const handleItemClick = useCallback((id: string) => {\n const newSelectedIds = [...selectedIds];\n if (newSelectedIds.includes(id)) {\n newSelectedIds.splice(newSelectedIds.indexOf(id), 1);\n } else {\n newSelectedIds.push(id);\n }\n onSelectedIdsChange(newSelectedIds);\n onFilterChange('');\n }, [selectedIds, onSelectedIdsChange, onFilterChange]);\n\n const handleFilterChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { value } = e.currentTarget;\n onFilterChange(value);\n }, [onFilterChange]);\n\n const [viewportIds, getMore] = useInfiniteScroll(onLoadMore, itemIds, Boolean(filterValue));\n\n const lang = useLang();\n\n return (\n <div className=\"Picker\">\n <div className=\"picker-header custom-scroll\" dir={lang.isRtl ? 'rtl' : undefined}>\n {selectedIds.map((id, i) => (\n <PickerSelectedItem\n chatOrUserId={id}\n isMinimized={shouldMinimize && i < selectedIds.length - ALWAYS_FULL_ITEMS_COUNT}\n canClose\n onClick={handleItemClick}\n clickArg={id}\n />\n ))}\n <InputText\n id={searchInputId}\n ref={inputRef}\n value={filterValue}\n onChange={handleFilterChange}\n placeholder={filterPlaceholder || lang('SelectChat')}\n />\n </div>\n\n {viewportIds?.length ? (\n <InfiniteScroll\n className=\"picker-list custom-scroll\"\n items={viewportIds}\n onLoadMore={getMore}\n noScrollRestore={noScrollRestore}\n >\n {viewportIds.map((id) => (\n <ListItem\n key={id}\n className=\"chat-item-clickable picker-list-item\"\n onClick={() => handleItemClick(id)}\n ripple\n >\n <Checkbox label=\"\" checked={selectedIds.includes(id)} />\n {isUserId(id) ? (\n <PrivateChatInfo userId={id} />\n ) : (\n <GroupChatInfo chatId={id} />\n )}\n </ListItem>\n ))}\n </InfiniteScroll>\n ) : !isLoading && viewportIds && !viewportIds.length ? (\n <p className=\"no-results\">{notFoundText || 'Sorry, nothing found.'}</p>\n ) : (\n <Loading />\n )}\n </div>\n );\n};\n\nexport default memo(Picker);\n","import React, { FC, memo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiChat, ApiUser } from '../../api/types';\n\nimport { selectChat, selectUser } from '../../modules/selectors';\nimport { getChatTitle, getUserFirstOrLastName, isUserId } from '../../modules/helpers';\nimport renderText from './helpers/renderText';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport Avatar from './Avatar';\n\nimport './PickerSelectedItem.scss';\n\ntype OwnProps = {\n chatOrUserId?: string;\n icon?: string;\n title?: string;\n isMinimized?: boolean;\n canClose?: boolean;\n onClick: (arg: any) => void;\n clickArg: any;\n className?: string;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n user?: ApiUser;\n};\n\nconst PickerSelectedItem: FC<OwnProps & StateProps> = ({\n icon,\n title,\n isMinimized,\n canClose,\n onClick,\n clickArg,\n chat,\n user,\n className,\n}) => {\n const lang = useLang();\n\n let iconElement: any;\n let titleText: any;\n\n if (icon && title) {\n iconElement = (\n <div className=\"item-icon\">\n <i className={`icon-${icon}`} />\n </div>\n );\n\n titleText = title;\n } else if (chat || user) {\n iconElement = (\n <Avatar\n chat={chat}\n user={user}\n size=\"small\"\n isSavedMessages={user?.isSelf}\n />\n );\n\n const name = !chat || (user && !user.isSelf)\n ? getUserFirstOrLastName(user)\n : getChatTitle(lang, chat, user);\n\n titleText = name ? renderText(name) : undefined;\n }\n\n const fullClassName = buildClassName(\n 'PickerSelectedItem',\n className,\n isMinimized && 'minimized',\n canClose && 'closeable',\n );\n\n return (\n <div\n className={fullClassName}\n onClick={() => onClick(clickArg)}\n title={isMinimized ? titleText : undefined}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n {iconElement}\n {!isMinimized && (\n <div className=\"item-name\" dir=\"auto\">\n {titleText}\n </div>\n )}\n {canClose && (\n <div className=\"item-remove\">\n <i className=\"icon-close\" />\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatOrUserId }): StateProps => {\n if (!chatOrUserId) {\n return {};\n }\n\n const chat = chatOrUserId ? selectChat(global, chatOrUserId) : undefined;\n const user = isUserId(chatOrUserId) ? selectUser(global, chatOrUserId) : undefined;\n\n return {\n chat,\n user,\n };\n },\n)(PickerSelectedItem));\n","import { MouseEvent as ReactMouseEvent } from 'react';\nimport React, {\n FC, useEffect, useCallback, memo,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiUser, ApiTypingStatus, ApiUserStatus } from '../../api/types';\nimport { GlobalState } from '../../global/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { selectChatMessages, selectUser, selectUserStatus } from '../../modules/selectors';\nimport { getUserFullName, getUserStatus, isUserOnline } from '../../modules/helpers';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport Avatar from './Avatar';\nimport VerifiedIcon from './VerifiedIcon';\nimport TypingStatus from './TypingStatus';\nimport DotAnimation from './DotAnimation';\n\ntype OwnProps = {\n userId: string;\n typingStatus?: ApiTypingStatus;\n avatarSize?: 'tiny' | 'small' | 'medium' | 'large' | 'jumbo';\n forceShowSelf?: boolean;\n status?: string;\n withDots?: boolean;\n withMediaViewer?: boolean;\n withUsername?: boolean;\n withFullInfo?: boolean;\n withUpdatingStatus?: boolean;\n noStatusOrTyping?: boolean;\n noRtl?: boolean;\n};\n\ntype StateProps =\n {\n user?: ApiUser;\n userStatus?: ApiUserStatus;\n isSavedMessages?: boolean;\n areMessagesLoaded: boolean;\n serverTimeOffset: number;\n }\n & Pick<GlobalState, 'lastSyncTime'>;\n\nconst PrivateChatInfo: FC<OwnProps & StateProps> = ({\n typingStatus,\n avatarSize = 'medium',\n status,\n withDots,\n withMediaViewer,\n withUsername,\n withFullInfo,\n withUpdatingStatus,\n noStatusOrTyping,\n noRtl,\n user,\n userStatus,\n isSavedMessages,\n areMessagesLoaded,\n lastSyncTime,\n serverTimeOffset,\n}) => {\n const {\n loadFullUser,\n openMediaViewer,\n } = getDispatch();\n\n const { id: userId } = user || {};\n const fullName = getUserFullName(user);\n\n useEffect(() => {\n if (withFullInfo && lastSyncTime && userId) {\n loadFullUser({ userId });\n }\n }, [userId, loadFullUser, lastSyncTime, withFullInfo]);\n\n const handleAvatarViewerOpen = useCallback((e: ReactMouseEvent<HTMLDivElement, MouseEvent>, hasPhoto: boolean) => {\n if (user && hasPhoto) {\n e.stopPropagation();\n openMediaViewer({\n avatarOwnerId: user.id,\n origin: avatarSize === 'jumbo' ? MediaViewerOrigin.ProfileAvatar : MediaViewerOrigin.MiddleHeaderAvatar,\n });\n }\n }, [user, avatarSize, openMediaViewer]);\n\n const lang = useLang();\n\n if (!user) {\n return undefined;\n }\n\n function renderStatusOrTyping() {\n if (status) {\n return withDots ? (\n <DotAnimation className=\"status\" content={status} />\n ) : (\n <span className=\"status\" dir=\"auto\">{status}</span>\n );\n }\n\n if (withUpdatingStatus && !areMessagesLoaded) {\n return (\n <DotAnimation className=\"status\" content={lang('Updating')} />\n );\n }\n\n if (!user) {\n return undefined;\n }\n\n if (typingStatus) {\n return <TypingStatus typingStatus={typingStatus} />;\n }\n\n return (\n <span className={`status ${isUserOnline(user, userStatus) ? 'online' : ''}`}>\n {withUsername && user.username && <span className=\"handle\">{user.username}</span>}\n <span className=\"user-status\" dir=\"auto\">{getUserStatus(lang, user, userStatus, serverTimeOffset)}</span>\n </span>\n );\n }\n\n return (\n <div className=\"ChatInfo\" dir={!noRtl && lang.isRtl ? 'rtl' : undefined}>\n <Avatar\n key={user.id}\n size={avatarSize}\n user={user}\n isSavedMessages={isSavedMessages}\n onClick={withMediaViewer ? handleAvatarViewerOpen : undefined}\n />\n <div className=\"info\">\n {isSavedMessages ? (\n <div className=\"title\">\n <h3>{lang('SavedMessages')}</h3>\n </div>\n ) : (\n <div className=\"title\">\n <h3 dir=\"auto\">{fullName && renderText(fullName)}</h3>\n {user?.isVerified && <VerifiedIcon />}\n </div>\n )}\n {(status || (!isSavedMessages && !noStatusOrTyping)) && renderStatusOrTyping()}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId, forceShowSelf }): StateProps => {\n const { lastSyncTime, serverTimeOffset } = global;\n const user = selectUser(global, userId);\n const userStatus = selectUserStatus(global, userId);\n const isSavedMessages = !forceShowSelf && user && user.isSelf;\n const areMessagesLoaded = Boolean(selectChatMessages(global, userId));\n\n return {\n lastSyncTime, user, userStatus, isSavedMessages, areMessagesLoaded, serverTimeOffset,\n };\n },\n)(PrivateChatInfo));\n","import React, { FC, memo } from '../../lib/teact/teact';\n\nimport {\n ApiChat, ApiMediaFormat, ApiPhoto, ApiUser,\n} from '../../api/types';\n\nimport {\n getChatAvatarHash,\n getChatTitle,\n getUserColorKey,\n getUserFullName,\n isUserId,\n isChatWithRepliesBot,\n isDeletedUser,\n} from '../../modules/helpers';\nimport renderText from './helpers/renderText';\nimport buildClassName from '../../util/buildClassName';\nimport { getFirstLetters } from '../../util/textFormat';\nimport useMedia from '../../hooks/useMedia';\nimport useBlurSync from '../../hooks/useBlurSync';\nimport usePrevious from '../../hooks/usePrevious';\nimport useLang from '../../hooks/useLang';\n\nimport Spinner from '../ui/Spinner';\n\nimport './ProfilePhoto.scss';\n\ntype OwnProps = {\n chat?: ApiChat;\n user?: ApiUser;\n isFirstPhoto?: boolean;\n isSavedMessages?: boolean;\n photo?: ApiPhoto;\n lastSyncTime?: number;\n onClick: NoneToVoidFunction;\n};\n\nconst ProfilePhoto: FC<OwnProps> = ({\n chat,\n user,\n photo,\n isFirstPhoto,\n isSavedMessages,\n lastSyncTime,\n onClick,\n}) => {\n const lang = useLang();\n const isDeleted = user && isDeletedUser(user);\n const isRepliesChat = chat && isChatWithRepliesBot(chat.id);\n\n function getMediaHash(size: 'normal' | 'big', forceAvatar?: boolean) {\n if (photo && !forceAvatar) {\n return `photo${photo.id}?size=c`;\n }\n\n let hash: string | undefined;\n if (!isSavedMessages && !isDeleted && !isRepliesChat) {\n if (user) {\n hash = getChatAvatarHash(user, size);\n } else if (chat) {\n hash = getChatAvatarHash(chat, size);\n }\n }\n\n return hash;\n }\n\n const photoBlobUrl = useMedia(getMediaHash('big'), false, ApiMediaFormat.BlobUrl, lastSyncTime);\n const avatarMediaHash = isFirstPhoto && !photoBlobUrl ? getMediaHash('normal', true) : undefined;\n const avatarBlobUrl = useMedia(avatarMediaHash, false, ApiMediaFormat.BlobUrl, lastSyncTime);\n const thumbDataUri = useBlurSync(!photoBlobUrl && photo && photo.thumbnail && photo.thumbnail.dataUri);\n const imageSrc = photoBlobUrl || avatarBlobUrl || thumbDataUri;\n const prevImageSrc = usePrevious(imageSrc);\n\n let content: string | undefined = '';\n\n if (isSavedMessages) {\n content = <i className=\"icon-avatar-saved-messages\" />;\n } else if (isDeleted) {\n content = <i className=\"icon-avatar-deleted-account\" />;\n } else if (isRepliesChat) {\n content = <i className=\"icon-reply-filled\" />;\n } else if (imageSrc) {\n content = <img src={imageSrc} className=\"avatar-media\" alt=\"\" decoding=\"async\" />;\n } else if (!imageSrc && user) {\n const userFullName = getUserFullName(user);\n content = userFullName ? getFirstLetters(userFullName, 2) : undefined;\n } else if (!imageSrc && chat) {\n const title = getChatTitle(lang, chat);\n content = title && getFirstLetters(title, isUserId(chat.id) ? 2 : 1);\n } else {\n content = (\n <div className=\"spinner-wrapper\">\n <Spinner color=\"white\" />\n </div>\n );\n }\n\n const fullClassName = buildClassName(\n 'ProfilePhoto',\n `color-bg-${getUserColorKey(user || chat)}`,\n isSavedMessages && 'saved-messages',\n isDeleted && 'deleted-account',\n isRepliesChat && 'replies-bot-account',\n (!isSavedMessages && !(imageSrc)) && 'no-photo',\n );\n\n return (\n <div className={fullClassName} onClick={imageSrc ? onClick : undefined}>\n {prevImageSrc && imageSrc && prevImageSrc !== imageSrc && (\n <img src={prevImageSrc} className=\"prev-avatar-media\" alt=\"\" decoding=\"async\" />\n )}\n {typeof content === 'string' ? renderText(content, ['hq_emoji']) : content}\n </div>\n );\n};\n\nexport default memo(ProfilePhoto);\n","import React, {\n FC, useEffect, useCallback, memo, useState,\n} from '../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiUser, ApiChat, ApiUserStatus } from '../../api/types';\nimport { GlobalState } from '../../global/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport { selectChat, selectUser, selectUserStatus } from '../../modules/selectors';\nimport {\n getUserFullName, getUserStatus, isChatChannel, isUserOnline,\n} from '../../modules/helpers';\nimport renderText from './helpers/renderText';\nimport { captureEvents, SwipeDirection } from '../../util/captureEvents';\nimport buildClassName from '../../util/buildClassName';\nimport usePhotosPreload from './hooks/usePhotosPreload';\nimport useLang from '../../hooks/useLang';\n\nimport VerifiedIcon from './VerifiedIcon';\nimport ProfilePhoto from './ProfilePhoto';\nimport Transition from '../ui/Transition';\n\nimport './ProfileInfo.scss';\n\ntype OwnProps = {\n userId: string;\n forceShowSelf?: boolean;\n};\n\ntype StateProps =\n {\n user?: ApiUser;\n userStatus?: ApiUserStatus;\n chat?: ApiChat;\n isSavedMessages?: boolean;\n animationLevel: 0 | 1 | 2;\n serverTimeOffset: number;\n }\n & Pick<GlobalState, 'connectionState'>;\n\nconst ProfileInfo: FC<OwnProps & StateProps> = ({\n forceShowSelf,\n user,\n userStatus,\n chat,\n isSavedMessages,\n connectionState,\n animationLevel,\n serverTimeOffset,\n}) => {\n const {\n loadFullUser,\n openMediaViewer,\n } = getDispatch();\n\n const lang = useLang();\n\n const { id: userId } = user || {};\n const { id: chatId } = chat || {};\n const fullName = user ? getUserFullName(user) : (chat ? chat.title : '');\n const photos = user?.photos || chat?.photos || [];\n const slideAnimation = animationLevel >= 1\n ? (lang.isRtl ? 'slide-optimized-rtl' : 'slide-optimized')\n : 'none';\n\n const [currentPhotoIndex, setCurrentPhotoIndex] = useState(0);\n const isFirst = isSavedMessages || photos.length <= 1 || currentPhotoIndex === 0;\n const isLast = isSavedMessages || photos.length <= 1 || currentPhotoIndex === photos.length - 1;\n\n // Deleting the last profile photo may result in an error\n useEffect(() => {\n if (currentPhotoIndex > photos.length) {\n setCurrentPhotoIndex(Math.max(0, photos.length - 1));\n }\n }, [currentPhotoIndex, photos.length]);\n\n useEffect(() => {\n if (connectionState === 'connectionStateReady' && userId && !forceShowSelf) {\n loadFullUser({ userId });\n }\n }, [userId, loadFullUser, connectionState, forceShowSelf]);\n\n usePhotosPreload(user || chat, photos, currentPhotoIndex);\n\n const handleProfilePhotoClick = useCallback(() => {\n openMediaViewer({\n avatarOwnerId: userId || chatId,\n profilePhotoIndex: currentPhotoIndex,\n origin: forceShowSelf ? MediaViewerOrigin.SettingsAvatar : MediaViewerOrigin.ProfileAvatar,\n });\n }, [openMediaViewer, userId, chatId, currentPhotoIndex, forceShowSelf]);\n\n const selectPreviousMedia = useCallback(() => {\n if (isFirst) {\n return;\n }\n\n setCurrentPhotoIndex(currentPhotoIndex - 1);\n }, [currentPhotoIndex, isFirst]);\n\n const selectNextMedia = useCallback(() => {\n if (isLast) {\n return;\n }\n\n setCurrentPhotoIndex(currentPhotoIndex + 1);\n }, [currentPhotoIndex, isLast]);\n\n // Support for swipe gestures and closing on click\n useEffect(() => {\n const element = document.querySelector<HTMLDivElement>('.photo-wrapper');\n if (!element) {\n return undefined;\n }\n\n return captureEvents(element, {\n selectorToPreventScroll: '.Profile, .settings-content',\n onSwipe: IS_TOUCH_ENV ? (e, direction) => {\n if (direction === SwipeDirection.Right) {\n selectPreviousMedia();\n return true;\n } else if (direction === SwipeDirection.Left) {\n selectNextMedia();\n return true;\n }\n\n return false;\n } : undefined,\n });\n }, [selectNextMedia, selectPreviousMedia]);\n\n if (!user && !chat) {\n return undefined;\n }\n\n function renderPhotoTabs() {\n if (isSavedMessages || !photos || photos.length <= 1) {\n return undefined;\n }\n\n return (\n <div className=\"photo-dashes\">\n {photos.map((_, i) => (\n <span className={`photo-dash ${i === currentPhotoIndex ? 'current' : ''}`} />\n ))}\n </div>\n );\n }\n\n function renderPhoto() {\n const photo = !isSavedMessages && photos && photos.length > 0 ? photos[currentPhotoIndex] : undefined;\n\n return (\n <ProfilePhoto\n key={currentPhotoIndex}\n user={user}\n chat={chat}\n photo={photo}\n isSavedMessages={isSavedMessages}\n isFirstPhoto={isFirst}\n onClick={handleProfilePhotoClick}\n />\n );\n }\n\n function renderStatus() {\n if (user) {\n return (\n <div className={`status ${isUserOnline(user, userStatus) ? 'online' : ''}`}>\n <span className=\"user-status\" dir=\"auto\">{getUserStatus(lang, user, userStatus, serverTimeOffset)}</span>\n </div>\n );\n }\n\n return (\n <span className=\"status\" dir=\"auto\">{\n isChatChannel(chat!)\n ? lang('Subscribers', chat!.membersCount ?? 0, 'i')\n : lang('Members', chat!.membersCount ?? 0, 'i')\n }\n </span>\n );\n }\n\n const isVerifiedIconShown = (user || chat)?.isVerified;\n\n return (\n <div className={buildClassName('ProfileInfo', forceShowSelf && 'self')} dir={lang.isRtl ? 'rtl' : undefined}>\n <div className=\"photo-wrapper\">\n {renderPhotoTabs()}\n <Transition activeKey={currentPhotoIndex} name={slideAnimation} className=\"profile-slide-container\">\n {renderPhoto()}\n </Transition>\n\n {!isFirst && (\n <button\n type=\"button\"\n className=\"navigation prev\"\n aria-label={lang('AccDescrPrevious')}\n onClick={selectPreviousMedia}\n />\n )}\n {!isLast && (\n <button\n type=\"button\"\n className=\"navigation next\"\n aria-label={lang('Next')}\n onClick={selectNextMedia}\n />\n )}\n </div>\n\n <div className=\"info\" dir={lang.isRtl ? 'rtl' : 'auto'}>\n {isSavedMessages ? (\n <div className=\"title\">\n <h3 dir=\"auto\">{lang('SavedMessages')}</h3>\n </div>\n ) : (\n <div className=\"title\">\n <h3 dir=\"auto\">{fullName && renderText(fullName)}</h3>\n {isVerifiedIconShown && <VerifiedIcon />}\n </div>\n )}\n {!isSavedMessages && renderStatus()}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId, forceShowSelf }): StateProps => {\n const { connectionState, serverTimeOffset } = global;\n const user = selectUser(global, userId);\n const userStatus = selectUserStatus(global, userId);\n const chat = selectChat(global, userId);\n const isSavedMessages = !forceShowSelf && user && user.isSelf;\n const { animationLevel } = global.settings.byKey;\n\n return {\n connectionState,\n user,\n userStatus,\n chat,\n isSavedMessages,\n animationLevel,\n serverTimeOffset,\n };\n },\n)(ProfileInfo));\n","import {\n ApiChat, ApiMediaFormat, ApiPhoto, ApiUser,\n} from '../../../api/types';\nimport { useEffect } from '../../../lib/teact/teact';\nimport * as mediaLoader from '../../../util/mediaLoader';\n\nconst PHOTOS_TO_PRELOAD = 4;\n\nexport default function usePhotosPreload(\n profile: ApiUser | ApiChat | undefined,\n photos: ApiPhoto[],\n currentIndex: number,\n) {\n useEffect(() => {\n photos.slice(currentIndex, currentIndex + PHOTOS_TO_PRELOAD).forEach((photo) => {\n const mediaData = mediaLoader.getFromMemory(`photo${photo.id}?size=c`);\n if (!mediaData) {\n mediaLoader.fetch(`photo${photo.id}?size=c`, ApiMediaFormat.BlobUrl);\n }\n });\n }, [currentIndex, photos]);\n}\n","import { RefObject } from 'react';\nimport React, { FC, memo } from '../../lib/teact/teact';\nimport { getGlobal } from '../../lib/teact/teactn';\n\nimport { ApiMediaFormat } from '../../api/types';\n\nimport useMedia from '../../hooks/useMedia';\nimport buildClassName from '../../util/buildClassName';\n\nimport './ReactionStaticEmoji.scss';\n\ntype OwnProps = {\n reaction: string;\n ref?: RefObject<HTMLImageElement>;\n className?: string;\n};\n\nconst ReactionStaticEmoji: FC<OwnProps> = ({\n reaction,\n ref,\n className,\n}) => {\n const staticIconId = getGlobal().availableReactions?.find((l) => l.reaction === reaction)?.staticIcon?.id;\n const mediaData = useMedia(`document${staticIconId}`, !staticIconId, ApiMediaFormat.BlobUrl);\n\n return (\n <img\n className={buildClassName('ReactionStaticEmoji', className)}\n ref={ref}\n src={mediaData}\n alt=\"\"\n />\n );\n};\n\nexport default memo(ReactionStaticEmoji);\n","import { MouseEvent as ReactMouseEvent } from 'react';\nimport React, {\n FC, memo, useEffect, useRef,\n} from '../../lib/teact/teact';\n\nimport { ApiMediaFormat, ApiSticker } from '../../api/types';\n\nimport { useIsIntersecting, ObserveFn } from '../../hooks/useIntersectionObserver';\nimport useMedia from '../../hooks/useMedia';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useFlag from '../../hooks/useFlag';\nimport buildClassName from '../../util/buildClassName';\nimport { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur';\nimport safePlay from '../../util/safePlay';\nimport { IS_WEBM_SUPPORTED } from '../../util/environment';\n\nimport AnimatedSticker from './AnimatedSticker';\nimport Button from '../ui/Button';\n\nimport './StickerButton.scss';\n\ntype OwnProps = {\n sticker: ApiSticker;\n size: number;\n observeIntersection: ObserveFn;\n noAnimate?: boolean;\n title?: string;\n className?: string;\n onClick?: (arg: any) => void;\n clickArg?: any;\n onUnfaveClick?: (sticker: ApiSticker) => void;\n};\n\nconst StickerButton: FC<OwnProps> = ({\n sticker, size, observeIntersection, noAnimate, title, className, onClick, clickArg, onUnfaveClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const localMediaHash = `sticker${sticker.id}`;\n const stickerSelector = `sticker-button-${sticker.id}`;\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const thumbDataUri = sticker.thumbnail ? sticker.thumbnail.dataUri : undefined;\n const previewBlobUrl = useMedia(`${localMediaHash}?size=m`, !isIntersecting, ApiMediaFormat.BlobUrl);\n\n const shouldPlay = isIntersecting && !noAnimate;\n const lottieData = useMedia(sticker.isLottie && localMediaHash, !shouldPlay, ApiMediaFormat.Lottie);\n const [isLottieLoaded, markLoaded, unmarkLoaded] = useFlag(Boolean(lottieData));\n const canLottiePlay = isLottieLoaded && shouldPlay;\n const isGif = sticker.isGif && IS_WEBM_SUPPORTED;\n const gifBlobUrl = useMedia(isGif && localMediaHash, !shouldPlay, ApiMediaFormat.BlobUrl);\n const canGifPlay = Boolean(isGif && gifBlobUrl && shouldPlay);\n\n const { transitionClassNames: previewTransitionClassNames } = useShowTransition(\n Boolean(previewBlobUrl || canLottiePlay),\n undefined,\n undefined,\n 'slow',\n );\n\n // To avoid flickering\n useEffect(() => {\n if (!shouldPlay) {\n unmarkLoaded();\n }\n }, [unmarkLoaded, shouldPlay]);\n\n useEffect(() => {\n if (!isGif || !ref.current) return;\n const video = ref.current.querySelector('video');\n if (!video) return;\n if (canGifPlay) {\n safePlay(video);\n } else {\n video.pause();\n }\n }, [isGif, canGifPlay]);\n\n function handleClick() {\n if (onClick) {\n onClick(clickArg);\n }\n }\n\n function handleUnfaveClick(e: ReactMouseEvent<HTMLButtonElement, MouseEvent>) {\n e.stopPropagation();\n e.preventDefault();\n\n onUnfaveClick!(sticker);\n }\n\n const fullClassName = buildClassName(\n 'StickerButton',\n onClick && 'interactive',\n stickerSelector,\n className,\n );\n\n const style = (thumbDataUri && !canLottiePlay && !canGifPlay) ? `background-image: url('${thumbDataUri}');` : '';\n\n return (\n <div\n ref={ref}\n className={fullClassName}\n title={title || (sticker?.emoji)}\n style={style}\n data-sticker-id={sticker.id}\n onMouseDown={preventMessageInputBlurWithBubbling}\n onClick={handleClick}\n >\n {!canLottiePlay && !canGifPlay && (\n // eslint-disable-next-line jsx-a11y/alt-text\n <img src={previewBlobUrl} className={previewTransitionClassNames} />\n )}\n {isGif && (\n <video\n className={previewTransitionClassNames}\n src={gifBlobUrl}\n autoPlay={canGifPlay}\n loop\n playsInline\n muted\n />\n )}\n {shouldPlay && lottieData && (\n <AnimatedSticker\n id={localMediaHash}\n animationData={lottieData}\n play\n size={size}\n isLowPriority\n onLoad={markLoaded}\n />\n )}\n {onUnfaveClick && (\n <Button\n className=\"sticker-unfave-button\"\n color=\"dark\"\n round\n onClick={handleUnfaveClick}\n >\n <i className=\"icon-close\" />\n </Button>\n )}\n </div>\n );\n};\n\nexport default memo(StickerButton);\n","import React, { FC, memo } from '../../lib/teact/teact';\nimport { OwnProps } from './StickerSetModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst StickerSetModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const StickerSetModal = useModuleLoader(Bundles.Extra, 'StickerSetModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return StickerSetModal ? <StickerSetModal {...props} /> : undefined;\n};\n\nexport default memo(StickerSetModalAsync);\n","import React, { FC, memo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../lib/teact/teactn';\n\nimport { ApiUser, ApiTypingStatus } from '../../api/types';\n\nimport { selectUser } from '../../modules/selectors';\nimport { getUserFirstOrLastName } from '../../modules/helpers';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport DotAnimation from './DotAnimation';\n\nimport './TypingStatus.scss';\n\ntype OwnProps = {\n typingStatus: ApiTypingStatus;\n};\n\ntype StateProps = {\n typingUser?: ApiUser;\n};\n\nconst TypingStatus: FC<OwnProps & StateProps> = ({ typingStatus, typingUser }) => {\n const lang = useLang();\n const typingUserName = typingUser && !typingUser.isSelf && getUserFirstOrLastName(typingUser);\n const content = lang(typingStatus.action)\n // Fix for translation \"{user} is typing\"\n .replace('{user}', '')\n .replace('{emoji}', typingStatus.emoji).trim();\n\n return (\n <p className=\"typing-status\" dir={lang.isRtl ? 'rtl' : 'auto'}>\n {typingUserName && (\n <span className=\"sender-name\" dir=\"auto\">{renderText(typingUserName)}</span>\n )}\n <DotAnimation content={content} />\n </p>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { typingStatus }): StateProps => {\n if (!typingStatus.userId) {\n return {};\n }\n\n const typingUser = selectUser(global, typingStatus.userId);\n\n return { typingUser };\n },\n)(TypingStatus));\n","import React, { FC } from '../../lib/teact/teact';\n\nimport './VerifiedIcon.scss';\n\nconst VerifiedIcon: FC = () => {\n return (\n <span className=\"VerifiedIcon\" />\n );\n};\n\nexport default VerifiedIcon;\n","import React, { FC, memo, useCallback } from '../../lib/teact/teact';\n\nimport { ApiMessage, ApiWebPage } from '../../api/types';\nimport { ObserveFn } from '../../hooks/useIntersectionObserver';\n\nimport {\n getFirstLinkInMessage, getMessageText,\n getMessageWebPage,\n} from '../../modules/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport trimText from '../../util/trimText';\nimport renderText from './helpers/renderText';\nimport { formatPastTimeShort } from '../../util/dateFormat';\nimport useLang from '../../hooks/useLang';\nimport { renderMessageSummary, TextPart } from './helpers/renderMessageText';\n\nimport Media from './Media';\nimport Link from '../ui/Link';\nimport SafeLink from './SafeLink';\n\nimport './WebLink.scss';\n\nconst MAX_TEXT_LENGTH = 170; // symbols\n\ntype OwnProps = {\n message: ApiMessage;\n senderTitle?: string;\n isProtected?: boolean;\n observeIntersection?: ObserveFn;\n onMessageClick: (messageId: number, chatId: string) => void;\n};\n\ntype ApiWebPageWithFormatted =\n ApiWebPage\n & { formattedDescription?: TextPart[] };\n\nconst WebLink: FC<OwnProps> = ({\n message, senderTitle, isProtected, observeIntersection, onMessageClick,\n}) => {\n const lang = useLang();\n\n let linkData: ApiWebPageWithFormatted | undefined = getMessageWebPage(message);\n\n if (!linkData) {\n const link = getFirstLinkInMessage(message);\n if (link) {\n const { url, domain } = link;\n\n linkData = {\n siteName: domain.replace(/^www./, ''),\n url: url.includes('://') ? url : url.includes('@') ? `mailto:${url}` : `http://${url}`,\n formattedDescription: getMessageText(message) !== url\n ? renderMessageSummary(lang, message, undefined, undefined, MAX_TEXT_LENGTH)\n : undefined,\n } as ApiWebPageWithFormatted;\n }\n }\n\n const handleMessageClick = useCallback(() => {\n onMessageClick(message.id, message.chatId);\n }, [onMessageClick, message.id, message.chatId]);\n\n if (!linkData) {\n return undefined;\n }\n\n const {\n siteName,\n url,\n displayUrl,\n title,\n description,\n formattedDescription,\n photo,\n video,\n } = linkData;\n\n const truncatedDescription = !senderTitle && description && trimText(description, MAX_TEXT_LENGTH);\n\n const className = buildClassName(\n 'WebLink scroll-item',\n (!photo && !video) && 'without-media',\n );\n\n return (\n <div\n className={className}\n data-initial={(siteName || displayUrl)[0]}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n {photo && (\n <Media message={message} isProtected={isProtected} observeIntersection={observeIntersection} />\n )}\n <div className=\"content\">\n <Link isRtl={lang.isRtl} className=\"site-title\" onClick={handleMessageClick}>\n {renderText(title || siteName || displayUrl)}\n </Link>\n {(truncatedDescription || formattedDescription) && (\n <Link isRtl={lang.isRtl} className=\"site-description\" onClick={handleMessageClick}>\n {formattedDescription || (truncatedDescription && renderText(truncatedDescription))}\n </Link>\n )}\n <SafeLink\n url={url}\n className=\"site-name\"\n text=\"\"\n isRtl={lang.isRtl}\n >\n {url.replace('mailto:', '') || displayUrl}\n </SafeLink>\n {senderTitle && <div className=\"sender-name\">{renderText(senderTitle)}</div>}\n </div>\n {senderTitle && (\n <div className=\"message-date\">\n <Link\n className=\"date\"\n onClick={handleMessageClick}\n isRtl={lang.isRtl}\n >\n {formatPastTimeShort(lang, message.date * 1000)}\n </Link>\n </div>\n )}\n </div>\n );\n};\n\nexport default memo(WebLink);\n","import {\n ApiPhoto, ApiVideo, ApiSticker, ApiDimensions,\n} from '../../../api/types';\n\nimport { STICKER_SIZE_INLINE_DESKTOP_FACTOR, STICKER_SIZE_INLINE_MOBILE_FACTOR } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport windowSize from '../../../util/windowSize';\nimport { getPhotoInlineDimensions, getVideoDimensions } from '../../../modules/helpers';\n\nexport const MEDIA_VIEWER_MEDIA_QUERY = '(max-height: 640px)';\nexport const REM = parseInt(getComputedStyle(document.documentElement).fontSize, 10);\nexport const ROUND_VIDEO_DIMENSIONS_PX = 240;\nexport const GIF_MIN_WIDTH = 300;\nexport const AVATAR_FULL_DIMENSIONS = { width: 640, height: 640 };\nexport const LIKE_STICKER_ID = '4986041492570112461';\n\nconst DEFAULT_MEDIA_DIMENSIONS: ApiDimensions = { width: 100, height: 100 };\nconst MOBILE_SCREEN_NO_AVATARS_MESSAGE_EXTRA_WIDTH_REM = 4.5;\nconst MOBILE_SCREEN_MESSAGE_EXTRA_WIDTH_REM = 7;\nconst MESSAGE_MAX_WIDTH_REM = 29;\nconst MESSAGE_OWN_MAX_WIDTH_REM = 30;\n\nlet cachedMaxWidthOwn: number | undefined;\nlet cachedMaxWidth: number | undefined;\nlet cachedMaxWidthNoAvatar: number | undefined;\n\nfunction getMaxMessageWidthRem(fromOwnMessage: boolean, noAvatars?: boolean) {\n const regularMaxWidth = fromOwnMessage ? MESSAGE_OWN_MAX_WIDTH_REM : MESSAGE_MAX_WIDTH_REM;\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n return regularMaxWidth;\n }\n\n const { width: windowWidth } = windowSize.get();\n\n // @optimization Limitation: changing device screen width not supported\n if (!cachedMaxWidthOwn) {\n cachedMaxWidthOwn = Math.min(\n MESSAGE_OWN_MAX_WIDTH_REM,\n windowWidth / REM - MOBILE_SCREEN_NO_AVATARS_MESSAGE_EXTRA_WIDTH_REM,\n );\n }\n if (!cachedMaxWidth) {\n cachedMaxWidth = Math.min(\n MESSAGE_MAX_WIDTH_REM,\n windowWidth / REM - MOBILE_SCREEN_MESSAGE_EXTRA_WIDTH_REM,\n );\n }\n if (!cachedMaxWidthNoAvatar) {\n cachedMaxWidthNoAvatar = Math.min(\n MESSAGE_MAX_WIDTH_REM,\n windowWidth / REM - MOBILE_SCREEN_NO_AVATARS_MESSAGE_EXTRA_WIDTH_REM,\n );\n }\n\n return fromOwnMessage\n ? cachedMaxWidthOwn\n : (noAvatars ? cachedMaxWidthNoAvatar : cachedMaxWidth);\n}\n\nexport function getAvailableWidth(\n fromOwnMessage: boolean,\n isForwarded?: boolean,\n isWebPagePhoto?: boolean,\n noAvatars?: boolean,\n) {\n const extraPaddingRem = isForwarded || isWebPagePhoto ? 1.625 : 0;\n const availableWidthRem = getMaxMessageWidthRem(fromOwnMessage, noAvatars) - extraPaddingRem;\n\n return availableWidthRem * REM;\n}\n\nfunction getAvailableHeight(isGif?: boolean, aspectRatio?: number) {\n if (\n isGif && aspectRatio\n && aspectRatio >= 0.75 && aspectRatio <= 1.25\n ) {\n return 20 * REM;\n }\n\n return 27 * REM;\n}\n\nfunction calculateDimensionsForMessageMedia({\n width,\n height,\n fromOwnMessage,\n isForwarded,\n isWebPagePhoto,\n isGif,\n noAvatars,\n}: {\n width: number;\n height: number;\n fromOwnMessage: boolean;\n isForwarded?: boolean;\n isWebPagePhoto?: boolean;\n isGif?: boolean;\n noAvatars?: boolean;\n}): ApiDimensions {\n const aspectRatio = height / width;\n const availableWidth = getAvailableWidth(fromOwnMessage, isForwarded, isWebPagePhoto, noAvatars);\n const availableHeight = getAvailableHeight(isGif, aspectRatio);\n const mediaWidth = isGif ? Math.max(GIF_MIN_WIDTH, width) : width;\n const mediaHeight = isGif ? height * (mediaWidth / width) : height;\n\n return calculateDimensions(availableWidth, availableHeight, mediaWidth, mediaHeight);\n}\n\nexport function getMediaViewerAvailableDimensions(withFooter: boolean, isVideo: boolean): ApiDimensions {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n const { width: windowWidth, height: windowHeight } = windowSize.get();\n let occupiedHeightRem = isVideo && mql.matches ? 10 : 8.25;\n if (withFooter && !IS_TOUCH_ENV) {\n occupiedHeightRem = mql.matches ? 10 : 12.5;\n }\n return {\n width: windowWidth,\n height: windowHeight - occupiedHeightRem * REM,\n };\n}\n\nexport function calculateInlineImageDimensions(\n photo: ApiPhoto,\n fromOwnMessage: boolean,\n isForwarded?: boolean,\n isWebPagePhoto?: boolean,\n noAvatars?: boolean,\n) {\n const { width, height } = getPhotoInlineDimensions(photo) || DEFAULT_MEDIA_DIMENSIONS;\n\n return calculateDimensionsForMessageMedia({\n width,\n height,\n fromOwnMessage,\n isForwarded,\n isWebPagePhoto,\n noAvatars,\n });\n}\n\nexport function calculateVideoDimensions(\n video: ApiVideo,\n fromOwnMessage: boolean,\n isForwarded?: boolean,\n noAvatars?: boolean,\n) {\n const { width, height } = getVideoDimensions(video) || DEFAULT_MEDIA_DIMENSIONS;\n\n return calculateDimensionsForMessageMedia({\n width,\n height,\n fromOwnMessage,\n isForwarded,\n isGif: video.isGif,\n noAvatars,\n });\n}\n\nexport function getPictogramDimensions(): ApiDimensions {\n return {\n width: 2 * REM,\n height: 2 * REM,\n };\n}\n\nexport function getDocumentThumbnailDimensions(smaller?: boolean): ApiDimensions {\n if (smaller) {\n return {\n width: 3 * REM,\n height: 3 * REM,\n };\n }\n\n return {\n width: 3.375 * REM,\n height: 3.375 * REM,\n };\n}\n\nexport function getStickerDimensions(sticker: ApiSticker): ApiDimensions {\n const { width } = sticker;\n let { height } = sticker;\n\n // For some reason this sticker has some weird `height` value\n if (sticker.id === LIKE_STICKER_ID) {\n height = width;\n }\n\n const aspectRatio = (height && width) && height / width;\n const baseWidth = REM * (\n IS_SINGLE_COLUMN_LAYOUT\n ? STICKER_SIZE_INLINE_MOBILE_FACTOR\n : STICKER_SIZE_INLINE_DESKTOP_FACTOR\n );\n const calculatedHeight = aspectRatio ? baseWidth * aspectRatio : baseWidth;\n\n if (aspectRatio && calculatedHeight > baseWidth) {\n return {\n width: Math.round(baseWidth / aspectRatio),\n height: baseWidth,\n };\n }\n\n return {\n width: baseWidth,\n height: calculatedHeight,\n };\n}\n\nexport function calculateMediaViewerDimensions(\n { width, height }: ApiDimensions, withFooter: boolean, isVideo: boolean = false,\n): ApiDimensions {\n const { width: availableWidth, height: availableHeight } = getMediaViewerAvailableDimensions(withFooter, isVideo);\n\n return calculateDimensions(availableWidth, availableHeight, width, height);\n}\n\nexport function calculateDimensions(\n availableWidth: number,\n availableHeight: number,\n mediaWidth: number,\n mediaHeight: number,\n): ApiDimensions {\n const aspectRatio = mediaHeight / mediaWidth;\n const calculatedWidth = Math.min(mediaWidth, availableWidth);\n const calculatedHeight = Math.round(calculatedWidth * aspectRatio);\n\n if (calculatedHeight > availableHeight) {\n return {\n width: Math.round(availableHeight / aspectRatio),\n height: availableHeight,\n };\n }\n\n return {\n width: calculatedWidth,\n height: Math.round(calculatedWidth * aspectRatio),\n };\n}\n","import {\n useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\nimport safePlay from '../../../util/safePlay';\nimport { getDispatch } from '../../../lib/teact/teactn';\nimport useMedia from '../../../hooks/useMedia';\nimport { ActiveEmojiInteraction } from '../../../global/types';\nimport useFlag from '../../../hooks/useFlag';\nimport { selectLocalAnimatedEmojiEffectByName } from '../../../modules/selectors';\n\nconst WIDTH = {\n large: 160,\n medium: 128,\n small: 104,\n};\nconst INTERACTION_BUNCH_TIME = 1000;\nconst MS_DIVIDER = 1000;\nconst TIME_DEFAULT = 0;\n\nexport default function useAnimatedEmoji(\n size: 'large' | 'medium' | 'small',\n chatId?: string,\n messageId?: number,\n soundId?: string,\n activeEmojiInteractions?: ActiveEmojiInteraction[],\n isOwn?: boolean,\n localEffect?: string,\n emoji?: string,\n) {\n const {\n interactWithAnimatedEmoji, sendEmojiInteraction, sendWatchingEmojiInteraction,\n } = getDispatch();\n\n const hasEffect = localEffect || emoji;\n const [isAnimationLoaded, markAnimationLoaded] = useFlag();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line no-null/no-null\n const audioRef = useRef<HTMLAudioElement | undefined>(null);\n\n const soundMediaData = useMedia(soundId ? `document${soundId}` : undefined, !soundId);\n\n const width = WIDTH[size];\n const style = `width: ${width}px; height: ${width}px;`;\n\n const [playKey, setPlayKey] = useState(String(Math.random()));\n const interactions = useRef<number[] | undefined>(undefined);\n const startedInteractions = useRef<number | undefined>(undefined);\n const sendInteractionBunch = useCallback(() => {\n const container = ref.current;\n\n if (!container) return;\n\n sendEmojiInteraction({\n chatId,\n messageId,\n localEffect,\n emoji,\n interactions: interactions.current,\n });\n startedInteractions.current = undefined;\n interactions.current = undefined;\n }, [sendEmojiInteraction, chatId, messageId, localEffect, emoji]);\n\n const play = useCallback(() => {\n setPlayKey(String(Math.random()));\n\n const audio = audioRef.current;\n if (soundMediaData) {\n if (audio) {\n audio.pause();\n audio.remove();\n }\n audioRef.current = new Audio();\n audioRef.current.src = soundMediaData;\n safePlay(audioRef.current);\n audioRef.current.addEventListener('ended', () => {\n audioRef.current = undefined;\n }, { once: true });\n }\n }, [soundMediaData]);\n\n const handleClick = useCallback(() => {\n play();\n\n const container = ref.current;\n\n if (!hasEffect || !container || !messageId || !chatId) {\n return;\n }\n\n const { x, y } = container.getBoundingClientRect();\n\n interactWithAnimatedEmoji({\n localEffect,\n emoji,\n x,\n y,\n startSize: width,\n isReversed: !isOwn,\n });\n\n if (!interactions.current) {\n interactions.current = [];\n startedInteractions.current = performance.now();\n setTimeout(sendInteractionBunch, INTERACTION_BUNCH_TIME);\n }\n\n interactions.current.push(startedInteractions.current\n ? (performance.now() - startedInteractions.current) / MS_DIVIDER\n : TIME_DEFAULT);\n }, [\n chatId, emoji, hasEffect, interactWithAnimatedEmoji, isOwn,\n localEffect, messageId, play, sendInteractionBunch, width,\n ]);\n\n // Set an end anchor for remote activated interaction\n useEffect(() => {\n const container = ref.current;\n\n if (!container || !activeEmojiInteractions) return;\n\n activeEmojiInteractions.forEach(({\n id,\n startSize,\n messageId: interactionMessageId,\n }) => {\n if (startSize || messageId !== interactionMessageId) {\n return;\n }\n\n const { x, y } = container.getBoundingClientRect();\n\n sendWatchingEmojiInteraction({\n id,\n chatId,\n emoticon: localEffect ? selectLocalAnimatedEmojiEffectByName(localEffect) : emoji,\n startSize: width,\n x,\n y,\n isReversed: !isOwn,\n });\n play();\n });\n }, [\n activeEmojiInteractions, chatId, emoji, isOwn, localEffect, messageId, play, sendWatchingEmojiInteraction, width,\n ]);\n\n return {\n playKey,\n ref,\n style,\n width,\n handleClick,\n markAnimationLoaded,\n isAnimationLoaded,\n };\n}\n","import React, { FC, memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\nimport { OwnProps } from './ChatFolderModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst ChatFolderModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const ChatFolderModal = useModuleLoader(Bundles.Extra, 'ChatFolderModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ChatFolderModal ? <ChatFolderModal {...props} /> : undefined;\n};\n\nexport default memo(ChatFolderModalAsync);\n","import { useMemo } from '../../../../lib/teact/teact';\n\nexport enum ChatAnimationTypes {\n Move,\n Opacity,\n None,\n}\n\nexport function useChatAnimationType(orderDiffById: Record<string, number>) {\n return useMemo(() => {\n const orderDiffs = Object.values(orderDiffById);\n const numberOfUp = orderDiffs.filter((diff) => diff < 0).length;\n const numberOfDown = orderDiffs.filter((diff) => diff > 0).length;\n\n return (chatId: string): ChatAnimationTypes => {\n const orderDiff = orderDiffById[chatId];\n if (orderDiff === 0) {\n return ChatAnimationTypes.None;\n }\n\n if (\n orderDiff === Infinity\n || orderDiff === -Infinity\n || (numberOfUp <= numberOfDown && orderDiff < 0)\n || (numberOfDown < numberOfUp && orderDiff > 0)\n ) {\n return ChatAnimationTypes.Opacity;\n }\n\n return ChatAnimationTypes.Move;\n };\n }, [orderDiffById]);\n}\n","import React, { FC, memo } from '../../../lib/teact/teact';\n\nimport { ApiChat } from '../../../api/types';\n\nimport { formatIntegerCompact } from '../../../util/textFormat';\nimport buildClassName from '../../../util/buildClassName';\n\nimport ShowTransition from '../../ui/ShowTransition';\n\nimport './Badge.scss';\n\ntype OwnProps = {\n chat: ApiChat;\n isPinned?: boolean;\n isMuted?: boolean;\n};\n\nconst Badge: FC<OwnProps> = ({ chat, isPinned, isMuted }) => {\n const isShown = Boolean(chat.unreadCount || chat.hasUnreadMark || isPinned);\n const className = buildClassName(\n 'Badge',\n isMuted && 'muted',\n isPinned && 'pinned',\n Boolean(chat.unreadCount || chat.hasUnreadMark) && 'unread',\n );\n\n function renderContent() {\n if (chat.unreadCount) {\n if (chat.unreadMentionsCount) {\n return (\n <div className=\"Badge-wrapper\">\n <div className=\"Badge mention\">\n <i className=\"icon-mention\" />\n </div>\n <div className={className}>\n {formatIntegerCompact(chat.unreadCount)}\n </div>\n </div>\n );\n }\n\n return (\n <div className={className}>\n {formatIntegerCompact(chat.unreadCount)}\n </div>\n );\n } else if (chat.hasUnreadMark) {\n return (\n <div className={className} />\n );\n } else if (isPinned) {\n return (\n <div className={className}>\n <i className=\"icon-pinned-chat\" />\n </div>\n );\n }\n\n return undefined;\n }\n\n return (\n <ShowTransition isCustom className=\"Badge-transition\" isOpen={isShown}>\n {renderContent()}\n </ShowTransition>\n );\n};\n\nexport default memo(Badge);\n","import React, { FC, memo } from '../../../lib/teact/teact';\nimport buildClassName from '../../../util/buildClassName';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\n\nimport './ChatCallStatus.scss';\n\ntype OwnProps = {\n isSelected?: boolean;\n isActive?: boolean;\n};\n\nconst ChatCallStatus: FC<OwnProps> = ({\n isSelected,\n isActive,\n}) => {\n return (\n <div className={buildClassName(\n 'ChatCallStatus',\n isActive && 'active',\n isSelected && !IS_SINGLE_COLUMN_LAYOUT && 'selected',\n )}\n >\n <div className=\"indicator\">\n <div />\n <div />\n <div />\n </div>\n </div>\n );\n};\n\nexport default memo(ChatCallStatus);\n","import React, {\n FC, memo, useCallback, useLayoutEffect, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn';\n\nimport useLang, { LangFn } from '../../../hooks/useLang';\n\nimport {\n ApiChat, ApiUser, ApiMessage, ApiMessageOutgoingStatus, ApiFormattedText, MAIN_THREAD_ID, ApiUserStatus,\n} from '../../../api/types';\n\nimport { ANIMATION_END_DELAY } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport {\n getChatTitle,\n isUserId,\n isActionMessage,\n getPrivateChatUserId,\n getMessageAction,\n getMessageSenderName,\n isChatChannel,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessageVideo,\n getMessageSticker,\n selectIsChatMuted,\n getMessageRoundVideo,\n} from '../../../modules/helpers';\nimport {\n selectChat, selectUser, selectChatMessage, selectOutgoingStatus, selectDraft, selectCurrentMessageList,\n selectNotifySettings, selectNotifyExceptions, selectUserStatus,\n} from '../../../modules/selectors';\nimport { renderActionMessageText } from '../../common/helpers/renderActionMessageText';\nimport renderText from '../../common/helpers/renderText';\nimport { fastRaf } from '../../../util/schedulers';\nimport buildClassName from '../../../util/buildClassName';\nimport useEnsureMessage from '../../../hooks/useEnsureMessage';\nimport useChatContextActions from '../../../hooks/useChatContextActions';\nimport useFlag from '../../../hooks/useFlag';\nimport useMedia from '../../../hooks/useMedia';\nimport { ChatAnimationTypes } from './hooks';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport Avatar from '../../common/Avatar';\nimport VerifiedIcon from '../../common/VerifiedIcon';\nimport TypingStatus from '../../common/TypingStatus';\nimport LastMessageMeta from '../../common/LastMessageMeta';\nimport DeleteChatModal from '../../common/DeleteChatModal';\nimport ListItem from '../../ui/ListItem';\nimport Badge from './Badge';\nimport ChatFolderModal from '../ChatFolderModal.async';\nimport ChatCallStatus from './ChatCallStatus';\n\nimport './Chat.scss';\n\ntype OwnProps = {\n style?: string;\n chatId: string;\n folderId?: number;\n orderDiff: number;\n animationType: ChatAnimationTypes;\n isPinned?: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n isMuted?: boolean;\n user?: ApiUser;\n userStatus?: ApiUserStatus;\n actionTargetUserIds?: string[];\n actionTargetMessage?: ApiMessage;\n actionTargetChatId?: string;\n lastMessageSender?: ApiUser;\n lastMessageOutgoingStatus?: ApiMessageOutgoingStatus;\n draft?: ApiFormattedText;\n animationLevel?: number;\n isSelected?: boolean;\n canScrollDown?: boolean;\n canChangeFolder?: boolean;\n lastSyncTime?: number;\n};\n\nconst ANIMATION_DURATION = 200;\n\nconst Chat: FC<OwnProps & StateProps> = ({\n style,\n chatId,\n folderId,\n orderDiff,\n animationType,\n isPinned,\n chat,\n isMuted,\n user,\n userStatus,\n actionTargetUserIds,\n lastMessageSender,\n lastMessageOutgoingStatus,\n actionTargetMessage,\n actionTargetChatId,\n draft,\n animationLevel,\n isSelected,\n canScrollDown,\n canChangeFolder,\n lastSyncTime,\n}) => {\n const {\n openChat,\n focusLastMessage,\n } = getDispatch();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isChatFolderModalOpen, openChatFolderModal, closeChatFolderModal] = useFlag();\n const [shouldRenderDeleteModal, markRenderDeleteModal, unmarkRenderDeleteModal] = useFlag();\n const [shouldRenderChatFolderModal, markRenderChatFolderModal, unmarkRenderChatFolderModal] = useFlag();\n\n const { lastMessage, typingStatus } = chat || {};\n const isAction = lastMessage && isActionMessage(lastMessage);\n\n useEnsureMessage(chatId, isAction ? lastMessage!.replyToMessageId : undefined, actionTargetMessage);\n\n const mediaThumbnail = lastMessage && !getMessageSticker(lastMessage)\n ? getMessageMediaThumbDataUri(lastMessage)\n : undefined;\n const mediaBlobUrl = useMedia(lastMessage ? getMessageMediaHash(lastMessage, 'micro') : undefined);\n const isRoundVideo = Boolean(lastMessage && getMessageRoundVideo(lastMessage));\n\n const actionTargetUsers = useMemo(() => {\n if (!actionTargetUserIds) {\n return undefined;\n }\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n return actionTargetUserIds.map((userId) => usersById[userId]).filter<ApiUser>(Boolean as any);\n }, [actionTargetUserIds]);\n\n // Sets animation excess values when `orderDiff` changes and then resets excess values to animate.\n useLayoutEffect(() => {\n const element = ref.current;\n\n if (animationLevel === 0 || !element) {\n return;\n }\n\n // TODO Refactor animation: create `useListAnimation` that owns `orderDiff` and `animationType`\n if (animationType === ChatAnimationTypes.Opacity) {\n element.style.opacity = '0';\n\n fastRaf(() => {\n element.classList.add('animate-opacity');\n element.style.opacity = '1';\n });\n } else if (animationType === ChatAnimationTypes.Move) {\n element.style.transform = `translate3d(0, ${-orderDiff * 100}%, 0)`;\n\n fastRaf(() => {\n element.classList.add('animate-transform');\n element.style.transform = '';\n });\n } else {\n return;\n }\n\n setTimeout(() => {\n fastRaf(() => {\n element.classList.remove('animate-opacity', 'animate-transform');\n element.style.opacity = '';\n element.style.transform = '';\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n }, [animationLevel, orderDiff, animationType]);\n\n const handleClick = useCallback(() => {\n openChat({ id: chatId, shouldReplaceHistory: true });\n\n if (isSelected && canScrollDown) {\n focusLastMessage();\n }\n }, [\n isSelected,\n canScrollDown,\n openChat,\n chatId,\n focusLastMessage,\n ]);\n\n function handleDelete() {\n markRenderDeleteModal();\n openDeleteModal();\n }\n\n function handleChatFolderChange() {\n markRenderChatFolderModal();\n openChatFolderModal();\n }\n\n const contextActions = useChatContextActions({\n chat,\n user,\n handleDelete,\n handleChatFolderChange,\n folderId,\n isPinned,\n isMuted,\n canChangeFolder,\n });\n\n const lang = useLang();\n\n if (!chat) {\n return undefined;\n }\n\n function renderLastMessageOrTyping() {\n if (typingStatus && lastMessage && typingStatus.timestamp > lastMessage.date * 1000) {\n return <TypingStatus typingStatus={typingStatus} />;\n }\n\n if (draft?.text.length) {\n return (\n <p className=\"last-message\" dir={lang.isRtl ? 'auto' : 'ltr'}>\n <span className=\"draft\">{lang('Draft')}</span>\n {renderText(draft.text)}\n </p>\n );\n }\n\n if (!lastMessage) {\n return undefined;\n }\n\n if (isAction) {\n const isChat = chat && (isChatChannel(chat) || lastMessage.senderId === lastMessage.chatId);\n\n return (\n <p className=\"last-message\" dir={lang.isRtl ? 'auto' : 'ltr'}>\n {renderActionMessageText(\n lang,\n lastMessage,\n !isChat ? lastMessageSender : undefined,\n isChat ? chat : undefined,\n actionTargetUsers,\n actionTargetMessage,\n actionTargetChatId,\n { asTextWithSpoilers: true },\n )}\n </p>\n );\n }\n\n const senderName = getMessageSenderName(lang, chatId, lastMessageSender);\n\n return (\n <p className=\"last-message\" dir={lang.isRtl ? 'auto' : 'ltr'}>\n {senderName && (\n <>\n <span className=\"sender-name\">{renderText(senderName)}</span>\n <span className=\"colon\">:</span>\n </>\n )}\n {renderSummary(lang, lastMessage!, mediaBlobUrl || mediaThumbnail, isRoundVideo)}\n </p>\n );\n }\n\n const className = buildClassName(\n 'Chat chat-item-clickable',\n isUserId(chatId) ? 'private' : 'group',\n isSelected && 'selected',\n );\n\n return (\n <ListItem\n ref={ref}\n className={className}\n style={style}\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n contextActions={contextActions}\n onClick={handleClick}\n >\n <div className=\"status\">\n <Avatar\n chat={chat}\n user={user}\n userStatus={userStatus}\n isSavedMessages={user?.isSelf}\n lastSyncTime={lastSyncTime}\n />\n {chat.isCallActive && chat.isCallNotEmpty && (\n <ChatCallStatus isSelected={isSelected} isActive={animationLevel !== 0} />\n )}\n </div>\n <div className=\"info\">\n <div className=\"title\">\n <h3>{renderText(getChatTitle(lang, chat, user))}</h3>\n {chat.isVerified && <VerifiedIcon />}\n {isMuted && <i className=\"icon-muted\" />}\n {chat.lastMessage && (\n <LastMessageMeta\n message={chat.lastMessage}\n outgoingStatus={lastMessageOutgoingStatus}\n />\n )}\n </div>\n <div className=\"subtitle\">\n {renderLastMessageOrTyping()}\n <Badge chat={chat} isPinned={isPinned} isMuted={isMuted} />\n </div>\n </div>\n {shouldRenderDeleteModal && (\n <DeleteChatModal\n isOpen={isDeleteModalOpen}\n onClose={closeDeleteModal}\n onCloseAnimationEnd={unmarkRenderDeleteModal}\n chat={chat}\n />\n )}\n {shouldRenderChatFolderModal && (\n <ChatFolderModal\n isOpen={isChatFolderModalOpen}\n onClose={closeChatFolderModal}\n onCloseAnimationEnd={unmarkRenderChatFolderModal}\n chatId={chatId}\n />\n )}\n </ListItem>\n );\n};\n\nfunction renderSummary(lang: LangFn, message: ApiMessage, blobUrl?: string, isRoundVideo?: boolean) {\n if (!blobUrl) {\n return renderMessageSummary(lang, message);\n }\n\n return (\n <span className=\"media-preview\">\n <img src={blobUrl} alt=\"\" className={isRoundVideo ? 'round' : undefined} />\n {getMessageVideo(message) && <i className=\"icon-play\" />}\n {renderMessageSummary(lang, message, true)}\n </span>\n );\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n if (!chat || !chat.lastMessage) {\n return {};\n }\n\n const { senderId, replyToMessageId, isOutgoing } = chat.lastMessage;\n const lastMessageSender = senderId ? selectUser(global, senderId) : undefined;\n const lastMessageAction = getMessageAction(chat.lastMessage);\n const actionTargetMessage = lastMessageAction && replyToMessageId\n ? selectChatMessage(global, chat.id, replyToMessageId)\n : undefined;\n const { targetUserIds: actionTargetUserIds, targetChatId: actionTargetChatId } = lastMessageAction || {};\n const privateChatUserId = getPrivateChatUserId(chat);\n const {\n chatId: currentChatId,\n threadId: currentThreadId,\n type: messageListType,\n } = selectCurrentMessageList(global) || {};\n const isSelected = chatId === currentChatId && currentThreadId === MAIN_THREAD_ID;\n\n return {\n chat,\n isMuted: selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)),\n lastMessageSender,\n actionTargetUserIds,\n actionTargetChatId,\n actionTargetMessage,\n draft: selectDraft(global, chatId, MAIN_THREAD_ID),\n animationLevel: global.settings.byKey.animationLevel,\n isSelected,\n canScrollDown: isSelected && messageListType === 'thread',\n canChangeFolder: Boolean(global.chatFolders.orderedIds?.length),\n lastSyncTime: global.lastSyncTime,\n ...(isOutgoing && { lastMessageOutgoingStatus: selectOutgoingStatus(global, chat.lastMessage) }),\n ...(privateChatUserId && {\n user: selectUser(global, privateChatUserId),\n userStatus: selectUserStatus(global, privateChatUserId),\n }),\n };\n },\n)(Chat));\n","import React, { FC, memo, useCallback } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../lib/teact/teactn';\n\nimport { ApiChatFolder, ApiSticker } from '../../../api/types';\nimport { SettingsScreens } from '../../../types';\nimport { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { selectAnimatedEmoji, selectChatFolder } from '../../../modules/selectors';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport AnimatedEmoji from '../../common/AnimatedEmoji';\n\nimport './EmptyFolder.scss';\n\ntype OwnProps = {\n folderId?: number;\n folderType: 'all' | 'archived' | 'folder';\n foldersDispatch?: FolderEditDispatch;\n onScreenSelect?: (screen: SettingsScreens) => void;\n};\n\ntype StateProps = {\n chatFolder?: ApiChatFolder;\n animatedEmoji?: ApiSticker;\n};\n\nconst EmptyFolder: FC<OwnProps & StateProps> = ({\n chatFolder, animatedEmoji, foldersDispatch, onScreenSelect,\n}) => {\n const lang = useLang();\n\n const handleEditFolder = useCallback(() => {\n foldersDispatch!({ type: 'editFolder', payload: chatFolder });\n onScreenSelect!(SettingsScreens.FoldersEditFolderFromChatList);\n }, [chatFolder, foldersDispatch, onScreenSelect]);\n\n return (\n <div className=\"EmptyFolder\">\n <div className=\"sticker\">{animatedEmoji && <AnimatedEmoji sticker={animatedEmoji} />}</div>\n <h3 className=\"title\" dir=\"auto\">{lang('FilterNoChatsToDisplay')}</h3>\n <p className=\"description\" dir=\"auto\">\n {lang(chatFolder ? 'ChatList.EmptyChatListFilterText' : 'Chat.EmptyChat')}\n </p>\n {chatFolder && foldersDispatch && onScreenSelect && (\n <Button\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n fluid\n pill\n onClick={handleEditFolder}\n size=\"smaller\"\n isRtl={lang.isRtl}\n >\n <i className=\"icon-settings\" />\n {lang('ChatList.EmptyChatListEditFilter')}\n </Button>\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global, { folderId, folderType }): StateProps => {\n const chatFolder = folderId && folderType === 'folder' ? selectChatFolder(global, folderId) : undefined;\n\n return {\n chatFolder,\n animatedEmoji: selectAnimatedEmoji(global, '📂'),\n };\n})(EmptyFolder));\n","import React, {\n FC, memo, useMemo, useEffect,\n} from '../../../lib/teact/teact';\nimport { getDispatch } from '../../../lib/teact/teactn';\n\nimport { SettingsScreens } from '../../../types';\nimport { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';\n\nimport {\n ALL_FOLDER_ID,\n ARCHIVED_FOLDER_ID,\n CHAT_HEIGHT_PX,\n CHAT_LIST_SLICE,\n} from '../../../config';\nimport { IS_MAC_OS, IS_PWA } from '../../../util/environment';\nimport { mapValues } from '../../../util/iteratees';\nimport { getPinnedChatsCount } from '../../../util/folderManager';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useInfiniteScroll from '../../../hooks/useInfiniteScroll';\nimport { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager';\nimport { useChatAnimationType } from './hooks';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Loading from '../../ui/Loading';\nimport Chat from './Chat';\nimport EmptyFolder from './EmptyFolder';\n\ntype OwnProps = {\n folderType: 'all' | 'archived' | 'folder';\n folderId?: number;\n isActive: boolean;\n lastSyncTime?: number;\n foldersDispatch?: FolderEditDispatch;\n onScreenSelect?: (screen: SettingsScreens) => void;\n};\n\nconst ChatList: FC<OwnProps> = ({\n folderType,\n folderId,\n isActive,\n foldersDispatch,\n onScreenSelect,\n}) => {\n const { openChat, openNextChat } = getDispatch();\n\n const resolvedFolderId = (\n folderType === 'all' ? ALL_FOLDER_ID : folderType === 'archived' ? ARCHIVED_FOLDER_ID : folderId!\n );\n\n const orderedIds = useFolderManagerForOrderedIds(resolvedFolderId);\n\n const orderById = useMemo(() => {\n if (!orderedIds) {\n return undefined;\n }\n\n return orderedIds.reduce((acc, id, i) => {\n acc[id] = i;\n return acc;\n }, {} as Record<string, number>);\n }, [orderedIds]);\n\n const prevOrderById = usePrevious(orderById);\n\n const orderDiffById = useMemo(() => {\n if (!orderById || !prevOrderById) {\n return {};\n }\n\n return mapValues(orderById, (order, id) => {\n return prevOrderById[id] !== undefined ? order - prevOrderById[id] : -Infinity;\n });\n }, [orderById, prevOrderById]);\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, orderedIds, undefined, CHAT_LIST_SLICE);\n\n // Support <Cmd>+<Digit> and <Alt>+<Up/Down> to navigate between chats\n useEffect(() => {\n if (!isActive || !orderedIds) {\n return undefined;\n }\n\n function handleKeyDown(e: KeyboardEvent) {\n if (IS_PWA && ((IS_MAC_OS && e.metaKey) || (!IS_MAC_OS && e.ctrlKey)) && e.code.startsWith('Digit')) {\n const [, digit] = e.code.match(/Digit(\\d)/) || [];\n if (!digit) return;\n\n const position = Number(digit) - 1;\n if (position > orderedIds!.length - 1) return;\n\n openChat({ id: orderedIds![position], shouldReplaceHistory: true });\n }\n\n if (e.altKey) {\n const targetIndexDelta = e.key === 'ArrowDown' ? 1 : e.key === 'ArrowUp' ? -1 : undefined;\n if (!targetIndexDelta) return;\n\n e.preventDefault();\n openNextChat({ targetIndexDelta, orderedIds });\n }\n }\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [isActive, openChat, openNextChat, orderedIds]);\n\n const getAnimationType = useChatAnimationType(orderDiffById);\n\n function renderChats() {\n const viewportOffset = orderedIds!.indexOf(viewportIds![0]);\n const pinnedCount = getPinnedChatsCount(resolvedFolderId) || 0;\n\n return viewportIds!.map((id, i) => (\n <Chat\n key={id}\n teactOrderKey={i}\n chatId={id}\n isPinned={viewportOffset + i < pinnedCount}\n folderId={folderId}\n animationType={getAnimationType(id)}\n orderDiff={orderDiffById[id]}\n style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}\n />\n ));\n }\n\n return (\n <InfiniteScroll\n className=\"chat-list custom-scroll\"\n items={viewportIds}\n preloadBackwards={CHAT_LIST_SLICE}\n withAbsolutePositioning\n maxHeight={(orderedIds?.length || 0) * CHAT_HEIGHT_PX}\n onLoadMore={getMore}\n >\n {viewportIds?.length ? (\n renderChats()\n ) : viewportIds && !viewportIds.length ? (\n (\n <EmptyFolder\n folderId={folderId}\n folderType={folderType}\n foldersDispatch={foldersDispatch}\n onScreenSelect={onScreenSelect}\n />\n )\n ) : (\n <Loading key=\"loading\" />\n )}\n </InfiniteScroll>\n );\n};\n\nexport default memo(ChatList);\n","import { ApiChat, ApiMessage, ApiUser } from '../../../../api/types';\nimport {\n getChatTitle,\n getSenderTitle,\n isUserId,\n isChatGroup,\n} from '../../../../modules/helpers';\nimport { LangFn } from '../../../../hooks/useLang';\n\nexport function getSenderName(\n lang: LangFn, message: ApiMessage, chatsById: Record<string, ApiChat>, usersById: Record<string, ApiUser>,\n) {\n const { senderId } = message;\n if (!senderId) {\n return undefined;\n }\n\n const sender = isUserId(senderId) ? usersById[senderId] : chatsById[senderId];\n\n let senderName = getSenderTitle(lang, sender);\n\n const chat = chatsById[message.chatId];\n if (chat) {\n if (isUserId(senderId) && (sender as ApiUser).isSelf) {\n senderName = `${lang('FromYou')} → ${getChatTitle(lang, chat)}`;\n } else if (isChatGroup(chat)) {\n senderName += ` → ${getChatTitle(lang, chat)}`;\n }\n }\n\n return senderName;\n}\n","import React, { FC, memo } from '../../../lib/teact/teact';\n\nimport useFlag from '../../../hooks/useFlag';\nimport buildClassName from '../../../util/buildClassName';\n\nimport './DropTarget.scss';\n\nexport type OwnProps = {\n isQuick?: boolean;\n onFileSelect: (e: React.DragEvent<HTMLDivElement>) => void;\n};\n\nconst DropTarget: FC<OwnProps> = ({ isQuick, onFileSelect }) => {\n const [isHovered, markHovered, unmarkHovered] = useFlag();\n\n const handleDragEnter = () => { markHovered(); };\n const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {\n const { relatedTarget: toTarget } = e;\n\n if (toTarget) {\n e.stopPropagation();\n }\n\n unmarkHovered();\n };\n\n const className = buildClassName(\n 'DropTarget',\n isHovered && 'hovered',\n );\n\n return (\n <div\n className={className}\n onDrop={onFileSelect}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n >\n <div className=\"target-content\">\n <div className={`icon icon-${isQuick ? 'photo' : 'document'}`} />\n <div className=\"title\">Drop files here to send them</div>\n <div className=\"description\">{isQuick ? 'in a quick way' : 'without compression'}</div>\n </div>\n </div>\n );\n};\n\nexport default memo(DropTarget);\n","import React, {\n FC, memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport buildClassName from '../../../util/buildClassName';\nimport getFilesFromDataTransferItems from './helpers/getFilesFromDataTransferItems';\n\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport usePrevious from '../../../hooks/usePrevious';\n\nimport Portal from '../../ui/Portal';\nimport DropTarget from './DropTarget';\n\nimport './DropArea.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n withQuick?: boolean;\n onHide: NoneToVoidFunction;\n onFileSelect: (files: File[], isQuick: boolean) => void;\n};\n\nexport enum DropAreaState {\n None = 'none',\n Document = 'document',\n QuickFile = 'quick_file',\n}\n\nconst DROP_LEAVE_TIMEOUT_MS = 150;\n\nconst DropArea: FC<OwnProps> = ({\n isOpen, withQuick, onHide, onFileSelect,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const hideTimeoutRef = useRef<number>(null);\n const prevWithQuick = usePrevious(withQuick);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen);\n\n useEffect(() => (isOpen ? captureEscKeyListener(onHide) : undefined), [isOpen, onHide]);\n\n const handleFilesDrop = useCallback(async (e: React.DragEvent<HTMLDivElement>) => {\n const { dataTransfer: dt } = e;\n let files: File[] = [];\n\n if (dt.files && dt.files.length > 0 && (!dt.items || !dt.items.length)) {\n files = files.concat(Array.from(dt.files));\n } else if (dt.items && dt.items.length > 0) {\n const folderFiles = await getFilesFromDataTransferItems(dt.items);\n if (folderFiles.length) {\n files = files.concat(folderFiles);\n }\n }\n\n onHide();\n onFileSelect(files, false);\n }, [onFileSelect, onHide]);\n\n const handleQuickFilesDrop = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n const { dataTransfer: dt } = e;\n\n if (dt.files && dt.files.length > 0) {\n onHide();\n onFileSelect(Array.from(dt.files), true);\n }\n }, [onFileSelect, onHide]);\n\n const handleDragLeave = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n e.stopPropagation();\n\n const { target: fromTarget, relatedTarget: toTarget } = e;\n\n // Esc button pressed during drag event\n if ((fromTarget as HTMLDivElement).matches('.DropTarget, .DropArea') && !toTarget) {\n hideTimeoutRef.current = window.setTimeout(() => {\n onHide();\n }, DROP_LEAVE_TIMEOUT_MS);\n }\n }, [onHide]);\n\n const handleDragOver = () => {\n if (hideTimeoutRef.current) {\n window.clearTimeout(hideTimeoutRef.current);\n }\n };\n\n if (!shouldRender) {\n return undefined;\n }\n\n const className = buildClassName(\n 'DropArea',\n transitionClassNames,\n );\n\n return (\n <Portal containerId=\"#middle-column-portals\">\n <div className={className} onDragLeave={handleDragLeave} onDragOver={handleDragOver} onDrop={onHide}>\n <DropTarget onFileSelect={handleFilesDrop} />\n {(withQuick || prevWithQuick) && <DropTarget onFileSelect={handleQuickFilesDrop} isQuick />}\n </div>\n </Portal>\n );\n};\n\nexport default memo(DropArea);\n","import React, { FC, memo } from '../../../lib/teact/teact';\nimport { OwnProps } from './EmojiTooltip';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst EmojiTooltipAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const EmojiTooltip = useModuleLoader(Bundles.Extra, 'EmojiTooltip', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return EmojiTooltip ? <EmojiTooltip {...props} /> : undefined;\n};\n\nexport default memo(EmojiTooltipAsync);\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, useEffect, useRef, memo, useState, useCallback,\n} from '../../../lib/teact/teact';\nimport { getDispatch, withGlobal } from '../../../lib/teact/teactn';\n\nimport { IAnchorPosition, ISettings } from '../../../types';\n\nimport { EDITABLE_INPUT_ID } from '../../../config';\nimport { selectReplyingToId } from '../../../modules/selectors';\nimport { debounce } from '../../../util/schedulers';\nimport focusEditableElement from '../../../util/focusEditableElement';\nimport buildClassName from '../../../util/buildClassName';\nimport {\n IS_ANDROID, IS_EMOJI_SUPPORTED, IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV,\n} from '../../../util/environment';\nimport captureKeyboardListeners from '../../../util/captureKeyboardListeners';\nimport useLayoutEffectWithPrevDeps from '../../../hooks/useLayoutEffectWithPrevDeps';\nimport useFlag from '../../../hooks/useFlag';\nimport { isHeavyAnimating } from '../../../hooks/useHeavyAnimationCheck';\nimport useSendMessageAction from '../../../hooks/useSendMessageAction';\nimport useLang from '../../../hooks/useLang';\nimport parseEmojiOnlyString from '../../common/helpers/parseEmojiOnlyString';\nimport { isSelectionInsideInput } from './helpers/selection';\nimport renderText from '../../common/helpers/renderText';\n\nimport TextFormatter from './TextFormatter';\n\nconst CONTEXT_MENU_CLOSE_DELAY_MS = 100;\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 350;\nconst TRANSITION_DURATION_FACTOR = 50;\n\ntype OwnProps = {\n id: string;\n chatId: string;\n threadId: number;\n isAttachmentModalInput?: boolean;\n editableInputId?: string;\n html: string;\n placeholder: string;\n forcedPlaceholder?: string;\n canAutoFocus: boolean;\n shouldSuppressFocus?: boolean;\n shouldSuppressTextFormatter?: boolean;\n onUpdate: (html: string) => void;\n onSuppressedFocus?: () => void;\n onSend: () => void;\n};\n\ntype StateProps = {\n replyingToId?: number;\n noTabCapture?: boolean;\n messageSendKeyCombo?: ISettings['messageSendKeyCombo'];\n};\n\nconst MAX_INPUT_HEIGHT = IS_SINGLE_COLUMN_LAYOUT ? 256 : 416;\nconst TAB_INDEX_PRIORITY_TIMEOUT = 2000;\nconst TEXT_FORMATTER_SAFE_AREA_PX = 90;\n// For some reason Safari inserts `<br>` after user removes text from input\nconst SAFARI_BR = '<br>';\n\nfunction clearSelection() {\n const selection = window.getSelection();\n if (!selection) {\n return;\n }\n\n if (selection.removeAllRanges) {\n selection.removeAllRanges();\n } else if (selection.empty) {\n selection.empty();\n }\n}\n\nconst MessageInput: FC<OwnProps & StateProps> = ({\n id,\n chatId,\n threadId,\n isAttachmentModalInput,\n editableInputId,\n html,\n placeholder,\n forcedPlaceholder,\n canAutoFocus,\n shouldSuppressFocus,\n shouldSuppressTextFormatter,\n replyingToId,\n noTabCapture,\n messageSendKeyCombo,\n onUpdate,\n onSuppressedFocus,\n onSend,\n}) => {\n const {\n editLastMessage,\n replyToNextMessage,\n } = getDispatch();\n\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const cloneRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n const isContextMenuOpenRef = useRef(false);\n const [isTextFormatterOpen, openTextFormatter, closeTextFormatter] = useFlag();\n const [textFormatterAnchorPosition, setTextFormatterAnchorPosition] = useState<IAnchorPosition>();\n const [selectedRange, setSelectedRange] = useState<Range>();\n\n const sendMessageAction = useSendMessageAction(chatId, threadId);\n\n useEffect(() => {\n if (!isAttachmentModalInput) return;\n updateInputHeight(false);\n }, [isAttachmentModalInput]);\n\n useLayoutEffectWithPrevDeps(([prevHtml]) => {\n if (html !== inputRef.current!.innerHTML) {\n inputRef.current!.innerHTML = html;\n }\n\n if (html !== cloneRef.current!.innerHTML) {\n cloneRef.current!.innerHTML = html;\n }\n\n if (prevHtml !== undefined && prevHtml !== html) {\n updateInputHeight(!html.length);\n }\n }, [html]);\n\n const chatIdRef = useRef(chatId);\n chatIdRef.current = chatId;\n const focusInput = useCallback(() => {\n if (!inputRef.current) {\n return;\n }\n\n if (isHeavyAnimating()) {\n setTimeout(focusInput, FOCUS_DELAY_MS);\n return;\n }\n\n focusEditableElement(inputRef.current!);\n }, []);\n\n const handleCloseTextFormatter = useCallback(() => {\n closeTextFormatter();\n clearSelection();\n }, [closeTextFormatter]);\n\n function checkSelection() {\n // Disable the formatter on iOS devices for now.\n if (IS_IOS) {\n return false;\n }\n\n const selection = window.getSelection();\n if (!selection || !selection.rangeCount || isContextMenuOpenRef.current) {\n closeTextFormatter();\n return false;\n }\n\n const selectionRange = selection.getRangeAt(0);\n const selectedText = selectionRange.toString().trim();\n if (\n shouldSuppressTextFormatter\n || !isSelectionInsideInput(selectionRange, editableInputId || EDITABLE_INPUT_ID)\n || !selectedText\n || parseEmojiOnlyString(selectedText)\n || !selectionRange.START_TO_END\n ) {\n closeTextFormatter();\n return false;\n }\n\n return true;\n }\n\n function processSelection() {\n if (!checkSelection()) {\n return;\n }\n\n const selectionRange = window.getSelection()!.getRangeAt(0);\n const selectionRect = selectionRange.getBoundingClientRect();\n const inputRect = inputRef.current!.getBoundingClientRect();\n\n let x = (selectionRect.left + selectionRect.width / 2) - inputRect.left;\n\n if (x < TEXT_FORMATTER_SAFE_AREA_PX) {\n x = TEXT_FORMATTER_SAFE_AREA_PX;\n } else if (x > inputRect.width - TEXT_FORMATTER_SAFE_AREA_PX) {\n x = inputRect.width - TEXT_FORMATTER_SAFE_AREA_PX;\n }\n\n setTextFormatterAnchorPosition({\n x,\n y: selectionRect.top - inputRect.top,\n });\n\n setSelectedRange(selectionRange);\n openTextFormatter();\n }\n\n function handleMouseDown(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n function handleMouseUp() {\n processSelection();\n\n event.target.removeEventListener('mouseup', handleMouseUp);\n }\n\n if (event.button !== 2) {\n event.target.addEventListener('mouseup', handleMouseUp);\n return;\n }\n\n if (isContextMenuOpenRef.current === true) {\n return;\n }\n\n isContextMenuOpenRef.current = true;\n\n function closeContextMenuMouseListener() {\n setTimeout(() => {\n isContextMenuOpenRef.current = false;\n }, CONTEXT_MENU_CLOSE_DELAY_MS);\n\n window.removeEventListener('mouseup', closeContextMenuMouseListener);\n }\n\n function closeContextMenuKeyListener(e: KeyboardEvent) {\n if (e.key !== 'Esc' && e.key !== 'Escape') {\n return;\n }\n\n setTimeout(() => {\n isContextMenuOpenRef.current = false;\n }, CONTEXT_MENU_CLOSE_DELAY_MS);\n\n window.removeEventListener('keydown', closeContextMenuKeyListener);\n }\n\n document.addEventListener('mousedown', closeContextMenuMouseListener);\n document.addEventListener('keydown', closeContextMenuKeyListener);\n }\n\n function handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {\n function handleKeyUp() {\n processSelection();\n\n e.target.removeEventListener('keyup', handleKeyUp);\n }\n\n if (!html.length && (e.metaKey || e.ctrlKey)) {\n const targetIndexDelta = e.key === 'ArrowDown' ? 1 : e.key === 'ArrowUp' ? -1 : undefined;\n if (targetIndexDelta) {\n e.preventDefault();\n\n replyToNextMessage({ targetIndexDelta });\n return;\n }\n }\n\n if (e.key === 'Enter' && !e.shiftKey) {\n if (\n !(IS_IOS || IS_ANDROID)\n && (\n (messageSendKeyCombo === 'enter' && !e.shiftKey)\n || (messageSendKeyCombo === 'ctrl-enter' && (e.ctrlKey || e.metaKey))\n )\n ) {\n e.preventDefault();\n\n closeTextFormatter();\n onSend();\n }\n } else if (e.key === 'ArrowUp' && !html.length && !e.metaKey && !e.ctrlKey && !e.altKey) {\n e.preventDefault();\n editLastMessage();\n } else {\n e.target.addEventListener('keyup', handleKeyUp);\n }\n }\n\n function handleChange(e: ChangeEvent<HTMLDivElement>) {\n const { innerHTML, textContent } = e.currentTarget;\n\n onUpdate(innerHTML === SAFARI_BR ? '' : innerHTML);\n sendMessageAction({ type: 'typing' });\n\n // Reset focus on the input to remove any active styling when input is cleared\n if (\n !IS_TOUCH_ENV\n && (!textContent || !textContent.length)\n // When emojis are not supported, innerHTML contains an emoji img tag that doesn't exist in the textContext\n && !(!IS_EMOJI_SUPPORTED && innerHTML.includes('emoji-small'))\n ) {\n const selection = window.getSelection()!;\n if (selection) {\n inputRef.current!.blur();\n selection.removeAllRanges();\n focusEditableElement(inputRef.current!, true);\n }\n }\n }\n\n function stopEvent(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (!checkSelection()) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n }\n\n function updateInputHeight(willSend = false) {\n const input = inputRef.current!;\n const clone = cloneRef.current!;\n const currentHeight = Number(input.style.height.replace('px', ''));\n const newHeight = Math.min(clone.scrollHeight, MAX_INPUT_HEIGHT);\n if (newHeight === currentHeight) {\n return;\n }\n\n const transitionDuration = Math.round(\n TRANSITION_DURATION_FACTOR * Math.log(Math.abs(newHeight - currentHeight)),\n );\n\n const exec = () => {\n input.style.height = `${newHeight}px`;\n input.style.transitionDuration = `${transitionDuration}ms`;\n input.classList.toggle('overflown', clone.scrollHeight > MAX_INPUT_HEIGHT);\n };\n\n if (willSend) {\n // Sync with sending animation\n requestAnimationFrame(exec);\n } else {\n exec();\n }\n }\n\n useEffect(() => {\n if (IS_TOUCH_ENV) {\n return;\n }\n\n if (canAutoFocus) {\n focusInput();\n }\n }, [chatId, focusInput, replyingToId, canAutoFocus]);\n\n useEffect(() => {\n if (noTabCapture) {\n return undefined;\n }\n\n const captureFirstTab = debounce((e: KeyboardEvent) => {\n if (e.key === 'Tab') {\n e.preventDefault();\n requestAnimationFrame(focusInput);\n }\n }, TAB_INDEX_PRIORITY_TIMEOUT, true, false);\n\n return captureKeyboardListeners({ onTab: captureFirstTab });\n }, [focusInput, noTabCapture]);\n\n useEffect(() => {\n const input = inputRef.current!;\n\n function suppressFocus() {\n input.blur();\n }\n\n if (shouldSuppressFocus) {\n input.addEventListener('focus', suppressFocus);\n }\n\n return () => {\n input.removeEventListener('focus', suppressFocus);\n };\n }, [shouldSuppressFocus]);\n\n const className = buildClassName(\n 'form-control custom-scroll',\n html.length > 0 && 'touched',\n shouldSuppressFocus && 'focus-disabled',\n );\n\n return (\n <div id={id} onClick={shouldSuppressFocus ? onSuppressedFocus : undefined} dir={lang.isRtl ? 'rtl' : undefined}>\n <div\n ref={inputRef}\n id={editableInputId || EDITABLE_INPUT_ID}\n className={className}\n contentEditable\n dir=\"auto\"\n onClick={focusInput}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n onContextMenu={IS_ANDROID ? stopEvent : undefined}\n onTouchCancel={IS_ANDROID ? processSelection : undefined}\n />\n <div ref={cloneRef} className={buildClassName(className, 'clone')} dir=\"auto\" />\n {!forcedPlaceholder && <span className=\"placeholder-text\" dir=\"auto\">{placeholder}</span>}\n <TextFormatter\n isOpen={isTextFormatterOpen}\n anchorPosition={textFormatterAnchorPosition}\n selectedRange={selectedRange}\n setSelectedRange={setSelectedRange}\n onClose={handleCloseTextFormatter}\n />\n {forcedPlaceholder && <span className=\"forced-placeholder\">{renderText(forcedPlaceholder!)}</span>}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, threadId }: OwnProps): StateProps => {\n const { messageSendKeyCombo } = global.settings.byKey;\n\n return {\n messageSendKeyCombo,\n replyingToId: chatId && threadId ? selectReplyingToId(global, chatId, threadId) : undefined,\n noTabCapture: global.isPollModalOpen || global.payment.isPaymentModalOpen,\n };\n },\n)(MessageInput));\n","import React, {\n FC, memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport { IAnchorPosition } from '../../../types';\nimport { ApiMessageEntityTypes } from '../../../api/types';\n\nimport { EDITABLE_INPUT_ID } from '../../../config';\nimport buildClassName from '../../../util/buildClassName';\nimport { ensureProtocol } from '../../../util/ensureProtocol';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport getKeyFromEvent from '../../../util/getKeyFromEvent';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useVirtualBackdrop from '../../../hooks/useVirtualBackdrop';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\n\nimport './TextFormatter.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n anchorPosition?: IAnchorPosition;\n selectedRange?: Range;\n setSelectedRange: (range: Range) => void;\n onClose: () => void;\n};\n\ninterface ISelectedTextFormats {\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n monospace?: boolean;\n spoiler?: boolean;\n}\n\nconst TEXT_FORMAT_BY_TAG_NAME: Record<string, keyof ISelectedTextFormats> = {\n B: 'bold',\n STRONG: 'bold',\n I: 'italic',\n EM: 'italic',\n U: 'underline',\n DEL: 'strikethrough',\n CODE: 'monospace',\n SPAN: 'spoiler',\n};\nconst fragmentEl = document.createElement('div');\n\nconst TextFormatter: FC<OwnProps> = ({\n isOpen,\n anchorPosition,\n selectedRange,\n setSelectedRange,\n onClose,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const linkUrlInputRef = useRef<HTMLInputElement>(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen);\n const [isLinkControlOpen, openLinkControl, closeLinkControl] = useFlag();\n const [linkUrl, setLinkUrl] = useState('');\n const [isEditingLink, setIsEditingLink] = useState(false);\n const [inputClassName, setInputClassName] = useState<string | undefined>();\n const [selectedTextFormats, setSelectedTextFormats] = useState<ISelectedTextFormats>({});\n\n useEffect(() => (isOpen ? captureEscKeyListener(onClose) : undefined), [isOpen, onClose]);\n useVirtualBackdrop(\n isOpen,\n containerRef,\n onClose,\n );\n\n useEffect(() => {\n if (isLinkControlOpen) {\n linkUrlInputRef.current!.focus();\n } else {\n setLinkUrl('');\n setIsEditingLink(false);\n }\n }, [isLinkControlOpen]);\n\n useEffect(() => {\n if (!shouldRender) {\n closeLinkControl();\n setSelectedTextFormats({});\n setInputClassName(undefined);\n }\n }, [closeLinkControl, shouldRender]);\n\n useEffect(() => {\n if (!isOpen || !selectedRange) {\n return;\n }\n\n const selectedFormats: ISelectedTextFormats = {};\n let { parentElement } = selectedRange.commonAncestorContainer;\n while (parentElement && parentElement.id !== EDITABLE_INPUT_ID) {\n const textFormat = TEXT_FORMAT_BY_TAG_NAME[parentElement.tagName];\n if (textFormat) {\n selectedFormats[textFormat] = true;\n }\n\n parentElement = parentElement.parentElement;\n }\n\n setSelectedTextFormats(selectedFormats);\n }, [isOpen, selectedRange, openLinkControl]);\n\n function restoreSelection() {\n if (!selectedRange) {\n return;\n }\n\n const selection = window.getSelection();\n if (selection) {\n selection.removeAllRanges();\n selection.addRange(selectedRange);\n }\n }\n\n const updateSelectedRange = useCallback(() => {\n const selection = window.getSelection();\n if (selection) {\n setSelectedRange(selection.getRangeAt(0));\n }\n }, [setSelectedRange]);\n\n const getSelectedText = useCallback(() => {\n if (!selectedRange) {\n return undefined;\n }\n fragmentEl.innerText = selectedRange.toString();\n\n return fragmentEl.innerHTML;\n }, [selectedRange]);\n\n const getSelectedElement = useCallback(() => {\n if (!selectedRange) {\n return undefined;\n }\n\n return selectedRange.commonAncestorContainer.parentElement;\n }, [selectedRange]);\n\n function updateInputStyles() {\n const input = linkUrlInputRef.current;\n if (!input) {\n return;\n }\n\n const { offsetWidth, scrollWidth, scrollLeft } = input;\n if (scrollWidth <= offsetWidth) {\n setInputClassName(undefined);\n return;\n }\n\n let className = '';\n if (scrollLeft < scrollWidth - offsetWidth) {\n className = 'mask-right';\n }\n if (scrollLeft > 0) {\n className += ' mask-left';\n }\n\n setInputClassName(className);\n }\n\n function handleLinkUrlChange(e: React.ChangeEvent<HTMLInputElement>) {\n setLinkUrl(e.target.value);\n updateInputStyles();\n }\n\n function getFormatButtonClassName(key: keyof ISelectedTextFormats) {\n if (selectedTextFormats[key]) {\n return 'active';\n }\n\n if (key === 'monospace' || key === 'strikethrough') {\n if (Object.keys(selectedTextFormats).some(\n (fKey) => fKey !== key && Boolean(selectedTextFormats[fKey as keyof ISelectedTextFormats]),\n )) {\n return 'disabled';\n }\n } else if (selectedTextFormats.monospace || selectedTextFormats.strikethrough) {\n return 'disabled';\n }\n\n return undefined;\n }\n\n const handleSpoilerText = useCallback(() => {\n if (selectedTextFormats.spoiler) {\n const element = getSelectedElement();\n if (\n !selectedRange\n || !element\n || element.dataset.entityType !== ApiMessageEntityTypes.Spoiler\n || !element.textContent\n ) {\n return;\n }\n\n element.replaceWith(element.textContent);\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n spoiler: false,\n }));\n\n return;\n }\n\n const text = getSelectedText();\n document.execCommand(\n 'insertHTML', false, `<span class=\"spoiler\" data-entity-type=\"${ApiMessageEntityTypes.Spoiler}\">${text}</span>`,\n );\n onClose();\n }, [getSelectedElement, getSelectedText, onClose, selectedRange, selectedTextFormats.spoiler]);\n\n const handleBoldText = useCallback(() => {\n setSelectedTextFormats((selectedFormats) => {\n // Somehow re-applying 'bold' command to already bold text doesn't work\n document.execCommand(selectedFormats.bold ? 'removeFormat' : 'bold');\n Object.keys(selectedFormats).forEach((key) => {\n if ((key === 'italic' || key === 'underline') && Boolean(selectedFormats[key])) {\n document.execCommand(key);\n }\n });\n\n updateSelectedRange();\n return {\n ...selectedFormats,\n bold: !selectedFormats.bold,\n };\n });\n }, [updateSelectedRange]);\n\n const handleItalicText = useCallback(() => {\n document.execCommand('italic');\n updateSelectedRange();\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n italic: !selectedFormats.italic,\n }));\n }, [updateSelectedRange]);\n\n const handleUnderlineText = useCallback(() => {\n document.execCommand('underline');\n updateSelectedRange();\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n underline: !selectedFormats.underline,\n }));\n }, [updateSelectedRange]);\n\n const handleStrikethroughText = useCallback(() => {\n if (selectedTextFormats.strikethrough) {\n const element = getSelectedElement();\n if (\n !selectedRange\n || !element\n || element.tagName !== 'DEL'\n || !element.textContent\n ) {\n return;\n }\n\n element.replaceWith(element.textContent);\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n strikethrough: false,\n }));\n\n return;\n }\n\n const text = getSelectedText();\n document.execCommand('insertHTML', false, `<del>${text}</del>`);\n onClose();\n }, [\n getSelectedElement, getSelectedText, onClose, selectedRange, selectedTextFormats.strikethrough,\n ]);\n\n const handleMonospaceText = useCallback(() => {\n if (selectedTextFormats.monospace) {\n const element = getSelectedElement();\n if (\n !selectedRange\n || !element\n || element.tagName !== 'CODE'\n || !element.textContent\n ) {\n return;\n }\n\n element.replaceWith(element.textContent);\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n monospace: false,\n }));\n\n return;\n }\n\n const text = getSelectedText();\n document.execCommand('insertHTML', false, `<code class=\"text-entity-code\" dir=\"auto\">${text}</code>`);\n onClose();\n }, [\n getSelectedElement, getSelectedText, onClose, selectedRange, selectedTextFormats.monospace,\n ]);\n\n function handleLinkUrlConfirm() {\n const formattedLinkUrl = encodeURI(ensureProtocol(linkUrl) || '');\n\n if (isEditingLink) {\n const element = getSelectedElement();\n if (!element || element.tagName !== 'A') {\n return;\n }\n\n (element as HTMLAnchorElement).href = formattedLinkUrl;\n\n onClose();\n\n return;\n }\n\n const text = getSelectedText();\n restoreSelection();\n document.execCommand(\n 'insertHTML',\n false,\n `<a href=${formattedLinkUrl} class=\"text-entity-link\" dir=\"auto\">${text}</a>`,\n );\n onClose();\n }\n\n const handleKeyDown = useCallback((e: KeyboardEvent) => {\n const HANDLERS_BY_KEY: Record<string, AnyToVoidFunction> = {\n k: openLinkControl,\n b: handleBoldText,\n u: handleUnderlineText,\n i: handleItalicText,\n m: handleMonospaceText,\n s: handleStrikethroughText,\n p: handleSpoilerText,\n };\n\n const handler = HANDLERS_BY_KEY[getKeyFromEvent(e)];\n\n if (\n e.altKey\n || !(e.ctrlKey || e.metaKey)\n || !handler\n ) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n handler();\n }, [\n openLinkControl, handleBoldText, handleUnderlineText, handleItalicText, handleMonospaceText,\n handleStrikethroughText, handleSpoilerText,\n ]);\n\n useEffect(() => {\n if (isOpen) {\n document.addEventListener('keydown', handleKeyDown);\n }\n\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [isOpen, handleKeyDown]);\n\n const lang = useLang();\n\n function handleContainerKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {\n if (e.key === 'Enter' && isLinkControlOpen) {\n handleLinkUrlConfirm();\n e.preventDefault();\n }\n }\n\n if (!shouldRender) {\n return undefined;\n }\n\n const className = buildClassName(\n 'TextFormatter',\n transitionClassNames,\n isLinkControlOpen && 'link-control-shown',\n );\n\n const linkUrlConfirmClassName = buildClassName(\n 'TextFormatter-link-url-confirm',\n Boolean(linkUrl.length) && 'shown',\n );\n\n const style = anchorPosition\n ? `left: ${anchorPosition.x}px; top: ${anchorPosition.y}px;--text-formatter-left: ${anchorPosition.x}px;`\n : '';\n\n return (\n <div\n ref={containerRef}\n className={className}\n style={style}\n onKeyDown={handleContainerKeyDown}\n >\n <div className=\"TextFormatter-buttons\">\n <Button\n color=\"translucent\"\n ariaLabel=\"Spoiler text\"\n className={getFormatButtonClassName('spoiler')}\n onClick={handleSpoilerText}\n >\n <i className=\"icon-eye-closed\" />\n </Button>\n <div className=\"TextFormatter-divider\" />\n <Button\n color=\"translucent\"\n ariaLabel=\"Bold text\"\n className={getFormatButtonClassName('bold')}\n onClick={handleBoldText}\n >\n <i className=\"icon-bold\" />\n </Button>\n <Button\n color=\"translucent\"\n ariaLabel=\"Italic text\"\n className={getFormatButtonClassName('italic')}\n onClick={handleItalicText}\n >\n <i className=\"icon-italic\" />\n </Button>\n <Button\n color=\"translucent\"\n ariaLabel=\"Underlined text\"\n className={getFormatButtonClassName('underline')}\n onClick={handleUnderlineText}\n >\n <i className=\"icon-underlined\" />\n </Button>\n <Button\n color=\"translucent\"\n ariaLabel=\"Strikethrough text\"\n className={getFormatButtonClassName('strikethrough')}\n onClick={handleStrikethroughText}\n >\n <i className=\"icon-strikethrough\" />\n </Button>\n <Button\n color=\"translucent\"\n ariaLabel=\"Monospace text\"\n className={getFormatButtonClassName('monospace')}\n onClick={handleMonospaceText}\n >\n <i className=\"icon-monospace\" />\n </Button>\n <div className=\"TextFormatter-divider\" />\n <Button color=\"translucent\" ariaLabel={lang('TextFormat.AddLinkTitle')} onClick={openLinkControl}>\n <i className=\"icon-link\" />\n </Button>\n </div>\n\n <div className=\"TextFormatter-link-control\">\n <div className=\"TextFormatter-buttons\">\n <Button color=\"translucent\" ariaLabel={lang('Cancel')} onClick={closeLinkControl}>\n <i className=\"icon-arrow-left\" />\n </Button>\n <div className=\"TextFormatter-divider\" />\n\n <div\n className={buildClassName('TextFormatter-link-url-input-wrapper', inputClassName)}\n >\n <input\n ref={linkUrlInputRef}\n className=\"TextFormatter-link-url-input\"\n type=\"text\"\n value={linkUrl}\n placeholder=\"Enter URL...\"\n autoComplete=\"off\"\n inputMode=\"url\"\n dir=\"auto\"\n onChange={handleLinkUrlChange}\n onScroll={updateInputStyles}\n />\n </div>\n\n <div className={linkUrlConfirmClassName}>\n <div className=\"TextFormatter-divider\" />\n <Button\n color=\"translucent\"\n ariaLabel={lang('Save')}\n className=\"color-primary\"\n onClick={handleLinkUrlConfirm}\n >\n <i className=\"icon-check\" />\n </Button>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(TextFormatter);\n","export default async function getFilesFromDataTransferItems(dataTransferItems: DataTransferItemList) {\n const files: File[] = [];\n\n function traverseFileTreePromise(entry: FileSystemEntry | File, item: DataTransferItem) {\n return new Promise(resolve => {\n if (entry instanceof File) {\n files.push(entry);\n resolve(entry);\n } else if (entry.isFile) {\n const itemFile = item.getAsFile();\n (entry as FileSystemFileEntry).file((file) => {\n files.push(file);\n resolve(file);\n }, () => {\n // iOS Safari throws an error \"NotFoundError: Path does not exist\" for files from the clipboard\n // https://stackoverflow.com/a/50059309\n if (itemFile) {\n files.push(itemFile);\n }\n resolve(itemFile);\n });\n } else if (entry.isDirectory) {\n let dirReader = (entry as FileSystemDirectoryEntry).createReader();\n dirReader.readEntries((entries) => {\n let entriesPromises = [];\n for (let entr of entries) {\n entriesPromises.push(traverseFileTreePromise(entr, item));\n }\n resolve(Promise.all(entriesPromises));\n });\n }\n });\n }\n\n let entriesPromises = [];\n for (let item of dataTransferItems) {\n if (item.kind === 'file') {\n const entry = item.webkitGetAsEntry() || item.getAsFile();\n if (entry) {\n entriesPromises.push(traverseFileTreePromise(entry, item));\n }\n }\n }\n\n await Promise.all(entriesPromises);\n\n return files;\n}\n\n","const RE_BR = /(<br>|<br\\s?\\/>)/g;\nconst RE_SPACE = /(&nbsp;|\\u00A0)/g;\nconst RE_CLEAN_HTML = /(<div>|<\\/div>)/gi;\nconst RE_EXTRA_NEW_LINE = /\\n$/i;\n\nexport function prepareForRegExp(html: string) {\n return html\n .replace(RE_SPACE, ' ')\n .replace(RE_BR, '\\n')\n .replace(RE_CLEAN_HTML, '')\n .replace(RE_EXTRA_NEW_LINE, '');\n}\n","const MAX_NESTING_PARENTS = 5;\n\nexport function isSelectionInsideInput(selectionRange: Range, inputId: string) {\n const { commonAncestorContainer } = selectionRange;\n let parentNode: HTMLElement | null = commonAncestorContainer as HTMLElement;\n let iterations = 1;\n while (parentNode && parentNode.id !== inputId && iterations < MAX_NESTING_PARENTS) {\n parentNode = parentNode.parentElement;\n iterations++;\n }\n\n return Boolean(parentNode && parentNode.id === inputId);\n}\n","import { areSortedArraysEqual } from './iteratees';\n\nconst cache = new WeakMap<AnyFunction, {\n lastArgs: any[];\n lastResult: any;\n}>();\n\nexport default function memoized<T extends AnyFunction>(fn: T) {\n return (...args: Parameters<T>): ReturnType<T> => {\n const cached = cache.get(fn);\n if (cached && areSortedArraysEqual(cached.lastArgs, args)) {\n return cached.lastResult;\n }\n\n const result = fn(...args);\n cache.set(fn, { lastArgs: args, lastResult: result });\n return result;\n };\n}\n","import {\n useCallback, useEffect, useState,\n} from '../../../../lib/teact/teact';\n\nimport { EDITABLE_INPUT_ID } from '../../../../config';\nimport { MEMO_EMPTY_ARRAY } from '../../../../util/memo';\nimport { prepareForRegExp } from '../helpers/prepareForRegExp';\nimport {\n EmojiData, EmojiModule, EmojiRawData, uncompressEmoji,\n} from '../../../../util/emoji';\nimport focusEditableElement from '../../../../util/focusEditableElement';\nimport {\n buildCollectionByKey, flatten, mapValues, pickTruthy, unique,\n} from '../../../../util/iteratees';\nimport memoized from '../../../../util/memoized';\nimport useFlag from '../../../../hooks/useFlag';\nimport renderText from '../../../common/helpers/renderText';\n\ninterface Library {\n keywords: string[];\n byKeyword: Record<string, Emoji[]>;\n names: string[];\n byName: Record<string, Emoji[]>;\n}\n\nlet emojiDataPromise: Promise<EmojiModule>;\nlet emojiRawData: EmojiRawData;\nlet emojiData: EmojiData;\n\nlet RE_EMOJI_SEARCH: RegExp;\nconst EMOJIS_LIMIT = 36;\nconst FILTER_MIN_LENGTH = 2;\n\nconst prepareRecentEmojisMemo = memoized(prepareRecentEmojis);\nconst prepareLibraryMemo = memoized(prepareLibrary);\nconst searchInLibraryMemo = memoized(searchInLibrary);\n\ntry {\n RE_EMOJI_SEARCH = new RegExp('(^|\\\\s):[-+_:\\\\p{L}\\\\p{N}]*$', 'gui');\n} catch (e) {\n // Support for older versions of firefox\n RE_EMOJI_SEARCH = new RegExp('(^|\\\\s):[-+_:\\\\d\\\\wа-яё]*$', 'gi');\n}\n\nexport default function useEmojiTooltip(\n isAllowed: boolean,\n htmlRef: { current: string },\n recentEmojiIds: string[],\n inputId = EDITABLE_INPUT_ID,\n onUpdateHtml: (html: string) => void,\n baseEmojiKeywords?: Record<string, string[]>,\n emojiKeywords?: Record<string, string[]>,\n isDisabled = false,\n) {\n const [isOpen, markIsOpen, unmarkIsOpen] = useFlag();\n const [byId, setById] = useState<Record<string, Emoji> | undefined>();\n const [shouldForceInsertEmoji, setShouldForceInsertEmoji] = useState(false);\n const [filteredEmojis, setFilteredEmojis] = useState<Emoji[]>(MEMO_EMPTY_ARRAY);\n\n // Initialize data on first render.\n useEffect(() => {\n if (isDisabled) return;\n const exec = () => {\n setById(emojiData.emojis);\n };\n\n if (emojiData) {\n exec();\n } else {\n ensureEmojiData()\n .then(exec);\n }\n }, [isDisabled]);\n\n const html = htmlRef.current;\n useEffect(() => {\n if (!isAllowed || !html || !byId || isDisabled) {\n unmarkIsOpen();\n return;\n }\n\n const code = html.includes(':') && getEmojiCode(html);\n if (!code) {\n setFilteredEmojis(MEMO_EMPTY_ARRAY);\n unmarkIsOpen();\n return;\n }\n\n const forceSend = code.length > 2 && code.endsWith(':');\n const filter = code.substr(1, forceSend ? code.length - 2 : undefined);\n let matched: Emoji[] = MEMO_EMPTY_ARRAY;\n\n setShouldForceInsertEmoji(forceSend);\n\n if (!filter) {\n matched = prepareRecentEmojisMemo(byId, recentEmojiIds, EMOJIS_LIMIT);\n } else if (filter.length >= FILTER_MIN_LENGTH) {\n const library = prepareLibraryMemo(byId, baseEmojiKeywords, emojiKeywords);\n matched = searchInLibraryMemo(library, filter, EMOJIS_LIMIT);\n }\n\n if (matched.length) {\n if (!forceSend) {\n markIsOpen();\n }\n setFilteredEmojis(matched);\n } else {\n unmarkIsOpen();\n }\n }, [\n byId, html, isAllowed, markIsOpen, recentEmojiIds, unmarkIsOpen, setShouldForceInsertEmoji,\n isDisabled, baseEmojiKeywords, emojiKeywords,\n ]);\n\n const insertEmoji = useCallback((textEmoji: string, isForce?: boolean) => {\n const currentHtml = htmlRef.current;\n const atIndex = currentHtml.lastIndexOf(':', isForce ? currentHtml.lastIndexOf(':') - 1 : undefined);\n if (atIndex !== -1) {\n onUpdateHtml(`${currentHtml.substr(0, atIndex)}${renderText(textEmoji, ['emoji_html'])}`);\n const messageInput = document.getElementById(inputId)!;\n requestAnimationFrame(() => {\n focusEditableElement(messageInput, true, true);\n });\n }\n\n unmarkIsOpen();\n }, [htmlRef, inputId, onUpdateHtml, unmarkIsOpen]);\n\n useEffect(() => {\n if (isOpen && shouldForceInsertEmoji && filteredEmojis.length) {\n insertEmoji(filteredEmojis[0].native, true);\n }\n }, [filteredEmojis, insertEmoji, isOpen, shouldForceInsertEmoji]);\n\n return {\n isEmojiTooltipOpen: isOpen,\n closeEmojiTooltip: unmarkIsOpen,\n filteredEmojis,\n insertEmoji,\n };\n}\n\nfunction getEmojiCode(html: string) {\n const emojis = prepareForRegExp(html).match(RE_EMOJI_SEARCH);\n\n return emojis ? emojis[0].trim() : undefined;\n}\n\nasync function ensureEmojiData() {\n if (!emojiDataPromise) {\n emojiDataPromise = import('emoji-data-ios/emoji-data.json') as unknown as Promise<EmojiModule>;\n emojiRawData = (await emojiDataPromise).default;\n\n emojiData = uncompressEmoji(emojiRawData);\n }\n\n return emojiDataPromise;\n}\n\nfunction prepareRecentEmojis(byId: Record<string, Emoji>, recentEmojiIds: string[], limit: number) {\n if (!byId || !recentEmojiIds.length) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return Object.values(pickTruthy(byId, recentEmojiIds)).slice(0, limit);\n}\n\nfunction prepareLibrary(\n byId: Record<string, Emoji>,\n baseEmojiKeywords?: Record<string, string[]>,\n emojiKeywords?: Record<string, string[]>,\n): Library {\n const emojis = Object.values(byId);\n\n const byNative = buildCollectionByKey<Emoji>(emojis, 'native');\n const baseEmojisByKeyword = baseEmojiKeywords\n ? mapValues(baseEmojiKeywords, (natives) => {\n return Object.values(pickTruthy(byNative, natives));\n })\n : {};\n const emojisByKeyword = emojiKeywords\n ? mapValues(emojiKeywords, (natives) => {\n return Object.values(pickTruthy(byNative, natives));\n })\n : {};\n\n const byKeyword = { ...baseEmojisByKeyword, ...emojisByKeyword };\n const keywords = ([] as string[]).concat(Object.keys(baseEmojisByKeyword), Object.keys(emojisByKeyword));\n\n const byName = emojis.reduce((result, emoji) => {\n emoji.names.forEach((name) => {\n if (!result[name]) {\n result[name] = [];\n }\n\n result[name].push(emoji);\n });\n\n return result;\n }, {} as Record<string, Emoji[]>);\n\n const names = Object.keys(byName);\n\n return {\n byKeyword,\n keywords,\n byName,\n names,\n };\n}\n\nfunction searchInLibrary(library: Library, filter: string, limit: number) {\n const {\n byKeyword, keywords, byName, names,\n } = library;\n\n let matched: Emoji[] = MEMO_EMPTY_ARRAY;\n\n const matchedKeywords = keywords.filter((keyword) => keyword.startsWith(filter)).sort();\n matched = matched.concat(flatten(Object.values(pickTruthy(byKeyword!, matchedKeywords))));\n\n // Also search by names, which is useful for non-English languages\n const matchedNames = names.filter((name) => name.startsWith(filter));\n matched = matched.concat(flatten(Object.values(pickTruthy(byName, matchedNames))));\n\n matched = unique(matched);\n\n return matched.slice(0, limit);\n}\n","import {\n useCallback, useEffect, useState,\n} from '../../../../lib/teact/teact';\nimport { getGlobal } from '../../../../lib/teact/teactn';\n\nimport { ApiMessageEntityTypes, ApiChatMember, ApiUser } from '../../../../api/types';\nimport { EDITABLE_INPUT_ID } from '../../../../config';\nimport { filterUsersByName, getUserFirstOrLastName } from '../../../../modules/helpers';\nimport { prepareForRegExp } from '../helpers/prepareForRegExp';\nimport focusEditableElement from '../../../../util/focusEditableElement';\nimport useFlag from '../../../../hooks/useFlag';\nimport { pickTruthy, unique } from '../../../../util/iteratees';\nimport { throttle } from '../../../../util/schedulers';\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\nlet RE_USERNAME_SEARCH: RegExp;\n\ntry {\n RE_USERNAME_SEARCH = new RegExp('(^|\\\\s)@[-_\\\\p{L}\\\\p{M}\\\\p{N}]*$', 'gui');\n} catch (e) {\n // Support for older versions of firefox\n RE_USERNAME_SEARCH = new RegExp('(^|\\\\s)@[-_\\\\d\\\\wа-яё]*$', 'gi');\n}\n\nexport default function useMentionTooltip(\n canSuggestMembers: boolean | undefined,\n htmlRef: { current: string },\n onUpdateHtml: (html: string) => void,\n inputId: string = EDITABLE_INPUT_ID,\n groupChatMembers?: ApiChatMember[],\n topInlineBotIds?: string[],\n currentUserId?: string,\n) {\n const [isOpen, markIsOpen, unmarkIsOpen] = useFlag();\n const [usersToMention, setUsersToMention] = useState<ApiUser[] | undefined>();\n\n const updateFilteredUsers = useCallback((filter, withInlineBots: boolean) => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n if (!(groupChatMembers || topInlineBotIds) || !usersById) {\n setUsersToMention(undefined);\n\n return;\n }\n\n runThrottled(() => {\n const memberIds = groupChatMembers?.reduce((acc: string[], member) => {\n if (member.userId !== currentUserId) {\n acc.push(member.userId);\n }\n\n return acc;\n }, []);\n\n const filteredIds = filterUsersByName(unique([\n ...((withInlineBots && topInlineBotIds) || []),\n ...(memberIds || []),\n ]), usersById, filter);\n\n setUsersToMention(Object.values(pickTruthy(usersById, filteredIds)));\n });\n }, [currentUserId, groupChatMembers, topInlineBotIds]);\n\n const html = htmlRef.current;\n useEffect(() => {\n if (!canSuggestMembers || !html.length) {\n unmarkIsOpen();\n return;\n }\n\n const usernameFilter = html.includes('@') && getUsernameFilter(html);\n\n if (usernameFilter) {\n const filter = usernameFilter ? usernameFilter.substr(1) : '';\n updateFilteredUsers(filter, canSuggestInlineBots(html));\n } else {\n unmarkIsOpen();\n }\n }, [canSuggestMembers, updateFilteredUsers, markIsOpen, unmarkIsOpen, html]);\n\n useEffect(() => {\n if (usersToMention?.length) {\n markIsOpen();\n } else {\n unmarkIsOpen();\n }\n }, [markIsOpen, unmarkIsOpen, usersToMention]);\n\n const insertMention = useCallback((user: ApiUser, forceFocus = false) => {\n if (!user.username && !getUserFirstOrLastName(user)) {\n return;\n }\n\n const insertedHtml = user.username\n ? `@${user.username}`\n : `<a\n class=\"text-entity-link\"\n data-entity-type=\"${ApiMessageEntityTypes.MentionName}\"\n data-user-id=\"${user.id}\"\n contenteditable=\"false\"\n dir=\"auto\"\n >${getUserFirstOrLastName(user)}</a>`;\n\n const currentHtml = htmlRef.current;\n const atIndex = currentHtml.lastIndexOf('@');\n if (atIndex !== -1) {\n onUpdateHtml(`${currentHtml.substr(0, atIndex)}${insertedHtml}&nbsp;`);\n const messageInput = document.getElementById(inputId)!;\n requestAnimationFrame(() => {\n focusEditableElement(messageInput, forceFocus);\n });\n }\n\n unmarkIsOpen();\n }, [htmlRef, inputId, onUpdateHtml, unmarkIsOpen]);\n\n return {\n isMentionTooltipOpen: isOpen,\n closeMentionTooltip: unmarkIsOpen,\n insertMention,\n mentionFilteredUsers: usersToMention,\n };\n}\n\nfunction getUsernameFilter(html: string) {\n const username = prepareForRegExp(html).match(RE_USERNAME_SEARCH);\n\n return username ? username[0].trim() : undefined;\n}\n\nfunction canSuggestInlineBots(html: string) {\n return html.startsWith('@');\n}\n","import { useEffect, useRef } from '../../../lib/teact/teact';\n\nimport useOnChange from '../../../hooks/useOnChange';\nimport useForceUpdate from '../../../hooks/useForceUpdate';\n\nexport default function useAsyncRendering<T extends any[]>(dependencies: T, delay?: number) {\n const isDisabled = delay === undefined;\n const shouldRenderRef = useRef(isDisabled);\n const timeoutRef = useRef<number>();\n const forceUpdate = useForceUpdate();\n\n useOnChange(() => {\n if (isDisabled) {\n return;\n }\n\n shouldRenderRef.current = false;\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n }, dependencies);\n\n useEffect(() => {\n if (isDisabled || shouldRenderRef.current) {\n return;\n }\n\n const exec = () => {\n shouldRenderRef.current = true;\n forceUpdate();\n };\n\n if (delay! > 0) {\n timeoutRef.current = window.setTimeout(exec, delay);\n } else {\n exec();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return shouldRenderRef.current;\n}\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, useCallback, memo, useState,\n} from '../../lib/teact/teact';\n\nimport Checkbox from './Checkbox';\n\ntype IRadioOption = {\n label: string;\n subLabel?: string;\n value: string;\n};\n\ntype OwnProps = {\n id?: string;\n options: IRadioOption[];\n selected?: string[];\n disabled?: boolean;\n round?: boolean;\n loadingOptions?: string[];\n onChange: (value: string[]) => void;\n};\n\nconst CheckboxGroup: FC<OwnProps> = ({\n id,\n options,\n selected = [],\n disabled,\n round,\n loadingOptions,\n onChange,\n}) => {\n const [values, setValues] = useState<string[]>(selected || []);\n\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n const { value, checked } = event.currentTarget;\n let newValues: string[];\n if (checked) {\n newValues = [...values, value];\n } else {\n newValues = values.filter((v) => v !== value);\n }\n\n setValues(newValues);\n onChange(newValues);\n }, [onChange, values]);\n\n return (\n <div id={id} className=\"radio-group\">\n {options.map((option) => (\n <Checkbox\n label={option.label}\n subLabel={option.subLabel}\n value={option.value}\n checked={selected.indexOf(option.value) !== -1}\n disabled={disabled}\n round={round}\n isLoading={loadingOptions ? loadingOptions.indexOf(option.value) !== -1 : undefined}\n onChange={handleChange}\n />\n ))}\n </div>\n );\n};\n\nexport default memo(CheckboxGroup);\n","import React, { FC } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport Button, { OwnProps as ButtonProps } from './Button';\n\nimport './FloatingActionButton.scss';\n\ntype OwnProps = {\n isShown: boolean;\n className?: string;\n color?: ButtonProps['color'];\n ariaLabel?: ButtonProps['ariaLabel'];\n disabled?: boolean;\n onClick: () => void;\n children: React.ReactNode;\n};\n\nconst FloatingActionButton: FC<OwnProps> = ({\n isShown,\n className,\n color = 'primary',\n ariaLabel,\n disabled,\n onClick,\n children,\n}) => {\n const buttonClassName = buildClassName(\n 'FloatingActionButton',\n isShown && 'revealed',\n className,\n );\n\n return (\n <Button\n className={buttonClassName}\n color={color}\n round\n disabled={disabled}\n onClick={isShown && !disabled ? onClick : undefined}\n ariaLabel={ariaLabel}\n tabIndex={-1}\n >\n {children}\n </Button>\n );\n};\n\nexport default FloatingActionButton;\n","import { RefObject } from 'react';\nimport React, { FC, useRef, useCallback } from '../../lib/teact/teact';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport { fastRaf } from '../../util/schedulers';\nimport buildClassName from '../../util/buildClassName';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\nimport useContextMenuPosition from '../../hooks/useContextMenuPosition';\nimport useFlag from '../../hooks/useFlag';\nimport useLang from '../../hooks/useLang';\n\nimport RippleEffect from './RippleEffect';\nimport Menu from './Menu';\nimport MenuItem from './MenuItem';\nimport Button from './Button';\n\nimport './ListItem.scss';\n\ninterface MenuItemContextAction {\n title: string;\n icon: string;\n destructive?: boolean;\n handler?: () => void;\n}\n\ninterface OwnProps {\n ref?: RefObject<HTMLDivElement>;\n buttonRef?: RefObject<HTMLDivElement>;\n icon?: string;\n secondaryIcon?: string;\n className?: string;\n style?: string;\n children: React.ReactNode;\n disabled?: boolean;\n ripple?: boolean;\n narrow?: boolean;\n inactive?: boolean;\n focus?: boolean;\n destructive?: boolean;\n multiline?: boolean;\n isStatic?: boolean;\n contextActions?: MenuItemContextAction[];\n onMouseDown?: (e: React.MouseEvent<HTMLDivElement>) => void;\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n onSecondaryIconClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst ListItem: FC<OwnProps> = ({\n ref,\n buttonRef,\n icon,\n secondaryIcon,\n className,\n style,\n children,\n disabled,\n ripple,\n narrow,\n inactive,\n focus,\n destructive,\n multiline,\n isStatic,\n contextActions,\n onMouseDown,\n onClick,\n onSecondaryIconClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n let containerRef = useRef<HTMLDivElement>(null);\n if (ref) {\n containerRef = ref;\n }\n const [isTouched, markIsTouched, unmarkIsTouched] = useFlag();\n\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(containerRef, !contextActions);\n\n const getTriggerElement = useCallback(() => containerRef.current, []);\n\n const getRootElement = useCallback(\n () => containerRef.current!.closest('.custom-scroll'),\n [],\n );\n\n const getMenuElement = useCallback(\n () => containerRef.current!.querySelector('.ListItem-context-menu .bubble'),\n [],\n );\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style: menuStyle,\n } = useContextMenuPosition(\n contextMenuPosition,\n getTriggerElement,\n getRootElement,\n getMenuElement,\n );\n\n const handleClick = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (disabled || !onClick) {\n return;\n }\n onClick(e);\n\n if (IS_TOUCH_ENV && !ripple) {\n markIsTouched();\n fastRaf(unmarkIsTouched);\n }\n }, [disabled, markIsTouched, onClick, ripple, unmarkIsTouched]);\n\n const handleSecondaryIconClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (disabled || e.button !== 0 || (!onSecondaryIconClick && !contextActions)) return;\n e.stopPropagation();\n if (onSecondaryIconClick) {\n onSecondaryIconClick(e);\n } else {\n handleContextMenu(e);\n }\n };\n\n const handleMouseDown = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (inactive || IS_TOUCH_ENV) {\n return;\n }\n if (contextActions && (e.button === 2 || !onClick)) {\n handleBeforeContextMenu(e);\n }\n if (e.button === 0) {\n if (!onClick) {\n handleContextMenu(e);\n } else {\n handleClick(e);\n }\n }\n }, [inactive, contextActions, onClick, handleBeforeContextMenu, handleContextMenu, handleClick]);\n\n const lang = useLang();\n\n const fullClassName = buildClassName(\n 'ListItem',\n className,\n !isStatic && 'no-selection',\n ripple && 'has-ripple',\n narrow && 'narrow',\n disabled && 'disabled',\n inactive && 'inactive',\n contextMenuPosition && 'has-menu-open',\n focus && 'focus',\n destructive && 'destructive',\n multiline && 'multiline',\n isStatic && 'is-static',\n );\n\n return (\n <div\n ref={containerRef}\n className={fullClassName}\n dir={lang.isRtl ? 'rtl' : undefined}\n style={style}\n onMouseDown={onMouseDown}\n >\n <div\n className={buildClassName('ListItem-button', isTouched && 'active')}\n role=\"button\"\n ref={buttonRef}\n tabIndex={0}\n onClick={(!inactive && IS_TOUCH_ENV) ? handleClick : undefined}\n onMouseDown={handleMouseDown}\n onContextMenu={(!inactive && contextActions) ? handleContextMenu : undefined}\n >\n {icon && (\n <i className={`icon-${icon}`} />\n )}\n {multiline && (<div className=\"multiline-item\">{children}</div>)}\n {!multiline && children}\n {!disabled && !inactive && ripple && (\n <RippleEffect />\n )}\n {secondaryIcon && (\n <Button\n className=\"secondary-icon\"\n round\n color=\"translucent\"\n size=\"smaller\"\n onClick={IS_TOUCH_ENV ? handleSecondaryIconClick : undefined}\n onMouseDown={!IS_TOUCH_ENV ? handleSecondaryIconClick : undefined}\n >\n <i className={`icon-${secondaryIcon}`} />\n </Button>\n )}\n </div>\n {contextActions && contextMenuPosition !== undefined && (\n <Menu\n isOpen={isContextMenuOpen}\n transformOriginX={transformOriginX}\n transformOriginY={transformOriginY}\n positionX={positionX}\n positionY={positionY}\n style={menuStyle}\n className=\"ListItem-context-menu\"\n autoClose\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n >\n {contextActions.map((action) => (\n <MenuItem\n key={action.title}\n icon={action.icon}\n destructive={action.destructive}\n disabled={!action.handler}\n onClick={action.handler}\n >\n {action.title}\n </MenuItem>\n ))}\n </Menu>\n )}\n </div>\n );\n};\n\nexport default ListItem;\n","import React, {\n FC,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from '../../lib/teact/teact';\n\nimport { ANIMATION_END_DELAY } from '../../config';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport buildClassName from '../../util/buildClassName';\nimport captureEscKeyListener from '../../util/captureEscKeyListener';\nimport { TextPart } from '../common/helpers/renderMessageText';\n\nimport Portal from './Portal';\n\nimport './Notification.scss';\n\ntype OwnProps = {\n containerId?: string;\n message: TextPart[];\n duration?: number;\n onDismiss: () => void;\n};\n\nconst DEFAULT_DURATION = 3000;\nconst ANIMATION_DURATION = 150;\n\nconst Notification: FC<OwnProps> = ({\n message, duration = DEFAULT_DURATION, containerId, onDismiss,\n}) => {\n const [isOpen, setIsOpen] = useState(true);\n // eslint-disable-next-line no-null/no-null\n const timerRef = useRef<number | undefined>(null);\n\n const { transitionClassNames } = useShowTransition(isOpen);\n\n const closeAndDismiss = useCallback(() => {\n setIsOpen(false);\n setTimeout(onDismiss, ANIMATION_DURATION + ANIMATION_END_DELAY);\n }, [onDismiss]);\n\n useEffect(() => (isOpen ? captureEscKeyListener(closeAndDismiss) : undefined), [isOpen, closeAndDismiss]);\n\n useEffect(() => {\n timerRef.current = window.setTimeout(closeAndDismiss, duration);\n\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n };\n }, [duration, closeAndDismiss]);\n\n const handleMouseEnter = useCallback(() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n timerRef.current = window.setTimeout(closeAndDismiss, duration);\n }, [duration, closeAndDismiss]);\n\n return (\n <Portal className=\"Notification-container\" containerId={containerId}>\n <div\n className={buildClassName('Notification', transitionClassNames)}\n onClick={closeAndDismiss}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <div className=\"content\">\n {message}\n </div>\n </div>\n </Portal>\n );\n};\n\nexport default Notification;\n","import React, {\n FC, useEffect, useRef, memo,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport './ProgressSpinner.scss';\n\nconst RADIUSES = {\n s: 22, m: 25, l: 28, xl: 20,\n};\nconst STROKE_WIDTH = 2;\nconst MIN_PROGRESS = 0.05;\nconst MAX_PROGRESS = 1;\n\nconst ProgressSpinner: FC<{\n progress?: number;\n size?: 's' | 'm' | 'l' | 'xl';\n square?: boolean;\n transparent?: boolean;\n noCross?: boolean;\n onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n}> = ({\n progress = 0,\n size = 'l',\n square,\n transparent,\n noCross,\n onClick,\n}) => {\n const radius = RADIUSES[size];\n const circleRadius = radius - STROKE_WIDTH * 2;\n const borderRadius = radius - 1;\n const circumference = circleRadius * 2 * Math.PI;\n // eslint-disable-next-line no-null/no-null\n const container = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!container.current) {\n return;\n }\n\n const svg = container.current.firstElementChild;\n const strokeDashOffset = circumference - Math.min(Math.max(MIN_PROGRESS, progress), MAX_PROGRESS) * circumference;\n\n if (!svg) {\n container.current.innerHTML = `<svg\n viewBox=\"0 0 ${borderRadius * 2} ${borderRadius * 2}\"\n height=\"${borderRadius * 2}\"\n width=\"${borderRadius * 2}\"\n >\n <circle\n stroke=\"white\"\n fill=\"transparent\"\n stroke-width=${STROKE_WIDTH}\n stroke-dasharray=\"${circumference} ${circumference}\"}\n stroke-dashoffset=\"${strokeDashOffset}\"\n stroke-linecap=\"round\"\n r=${circleRadius}\n cx=${borderRadius}\n cy=${borderRadius}\n />\n </svg>`;\n } else {\n (svg.firstElementChild as SVGElement).setAttribute('stroke-dashoffset', strokeDashOffset.toString());\n }\n }, [container, circumference, borderRadius, circleRadius, progress]);\n\n const className = buildClassName(\n `ProgressSpinner size-${size}`,\n transparent && 'transparent',\n square && 'square',\n noCross && 'no-cross',\n );\n\n return (\n <div\n ref={container}\n className={className}\n onClick={onClick}\n />\n );\n};\n\nexport default memo(ProgressSpinner);\n","import { ChangeEvent } from 'react';\nimport React, { FC, memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport Spinner from './Spinner';\n\nimport './Radio.scss';\n\ntype OwnProps = {\n id?: string;\n name: string;\n label: string;\n subLabel?: string;\n value: string;\n checked: boolean;\n disabled?: boolean;\n hidden?: boolean;\n isLoading?: boolean;\n onChange: (e: ChangeEvent<HTMLInputElement>) => void;\n};\n\nconst Radio: FC<OwnProps> = ({\n id,\n label,\n subLabel,\n value,\n name,\n checked,\n disabled,\n hidden,\n isLoading,\n onChange,\n}) => {\n const lang = useLang();\n const className = buildClassName(\n 'Radio',\n disabled && 'disabled',\n hidden && 'hidden-widget',\n isLoading && 'loading',\n );\n\n return (\n <label className={className} dir={lang.isRtl ? 'rtl' : undefined}>\n <input\n type=\"radio\"\n name={name}\n value={value}\n id={id}\n checked={checked}\n onChange={onChange}\n disabled={disabled || hidden}\n />\n <div className=\"Radio-main\">\n <span className=\"label\" dir={lang.isRtl ? 'auto' : undefined}>{label}</span>\n {subLabel && <span className=\"subLabel\" dir={lang.isRtl ? 'auto' : undefined}>{subLabel}</span>}\n </div>\n {isLoading && <Spinner />}\n </label>\n );\n};\n\nexport default memo(Radio);\n","import { ChangeEvent } from 'react';\nimport React, { FC, useCallback, memo } from '../../lib/teact/teact';\n\nimport Radio from './Radio';\n\nexport type IRadioOption = {\n label: string;\n subLabel?: string;\n value: string;\n hidden?: boolean;\n};\n\ntype OwnProps = {\n id?: string;\n name: string;\n options: IRadioOption[];\n selected?: string;\n disabled?: boolean;\n loadingOption?: string;\n onChange: (value: string) => void;\n};\n\nconst RadioGroup: FC<OwnProps> = ({\n id,\n name,\n options,\n selected,\n disabled,\n loadingOption,\n onChange,\n}) => {\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n const { value } = event.currentTarget;\n onChange(value);\n }, [onChange]);\n\n return (\n <div id={id} className=\"radio-group\">\n {options.map((option) => (\n <Radio\n name={name}\n label={option.label}\n subLabel={option.subLabel}\n value={option.value}\n checked={option.value === selected}\n hidden={option.hidden}\n disabled={disabled}\n isLoading={loadingOption ? loadingOption === option.value : undefined}\n onChange={handleChange}\n />\n ))}\n </div>\n );\n};\n\nexport default memo(RadioGroup);\n","import { ChangeEvent } from 'react';\nimport React, {\n FC, useCallback, useMemo, memo,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport './RangeSlider.scss';\n\ntype OwnProps = {\n options?: string[];\n min?: number;\n max?: number;\n step?: number;\n label?: string;\n value: number;\n renderValue?: (value: number) => string;\n disabled?: boolean;\n onChange: (value: number) => void;\n};\n\nconst RangeSlider: FC<OwnProps> = ({\n options,\n min = 0,\n max = options ? options.length - 1 : 100,\n step = 1,\n label,\n value,\n renderValue,\n disabled,\n onChange,\n}) => {\n const lang = useLang();\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n onChange(Number(event.currentTarget.value));\n }, [onChange]);\n\n const className = buildClassName(\n 'RangeSlider',\n disabled && 'disabled',\n );\n\n const trackWidth = useMemo(() => {\n if (options) {\n return (value / (options.length - 1)) * 100;\n } else {\n const possibleValuesLength = (max - min) / step;\n return ((value - min) / possibleValuesLength) * 100;\n }\n }, [options, value, max, min, step]);\n\n return (\n <div className={className}>\n {label && (\n <div className=\"slider-top-row\" dir={lang.isRtl ? 'rtl' : undefined}>\n <span className=\"label\" dir=\"auto\">{label}</span>\n {!options && (\n <span className=\"value\" dir=\"auto\">{renderValue ? renderValue(value) : value}</span>\n )}\n </div>\n )}\n <div className=\"slider-main\">\n <div\n className=\"slider-fill-track\"\n style={`width: ${trackWidth}%`}\n />\n <input\n min={min}\n max={max}\n value={value}\n step={step}\n type=\"range\"\n onChange={handleChange}\n />\n {options && (\n <div className=\"slider-options\">\n {options.map((option, index) => (\n <div\n className={buildClassName('slider-option no-selection', index === value && 'active')}\n onClick={() => onChange(index)}\n >\n {option}\n </div>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(RangeSlider);\n","import { RefObject } from 'react';\nimport React, {\n FC, useRef, useEffect, memo, useCallback,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useFlag from '../../hooks/useFlag';\nimport useLang from '../../hooks/useLang';\nimport useInputFocusOnOpen from '../../hooks/useInputFocusOnOpen';\n\nimport Loading from './Loading';\nimport Button from './Button';\nimport ShowTransition from './ShowTransition';\n\nimport './SearchInput.scss';\n\ntype OwnProps = {\n ref?: RefObject<HTMLInputElement>;\n children?: React.ReactNode;\n parentContainerClassName?: string;\n className?: string;\n inputId?: string;\n value?: string;\n focused?: boolean;\n isLoading?: boolean;\n spinnerColor?: 'yellow';\n spinnerBackgroundColor?: 'light';\n placeholder?: string;\n disabled?: boolean;\n autoComplete?: string;\n canClose?: boolean;\n autoFocusSearch?: boolean;\n onChange: (value: string) => void;\n onReset?: NoneToVoidFunction;\n onFocus?: NoneToVoidFunction;\n onBlur?: NoneToVoidFunction;\n onSpinnerClick?: NoneToVoidFunction;\n};\n\nconst SearchInput: FC<OwnProps> = ({\n ref,\n children,\n parentContainerClassName,\n value,\n inputId,\n className,\n focused,\n isLoading,\n spinnerColor,\n spinnerBackgroundColor,\n placeholder,\n disabled,\n autoComplete,\n canClose,\n autoFocusSearch,\n onChange,\n onReset,\n onFocus,\n onBlur,\n onSpinnerClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n let inputRef = useRef<HTMLInputElement>(null);\n if (ref) {\n inputRef = ref;\n }\n\n const [isInputFocused, markInputFocused, unmarkInputFocused] = useFlag(focused);\n\n useInputFocusOnOpen(inputRef, autoFocusSearch, unmarkInputFocused);\n\n useEffect(() => {\n if (!inputRef.current) {\n return;\n }\n\n if (focused) {\n inputRef.current.focus();\n } else {\n inputRef.current.blur();\n }\n }, [focused, placeholder]); // Trick for setting focus when selecting a contact to search for\n\n const lang = useLang();\n\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { currentTarget } = event;\n onChange(currentTarget.value);\n }\n\n function handleFocus() {\n markInputFocused();\n if (onFocus) {\n onFocus();\n }\n }\n\n function handleBlur() {\n unmarkInputFocused();\n if (onBlur) {\n onBlur();\n }\n }\n\n const handleKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === 'ArrowDown' || e.key === 'Enter') {\n const element = document.querySelector(`.${parentContainerClassName} .ListItem-button`) as HTMLElement;\n if (element) {\n element.focus();\n }\n }\n }, [parentContainerClassName]);\n\n return (\n <div\n className={buildClassName('SearchInput', className, isInputFocused && 'has-focus')}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n {children}\n <input\n ref={inputRef}\n id={inputId}\n type=\"text\"\n dir=\"auto\"\n placeholder={placeholder || lang('Search')}\n className=\"form-control\"\n value={value}\n disabled={disabled}\n autoComplete={autoComplete}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n />\n <i className=\"icon-search\" />\n <ShowTransition isOpen={Boolean(isLoading)} className=\"slow\">\n <Loading color={spinnerColor} backgroundColor={spinnerBackgroundColor} onClick={onSpinnerClick} />\n </ShowTransition>\n {!isLoading && (value || canClose) && onReset && (\n <Button\n round\n size=\"tiny\"\n color=\"translucent\"\n onClick={onReset}\n >\n <span className=\"icon-close\" />\n </Button>\n )}\n </div>\n );\n};\n\nexport default memo(SearchInput);\n","import React, { FC, useRef } from '../../lib/teact/teact';\n\nimport useShowTransition from '../../hooks/useShowTransition';\nimport usePrevious from '../../hooks/usePrevious';\nimport buildClassName from '../../util/buildClassName';\n\n\ntype OwnProps = {\n isOpen: boolean;\n isCustom?: boolean;\n id?: string;\n className?: string;\n onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n children: React.ReactNode;\n};\n\nconst ShowTransition: FC<OwnProps> = ({\n isOpen, isCustom, id, className, onClick, children,\n}) => {\n const { shouldRender, transitionClassNames } = useShowTransition(\n isOpen, undefined, undefined, isCustom ? false : undefined,\n );\n const prevIsOpen = usePrevious(isOpen);\n const prevChildren = usePrevious(children);\n const fromChildrenRef = useRef<React.ReactNode>();\n\n if (prevIsOpen && !isOpen) {\n fromChildrenRef.current = prevChildren;\n }\n\n return (\n shouldRender && (\n <div id={id} className={buildClassName(className, transitionClassNames)} onClick={onClick}>\n {isOpen ? children : fromChildrenRef.current!}\n </div>\n )\n );\n};\n\nexport default ShowTransition;\n","import { ChangeEvent } from 'react';\nimport React, { FC, memo, useCallback } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport './Switcher.scss';\n\ntype OwnProps = {\n id?: string;\n name?: string;\n value?: string;\n label: string;\n checked?: boolean;\n disabled?: boolean;\n inactive?: boolean;\n noAnimation?: boolean;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n onCheck?: (isChecked: boolean) => void;\n};\n\nconst Switcher: FC<OwnProps> = ({\n id,\n name,\n value,\n label,\n checked = false,\n disabled,\n inactive,\n noAnimation,\n onChange,\n onCheck,\n}) => {\n const handleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(e);\n }\n\n if (onCheck) {\n onCheck(e.currentTarget.checked);\n }\n }, [onChange, onCheck]);\n\n const className = buildClassName(\n 'Switcher',\n disabled && 'disabled',\n inactive && 'inactive',\n noAnimation && 'no-animation',\n );\n\n return (\n <label className={className} title={label}>\n <input\n type=\"checkbox\"\n id={id}\n name={name}\n value={value}\n checked={checked}\n disabled={disabled}\n onChange={handleChange}\n />\n <span className=\"widget\" />\n </label>\n );\n};\n\nexport default memo(Switcher);\n","import React, {\n FC, useRef, memo, useEffect,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport forceReflow from '../../util/forceReflow';\nimport renderText from '../common/helpers/renderText';\n\nimport './Tab.scss';\n\ntype OwnProps = {\n className?: string;\n title: string;\n isActive?: boolean;\n badgeCount?: number;\n isBadgeActive?: boolean;\n previousActiveTab?: number;\n onClick: (arg: number) => void;\n clickArg: number;\n};\n\nconst classNames = {\n active: 'Tab--active',\n badgeActive: 'Tab__badge--active',\n};\n\nconst Tab: FC<OwnProps> = ({\n className,\n title,\n isActive,\n badgeCount,\n isBadgeActive,\n previousActiveTab,\n onClick,\n clickArg,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const tabRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n // Set initial active state\n if (isActive && previousActiveTab === undefined && tabRef.current) {\n tabRef.current.classList.add(classNames.active);\n }\n\n if (!isActive || previousActiveTab === undefined) {\n return;\n }\n\n const tabEl = tabRef.current!;\n const prevTabEl = tabEl.parentElement!.children[previousActiveTab];\n if (!prevTabEl) {\n return;\n }\n\n const platformEl = tabEl.querySelector('i')!;\n const prevPlatformEl = prevTabEl.querySelector('i')!;\n\n // We move and resize the platform, so it repeats the position and size of the previous one\n const shiftLeft = prevPlatformEl.parentElement!.offsetLeft - platformEl.parentElement!.offsetLeft;\n const scaleFactor = prevPlatformEl.clientWidth / platformEl.clientWidth;\n\n prevPlatformEl.classList.remove('animate');\n platformEl.classList.remove('animate');\n platformEl.style.transform = `translate3d(${shiftLeft}px, 0, 0) scale3d(${scaleFactor}, 1, 1)`;\n forceReflow(platformEl);\n platformEl.classList.add('animate');\n platformEl.style.transform = 'none';\n\n prevTabEl.classList.remove(classNames.active);\n tabEl.classList.add(classNames.active);\n }, [isActive, previousActiveTab]);\n\n return (\n <div\n className={buildClassName('Tab', className)}\n onClick={() => onClick(clickArg)}\n ref={tabRef}\n >\n <span>\n {renderText(title)}\n {Boolean(badgeCount) && (\n <span className={buildClassName('badge', isBadgeActive && classNames.badgeActive)}>{badgeCount}</span>\n )}\n <i />\n </span>\n </div>\n );\n};\n\nexport default memo(Tab);\n","import React, {\n FC, memo, useRef, useEffect,\n} from '../../lib/teact/teact';\n\nimport { IS_ANDROID, IS_IOS } from '../../util/environment';\nimport fastSmoothScrollHorizontal from '../../util/fastSmoothScrollHorizontal';\nimport usePrevious from '../../hooks/usePrevious';\nimport useHorizontalScroll from '../../hooks/useHorizontalScroll';\nimport useLang from '../../hooks/useLang';\n\nimport Tab from './Tab';\n\nimport './TabList.scss';\n\nexport type TabWithProperties = {\n title: string;\n badgeCount?: number;\n isBadgeActive?: boolean;\n};\n\ntype OwnProps = {\n tabs: readonly TabWithProperties[];\n activeTab: number;\n big?: boolean;\n onSwitchTab: (index: number) => void;\n};\n\nconst TAB_SCROLL_THRESHOLD_PX = 16;\n// Should match duration from `--slide-transition` CSS variable\nconst SCROLL_DURATION = IS_IOS ? 450 : IS_ANDROID ? 400 : 300;\n\nconst TabList: FC<OwnProps> = ({\n tabs, activeTab, big, onSwitchTab,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const previousActiveTab = usePrevious(activeTab);\n\n useHorizontalScroll(containerRef.current);\n\n // Scroll container to place active tab in the center\n useEffect(() => {\n const container = containerRef.current!;\n const { scrollWidth, offsetWidth, scrollLeft } = container;\n if (scrollWidth <= offsetWidth) {\n return;\n }\n\n const activeTabElement = container.childNodes[activeTab] as HTMLElement | null;\n if (!activeTabElement) {\n return;\n }\n\n const { offsetLeft: activeTabOffsetLeft, offsetWidth: activeTabOffsetWidth } = activeTabElement;\n const newLeft = activeTabOffsetLeft - (offsetWidth / 2) + (activeTabOffsetWidth / 2);\n\n // Prevent scrolling by only a couple of pixels, which doesn't look smooth\n if (Math.abs(newLeft - scrollLeft) < TAB_SCROLL_THRESHOLD_PX) {\n return;\n }\n\n fastSmoothScrollHorizontal(container, newLeft, SCROLL_DURATION);\n }, [activeTab]);\n\n const lang = useLang();\n\n return (\n <div\n className={`TabList no-selection no-scrollbar ${big ? 'big' : ''}`}\n ref={containerRef}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n {tabs.map((tab, i) => (\n <Tab\n key={tab.title}\n title={lang(tab.title)}\n isActive={i === activeTab}\n badgeCount={tab.badgeCount}\n isBadgeActive={tab.isBadgeActive}\n previousActiveTab={previousActiveTab}\n onClick={onSwitchTab}\n clickArg={i}\n />\n ))}\n </div>\n );\n};\n\nexport default memo(TabList);\n","import { RefObject } from 'react';\nimport React, {\n FC, useLayoutEffect, useRef,\n} from '../../lib/teact/teact';\nimport { getGlobal } from '../../lib/teact/teactn';\nimport { GlobalState } from '../../global/types';\n\nimport { ANIMATION_LEVEL_MIN } from '../../config';\nimport buildClassName from '../../util/buildClassName';\nimport forceReflow from '../../util/forceReflow';\nimport { waitForAnimationEnd, waitForTransitionEnd } from '../../util/cssAnimationEndListeners';\nimport useForceUpdate from '../../hooks/useForceUpdate';\nimport usePrevious from '../../hooks/usePrevious';\nimport { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\n\nimport './Transition.scss';\n\nexport type ChildrenFn = (isActive: boolean, isFrom: boolean, currentKey: number) => React.ReactNode;\nexport type TransitionProps = {\n ref?: RefObject<HTMLDivElement>;\n activeKey: number;\n name: (\n 'none' | 'slide' | 'slide-rtl' | 'mv-slide' | 'slide-fade' | 'zoom-fade' | 'slide-layers'\n | 'fade' | 'push-slide' | 'reveal' | 'slide-optimized' | 'slide-optimized-rtl'\n );\n direction?: 'auto' | 'inverse' | 1 | -1;\n renderCount?: number;\n shouldRestoreHeight?: boolean;\n shouldCleanup?: boolean;\n cleanupExceptionKey?: number;\n isDisabled?: boolean;\n id?: string;\n className?: string;\n onStart?: NoneToVoidFunction;\n onStop?: NoneToVoidFunction;\n children: React.ReactNode | ChildrenFn;\n};\n\nconst classNames = {\n active: 'Transition__slide--active',\n};\n\nconst Transition: FC<TransitionProps> = ({\n ref,\n activeKey,\n name,\n direction = 'auto',\n renderCount,\n shouldRestoreHeight,\n shouldCleanup,\n cleanupExceptionKey,\n id,\n className,\n onStart,\n onStop,\n children,\n}) => {\n // No need for a container to update on change\n const { animationLevel } = getGlobal().settings.byKey;\n const currentKeyRef = useRef<number>();\n\n // eslint-disable-next-line no-null/no-null\n let containerRef = useRef<HTMLDivElement>(null);\n if (ref) {\n containerRef = ref;\n }\n\n const rendersRef = useRef<Record<number, React.ReactNode | ChildrenFn>>({});\n const prevActiveKey = usePrevious<any>(activeKey);\n const forceUpdate = useForceUpdate();\n\n const activeKeyChanged = prevActiveKey !== undefined && activeKey !== prevActiveKey;\n\n if (!renderCount && activeKeyChanged) {\n rendersRef.current = { [prevActiveKey]: rendersRef.current[prevActiveKey] };\n }\n\n rendersRef.current[activeKey] = children;\n\n useLayoutEffect(() => {\n function cleanup() {\n if (!shouldCleanup) {\n return;\n }\n\n const preservedRender = cleanupExceptionKey !== undefined ? rendersRef.current[cleanupExceptionKey] : undefined;\n\n rendersRef.current = preservedRender ? { [cleanupExceptionKey!]: preservedRender } : {};\n\n forceUpdate();\n }\n\n const container = containerRef.current!;\n\n const childElements = container.children;\n if (childElements.length === 1 && !activeKeyChanged) {\n if (name.startsWith('slide-optimized')) {\n (childElements[0] as HTMLElement).style.transition = 'none';\n (childElements[0] as HTMLElement).style.transform = 'translate3d(0, 0, 0)';\n }\n\n childElements[0].classList.add(classNames.active);\n\n return;\n }\n\n const childNodes = Array.from(container.childNodes);\n\n if (!activeKeyChanged || !childNodes.length) {\n return;\n }\n\n currentKeyRef.current = activeKey;\n\n const isBackwards = (\n direction === -1\n || (direction === 'auto' && prevActiveKey > activeKey)\n || (direction === 'inverse' && prevActiveKey < activeKey)\n );\n\n const keys = Object.keys(rendersRef.current).map(Number);\n const prevActiveIndex = renderCount ? prevActiveKey : keys.indexOf(prevActiveKey);\n const activeIndex = renderCount ? activeKey : keys.indexOf(activeKey);\n\n if (name === 'slide-optimized' || name === 'slide-optimized-rtl') {\n performSlideOptimized(\n animationLevel,\n name,\n isBackwards,\n cleanup,\n activeKey,\n currentKeyRef,\n container,\n shouldRestoreHeight,\n onStart,\n onStop,\n childNodes[activeIndex] as HTMLElement,\n childNodes[prevActiveIndex] as HTMLElement,\n );\n\n return;\n }\n\n container.classList.remove('animating');\n container.classList.toggle('backwards', isBackwards);\n\n if (name === 'none' || animationLevel === ANIMATION_LEVEL_MIN) {\n childNodes.forEach((node, i) => {\n if (node instanceof HTMLElement) {\n node.classList.remove('from', 'through', 'to');\n node.classList.toggle(classNames.active, i === activeIndex);\n }\n });\n\n cleanup();\n\n return;\n }\n\n childNodes.forEach((node, i) => {\n if (node instanceof HTMLElement) {\n node.classList.remove(classNames.active);\n node.classList.toggle('from', i === prevActiveIndex);\n node.classList.toggle('through', (\n (i > prevActiveIndex && i < activeIndex) || (i < prevActiveIndex && i > activeIndex)\n ));\n node.classList.toggle('to', i === activeIndex);\n }\n });\n\n const dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();\n\n requestAnimationFrame(() => {\n container.classList.add('animating');\n\n onStart?.();\n\n function onAnimationEnd() {\n requestAnimationFrame(() => {\n if (activeKey !== currentKeyRef.current) {\n return;\n }\n\n container.classList.remove('animating', 'backwards');\n\n childNodes.forEach((node, i) => {\n if (node instanceof HTMLElement) {\n node.classList.remove('from', 'through', 'to');\n node.classList.toggle(classNames.active, i === activeIndex);\n }\n });\n\n if (shouldRestoreHeight) {\n const activeElement = container.querySelector<HTMLDivElement>(`.${classNames.active}`);\n\n if (activeElement) {\n activeElement.style.height = 'auto';\n container.style.height = `${activeElement.clientHeight}px`;\n }\n }\n\n onStop?.();\n dispatchHeavyAnimationStop();\n cleanup();\n });\n }\n\n const watchedNode = name === 'mv-slide'\n ? childNodes[activeIndex]?.firstChild\n : name === 'reveal' && isBackwards\n ? childNodes[prevActiveIndex]\n : childNodes[activeIndex];\n\n if (watchedNode) {\n waitForAnimationEnd(watchedNode, onAnimationEnd);\n } else {\n onAnimationEnd();\n }\n });\n }, [\n activeKey,\n prevActiveKey,\n activeKeyChanged,\n direction,\n name,\n onStart,\n onStop,\n renderCount,\n shouldRestoreHeight,\n shouldCleanup,\n cleanupExceptionKey,\n animationLevel,\n forceUpdate,\n ]);\n\n useLayoutEffect(() => {\n if (shouldRestoreHeight) {\n const container = containerRef.current!;\n const activeElement = container.querySelector<HTMLDivElement>(`.${classNames.active}`)\n || container.querySelector<HTMLDivElement>('.from');\n\n if (activeElement) {\n activeElement.style.height = 'auto';\n container.style.height = `${activeElement.clientHeight}px`;\n container.style.flexBasis = `${activeElement.clientHeight}px`;\n }\n }\n }, [shouldRestoreHeight, children]);\n\n const renders = rendersRef.current;\n const collection = Object.keys(renderCount ? new Array(renderCount).fill(undefined) : renders).map(Number);\n\n const contents = collection.map((key) => {\n const render = renders[key];\n if (!render) {\n return undefined;\n }\n\n return (\n <div key={key} teactOrderKey={key}>{\n typeof render === 'function'\n ? render(key === activeKey, key === prevActiveKey, activeKey)\n : render\n }</div>\n );\n });\n\n return (\n <div\n ref={containerRef}\n id={id}\n className={buildClassName('Transition', className, name)}\n teactFastList={!renderCount && !shouldCleanup}\n >\n {contents}\n </div>\n );\n};\n\nexport default Transition;\n\nfunction performSlideOptimized(\n animationLevel: GlobalState['settings']['byKey']['animationLevel'],\n name: 'slide-optimized' | 'slide-optimized-rtl',\n isBackwards: boolean,\n cleanup: NoneToVoidFunction,\n activeKey: number,\n currentKeyRef: { current: number | undefined },\n container: HTMLElement,\n shouldRestoreHeight?: boolean,\n onStart?: NoneToVoidFunction,\n onStop?: NoneToVoidFunction,\n toSlide?: HTMLElement,\n fromSlide?: HTMLElement,\n) {\n if (!fromSlide || !toSlide) {\n return;\n }\n\n if (animationLevel === ANIMATION_LEVEL_MIN) {\n fromSlide.style.transition = 'none';\n fromSlide.style.transform = '';\n fromSlide.classList.remove(classNames.active);\n\n toSlide.style.transition = 'none';\n toSlide.style.transform = 'translate3d(0, 0, 0)';\n toSlide.classList.add(classNames.active);\n\n cleanup();\n\n return;\n }\n\n if (name === 'slide-optimized-rtl') {\n isBackwards = !isBackwards;\n }\n\n const dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();\n\n requestAnimationFrame(() => {\n onStart?.();\n\n fromSlide.style.transition = 'none';\n fromSlide.style.transform = 'translate3d(0, 0, 0)';\n\n toSlide.style.transition = 'none';\n toSlide.style.transform = `translate3d(${isBackwards ? '-' : ''}100%, 0, 0)`;\n\n forceReflow(toSlide);\n\n fromSlide.style.transition = '';\n fromSlide.style.transform = `translate3d(${isBackwards ? '' : '-'}100%, 0, 0)`;\n\n toSlide.style.transition = '';\n toSlide.style.transform = 'translate3d(0, 0, 0)';\n\n fromSlide.classList.remove(classNames.active);\n toSlide.classList.add(classNames.active);\n\n waitForTransitionEnd(fromSlide, () => {\n if (activeKey !== currentKeyRef.current) {\n return;\n }\n\n fromSlide.style.transition = 'none';\n fromSlide.style.transform = '';\n\n if (shouldRestoreHeight) {\n toSlide.style.height = 'auto';\n container.style.height = `${toSlide.clientHeight}px`;\n }\n\n onStop?.();\n dispatchHeavyAnimationStop();\n cleanup();\n });\n });\n}\n","import useReducer, { StateReducer, Dispatch } from '../useReducer';\nimport { ApiChatFolder } from '../../api/types';\nimport { pick, omit } from '../../util/iteratees';\n\nexport type FolderChatType = {\n icon: string;\n title: string;\n key: keyof Pick<ApiChatFolder, (\n 'contacts' | 'nonContacts' | 'groups' | 'channels' | 'bots' |\n 'excludeMuted' | 'excludeArchived' | 'excludeRead'\n )>;\n};\n\nexport const INCLUDED_CHAT_TYPES: FolderChatType[] = [\n { icon: 'user', title: 'FilterContacts', key: 'contacts' },\n { icon: 'non-contacts', title: 'FilterNonContacts', key: 'nonContacts' },\n { icon: 'group', title: 'FilterGroups', key: 'groups' },\n { icon: 'channel', title: 'FilterChannels', key: 'channels' },\n { icon: 'bots', title: 'FilterBots', key: 'bots' },\n];\n\nexport const EXCLUDED_CHAT_TYPES: FolderChatType[] = [\n { icon: 'mute', title: 'FilterMuted', key: 'excludeMuted' },\n { icon: 'archive', title: 'FilterArchived', key: 'excludeArchived' },\n { icon: 'readchats', title: 'FilterRead', key: 'excludeRead' },\n];\n\nconst INCLUDE_FILTER_FIELDS: Array<keyof FolderIncludeFilters> = [\n 'includedChatIds', 'bots', 'channels', 'groups', 'contacts', 'nonContacts',\n];\nconst EXCLUDE_FILTER_FIELDS: Array<keyof FolderExcludeFilters> = [\n 'excludedChatIds', 'excludeArchived', 'excludeMuted', 'excludeRead',\n];\n\nexport function selectChatFilters(state: FoldersState, mode: 'included' | 'excluded', selectTemp?: boolean) {\n let selectedChatIds: string[] = [];\n let selectedChatTypes: FolderChatType['key'][] = [];\n\n if (mode === 'included') {\n const {\n includedChatIds,\n ...includeFilters\n } = selectTemp\n ? state.includeFilters || {}\n : pick(\n state.folder,\n INCLUDE_FILTER_FIELDS,\n );\n\n selectedChatIds = includedChatIds || [];\n selectedChatTypes = (Object.keys(includeFilters) as Array<keyof typeof includeFilters>)\n .filter((key) => Boolean(includeFilters[key]));\n } else {\n const {\n excludedChatIds,\n ...excludeFilters\n } = selectTemp\n ? state.excludeFilters || {}\n : pick(\n state.folder,\n EXCLUDE_FILTER_FIELDS,\n );\n\n selectedChatIds = excludedChatIds || [];\n selectedChatTypes = (Object.keys(excludeFilters) as Array<keyof typeof excludeFilters>)\n .filter((key) => Boolean(excludeFilters[key]));\n }\n\n return {\n selectedChatIds,\n selectedChatTypes,\n };\n}\n\nfunction getSuggestedFolderName(includeFilters?: FolderIncludeFilters) {\n if (includeFilters) {\n const {\n includedChatIds,\n ...filters\n } = includeFilters;\n\n if (\n Object.values(filters).filter(Boolean).length > 1\n || (includedChatIds?.length)\n ) {\n return '';\n }\n\n if (filters.bots) {\n return 'Bots';\n } else if (filters.groups) {\n return 'Groups';\n } else if (filters.channels) {\n return 'Channels';\n } else if (filters.contacts) {\n return 'Contacts';\n } else if (filters.nonContacts) {\n return 'Non-Contacts';\n }\n }\n\n return '';\n}\n\ntype FolderIncludeFilters = Pick<ApiChatFolder, (\n 'includedChatIds' | 'bots' | 'channels' | 'groups' | 'contacts' | 'nonContacts'\n)>;\ntype FolderExcludeFilters = Pick<ApiChatFolder, 'excludedChatIds' | 'excludeArchived' | 'excludeMuted' | 'excludeRead'>;\n\nexport type FoldersState = {\n mode: 'create' | 'edit';\n isLoading?: boolean;\n isTouched?: boolean;\n error?: string;\n folderId?: number;\n chatFilter: string;\n folder: Omit<ApiChatFolder, 'id' | 'description' | 'emoticon'>;\n includeFilters?: FolderIncludeFilters;\n excludeFilters?: FolderExcludeFilters;\n};\nexport type FoldersActions = (\n 'setTitle' | 'saveFilters' | 'editFolder' | 'reset' | 'setChatFilter' | 'setIsLoading' | 'setError' |\n 'editIncludeFilters' | 'editExcludeFilters' | 'setIncludeFilters' | 'setExcludeFilters'\n);\nexport type FolderEditDispatch = Dispatch<FoldersActions>;\n\nconst INITIAL_STATE: FoldersState = {\n mode: 'create',\n chatFilter: '',\n folder: {\n title: '',\n includedChatIds: [],\n excludedChatIds: [],\n },\n};\n\nconst foldersReducer: StateReducer<FoldersState, FoldersActions> = (\n state,\n action,\n) => {\n switch (action.type) {\n case 'setTitle':\n return {\n ...state,\n folder: {\n ...state.folder,\n title: action.payload,\n },\n isTouched: true,\n };\n case 'editIncludeFilters':\n return {\n ...state,\n includeFilters: pick(\n state.folder,\n INCLUDE_FILTER_FIELDS,\n ),\n };\n case 'editExcludeFilters':\n return {\n ...state,\n excludeFilters: pick(\n state.folder,\n EXCLUDE_FILTER_FIELDS,\n ),\n };\n case 'setIncludeFilters':\n return {\n ...state,\n includeFilters: action.payload,\n chatFilter: '',\n };\n case 'setExcludeFilters':\n return {\n ...state,\n excludeFilters: action.payload,\n chatFilter: '',\n };\n case 'saveFilters':\n if (state.includeFilters) {\n return {\n ...state,\n folder: {\n ...omit(state.folder, INCLUDE_FILTER_FIELDS),\n title: state.folder.title ? state.folder.title : getSuggestedFolderName(state.includeFilters),\n ...state.includeFilters,\n },\n includeFilters: undefined,\n chatFilter: '',\n isTouched: true,\n };\n } else if (state.excludeFilters) {\n return {\n ...state,\n folder: {\n ...omit(state.folder, EXCLUDE_FILTER_FIELDS),\n ...state.excludeFilters,\n },\n excludeFilters: undefined,\n chatFilter: '',\n isTouched: true,\n };\n } else {\n return state;\n }\n case 'editFolder': {\n const { id: folderId, description, ...folder } = action.payload;\n\n return {\n mode: 'edit',\n folderId,\n folder,\n chatFilter: '',\n };\n }\n case 'setChatFilter': {\n return {\n ...state,\n chatFilter: action.payload,\n };\n }\n case 'setIsLoading': {\n return {\n ...state,\n isLoading: action.payload,\n };\n }\n case 'setError': {\n return {\n ...state,\n error: action.payload,\n };\n }\n case 'reset':\n return INITIAL_STATE;\n default:\n return state;\n }\n};\n\nconst useFoldersReducer = () => {\n return useReducer(foldersReducer, INITIAL_STATE);\n};\n\nexport default useFoldersReducer;\n","import {\n useCallback, useEffect, useRef, useState,\n} from '../lib/teact/teact';\nimport { getDispatch, getGlobal } from '../lib/teact/teactn';\n\nimport { register, Track, TrackId } from '../util/audioPlayer';\nimport useEffectWithPrevDeps from './useEffectWithPrevDeps';\nimport { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio';\nimport useOnChange from './useOnChange';\nimport {\n MediaSessionHandlers, registerMediaSession, setPlaybackState, setPositionState, updateMetadata,\n} from '../util/mediaSession';\n\ntype Handler = (e: Event) => void;\n\nconst DEFAULT_SKIP_TIME = 10;\n\nconst useAudioPlayer = (\n trackId: TrackId,\n originalDuration: number, // Sometimes incorrect for voice messages\n trackType: Track['type'],\n src?: string,\n handlers?: Record<string, Handler>,\n metadata?: MediaMetadata,\n onInit?: (element: HTMLAudioElement) => void,\n shouldPlay = false,\n onForcePlay?: NoneToVoidFunction,\n onTrackChange?: NoneToVoidFunction,\n noPlaylist = false,\n noProgressUpdates = false,\n) => {\n // eslint-disable-next-line no-null/no-null\n const controllerRef = useRef<ReturnType<typeof register>>(null);\n\n const [isPlaying, setIsPlaying] = useState(false);\n let isPlayingSync = isPlaying;\n\n const [playProgress, setPlayProgress] = useState<number>(0);\n\n const handleTrackChange = useCallback(() => {\n setIsPlaying(false);\n if (onTrackChange) onTrackChange();\n }, [onTrackChange]);\n\n useOnChange(() => {\n controllerRef.current = register(trackId, trackType, (eventName, e) => {\n switch (eventName) {\n case 'onPlay': {\n const {\n setVolume, setPlaybackRate, toggleMuted, proxy,\n } = controllerRef.current!;\n setIsPlaying(true);\n\n registerMediaSession(metadata, makeMediaHandlers(controllerRef));\n setPlaybackState('playing');\n setVolume(getGlobal().audioPlayer.volume);\n toggleMuted(Boolean(getGlobal().audioPlayer.isMuted));\n if (trackType === 'voice') {\n setPlaybackRate(getGlobal().audioPlayer.playbackRate);\n }\n\n setPositionState({\n duration: proxy.duration || 0,\n playbackRate: proxy.playbackRate,\n position: proxy.currentTime,\n });\n break;\n }\n case 'onRateChange': {\n const { proxy } = controllerRef.current!;\n setPositionState({\n duration: proxy.duration || 0,\n playbackRate: proxy.playbackRate,\n position: proxy.currentTime,\n });\n break;\n }\n case 'onPause':\n setIsPlaying(false);\n setPlaybackState('paused');\n break;\n case 'onTimeUpdate': {\n const { proxy } = controllerRef.current!;\n const duration = proxy.duration && Number.isFinite(proxy.duration) ? proxy.duration : originalDuration;\n if (!noProgressUpdates) setPlayProgress(proxy.currentTime / duration);\n break;\n }\n case 'onEnded': {\n setPlaybackState('paused');\n break;\n }\n }\n\n handlers?.[eventName]?.(e);\n }, onForcePlay, handleTrackChange);\n\n const { proxy } = controllerRef.current!;\n\n if (!isPlaying && !proxy.paused) {\n setIsPlaying(true);\n isPlayingSync = true;\n }\n\n if (onInit) {\n onInit(proxy);\n }\n }, [trackId]);\n\n useEffect(() => {\n if (isPlaying && metadata) updateMetadata(metadata);\n }, [metadata, isPlaying]);\n\n const {\n play,\n pause,\n setCurrentTime,\n proxy,\n destroy,\n setVolume,\n stop,\n isFirst,\n isLast,\n requestNextTrack,\n requestPreviousTrack,\n setPlaybackRate,\n toggleMuted,\n } = controllerRef.current!;\n const duration = proxy.duration && Number.isFinite(proxy.duration) ? proxy.duration : originalDuration;\n\n // RAF progress\n useEffect(() => {\n if (duration && !isSafariPatchInProgress(proxy) && !noProgressUpdates) {\n setPlayProgress(proxy.currentTime / duration);\n }\n }, [duration, playProgress, proxy, noProgressUpdates]);\n\n // Cleanup\n useEffect(() => () => {\n destroy(noPlaylist);\n }, [destroy, noPlaylist]);\n\n // Autoplay once `src` is present\n useEffectWithPrevDeps(([prevShouldPlay, prevSrc]) => {\n if (prevShouldPlay === shouldPlay && src === prevSrc) {\n return;\n }\n\n // When paused by another player\n if (proxy.src && proxy.paused) {\n return;\n }\n\n if (shouldPlay && src && !isPlaying) {\n play(src);\n }\n }, [shouldPlay, src, isPlaying, play, proxy.src, proxy.paused]);\n\n const playIfPresent = useCallback(() => {\n if (src) {\n play(src);\n }\n }, [src, play]);\n\n const playPause = useCallback(() => {\n if (isPlaying) {\n pause();\n } else {\n playIfPresent();\n }\n }, [pause, playIfPresent, isPlaying]);\n\n const setTime = useCallback((time: number) => {\n setCurrentTime(time);\n if (duration) {\n setPlayProgress(proxy.currentTime / duration);\n }\n }, [duration, proxy, setCurrentTime]);\n\n return {\n isPlaying: isPlayingSync,\n playProgress,\n playPause,\n pause,\n play: playIfPresent,\n stop,\n setCurrentTime: setTime,\n setVolume,\n audioProxy: proxy,\n duration,\n requestNextTrack,\n requestPreviousTrack,\n isFirst,\n isLast,\n setPlaybackRate,\n toggleMuted,\n };\n};\n\nfunction makeMediaHandlers(controllerRef: React.RefObject<ReturnType<typeof register>>) {\n let mediaHandlers: MediaSessionHandlers = {};\n if (controllerRef && controllerRef.current) {\n const {\n play, pause, setCurrentTime, proxy, requestNextTrack, requestPreviousTrack, isFirst, isLast,\n } = controllerRef.current;\n mediaHandlers = {\n play: () => {\n play(proxy.src);\n },\n pause: () => {\n pause();\n },\n stop: () => {\n pause();\n setCurrentTime(0);\n getDispatch().closeAudioPlayer();\n },\n seekbackward: (event) => {\n const skipTime = event.seekOffset || DEFAULT_SKIP_TIME;\n setCurrentTime(Math.max(proxy.currentTime - skipTime, 0));\n },\n seekforward: (event) => {\n const skipTime = event.seekOffset || DEFAULT_SKIP_TIME;\n setCurrentTime(Math.min(proxy.currentTime + skipTime, proxy.duration));\n },\n seekTo: (event) => {\n if (event.seekTime) {\n setCurrentTime(event.seekTime);\n }\n },\n };\n\n if (!isLast()) {\n mediaHandlers.nexttrack = () => {\n requestNextTrack();\n };\n }\n if (!isFirst()) {\n mediaHandlers.previoustrack = () => {\n requestPreviousTrack();\n };\n }\n }\n return mediaHandlers;\n}\n\nexport default useAudioPlayer;\n","import { useEffect, useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport { imgToCanvas } from '../util/files';\nimport useForceUpdate from './useForceUpdate';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\nconst MAX_CACHE_SIZE = 1000;\n\nconst cache = new Map<string, string>();\n\nexport default function useBlur(dataUri?: string, isDisabled = false, delay?: number) {\n const blurredRef = useRef<string | undefined>(dataUri ? cache.get(dataUri) : undefined);\n const timeoutRef = useRef<number>();\n const forceUpdate = useForceUpdate();\n\n if (timeoutRef.current && isDisabled) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n\n useEffect(() => {\n if (!dataUri || blurredRef.current || isDisabled) {\n return;\n }\n\n const img = new Image();\n\n img.onload = () => {\n const canvas = imgToCanvas(img);\n fastBlur(canvas.getContext('2d'), 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n const blurredDataUri = canvas.toDataURL();\n\n blurredRef.current = blurredDataUri;\n forceUpdate();\n\n if (cache.size >= MAX_CACHE_SIZE) {\n cache.clear();\n }\n cache.set(dataUri, blurredDataUri);\n };\n\n if (delay) {\n timeoutRef.current = window.setTimeout(() => {\n img.src = dataUri;\n }, delay);\n } else {\n img.src = dataUri;\n }\n }, [dataUri, delay, forceUpdate, isDisabled]);\n\n return blurredRef.current;\n}\n","import { useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport useOnChange from './useOnChange';\nimport useBlur from './useBlur';\nimport { imgToCanvas } from '../util/files';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\n\nexport default function useBlurSync(dataUri: string | false | undefined) {\n const blurredRef = useRef<string>();\n\n let isChanged = false;\n\n useOnChange(() => {\n isChanged = true;\n\n blurredRef.current = undefined;\n\n if (!dataUri) {\n return;\n }\n\n const img = new Image();\n img.src = dataUri;\n if (!img.width) {\n return;\n }\n\n const canvas = imgToCanvas(img);\n fastBlur(canvas.getContext('2d'), 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n\n blurredRef.current = canvas.toDataURL();\n }, [dataUri]);\n\n // Sometimes `Image` do not manage to load synchronously,\n // so we fall back the non-blurred variant and prepare the async one at least for the next time\n const blurredAsync = useBlur(dataUri || undefined, Boolean(blurredRef.current));\n\n return blurredRef.current || (!isChanged && blurredAsync) || dataUri || undefined;\n}\n","import React, { useCallback, useMemo, useState } from '../lib/teact/teact';\nimport { debounce } from '../util/schedulers';\nimport { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio';\n\ntype BufferingEvent = (e: Event | React.SyntheticEvent<HTMLMediaElement>) => void;\n\nconst MIN_READY_STATE = 3;\n// Avoid flickering when re-mounting previously buffered video\nconst DEBOUNCE = 200;\n\nconst useBuffering = (noInitiallyBuffered = false) => {\n const [isBuffered, setIsBuffered] = useState(!noInitiallyBuffered);\n const [bufferedProgress, setBufferedProgress] = useState(0);\n\n const setIsBufferedDebounced = useMemo(() => {\n return debounce(setIsBuffered, DEBOUNCE, false, true);\n }, []);\n\n const handleBuffering = useCallback<BufferingEvent>((e) => {\n const media = e.currentTarget as HTMLMediaElement;\n\n if (!isSafariPatchInProgress(media)) {\n if (media.buffered.length) {\n setBufferedProgress(media.buffered.end(0) / media.duration);\n }\n\n setIsBufferedDebounced(media.readyState >= MIN_READY_STATE || media.currentTime > 0);\n }\n }, [setIsBufferedDebounced]);\n\n const bufferingHandlers = {\n onLoadedData: handleBuffering,\n onPlaying: handleBuffering,\n onLoadStart: handleBuffering, // Needed for Safari to start\n onPause: handleBuffering, // Needed for Chrome when seeking\n onTimeUpdate: handleBuffering, // Needed for audio buffering progress\n onProgress: handleBuffering, // Needed for video buffering progress\n };\n\n return {\n isBuffered,\n bufferedProgress,\n bufferingHandlers,\n checkBuffering(element: HTMLMediaElement) {\n setIsBufferedDebounced(element.readyState >= MIN_READY_STATE);\n },\n };\n};\n\nexport default useBuffering;\n","import { useEffect, useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport useForceUpdate from './useForceUpdate';\nimport { IS_CANVAS_FILTER_SUPPORTED } from '../util/environment';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\n\nexport default function useCanvasBlur(dataUri?: string, isDisabled = false, withRaf?: boolean) {\n // eslint-disable-next-line no-null/no-null\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const forceUpdate = useForceUpdate();\n\n useEffect(() => {\n const canvas = canvasRef.current;\n\n if (!dataUri || !canvas || isDisabled) {\n return;\n }\n\n const img = new Image();\n\n const processBlur = () => {\n canvas.width = img.width;\n canvas.height = img.height;\n\n const ctx = canvas.getContext('2d', { alpha: false })!;\n\n if (IS_CANVAS_FILTER_SUPPORTED) {\n ctx.filter = `blur(${RADIUS}px)`;\n }\n\n ctx.drawImage(img, -RADIUS * 2, -RADIUS * 2, canvas.width + RADIUS * 4, canvas.height + RADIUS * 4);\n\n if (!IS_CANVAS_FILTER_SUPPORTED) {\n fastBlur(ctx, 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n }\n };\n\n img.onload = () => {\n if (withRaf) {\n requestAnimationFrame(processBlur);\n } else {\n processBlur();\n }\n };\n\n img.src = dataUri;\n }, [canvasRef, dataUri, forceUpdate, isDisabled, withRaf]);\n\n return canvasRef;\n}\n","import { useMemo } from '../lib/teact/teact';\nimport { getDispatch } from '../lib/teact/teactn';\n\nimport { ApiChat, ApiUser } from '../api/types';\n\nimport { SERVICE_NOTIFICATIONS_USER_ID } from '../config';\nimport {\n isChatArchived, getCanDeleteChat, isUserId, isChatChannel,\n} from '../modules/helpers';\nimport { compact } from '../util/iteratees';\nimport useLang from './useLang';\n\nconst useChatContextActions = ({\n chat,\n user,\n folderId,\n isPinned,\n isMuted,\n canChangeFolder,\n handleDelete,\n handleChatFolderChange,\n}: {\n chat: ApiChat | undefined;\n user: ApiUser | undefined;\n folderId?: number;\n isPinned?: boolean;\n isMuted?: boolean;\n canChangeFolder?: boolean;\n handleDelete: () => void;\n handleChatFolderChange: () => void;\n}, isInSearch = false) => {\n const lang = useLang();\n\n const { isSelf } = user || {};\n const isServiceNotifications = user?.id === SERVICE_NOTIFICATIONS_USER_ID;\n\n return useMemo(() => {\n if (!chat) {\n return undefined;\n }\n\n const {\n toggleChatPinned,\n updateChatMutedState,\n toggleChatArchived,\n toggleChatUnread,\n } = getDispatch();\n\n const actionAddToFolder = canChangeFolder ? {\n title: lang('ChatList.Filter.AddToFolder'),\n icon: 'folder',\n handler: handleChatFolderChange,\n } : undefined;\n\n const actionPin = isPinned\n ? {\n title: lang('UnpinFromTop'),\n icon: 'unpin',\n handler: () => toggleChatPinned({ id: chat.id, folderId }),\n }\n : { title: lang('PinToTop'), icon: 'pin', handler: () => toggleChatPinned({ id: chat.id, folderId }) };\n\n if (isInSearch) {\n return compact([actionPin, actionAddToFolder]);\n }\n\n const actionUnreadMark = chat.unreadCount || chat.hasUnreadMark\n ? { title: lang('MarkAsRead'), icon: 'readchats', handler: () => toggleChatUnread({ id: chat.id }) }\n : { title: lang('MarkAsUnread'), icon: 'unread', handler: () => toggleChatUnread({ id: chat.id }) };\n\n const actionMute = isMuted\n ? {\n title: lang('ChatList.Unmute'),\n icon: 'unmute',\n handler: () => updateChatMutedState({ chatId: chat.id, isMuted: false }),\n }\n : {\n title: lang('ChatList.Mute'),\n icon: 'mute',\n handler: () => updateChatMutedState({ chatId: chat.id, isMuted: true }),\n };\n\n const actionArchive = isChatArchived(chat)\n ? { title: lang('Unarchive'), icon: 'unarchive', handler: () => toggleChatArchived({ id: chat.id }) }\n : { title: lang('Archive'), icon: 'archive', handler: () => toggleChatArchived({ id: chat.id }) };\n\n const actionDelete = {\n title: isUserId(chat.id)\n ? lang('Delete')\n : lang(getCanDeleteChat(chat)\n ? 'DeleteChat'\n : (isChatChannel(chat) ? 'LeaveChannel' : 'Group.LeaveGroup')),\n icon: 'delete',\n destructive: true,\n handler: handleDelete,\n };\n\n const isInFolder = folderId !== undefined;\n\n return compact([\n actionAddToFolder,\n actionUnreadMark,\n actionPin,\n !isSelf && actionMute,\n !isSelf && !isServiceNotifications && !isInFolder && actionArchive,\n actionDelete,\n ]);\n }, [\n chat, canChangeFolder, lang, handleChatFolderChange, isPinned, isInSearch, isMuted, handleDelete, folderId, isSelf,\n isServiceNotifications,\n ]);\n};\n\nexport default useChatContextActions;\n","import { RefObject } from 'react';\nimport { useState, useEffect, useCallback } from '../lib/teact/teact';\n\nimport { IAnchorPosition } from '../types';\nimport {\n IS_TOUCH_ENV, IS_SINGLE_COLUMN_LAYOUT, IS_PWA, IS_IOS,\n} from '../util/environment';\n\nconst LONG_TAP_DURATION_MS = 200;\n\nfunction checkIsDisabledForMobile() {\n return IS_SINGLE_COLUMN_LAYOUT\n && window.document.body.classList.contains('enable-symbol-menu-transforms');\n}\n\nfunction stopEvent(e: Event) {\n e.stopImmediatePropagation();\n e.preventDefault();\n e.stopPropagation();\n}\n\nconst useContextMenuHandlers = (\n elementRef: RefObject<HTMLElement>,\n isMenuDisabled?: boolean,\n shouldDisableOnLink?: boolean,\n shouldDisableOnLongTap?: boolean,\n) => {\n const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);\n const [contextMenuPosition, setContextMenuPosition] = useState<IAnchorPosition | undefined>(undefined);\n\n const handleBeforeContextMenu = useCallback((e: React.MouseEvent) => {\n if (!isMenuDisabled && e.button === 2) {\n (e.target as HTMLElement).classList.add('no-selection');\n }\n }, [isMenuDisabled]);\n\n const handleContextMenu = useCallback((e: React.MouseEvent) => {\n (e.target as HTMLElement).classList.remove('no-selection');\n\n if (isMenuDisabled || (shouldDisableOnLink && (e.target as HTMLElement).matches('a[href]'))) {\n return;\n }\n e.preventDefault();\n\n if (contextMenuPosition) {\n return;\n }\n\n setIsContextMenuOpen(true);\n setContextMenuPosition({ x: e.clientX, y: e.clientY });\n }, [isMenuDisabled, shouldDisableOnLink, contextMenuPosition]);\n\n const handleContextMenuClose = useCallback(() => {\n setIsContextMenuOpen(false);\n }, []);\n\n const handleContextMenuHide = useCallback(() => {\n setContextMenuPosition(undefined);\n document.body.classList.remove('no-selection');\n }, []);\n\n // Support context menu on touch-devices\n useEffect(() => {\n if (isMenuDisabled || !IS_TOUCH_ENV || shouldDisableOnLongTap) {\n return undefined;\n }\n\n const element = elementRef.current;\n if (!element) {\n return undefined;\n }\n\n let timer: number | undefined;\n\n const clearLongPressTimer = () => {\n if (timer) {\n clearTimeout(timer);\n timer = undefined;\n }\n };\n\n const emulateContextMenuEvent = (originalEvent: TouchEvent) => {\n clearLongPressTimer();\n\n const { clientX, clientY, target } = originalEvent.touches[0];\n\n if (contextMenuPosition || (shouldDisableOnLink && (target as HTMLElement).matches('a[href]'))) {\n return;\n }\n\n // Temporarily intercept and clear the next click\n element.addEventListener('touchend', function cancelClickOnce(e) {\n element.removeEventListener('touchend', cancelClickOnce, true);\n stopEvent(e);\n }, true);\n\n // On iOS15, in PWA mode, the context menu immediately closes after opening\n if (IS_PWA && IS_IOS) {\n element.addEventListener('mousedown', function cancelClickOnce(e) {\n element.removeEventListener('mousedown', cancelClickOnce, true);\n stopEvent(e);\n }, true);\n }\n\n document.body.classList.add('no-selection');\n setIsContextMenuOpen(true);\n setContextMenuPosition({ x: clientX, y: clientY });\n };\n\n const startLongPressTimer = (e: TouchEvent) => {\n if (isMenuDisabled || checkIsDisabledForMobile()) {\n return;\n }\n clearLongPressTimer();\n\n timer = window.setTimeout(() => emulateContextMenuEvent(e), LONG_TAP_DURATION_MS);\n };\n\n // @perf Consider event delegation\n element.addEventListener('touchstart', startLongPressTimer, { passive: true });\n element.addEventListener('touchcancel', clearLongPressTimer, true);\n element.addEventListener('touchend', clearLongPressTimer, true);\n element.addEventListener('touchmove', clearLongPressTimer, { passive: true });\n\n return () => {\n clearLongPressTimer();\n element.removeEventListener('touchstart', startLongPressTimer);\n element.removeEventListener('touchcancel', clearLongPressTimer, true);\n element.removeEventListener('touchend', clearLongPressTimer, true);\n element.removeEventListener('touchmove', clearLongPressTimer);\n };\n }, [contextMenuPosition, isMenuDisabled, shouldDisableOnLongTap, elementRef, shouldDisableOnLink]);\n\n return {\n isContextMenuOpen,\n contextMenuPosition,\n handleBeforeContextMenu,\n handleContextMenu,\n handleContextMenuClose,\n handleContextMenuHide,\n };\n};\n\nexport default useContextMenuHandlers;\n","import { useState, useEffect } from '../lib/teact/teact';\nimport { IAnchorPosition } from '../types';\n\ninterface Layout {\n extraPaddingX?: number;\n extraTopPadding?: number;\n marginSides?: number;\n extraMarginTop?: number;\n}\n\nconst MENU_POSITION_VISUAL_COMFORT_SPACE_PX = 16;\nconst MENU_POSITION_BOTTOM_MARGIN = 12;\nconst EMPTY_RECT = {\n width: 0, left: 0, height: 0, top: 0,\n};\n\nexport default function useContextMenuPosition(\n anchor: IAnchorPosition | undefined,\n getTriggerElement: () => HTMLElement | null,\n getRootElement: () => HTMLElement | null,\n getMenuElement: () => HTMLElement | null,\n getLayout?: () => Layout,\n) {\n const [positionX, setPositionX] = useState<'right' | 'left'>('right');\n const [positionY, setPositionY] = useState<'top' | 'bottom'>('bottom');\n const [transformOriginX, setTransformOriginX] = useState<number>();\n const [transformOriginY, setTransformOriginY] = useState<number>();\n const [withScroll, setWithScroll] = useState(false);\n const [style, setStyle] = useState('');\n const [menuStyle, setMenuStyle] = useState('opacity: 0;');\n\n useEffect(() => {\n const triggerEl = getTriggerElement();\n if (!anchor || !triggerEl) {\n return;\n }\n\n let { x, y } = anchor;\n const anchorX = x;\n const anchorY = y;\n\n const menuEl = getMenuElement();\n const rootEl = getRootElement();\n\n const {\n extraPaddingX = 0,\n extraTopPadding = 0,\n marginSides = 0,\n extraMarginTop = 0,\n } = getLayout?.() || {};\n\n const marginTop = menuEl ? parseInt(getComputedStyle(menuEl).marginTop, 10) + extraMarginTop : undefined;\n\n const menuRect = menuEl ? {\n width: menuEl.offsetWidth,\n height: menuEl.offsetHeight + marginTop!,\n } : EMPTY_RECT;\n\n const rootRect = rootEl ? rootEl.getBoundingClientRect() : EMPTY_RECT;\n\n let horizontalPosition: 'left' | 'right';\n let verticalPosition: 'top' | 'bottom';\n if (x + menuRect.width + extraPaddingX < rootRect.width + rootRect.left) {\n x += 3;\n horizontalPosition = 'left';\n } else if (x - menuRect.width > 0) {\n horizontalPosition = 'right';\n x -= 3;\n } else {\n horizontalPosition = 'left';\n x = 16;\n }\n setPositionX(horizontalPosition);\n\n if (marginSides\n && horizontalPosition === 'right' && (x + extraPaddingX + marginSides >= rootRect.width + rootRect.left)) {\n x -= marginSides;\n }\n\n if (marginSides && horizontalPosition === 'left') {\n if (x + extraPaddingX + marginSides + menuRect.width >= rootRect.width + rootRect.left) {\n x -= marginSides;\n } else if (x - marginSides <= 0) {\n x += marginSides;\n }\n }\n\n if (y + menuRect.height < rootRect.height + rootRect.top) {\n verticalPosition = 'top';\n } else {\n verticalPosition = 'bottom';\n\n if (y - menuRect.height < rootRect.top + extraTopPadding) {\n y = rootRect.top + rootRect.height;\n }\n }\n setPositionY(verticalPosition);\n\n const triggerRect = triggerEl.getBoundingClientRect();\n const left = horizontalPosition === 'left'\n ? Math.min(x - triggerRect.left, rootRect.width - menuRect.width - MENU_POSITION_VISUAL_COMFORT_SPACE_PX)\n : Math.max((x - triggerRect.left), menuRect.width + MENU_POSITION_VISUAL_COMFORT_SPACE_PX);\n const top = Math.min(\n rootRect.height - triggerRect.top + triggerRect.height - MENU_POSITION_BOTTOM_MARGIN + (marginTop || 0),\n y - triggerRect.top,\n );\n const menuMaxHeight = rootRect.height - MENU_POSITION_BOTTOM_MARGIN - (marginTop || 0);\n\n setWithScroll(menuMaxHeight < menuRect.height);\n setMenuStyle(`max-height: ${menuMaxHeight}px;`);\n setStyle(`left: ${left}px; top: ${top}px`);\n const offsetX = (anchorX - triggerRect.left) - left;\n const offsetY = (anchorY - triggerRect.top) - top - (marginTop || 0);\n setTransformOriginX(horizontalPosition === 'left' ? offsetX : menuRect.width + offsetX);\n setTransformOriginY(verticalPosition === 'bottom' ? menuRect.height + offsetY : offsetY);\n }, [\n anchor, getMenuElement, getRootElement, getTriggerElement, getLayout,\n ]);\n\n return {\n positionX,\n positionY,\n transformOriginX,\n transformOriginY,\n style,\n menuStyle,\n withScroll,\n };\n}\n","import { useMemo } from '../lib/teact/teact';\n\nimport { debounce } from '../util/schedulers';\n\nexport default function useDebounce(ms: number, noFirst?: boolean, noLast?: boolean) {\n return useMemo(() => {\n return debounce((cb) => cb(), ms, !noFirst, !noLast);\n }, [ms, noFirst, noLast]);\n}\n","import { useEffect, useMemo } from '../lib/teact/teact';\nimport { getDispatch } from '../lib/teact/teactn';\n\nimport { ApiMessage } from '../api/types';\n\nimport { throttle } from '../util/schedulers';\n\nconst useEnsureMessage = (\n chatId: string,\n messageId?: number,\n message?: ApiMessage,\n replyOriginForId?: number,\n) => {\n const { loadMessage } = getDispatch();\n const loadMessageThrottled = useMemo(() => {\n const throttled = throttle(loadMessage, 500, true);\n return () => {\n throttled({ chatId, messageId, replyOriginForId });\n };\n }, [loadMessage, chatId, messageId, replyOriginForId]);\n\n useEffect(() => {\n if (messageId && !message) {\n loadMessageThrottled();\n }\n });\n};\n\nexport default useEnsureMessage;\n","import { useEffect, useState } from '../lib/teact/teact';\nimport {\n getOrderedIds,\n getUnreadCounters,\n getChatsCount,\n addOrderedIdsCallback,\n addUnreadCountersCallback,\n addChatsCountCallback,\n} from '../util/folderManager';\n\nexport function useFolderManagerForOrderedIds(folderId: number) {\n const [orderedIds, setOrderedIds] = useState(getOrderedIds(folderId));\n\n useEffect(() => addOrderedIdsCallback(folderId, setOrderedIds), [folderId]);\n\n return orderedIds;\n}\n\nexport function useFolderManagerForUnreadCounters() {\n const [unreadCounters, setUnreadCounters] = useState(getUnreadCounters());\n\n useEffect(() => addUnreadCountersCallback(setUnreadCounters), []);\n\n return unreadCounters;\n}\n\nexport function useFolderManagerForChatsCount() {\n const [chatsCount, setChatsCount] = useState(getChatsCount());\n\n useEffect(() => addChatsCountCallback(setChatsCount), []);\n\n return chatsCount;\n}\n","import { useEffect } from '../lib/teact/teact';\n\nconst useHorizontalScroll = (container: HTMLElement | null, isDisabled?: boolean) => {\n useEffect(() => {\n if (!container || isDisabled) {\n return undefined;\n }\n\n function handleScroll(e: WheelEvent) {\n // Ignore horizontal scroll and let it work natively (e.g. on touchpad)\n if (!e.deltaX) {\n container!.scrollLeft += e.deltaY / 4;\n }\n }\n\n container.addEventListener('wheel', handleScroll, { passive: true });\n\n return () => {\n container.removeEventListener('wheel', handleScroll);\n };\n }, [container, isDisabled]);\n};\n\nexport default useHorizontalScroll;\n","import { RefObject } from 'react';\nimport { useEffect } from '../lib/teact/teact';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../util/environment';\n\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 500;\nconst MODAL_HIDE_DELAY_MS = 300;\n\nexport default function useInputFocusOnOpen(\n inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement>,\n isOpen?: boolean,\n onClose?: NoneToVoidFunction,\n) {\n useEffect(() => {\n if (isOpen) {\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n });\n }, FOCUS_DELAY_MS);\n }\n } else {\n if (inputRef.current) {\n inputRef.current.blur();\n }\n\n if (onClose) {\n setTimeout(onClose, MODAL_HIDE_DELAY_MS);\n }\n }\n }, [inputRef, isOpen, onClose]);\n}\n","import { RefObject } from 'react';\nimport {\n useEffect, useRef, useCallback, useState,\n} from '../lib/teact/teact';\n\nimport { throttle, debounce } from '../util/schedulers';\nimport useHeavyAnimationCheck from './useHeavyAnimationCheck';\n\ntype TargetCallback = (entry: IntersectionObserverEntry) => void;\ntype RootCallback = (entries: IntersectionObserverEntry[]) => void;\ntype ObserveCleanup = NoneToVoidFunction;\nexport type ObserveFn = (target: HTMLElement, targetCallback?: TargetCallback) => ObserveCleanup;\n\ninterface IntersectionController {\n observer: IntersectionObserver;\n callbacks: Map<HTMLElement, TargetCallback>;\n}\n\ninterface Response {\n observe: ObserveFn;\n freeze: NoneToVoidFunction;\n unfreeze: NoneToVoidFunction;\n}\n\nexport function useIntersectionObserver({\n rootRef,\n throttleMs,\n debounceMs,\n shouldSkipFirst,\n margin,\n threshold,\n isDisabled,\n}: {\n rootRef: RefObject<HTMLDivElement>;\n throttleMs?: number;\n debounceMs?: number;\n shouldSkipFirst?: boolean;\n margin?: number;\n threshold?: number | number[];\n isDisabled?: boolean;\n}, rootCallback?: RootCallback): Response {\n const controllerRef = useRef<IntersectionController>();\n const rootCallbackRef = useRef<RootCallback>();\n const freezeFlagsRef = useRef(0);\n const onUnfreezeRef = useRef<NoneToVoidFunction>();\n\n rootCallbackRef.current = rootCallback;\n\n const freeze = useCallback(() => {\n freezeFlagsRef.current++;\n }, []);\n\n const unfreeze = useCallback(() => {\n if (!freezeFlagsRef.current) {\n return;\n }\n\n freezeFlagsRef.current--;\n\n if (!freezeFlagsRef.current && onUnfreezeRef.current) {\n onUnfreezeRef.current();\n onUnfreezeRef.current = undefined;\n }\n }, []);\n\n useHeavyAnimationCheck(freeze, unfreeze);\n\n useEffect(() => {\n if (isDisabled) {\n return undefined;\n }\n\n return () => {\n if (controllerRef.current) {\n controllerRef.current.observer.disconnect();\n controllerRef.current.callbacks.clear();\n controllerRef.current = undefined;\n }\n };\n }, [isDisabled]);\n\n function initController() {\n const callbacks = new Map();\n const entriesAccumulator = new Map<Element, IntersectionObserverEntry>();\n const observerCallbackSync = () => {\n const entries = Array.from(entriesAccumulator.values());\n\n entries.forEach((entry: IntersectionObserverEntry) => {\n const callback = callbacks.get(entry.target);\n if (callback) {\n callback!(entry, entries);\n }\n });\n\n if (rootCallbackRef.current) {\n rootCallbackRef.current(entries);\n }\n\n entriesAccumulator.clear();\n };\n const scheduler = throttleMs ? throttle : debounceMs ? debounce : undefined;\n const observerCallback = scheduler\n ? scheduler(observerCallbackSync, (throttleMs || debounceMs)!, !shouldSkipFirst)\n : observerCallbackSync;\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n entriesAccumulator.set(entry.target, entry);\n });\n\n if (freezeFlagsRef.current) {\n onUnfreezeRef.current = () => {\n observerCallback();\n };\n } else {\n observerCallback();\n }\n },\n {\n root: rootRef.current,\n rootMargin: margin ? `${margin}px` : undefined,\n threshold,\n },\n );\n\n controllerRef.current = { observer, callbacks };\n }\n\n const observe = useCallback((target, targetCallback) => {\n if (!controllerRef.current) {\n initController();\n }\n\n const controller = controllerRef.current!;\n controller.observer.observe(target);\n\n if (targetCallback) {\n controller.callbacks.set(target, targetCallback);\n }\n\n return () => {\n if (targetCallback) {\n controller.callbacks.delete(target);\n }\n\n controller.observer.unobserve(target);\n };\n // Arguments should never change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isDisabled]);\n\n return { observe, freeze, unfreeze };\n}\n\nexport function useOnIntersect(\n targetRef: RefObject<HTMLDivElement>, observe?: ObserveFn, callback?: TargetCallback,\n) {\n useEffect(() => {\n return observe ? observe(targetRef.current!, callback) : undefined;\n // Arguments should never change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport function useIsIntersecting(\n targetRef: RefObject<HTMLDivElement>, observe?: ObserveFn, callback?: TargetCallback,\n) {\n const [isIntersecting, setIsIntersecting] = useState(!observe);\n\n useOnIntersect(targetRef, observe, (entry) => {\n setIsIntersecting(entry.isIntersecting);\n\n if (callback) {\n callback(entry);\n }\n });\n\n return isIntersecting;\n}\n","import { useEffect, useLayoutEffect, useRef } from '../lib/teact/teact';\n\nfunction useInterval(callback: NoneToVoidFunction, delay?: number, noFirst = false) {\n const savedCallback = useRef(callback);\n\n useLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n useEffect(() => {\n if (delay === undefined) {\n return undefined;\n }\n\n const id = setInterval(() => savedCallback.current(), delay);\n if (!noFirst) savedCallback.current();\n\n return () => clearInterval(id);\n }, [delay, noFirst]);\n}\n\nexport default useInterval;\n","import { useLayoutEffect } from '../lib/teact/teact';\nimport usePrevious from './usePrevious';\n\nconst useLayoutEffectWithPrevDeps = <T extends readonly any[]>(\n cb: (args: T | readonly []) => void, dependencies: T, debugKey?: string,\n) => {\n const prevDeps = usePrevious<T>(dependencies);\n return useLayoutEffect(() => {\n return cb(prevDeps || []);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies, debugKey);\n};\n\nexport default useLayoutEffectWithPrevDeps;\n","import useShowTransition from './useShowTransition';\n\nexport default function useMediaTransition(mediaData?: any) {\n const isMediaReady = Boolean(mediaData);\n const { transitionClassNames } = useShowTransition(isMediaReady, undefined, isMediaReady, 'slow');\n\n return transitionClassNames;\n}\n","import { useRef } from '../lib/teact/teact';\nimport generateIdFor from '../util/generateIdFor';\n\nconst store: Record<string, boolean> = {};\n\nconst useUniqueId = () => {\n const idRef = useRef<string>();\n\n if (!idRef.current) {\n idRef.current = generateIdFor(store);\n store[idRef.current] = true;\n }\n\n return idRef.current;\n};\n\nexport default useUniqueId;\n","import {\n useEffect, useMemo, useRef, useState,\n} from '../lib/teact/teact';\n\nimport { IS_PROGRESSIVE_SUPPORTED } from '../util/environment';\nimport { ApiMediaFormat } from '../api/types';\nimport { throttle } from '../util/schedulers';\nimport * as mediaLoader from '../util/mediaLoader';\nimport useForceUpdate from './useForceUpdate';\nimport useUniqueId from './useUniqueId';\n\nconst STREAMING_PROGRESS = 0.75;\nconst STREAMING_TIMEOUT = 1500;\nconst PROGRESS_THROTTLE = 500;\n\nexport default function useMediaWithLoadProgress(\n mediaHash: string | undefined,\n noLoad = false,\n mediaFormat = ApiMediaFormat.BlobUrl,\n cacheBuster?: number,\n delay?: number | false,\n isHtmlAllowed = false,\n) {\n const mediaData = mediaHash ? mediaLoader.getFromMemory(mediaHash) : undefined;\n const isStreaming = mediaFormat === ApiMediaFormat.Stream || (\n IS_PROGRESSIVE_SUPPORTED && mediaFormat === ApiMediaFormat.Progressive\n );\n const forceUpdate = useForceUpdate();\n const id = useUniqueId();\n const [loadProgress, setLoadProgress] = useState(mediaData && !isStreaming ? 1 : 0);\n const startedAtRef = useRef<number>();\n\n const handleProgress = useMemo(() => {\n return throttle((progress: number) => {\n if (startedAtRef.current && (!delay || (Date.now() - startedAtRef.current > delay))) {\n setLoadProgress(progress);\n }\n }, PROGRESS_THROTTLE, true);\n }, [delay]);\n\n useEffect(() => {\n if (!noLoad && mediaHash) {\n if (!mediaData) {\n setLoadProgress(0);\n\n if (startedAtRef.current) {\n mediaLoader.cancelProgress(handleProgress);\n }\n\n startedAtRef.current = Date.now();\n\n mediaLoader.fetch(mediaHash, mediaFormat, isHtmlAllowed, handleProgress, id).then(() => {\n const spentTime = Date.now() - startedAtRef.current!;\n startedAtRef.current = undefined;\n\n if (!delay || spentTime >= delay) {\n forceUpdate();\n } else {\n setTimeout(forceUpdate, delay - spentTime);\n }\n });\n } else if (isStreaming) {\n setTimeout(() => {\n setLoadProgress(STREAMING_PROGRESS);\n }, STREAMING_TIMEOUT);\n }\n }\n }, [\n noLoad, mediaHash, mediaData, mediaFormat, cacheBuster, forceUpdate, isStreaming, delay, handleProgress,\n isHtmlAllowed, id,\n ]);\n\n useEffect(() => {\n if (noLoad && startedAtRef.current) {\n mediaLoader.cancelProgress(handleProgress);\n setLoadProgress(0);\n startedAtRef.current = undefined;\n }\n }, [handleProgress, noLoad]);\n\n useEffect(() => {\n return () => {\n if (mediaHash) {\n mediaLoader.removeCallback(mediaHash, id);\n }\n };\n }, [id, mediaHash]);\n\n return { mediaData, loadProgress };\n}\n","import { useCallback, useEffect, useRef } from '../lib/teact/teact';\n\nimport { IS_TOUCH_ENV } from '../util/environment';\n\nconst MENU_CLOSE_TIMEOUT = 250;\nlet closeTimeout: number | undefined;\n\nexport default function useMouseInside(\n isOpen: boolean, onClose: NoneToVoidFunction, menuCloseTimeout = MENU_CLOSE_TIMEOUT, isDisabled = false,\n) {\n const isMouseInside = useRef(false);\n\n const markMouseInside = useCallback(() => {\n isMouseInside.current = true;\n }, []);\n\n useEffect(() => {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n closeTimeout = undefined;\n }\n\n if (isOpen && !IS_TOUCH_ENV && !isDisabled) {\n closeTimeout = window.setTimeout(() => {\n if (!isMouseInside.current) {\n onClose();\n }\n }, menuCloseTimeout * 2);\n }\n }, [isDisabled, isOpen, menuCloseTimeout, onClose]);\n\n const handleMouseEnter = useCallback(() => {\n isMouseInside.current = true;\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n isMouseInside.current = false;\n\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n closeTimeout = undefined;\n }\n\n closeTimeout = window.setTimeout(() => {\n if (!isMouseInside.current) {\n onClose();\n }\n }, menuCloseTimeout);\n }, [menuCloseTimeout, onClose]);\n\n return [handleMouseEnter, handleMouseLeave, markMouseInside];\n}\n","import { useRef } from '../lib/teact/teact';\n\nimport usePrevious from './usePrevious';\nimport useForceUpdate from './useForceUpdate';\nimport useOnChange from './useOnChange';\n\nexport default function usePrevDuringAnimation(current: any, duration?: number) {\n const prev = usePrevious(current, true);\n const timeoutRef = useRef<number>();\n const forceUpdate = useForceUpdate();\n // eslint-disable-next-line no-null/no-null\n const isCurrentPresent = current !== undefined && current !== null;\n // eslint-disable-next-line no-null/no-null\n const isPrevPresent = prev !== undefined && prev !== null;\n\n if (isCurrentPresent && timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n\n useOnChange(() => {\n // When `current` becomes empty\n if (duration && !isCurrentPresent && isPrevPresent && !timeoutRef.current) {\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = undefined;\n forceUpdate();\n }, duration);\n }\n }, [current]);\n\n return !timeoutRef.current || !duration || isCurrentPresent ? current : prev;\n}\n","import { useState, useCallback, useRef } from '../lib/teact/teact';\n\nexport type ReducerAction<Actions> = { type: Actions; payload?: any };\nexport type StateReducer<State, Actions> = (state: State, action: ReducerAction<Actions>) => State;\nexport type Dispatch<Actions> = (action: ReducerAction<Actions>) => void;\n\nexport default function useReducer<State, Actions>(\n reducer: StateReducer<State, Actions>,\n initialState: State,\n) {\n const reducerRef = useRef(reducer);\n const [state, setState] = useState<State>(initialState);\n\n const dispatch = useCallback((action: ReducerAction<Actions>) => {\n setState((currentState) => reducerRef.current(currentState, action));\n }, []);\n\n return [\n state,\n dispatch,\n ] as [State, Dispatch<Actions>];\n}\n","import { useMemo } from '../lib/teact/teact';\nimport { getDispatch } from '../lib/teact/teactn';\n\nimport { ApiSendMessageAction } from '../api/types';\n\nimport { SEND_MESSAGE_ACTION_INTERVAL } from '../config';\nimport { throttle } from '../util/schedulers';\n\nconst useSendMessageAction = (chatId: string, threadId?: number) => {\n return useMemo(() => {\n return throttle((action: ApiSendMessageAction) => {\n getDispatch().sendMessageAction({ chatId, threadId, action });\n }, SEND_MESSAGE_ACTION_INTERVAL);\n }, [chatId, threadId]);\n};\n\nexport default useSendMessageAction;\n","import { useRef } from '../lib/teact/teact';\n\nimport useOnChange from './useOnChange';\n\n// Allows to use state value as \"silent\" dependency in hooks (not causing updates).\n// Useful for state values that update frequently (such as controlled input value).\nexport function useStateRef<T>(value: T) {\n const ref = useRef<T>(value);\n\n useOnChange(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n}\n","import { RefObject } from 'react';\nimport { useEffect } from '../lib/teact/teact';\nimport { fastRaf } from '../util/schedulers';\n\n// Fix for memory leak when unmounting video element\nexport default function useVideoCleanup(videoRef: RefObject<HTMLVideoElement>, dependencies: any[]) {\n useEffect(() => {\n const videoEl = videoRef.current;\n\n return () => {\n if (videoEl) {\n fastRaf(() => {\n videoEl.pause();\n videoEl.src = '';\n videoEl.load();\n });\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n","/* eslint-disable no-nested-ternary */\n/* eslint-disable no-bitwise */\n/* eslint-disable no-multi-assign */\n/* eslint-disable no-cond-assign */\n/* eslint-disable no-param-reassign */\n/* eslint-disable prefer-const */\n/* eslint-disable eqeqeq */\n\n/*\nSuperfast Blur - a fast Box Blur For Canvas\n\nVersion: 0.5\nAuthor: Mario Klingemann\nContact: mario@quasimondo.com\nWebsite: http://www.quasimondo.com/BoxBlurForCanvas\nTwitter: @quasimondo\n\nIn case you find this class useful - especially in commercial projects -\nI am not totally unhappy for a small donation to my PayPal account\nmario@quasimondo.de\n\nOr support me on flattr:\nhttps://flattr.com/thing/140066/Superfast-Blur-a-pretty-fast-Box-Blur-Effect-for-CanvasJavascript\n\nCopyright (c) 2011 Mario Klingemann\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// eslint-disable-next-line max-len\nconst mul_table = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1];\n// eslint-disable-next-line max-len\nconst shg_table = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18];\n\nexport default function boxBlurCanvasRGB(context, top_x, top_y, width, height, radius, iterations) {\n if (Number.isNaN(radius) || radius < 1) return;\n\n radius |= 0;\n\n if (Number.isNaN(iterations)) iterations = 1;\n iterations |= 0;\n if (iterations > 3) iterations = 3;\n if (iterations < 1) iterations = 1;\n\n const imageData = context.getImageData(top_x, top_y, width, height);\n\n const pixels = imageData.data;\n\n let rsum;\n let gsum;\n let bsum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let wm = width - 1;\n let hm = height - 1;\n let rad1 = radius + 1;\n\n let r = [];\n let g = [];\n let b = [];\n\n let mul_sum = mul_table[radius];\n let shg_sum = shg_table[radius];\n\n let vmin = [];\n let vmax = [];\n\n while (iterations-- > 0) {\n yw = yi = 0;\n\n for (y = 0; y < height; y++) {\n rsum = pixels[yw] * rad1;\n gsum = pixels[yw + 1] * rad1;\n bsum = pixels[yw + 2] * rad1;\n\n for (i = 1; i <= radius; i++) {\n p = yw + (((i > wm ? wm : i)) << 2);\n rsum += pixels[p++];\n gsum += pixels[p++];\n bsum += pixels[p++];\n }\n\n for (x = 0; x < width; x++) {\n r[yi] = rsum;\n g[yi] = gsum;\n b[yi] = bsum;\n\n if (y == 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = ((p = x - radius) > 0 ? p << 2 : 0);\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += pixels[p1++] - pixels[p2++];\n gsum += pixels[p1++] - pixels[p2++];\n bsum += pixels[p1++] - pixels[p2++];\n\n yi++;\n }\n yw += (width << 2);\n }\n\n for (x = 0; x < width; x++) {\n yp = x;\n rsum = r[yp] * rad1;\n gsum = g[yp] * rad1;\n bsum = b[yp] * rad1;\n\n for (i = 1; i <= radius; i++) {\n yp += (i > hm ? 0 : width);\n rsum += r[yp];\n gsum += g[yp];\n bsum += b[yp];\n }\n\n yi = x << 2;\n for (y = 0; y < height; y++) {\n pixels[yi] = (rsum * mul_sum) >>> shg_sum;\n pixels[yi + 1] = (gsum * mul_sum) >>> shg_sum;\n pixels[yi + 2] = (bsum * mul_sum) >>> shg_sum;\n\n if (x == 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * width;\n vmax[y] = ((p = y - radius) > 0 ? p * width : 0);\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += r[p1] - r[p2];\n gsum += g[p1] - g[p2];\n bsum += b[p1] - b[p2];\n\n yi += width << 2;\n }\n }\n }\n\n context.putImageData(imageData, top_x, top_y);\n}\n","import { getDispatch, getGlobal } from '../lib/teact/teactn';\n\nimport { AudioOrigin, GlobalSearchContent } from '../types';\nimport { ApiMessage } from '../api/types';\n\nimport { IS_SAFARI } from './environment';\nimport safePlay from './safePlay';\nimport { patchSafariProgressiveAudio, isSafariPatchInProgress } from './patchSafariProgressiveAudio';\nimport { getMessageKey, MessageKey, parseMessageKey } from '../modules/helpers';\nimport { fastRaf } from './schedulers';\nimport { selectCurrentMessageList } from '../modules/selectors';\n\ntype Handler = (eventName: string, e: Event) => void;\nexport type TrackId = `${MessageKey}-${number}`;\n\nexport interface Track {\n audio: HTMLAudioElement;\n proxy: HTMLAudioElement;\n type: 'voice' | 'audio';\n handlers: Handler[];\n onForcePlay?: NoneToVoidFunction;\n onTrackChange?: NoneToVoidFunction;\n}\n\nconst tracks = new Map<TrackId, Track>();\nlet voiceQueue: TrackId[] = [];\nlet musicQueue: TrackId[] = [];\n\nlet currentTrackId: TrackId | undefined;\n\nfunction createAudio(\n trackId: TrackId,\n type: Track['type'],\n onForcePlay?: NoneToVoidFunction,\n onTrackChange?: NoneToVoidFunction,\n): Track {\n const audio = new Audio();\n\n function handleEvent(eventName: string) {\n return (e: Event) => {\n if (!tracks.has(trackId)) {\n return;\n }\n\n if (isSafariPatchInProgress(audio)) {\n return;\n }\n\n tracks.get(trackId)!.handlers.forEach((handler) => {\n handler(eventName, e);\n });\n };\n }\n\n audio.addEventListener('timeupdate', handleEvent('onTimeUpdate'));\n audio.addEventListener('play', handleEvent('onPlay'));\n audio.addEventListener('pause', handleEvent('onPause'));\n audio.addEventListener('loadstart', handleEvent('onLoadStart'));\n audio.addEventListener('loadeddata', handleEvent('onLoadedData'));\n audio.addEventListener('playing', handleEvent('onPlaying'));\n audio.addEventListener('ended', () => {\n if (!tracks.has(trackId)) {\n return;\n }\n\n if (isSafariPatchInProgress(audio)) {\n return;\n }\n\n playNext(trackId);\n });\n\n return {\n audio,\n type,\n proxy: new Proxy(audio, {\n get: (target, key: keyof HTMLAudioElement) => target[key],\n }),\n handlers: [],\n onForcePlay,\n onTrackChange,\n };\n}\n\nfunction playNext(trackId: TrackId, isReverseOrder?: boolean) {\n const currentTrack = currentTrackId && tracks.get(currentTrackId);\n if (currentTrack) {\n currentTrack.audio.pause();\n currentTrack.audio.currentTime = 0;\n if (currentTrack.onTrackChange) currentTrack.onTrackChange();\n }\n\n const origin = getGlobal().audioPlayer.origin || AudioOrigin.Inline;\n\n const nextTrackId = findNextInQueue(trackId, origin, isReverseOrder);\n if (!nextTrackId) {\n return;\n }\n\n if (!tracks.has(nextTrackId)) {\n // A bit hacky way to continue playlist when switching chat\n getDispatch().openAudioPlayer(parseMessageKey(splitTrackId(nextTrackId).messageKey));\n\n return;\n }\n\n const nextTrack = tracks.get(nextTrackId)!;\n\n if (nextTrack.onForcePlay) {\n nextTrack.onForcePlay();\n }\n\n currentTrackId = nextTrackId;\n\n if (nextTrack.audio.src) {\n safePlay(nextTrack.audio);\n }\n}\n\nexport function stopCurrentAudio() {\n const currentTrack = currentTrackId && tracks.get(currentTrackId);\n if (currentTrack) {\n currentTrack.audio.pause();\n }\n}\n\nexport function register(\n trackId: TrackId,\n trackType: Track['type'],\n handler: Handler,\n onForcePlay?: NoneToVoidFunction,\n onTrackChange?: NoneToVoidFunction,\n) {\n if (!tracks.has(trackId)) {\n const track = createAudio(trackId, trackType, onForcePlay, onTrackChange);\n tracks.set(trackId, track);\n addTrackToQueue(track, trackId);\n }\n const { audio, proxy, handlers } = tracks.get(trackId)!;\n\n handlers.push(handler);\n\n return {\n play(src: string) {\n if (!audio.paused) return;\n const currentTrack = currentTrackId && tracks.get(currentTrackId);\n if (currentTrack && currentTrackId !== trackId) {\n currentTrack.audio.pause();\n currentTrack.audio.currentTime = 0;\n if (isSafariPatchInProgress(currentTrack.audio)) {\n currentTrack.audio.dataset.preventPlayAfterPatch = 'true';\n }\n if (currentTrack.onTrackChange) currentTrack.onTrackChange();\n }\n\n currentTrackId = trackId;\n\n if (!audio.src) {\n audio.src = src;\n audio.preload = 'auto';\n\n if (src.includes('/progressive/') && IS_SAFARI) {\n delete audio.dataset.preventPlayAfterPatch;\n patchSafariProgressiveAudio(audio);\n }\n }\n\n safePlay(audio);\n cleanUpQueue(trackType, trackId);\n },\n\n pause() {\n if (currentTrackId === trackId) {\n audio.pause();\n }\n },\n\n stop() {\n if (currentTrackId === trackId) {\n // Hack, reset src to remove default media session notification\n const prevSrc = audio.src;\n audio.pause();\n // onPause not called otherwise, but required to sync UI\n fastRaf(() => {\n audio.src = '';\n audio.src = prevSrc;\n });\n }\n },\n\n setCurrentTime(time: number) {\n if (currentTrackId === trackId) {\n if (audio.fastSeek) {\n audio.fastSeek(time);\n } else {\n audio.currentTime = time;\n }\n }\n },\n\n setVolume(volume: number) {\n if (currentTrackId === trackId) {\n audio.volume = volume;\n audio.muted = false;\n }\n },\n\n setPlaybackRate(rate: number) {\n if (currentTrackId === trackId) {\n audio.playbackRate = rate;\n }\n },\n\n toggleMuted(muted?: boolean) {\n if (muted === undefined) {\n audio.muted = !audio.muted;\n } else {\n audio.muted = muted;\n }\n },\n\n proxy,\n\n requestNextTrack() {\n playNext(trackId);\n },\n\n isLast() {\n return !findNextInQueue(trackId, getGlobal().audioPlayer.origin);\n },\n\n isFirst() {\n return !findNextInQueue(trackId, getGlobal().audioPlayer.origin, true);\n },\n\n requestPreviousTrack() {\n playNext(trackId, true);\n },\n\n destroy(shouldRemoveFromQueue = false) {\n const track = tracks.get(trackId);\n if (!track) {\n return;\n }\n\n track.handlers = track.handlers.filter((h) => h !== handler);\n\n if (!track.handlers.length) {\n track.audio.pause();\n tracks.delete(trackId);\n\n if (shouldRemoveFromQueue) {\n removeFromQueue(track, trackId);\n }\n\n if (trackId === currentTrackId) {\n currentTrackId = undefined;\n }\n }\n },\n };\n}\n\nfunction getTrackQueue(track: Track) {\n switch (track.type) {\n case 'audio': return musicQueue;\n case 'voice': return voiceQueue;\n default: return undefined;\n }\n}\n\nfunction addTrackToQueue(track: Track, trackId: TrackId) {\n if (track.type === 'audio' && !musicQueue.includes(trackId)) {\n musicQueue.push(trackId);\n musicQueue.sort(trackIdComparator);\n }\n\n if (track.type === 'voice' && !voiceQueue.includes(trackId)) {\n voiceQueue.push(trackId);\n voiceQueue.sort(trackIdComparator);\n }\n}\n\nfunction removeFromQueue(track: Track, trackId: TrackId) {\n const trackIdFilter = (el: TrackId) => el !== trackId;\n if (track.type === 'audio') {\n musicQueue = musicQueue.filter(trackIdFilter);\n }\n\n if (track.type === 'voice') {\n voiceQueue = voiceQueue.filter(trackIdFilter);\n }\n}\n\nfunction cleanUpQueue(type: Track['type'], trackId: TrackId) {\n if (getGlobal().globalSearch.currentContent === GlobalSearchContent.Music) return;\n const { chatId } = parseMessageKey(splitTrackId(trackId).messageKey);\n const openedChatId = selectCurrentMessageList(getGlobal())?.chatId;\n const queueFilter = (id: string) => (\n id.startsWith(`msg${chatId}`) || (openedChatId && id.startsWith(`msg${openedChatId}`))\n );\n\n if (type === 'audio') {\n musicQueue = musicQueue.filter(queueFilter);\n }\n\n if (type === 'voice') {\n voiceQueue = voiceQueue.filter(queueFilter);\n }\n}\n\nfunction findNextInQueue(currentId: TrackId, origin = AudioOrigin.Inline, isReverseOrder?: boolean) {\n const track = tracks.get(currentId)!;\n const queue = getTrackQueue(track);\n if (!queue) return undefined;\n\n if (origin === AudioOrigin.Search) {\n const index = queue.indexOf(currentId);\n if (index < 0) return undefined;\n const direction = isReverseOrder ? -1 : 1;\n return queue[index + direction];\n }\n\n const { chatId } = parseMessageKey(splitTrackId(currentId).messageKey);\n const chatAudio = queue.filter((id) => id.startsWith(`msg${chatId}`));\n const index = chatAudio.indexOf(currentId);\n if (index < 0) return undefined;\n let direction = origin === AudioOrigin.Inline ? -1 : 1;\n if (isReverseOrder) direction *= -1;\n return chatAudio[index + direction];\n}\n\nexport function makeTrackId(message: ApiMessage): TrackId {\n return `${getMessageKey(message)}-${message.date}`;\n}\n\nfunction splitTrackId(trackId: TrackId) {\n const messageKey = trackId.match(/^msg(-?\\d+)-(\\d+)/)![0] as MessageKey;\n const date = Number(trackId.split('-').pop());\n return {\n messageKey,\n date,\n };\n}\n\n// Descending order by date\nfunction trackIdComparator(one?: TrackId, two?: TrackId) {\n if (!one || !two) return 0;\n const { date: dateOne, messageKey: keyOne } = splitTrackId(one);\n const { date: dateTwo, messageKey: keyTwo } = splitTrackId(two);\n const diff = dateTwo - dateOne;\n return diff === 0 ? keyTwo.localeCompare(keyOne) : diff;\n}\n","import { IS_IOS } from './environment';\n\nexport enum SwipeDirection {\n Up,\n Down,\n Left,\n Right,\n}\n\ninterface CaptureOptions {\n onCapture?: (e: MouseEvent | TouchEvent) => void;\n onRelease?: (e: MouseEvent | TouchEvent) => void;\n onDrag?: (\n e: MouseEvent | TouchEvent,\n captureEvent: MouseEvent | TouchEvent,\n params: {\n dragOffsetX: number;\n dragOffsetY: number;\n },\n ) => void;\n onSwipe?: (e: Event, direction: SwipeDirection) => boolean;\n onZoom?: (e: TouchEvent, params: {\n // Relative zoom factor\n zoomFactor: number;\n\n // center coordinate of the initial pinch\n initialCenterX: number;\n initialCenterY: number;\n\n // offset of the pinch center (current from initial)\n dragOffsetX: number;\n dragOffsetY: number;\n\n // center coordinate of the current pinch\n currentCenterX: number;\n currentCenterY: number;\n }) => void;\n onClick?: (e: MouseEvent | TouchEvent) => void;\n onDoubleClick?: (e: MouseEvent | RealTouchEvent, params: { centerX: number; centerY: number }) => void;\n excludedClosestSelector?: string;\n selectorToPreventScroll?: string;\n maxZoom?: number;\n minZoom?: number;\n isNotPassive?: boolean;\n withCursor?: boolean;\n}\n\n// https://stackoverflow.com/questions/11287877/how-can-i-get-e-offsetx-on-mobile-ipad\n// Android does not have this value, and iOS has it but as read-only\nexport interface RealTouchEvent extends TouchEvent {\n pageX?: number;\n pageY?: number;\n}\n\ntype TSwipeAxis =\n 'x'\n | 'y'\n | undefined;\n\nexport const IOS_SCREEN_EDGE_THRESHOLD = 20;\nconst MOVED_THRESHOLD = 15;\nconst SWIPE_THRESHOLD = 50;\n\nfunction getDistance(a: Touch, b?: Touch) {\n if (!b) return 0;\n return Math.sqrt((b.pageX - a.pageX) ** 2 + (b.pageY - a.pageY) ** 2);\n}\n\nfunction getTouchCenter(a: Touch, b: Touch) {\n return {\n x: (a.pageX + b.pageX) / 2,\n y: (a.pageY + b.pageY) / 2,\n };\n}\n\nlet lastClickTime = 0;\n\nexport function captureEvents(element: HTMLElement, options: CaptureOptions) {\n let captureEvent: MouseEvent | RealTouchEvent | undefined;\n let hasMoved = false;\n let hasSwiped = false;\n let initialDistance = 0;\n let initialTouchCenter = { x: window.innerWidth / 2, y: window.innerHeight / 2 };\n let initialSwipeAxis: TSwipeAxis | undefined;\n\n function onCapture(e: MouseEvent | RealTouchEvent) {\n if (options.excludedClosestSelector && (\n (e.target as HTMLElement).matches(options.excludedClosestSelector)\n || (e.target as HTMLElement).closest(options.excludedClosestSelector)\n )) {\n return;\n }\n\n captureEvent = e;\n\n if (e.type === 'mousedown') {\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onRelease);\n } else if (e.type === 'touchstart') {\n // We need to always listen on `touchstart` target:\n // https://stackoverflow.com/questions/33298828/touch-move-event-dont-fire-after-touch-start-target-is-removed\n const target = e.target as HTMLElement;\n target.addEventListener('touchmove', onMove, { passive: true });\n target.addEventListener('touchend', onRelease);\n target.addEventListener('touchcancel', onRelease);\n\n if ('touches' in e) {\n if (e.pageX === undefined) {\n e.pageX = e.touches[0].pageX;\n }\n\n if (e.pageY === undefined) {\n e.pageY = e.touches[0].pageY;\n }\n\n if (e.touches.length === 2) {\n initialDistance = getDistance(e.touches[0], e.touches[1]);\n initialTouchCenter = getTouchCenter(e.touches[0], e.touches[1]);\n }\n }\n }\n\n document.body.classList.add('no-selection');\n if (options.withCursor) {\n document.body.classList.add('cursor-grabbing');\n }\n\n if (options.onCapture) {\n options.onCapture(e);\n }\n }\n\n function onRelease(e?: MouseEvent | TouchEvent) {\n if (captureEvent) {\n if (options.withCursor) {\n document.body.classList.remove('cursor-grabbing');\n }\n document.body.classList.remove('no-selection');\n\n document.removeEventListener('mouseup', onRelease);\n document.removeEventListener('mousemove', onMove);\n (captureEvent.target as HTMLElement).removeEventListener('touchcancel', onRelease);\n (captureEvent.target as HTMLElement).removeEventListener('touchend', onRelease);\n (captureEvent.target as HTMLElement).removeEventListener('touchmove', onMove);\n\n if (IS_IOS && options.selectorToPreventScroll) {\n Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => {\n scrollable.style.overflow = '';\n });\n }\n\n if (e) {\n if (hasMoved) {\n if (options.onRelease) {\n options.onRelease(e);\n }\n } else if (e.type === 'mouseup') {\n if (options.onDoubleClick && Date.now() - lastClickTime < 300) {\n options.onDoubleClick(e, {\n centerX: captureEvent!.pageX!,\n centerY: captureEvent!.pageY!,\n });\n } else if (options.onClick && (!('button' in e) || e.button === 0)) {\n options.onClick(e);\n }\n lastClickTime = Date.now();\n }\n }\n }\n\n hasMoved = false;\n hasSwiped = false;\n initialDistance = 0;\n initialSwipeAxis = undefined;\n initialTouchCenter = { x: window.innerWidth / 2, y: window.innerHeight / 2 };\n captureEvent = undefined;\n }\n\n function onMove(e: MouseEvent | RealTouchEvent) {\n if (captureEvent) {\n if (e.type === 'touchmove' && ('touches' in e)) {\n if (e.pageX === undefined) {\n e.pageX = e.touches[0].pageX;\n }\n\n if (e.pageY === undefined) {\n e.pageY = e.touches[0].pageY;\n }\n\n if (options.onZoom && initialDistance > 0 && e.touches.length === 2) {\n const endDistance = getDistance(e.touches[0], e.touches[1]);\n const touchCenter = getTouchCenter(e.touches[0], e.touches[1]);\n const dragOffsetX = touchCenter.x - initialTouchCenter.x;\n const dragOffsetY = touchCenter.y - initialTouchCenter.y;\n const zoomFactor = endDistance / initialDistance;\n options.onZoom(e, {\n zoomFactor,\n initialCenterX: initialTouchCenter.x,\n initialCenterY: initialTouchCenter.y,\n dragOffsetX,\n dragOffsetY,\n currentCenterX: touchCenter.x,\n currentCenterY: touchCenter.y,\n });\n if (zoomFactor !== 1) hasMoved = true;\n }\n }\n\n const dragOffsetX = e.pageX! - captureEvent.pageX!;\n const dragOffsetY = e.pageY! - captureEvent.pageY!;\n\n if (Math.abs(dragOffsetX) >= MOVED_THRESHOLD || Math.abs(dragOffsetY) >= MOVED_THRESHOLD) {\n hasMoved = true;\n }\n\n let shouldPreventScroll = false;\n\n if (options.onDrag) {\n options.onDrag(e, captureEvent, { dragOffsetX, dragOffsetY });\n shouldPreventScroll = true;\n }\n\n if (options.onSwipe && !hasSwiped) {\n hasSwiped = onSwipe(e, dragOffsetX, dragOffsetY);\n shouldPreventScroll = hasSwiped;\n }\n\n if (IS_IOS && shouldPreventScroll && options.selectorToPreventScroll) {\n Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => {\n scrollable.style.overflow = 'hidden';\n });\n }\n }\n }\n\n function onSwipe(e: MouseEvent | RealTouchEvent, dragOffsetX: number, dragOffsetY: number) {\n // Avoid conflicts with swipe-to-back gestures\n if (IS_IOS) {\n const x = (e as RealTouchEvent).touches[0].pageX;\n if (x <= IOS_SCREEN_EDGE_THRESHOLD || x >= window.innerWidth - IOS_SCREEN_EDGE_THRESHOLD) {\n return false;\n }\n }\n\n const xAbs = Math.abs(dragOffsetX);\n const yAbs = Math.abs(dragOffsetY);\n\n if (dragOffsetX && dragOffsetY) {\n const ratio = Math.max(xAbs, yAbs) / Math.min(xAbs, yAbs);\n // Diagonal swipe\n if (ratio < 2) {\n return false;\n }\n }\n\n let axis: TSwipeAxis | undefined;\n if (xAbs >= SWIPE_THRESHOLD) {\n axis = 'x';\n } else if (yAbs >= SWIPE_THRESHOLD) {\n axis = 'y';\n }\n\n if (!axis) {\n return false;\n }\n\n if (!initialSwipeAxis) {\n initialSwipeAxis = axis;\n } else if (initialSwipeAxis !== axis) {\n // Prevent horizontal swipe after vertical to prioritize scroll\n return false;\n }\n\n return processSwipe(e, axis, dragOffsetX, dragOffsetY, options.onSwipe!);\n }\n\n element.addEventListener('mousedown', onCapture);\n element.addEventListener('touchstart', onCapture, { passive: !options.isNotPassive });\n\n return () => {\n onRelease();\n\n element.removeEventListener('touchstart', onCapture);\n element.removeEventListener('mousedown', onCapture);\n };\n}\n\nfunction processSwipe(\n e: Event,\n currentSwipeAxis: TSwipeAxis,\n dragOffsetX: number,\n dragOffsetY: number,\n onSwipe: (e: Event, direction: SwipeDirection) => boolean,\n) {\n if (currentSwipeAxis === 'x') {\n if (dragOffsetX < 0) {\n return onSwipe(e, SwipeDirection.Left);\n } else {\n return onSwipe(e, SwipeDirection.Right);\n }\n } else if (currentSwipeAxis === 'y') {\n if (dragOffsetY < 0) {\n return onSwipe(e, SwipeDirection.Up);\n } else {\n return onSwipe(e, SwipeDirection.Down);\n }\n }\n\n return false;\n}\n","// Sometimes event is fired earlier than animation completes\nconst ANIMATION_END_DELAY = 50;\n\nexport function waitForTransitionEnd(node: Node, handler: NoneToVoidFunction, propertyName?: string) {\n waitForEndEvent('transitionend', node, handler, propertyName);\n}\n\nexport function waitForAnimationEnd(node: Node, handler: NoneToVoidFunction, animationName?: string) {\n waitForEndEvent('animationend', node, handler, animationName);\n}\n\nfunction waitForEndEvent(\n eventType: 'transitionend' | 'animationend',\n node: Node,\n handler: NoneToVoidFunction,\n detailedName?: string,\n) {\n let isHandled = false;\n\n node.addEventListener(eventType, function handleAnimationEnd(e: TransitionEvent | AnimationEvent) {\n if (isHandled || e.target !== e.currentTarget) {\n return;\n }\n\n if (detailedName && (\n (e instanceof TransitionEvent && e.propertyName === detailedName)\n || (e instanceof AnimationEvent && e.animationName === detailedName)\n )) {\n return;\n }\n\n isHandled = true;\n\n node.removeEventListener(eventType, handleAnimationEnd as EventListener);\n\n setTimeout(() => {\n handler();\n }, ANIMATION_END_DELAY);\n } as EventListener);\n}\n","export default function cycleRestrict(length: number, index: number) {\n return index - Math.floor(index / length) * length;\n}\n","import { getGlobal } from '../lib/teact/teactn';\n\nimport { FocusDirection } from '../types';\n\nimport {\n ANIMATION_LEVEL_MIN,\n FAST_SMOOTH_MAX_DISTANCE, FAST_SMOOTH_MAX_DURATION, FAST_SMOOTH_MIN_DURATION,\n FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE,\n} from '../config';\nimport { IS_ANDROID } from './environment';\nimport { dispatchHeavyAnimationEvent } from '../hooks/useHeavyAnimationCheck';\nimport { animateSingle } from './animation';\nimport { fastRaf } from './schedulers';\n\nlet isAnimating = false;\n\nexport default function fastSmoothScroll(\n container: HTMLElement,\n element: HTMLElement,\n position: ScrollLogicalPosition | 'centerOrTop',\n margin = 0,\n maxDistance = FAST_SMOOTH_MAX_DISTANCE,\n forceDirection?: FocusDirection,\n forceDuration?: number,\n forceNormalContainerHeight?: boolean,\n) {\n const scrollFrom = calculateScrollFrom(container, element, maxDistance, forceDirection);\n\n if (forceDirection === FocusDirection.Static) {\n scrollWithJs(container, element, scrollFrom, position, margin, 0);\n return;\n }\n\n if (getGlobal().settings.byKey.animationLevel === ANIMATION_LEVEL_MIN) {\n forceDuration = 0;\n }\n\n scrollWithJs(container, element, scrollFrom, position, margin, forceDuration, forceNormalContainerHeight);\n}\n\nexport function isAnimatingScroll() {\n return isAnimating;\n}\n\nfunction calculateScrollFrom(\n container: HTMLElement,\n element: HTMLElement,\n maxDistance = FAST_SMOOTH_MAX_DISTANCE,\n forceDirection?: FocusDirection,\n) {\n const { offsetTop: elementTop } = element;\n const { scrollTop } = container;\n\n if (forceDirection === undefined) {\n const offset = elementTop - container.scrollTop;\n\n if (offset < -maxDistance) {\n return scrollTop + (offset + maxDistance);\n } else if (offset > maxDistance) {\n return scrollTop + (offset - maxDistance);\n }\n } else if (forceDirection === FocusDirection.Up) {\n return elementTop + maxDistance;\n } else if (forceDirection === FocusDirection.Down) {\n return Math.max(0, elementTop - maxDistance);\n }\n\n return scrollTop;\n}\n\nfunction scrollWithJs(\n container: HTMLElement,\n element: HTMLElement,\n scrollFrom: number,\n position: ScrollLogicalPosition | 'centerOrTop',\n margin = 0,\n forceDuration?: number,\n forceNormalContainerHeight?: boolean,\n) {\n const { offsetTop: elementTop, offsetHeight: elementHeight } = element;\n const { scrollTop: currentScrollTop, offsetHeight: containerHeight, scrollHeight } = container;\n const targetContainerHeight = forceNormalContainerHeight && container.dataset.normalHeight\n ? Number(container.dataset.normalHeight)\n : containerHeight;\n\n if (currentScrollTop !== scrollFrom) {\n container.scrollTop = scrollFrom;\n }\n\n let path!: number;\n\n switch (position) {\n case 'start':\n path = (elementTop - margin) - scrollFrom + (IS_ANDROID ? 1 : 0);\n break;\n case 'end':\n path = (elementTop + elementHeight + margin) - (scrollFrom + targetContainerHeight);\n break;\n // 'nearest' is not supported yet\n case 'nearest':\n case 'center':\n case 'centerOrTop':\n path = elementHeight < targetContainerHeight\n ? (elementTop + elementHeight / 2) - (scrollFrom + targetContainerHeight / 2)\n : (elementTop - margin) - scrollFrom;\n break;\n }\n\n if (path < 0) {\n const remainingPath = -scrollFrom;\n path = Math.max(path, remainingPath);\n } else if (path > 0) {\n const remainingPath = scrollHeight - (scrollFrom + targetContainerHeight);\n path = Math.min(path, remainingPath);\n }\n\n if (path === 0) {\n return;\n }\n\n const target = scrollFrom + path;\n\n if (forceDuration === 0) {\n container.scrollTop = target;\n return;\n }\n\n isAnimating = true;\n\n const absPath = Math.abs(path);\n const transition = absPath < FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE ? shortTransition : longTransition;\n const duration = forceDuration || (\n FAST_SMOOTH_MIN_DURATION\n + (absPath / FAST_SMOOTH_MAX_DISTANCE) * (FAST_SMOOTH_MAX_DURATION - FAST_SMOOTH_MIN_DURATION)\n );\n const startAt = Date.now();\n const onHeavyAnimationStop = dispatchHeavyAnimationEvent();\n\n fastRaf(() => {\n animateSingle(() => {\n const t = Math.min((Date.now() - startAt) / duration, 1);\n const currentPath = path * (1 - transition(t));\n\n container.scrollTop = Math.round(target - currentPath);\n\n isAnimating = t < 1;\n\n if (!isAnimating) {\n onHeavyAnimationStop();\n }\n\n return isAnimating;\n });\n });\n}\n\nfunction longTransition(t: number) {\n return 1 - ((1 - t) ** 5);\n}\n\nfunction shortTransition(t: number) {\n return 1 - ((1 - t) ** 3.5);\n}\n","import { getGlobal } from '../lib/teact/teactn';\n\nimport { ANIMATION_LEVEL_MIN } from '../config';\nimport { animate } from './animation';\nimport { fastRaf } from './schedulers';\n\nconst DEFAULT_DURATION = 300;\n\nexport default function fastSmoothScrollHorizontal(container: HTMLElement, left: number, duration = DEFAULT_DURATION) {\n if (getGlobal().settings.byKey.animationLevel === ANIMATION_LEVEL_MIN) {\n duration = 0;\n }\n\n scrollWithJs(container, left, duration);\n}\n\nfunction scrollWithJs(container: HTMLElement, left: number, duration: number) {\n const isRtl = container.getAttribute('dir') === 'rtl';\n const { scrollLeft, offsetWidth: containerWidth, scrollWidth } = container;\n let path = left - scrollLeft;\n\n if (path < 0) {\n const remainingPath = -scrollLeft * (isRtl ? -1 : 1);\n path = Math.max(path, remainingPath);\n } else if (path > 0) {\n const remainingPath = scrollWidth - (scrollLeft + containerWidth);\n path = Math.min(path, remainingPath);\n }\n\n if (path === 0) {\n return;\n }\n\n const target = scrollLeft + path;\n\n if (duration === 0) {\n container.scrollLeft = target;\n return;\n }\n\n const startAt = Date.now();\n\n fastRaf(() => {\n animate(() => {\n const t = Math.min((Date.now() - startAt) / duration, 1);\n\n const currentPath = path * (1 - transition(t));\n container.scrollLeft = Math.round(target - currentPath);\n\n return t < 1;\n });\n });\n}\n\nfunction transition(t: number) {\n return 1 - ((1 - t) ** 3.5);\n}\n","import { IS_TOUCH_ENV } from './environment';\n\nexport default function focusEditableElement(element: HTMLElement, force?: boolean, forcePlaceCaretAtEnd?: boolean) {\n if (!force && element === document.activeElement) {\n return;\n }\n\n const selection = window.getSelection()!;\n const range = document.createRange();\n const lastChild = element.lastChild || element;\n\n if (!IS_TOUCH_ENV && !forcePlaceCaretAtEnd && (!lastChild || !lastChild.nodeValue)) {\n element.focus();\n return;\n }\n\n range.selectNodeContents(forcePlaceCaretAtEnd ? element : lastChild);\n // `false` means collapse to the end rather than the start\n range.collapse(false);\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","export default function getKeyFromEvent(e: KeyboardEvent) {\n const key = 'key' in e ? e.key : e.code;\n\n return key.startsWith('Key') ? key.slice(3).toLowerCase() : key;\n}\n","const ELEMENT_NODE = 1;\n\nexport default function getMessageIdsForSelectedText() {\n let selectedFragments = window.getSelection()?.getRangeAt(0).cloneContents();\n if (!selectedFragments || selectedFragments.childElementCount === 0) {\n return;\n }\n\n const messageIds = Array.from(selectedFragments.children)\n .reduce((result, node) => {\n if (node.nodeType === ELEMENT_NODE && node.classList.contains('message-date-group')) {\n return Array.from(node.querySelectorAll('.Message'))\n .reduce((acc, messageEl) => acc.concat(Number((messageEl as HTMLElement).dataset.messageId)), result);\n } else if (node.nodeType === ELEMENT_NODE && node.classList.contains('Message')) {\n return result.concat(Number((node as HTMLElement).dataset.messageId));\n }\n\n return result;\n }, [] as number[]);\n\n\n // Cleanup a document fragment because it is playing media content in the background\n while (selectedFragments.firstChild) {\n selectedFragments.removeChild(selectedFragments.firstChild);\n }\n selectedFragments = undefined;\n\n return messageIds;\n}\n","export type MediaSessionHandlers = {\n play?: () => void;\n pause?: () => void;\n stop?: () => void;\n\n previoustrack?: () => void;\n nexttrack?: () => void;\n\n togglemicrophone?: () => void;\n togglecamera?: () => void;\n hangup?: () => void;\n\n seekbackward?: (details: MediaSessionActionDetails) => void;\n seekforward?: (details: MediaSessionActionDetails) => void;\n seekTo?: ((details: MediaSessionActionDetails) => void);\n};\n\ninterface MediaMetadataParameters {\n title?: string;\n artist?: string;\n album?: string;\n artwork?: MediaImage[];\n}\n\nconst DEFAULT_HANDLERS = {\n play: undefined,\n pause: undefined,\n seekbackward: undefined,\n seekforward: undefined,\n previoustrack: undefined,\n nexttrack: undefined,\n stop: undefined,\n seekTo: undefined,\n};\n\nexport function registerMediaSession(metadata?: MediaMetadata, handlers?: MediaSessionHandlers) {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n if (metadata) updateMetadata(metadata);\n if (handlers) setMediaSessionHandlers(handlers);\n } else {\n // eslint-disable-next-line no-console\n console.warn('MediaSession API not supported in this browser');\n }\n}\n\nexport function updateMetadata(metadata?: MediaMetadata) {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n // eslint-disable-next-line no-null/no-null\n mediaSession.metadata = metadata ?? null;\n }\n}\n\nexport function setMediaSessionHandlers(handlers: MediaSessionHandlers) {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n Object.entries({ ...DEFAULT_HANDLERS, ...handlers }).forEach(([key, handler]) => {\n try {\n // @ts-ignore API not standardized yet\n mediaSession.setActionHandler(key, handler);\n } catch (err) {\n // Handler not supported, ignoring\n }\n });\n }\n}\n\nexport function clearMediaSession() {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n // eslint-disable-next-line no-null/no-null\n mediaSession.metadata = null;\n setMediaSessionHandlers(DEFAULT_HANDLERS);\n if (mediaSession.playbackState) mediaSession.playbackState = 'none';\n mediaSession.setPositionState?.();\n }\n}\n\nexport function setPlaybackState(state: 'none' | 'paused' | 'playing' = 'none') {\n const { mediaSession } = window.navigator;\n if (mediaSession && mediaSession.playbackState) {\n mediaSession.playbackState = state;\n }\n}\n\nexport function setPositionState(state?: MediaPositionState) {\n if (!state || state.position === undefined || state.duration === undefined) return;\n state.position = Math.min(state.position, state.duration);\n\n const { mediaSession } = window.navigator;\n mediaSession?.setPositionState?.(state);\n}\n\nexport function setMicrophoneActive(active: boolean) {\n const { mediaSession } = window.navigator;\n mediaSession?.setMicrophoneActive?.(active);\n}\n\nexport function setCameraActive(active: boolean) {\n const { mediaSession } = window.navigator;\n mediaSession?.setCameraActive?.(active);\n}\n\nexport function buildMediaMetadata({\n title, artist, album, artwork,\n}: MediaMetadataParameters) {\n if ('MediaMetadata' in window) {\n return new window.MediaMetadata({\n title,\n artist,\n album,\n artwork,\n });\n }\n return undefined;\n}\n","import { ApiMessageEntity, ApiMessageEntityTypes, ApiFormattedText } from '../api/types';\nimport { IS_EMOJI_SUPPORTED } from './environment';\n\nconst ENTITY_CLASS_BY_NODE_NAME: Record<string, string> = {\n B: ApiMessageEntityTypes.Bold,\n STRONG: ApiMessageEntityTypes.Bold,\n I: ApiMessageEntityTypes.Italic,\n EM: ApiMessageEntityTypes.Italic,\n U: ApiMessageEntityTypes.Underline,\n S: ApiMessageEntityTypes.Strike,\n STRIKE: ApiMessageEntityTypes.Strike,\n DEL: ApiMessageEntityTypes.Strike,\n CODE: ApiMessageEntityTypes.Code,\n PRE: ApiMessageEntityTypes.Pre,\n BLOCKQUOTE: ApiMessageEntityTypes.Blockquote,\n};\n\nconst MAX_TAG_DEEPNESS = 3;\n\nexport default function parseMessageInput(html: string): ApiFormattedText {\n const fragment = document.createElement('div');\n fragment.innerHTML = parseMarkdown(html);\n const text = fragment.innerText.trim().replace(/\\u200b+/g, '');\n let textIndex = 0;\n let recursionDeepness = 0;\n const entities: ApiMessageEntity[] = [];\n\n function addEntity(node: ChildNode) {\n const { index, entity } = getEntityDataFromNode(node, text, textIndex);\n\n if (entity) {\n textIndex = index;\n entities.push(entity);\n } else if (node.textContent) {\n textIndex += node.textContent.length;\n }\n\n if (node.hasChildNodes() && recursionDeepness <= MAX_TAG_DEEPNESS) {\n recursionDeepness += 1;\n Array.from(node.childNodes).forEach(addEntity);\n }\n }\n\n Array.from(fragment.childNodes).forEach((node) => {\n recursionDeepness = 1;\n addEntity(node);\n });\n\n return {\n text,\n entities: entities.length ? entities : undefined,\n };\n}\n\nfunction parseMarkdown(html: string) {\n let parsedHtml = html.slice(0);\n\n if (!IS_EMOJI_SUPPORTED) {\n // Emojis\n parsedHtml = parsedHtml.replace(/<img[^>]+alt=\"([^\"]+)\"[^>]*>/gm, '$1');\n }\n\n // Strip redundant nbsp's\n parsedHtml = parsedHtml.replace(/&nbsp;/g, ' ');\n\n // Replace <div><br></div> with newline (new line in Safari)\n parsedHtml = parsedHtml.replace(/<div><br([^>]*)?><\\/div>/g, '\\n');\n // Replace <br> with newline\n parsedHtml = parsedHtml.replace(/<br([^>]*)?>/g, '\\n');\n\n // Strip redundant <div> tags\n parsedHtml = parsedHtml.replace(/<\\/div>(\\s*)<div>/g, '\\n');\n parsedHtml = parsedHtml.replace(/<div>/g, '\\n');\n parsedHtml = parsedHtml.replace(/<\\/div>/g, '');\n\n // Pre\n parsedHtml = parsedHtml.replace(/^`{3}(.*[\\n\\r][^]*?^)`{3}/gm, '<pre>$1</pre>');\n parsedHtml = parsedHtml.replace(/[`]{3}([^`]+)[`]{3}/g, '<pre>$1</pre>');\n\n // Code\n parsedHtml = parsedHtml.replace(/[`]{1}([^`\\n]+)[`]{1}/g, '<code>$1</code>');\n\n // Other simple markdown\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<code[^<]*|<\\/)[*]{2}([^*\\n]+)[*]{2}(?![^<]*<\\/code>)(\\s|$)/g,\n '$1<b>$2</b>$3',\n );\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<code[^<]*|<\\/)[_]{2}([^_\\n]+)[_]{2}(?![^<]*<\\/code>)(\\s|$)/g,\n '$1<i>$2</i>$3',\n );\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<code[^<]*|<\\/)[~]{2}([^~\\n]+)[~]{2}(?![^<]*<\\/code>)(\\s|$)/g,\n '$1<s>$2</s>$3',\n );\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<code[^<]*|<\\/)[|]{2}([^|\\n]+)[|]{2}(?![^<]*<\\/code>)(\\s|$)/g,\n `$1<span data-entity-type=\"${ApiMessageEntityTypes.Spoiler}\">$2</span>$3`,\n );\n\n return parsedHtml;\n}\n\nfunction getEntityDataFromNode(\n node: ChildNode,\n rawText: string,\n textIndex: number,\n): { index: number; entity?: ApiMessageEntity } {\n const type = getEntityTypeFromNode(node);\n if (!type || !node.textContent) {\n return {\n index: textIndex,\n entity: undefined,\n };\n }\n\n const rawIndex = rawText.indexOf(node.textContent, textIndex);\n // In some cases, last text entity ends with a newline (which gets trimmed from `rawText`).\n // In this case, `rawIndex` would return `-1`, so we use `textIndex` instead.\n const index = rawIndex >= 0 ? rawIndex : textIndex;\n const offset = rawText.substring(0, index).length;\n const { length } = rawText.substring(index, index + node.textContent.length);\n\n let url: string | undefined;\n let userId: string | undefined;\n if (type === ApiMessageEntityTypes.TextUrl) {\n url = (node as HTMLAnchorElement).href;\n }\n if (type === ApiMessageEntityTypes.MentionName) {\n userId = (node as HTMLAnchorElement).dataset.userId;\n }\n\n return {\n index,\n entity: {\n type,\n offset,\n length,\n ...(url && { url }),\n ...(userId && { userId }),\n },\n };\n}\n\nfunction getEntityTypeFromNode(node: ChildNode) {\n if (ENTITY_CLASS_BY_NODE_NAME[node.nodeName]) {\n return ENTITY_CLASS_BY_NODE_NAME[node.nodeName];\n }\n\n if (node.nodeName === 'A') {\n const anchor = node as HTMLAnchorElement;\n if (anchor.dataset.entityType === ApiMessageEntityTypes.MentionName) {\n return ApiMessageEntityTypes.MentionName;\n }\n if (anchor.dataset.entityType === ApiMessageEntityTypes.Url) {\n return ApiMessageEntityTypes.Url;\n }\n if (anchor.href.startsWith('mailto:')) {\n return ApiMessageEntityTypes.Email;\n }\n if (anchor.href.startsWith('tel:')) {\n return ApiMessageEntityTypes.Phone;\n }\n if (anchor.href !== anchor.textContent) {\n return ApiMessageEntityTypes.TextUrl;\n }\n\n return ApiMessageEntityTypes.Url;\n }\n\n if (node.nodeName === 'SPAN') {\n return (node as HTMLElement).dataset.entityType;\n }\n\n return undefined;\n}\n","/*\n * Thanks to Ace Monkey for this mind-blowing patch.\n */\n\nexport function patchSafariProgressiveAudio(audioEl: HTMLAudioElement) {\n if (audioEl.dataset.patchedForSafari) {\n return;\n }\n\n audioEl.addEventListener('play', () => {\n const t = audioEl.currentTime;\n\n audioEl.dataset.patchForSafariInProgress = 'true';\n function onProgress() {\n if (!audioEl.buffered.length) {\n return;\n }\n audioEl.currentTime = audioEl.duration - 1;\n audioEl.addEventListener('progress', () => {\n delete audioEl.dataset.patchForSafariInProgress;\n audioEl.currentTime = t;\n if (audioEl.paused && !audioEl.dataset.preventPlayAfterPatch) {\n audioEl.play();\n }\n }, { once: true });\n\n audioEl.removeEventListener('progress', onProgress);\n }\n\n audioEl.addEventListener('progress', onProgress);\n }, { once: true });\n\n audioEl.dataset.patchedForSafari = 'true';\n}\n\nexport function isSafariPatchInProgress(audioEl: HTMLAudioElement) {\n return Boolean(audioEl.dataset.patchForSafariInProgress);\n}\n","import React from '../lib/teact/teact';\n\nconst stopEvent = (e: React.UIEvent | Event) => {\n e.stopPropagation();\n e.preventDefault();\n};\n\nexport default stopEvent;\n"],"names":["memo","sticker","effect","isOwn","soundId","size","observeIntersection","lastSyncTime","forceLoadPreview","messageId","chatId","activeEmojiInteractions","markAnimationLoaded","isAnimationLoaded","ref","width","style","handleClick","playKey","useAnimatedEmoji","undefined","emoji","localMediaHash","id","isIntersecting","useIsIntersecting","thumbDataUri","thumbnail","dataUri","previewBlobUrl","useMedia","ApiMediaFormat","transitionClassNames","useMediaTransition","mediaData","isMediaLoaded","Boolean","className","buildClassName","LIKE_STICKER_ID","onClick","src","alt","key","animationData","quality","play","forceOnHeavyAnimation","noLoop","onLoad","renderWaveform","canvas","spikes","progress","peak","fillStyle","progressFillStyle","length","height","ctx","getContext","scale","forEach","item","i","globalAlpha","spikeHeight","Math","max","x","y","radius","beginPath","moveTo","arcTo","closePath","roundedRectangle","fill","decodeWaveform","encoded5bit","bitsCount","valuesCount","floor","result","Array","bitsData","l","byteIndex","bitShift","value","lastByteIndex","lastBitShift","lastValue","interpolateArray","data","fitCount","newData","springFactor","leftFiller","rightFiller","idx","val","MIN_SPIKES","IS_SINGLE_COLUMN_LAYOUT","MAX_SPIKES","renderSeekline","playProgress","bufferedProgress","seekerRef","theme","message","senderTitle","uploadProgress","origin","date","isSelectable","isSelected","isDownloading","onPlay","onReadMedia","onCancelUpload","onDateClick","content","audio","voice","video","isMediaUnread","isVoice","isSeeking","useRef","playStateBeforeSeeking","lang","useLang","isRtl","dispatch","getDispatch","isActivated","setIsActivated","useState","shouldLoad","coverHash","getMessageMediaHash","coverBlobUrl","getMessageMediaFormat","loadProgress","downloadProgress","useMediaWithLoadProgress","handleForcePlay","useCallback","handleTrackChange","isBuffered","bufferingHandlers","checkBuffering","useBuffering","isPlaying","playPause","pause","setCurrentTime","duration","useAudioPlayer","makeTrackId","getMediaDuration","isMessageLocal","isOwnMessage","waveformCanvasRef","canvasRef","useMemo","waveform","min","durationFactor","spikesCount","round","Uint8Array","useLayoutEffect","current","useWaveformCanvas","withSeekline","useEffect","isLoadingForPlaying","isUploading","isTransferring","transferProgress","getMediaTransferState","shouldRender","shouldRenderSpinner","spinnerClassNames","useShowTransition","shouldRenderCross","handleButtonClick","setAudioPlayerOrigin","handleDownloadClick","cancelMessageMediaDownload","downloadMessageMedia","handleSeek","e","left","getBoundingClientRect","clientX","MouseEvent","targetTouches","stopPropagation","handleStartSeek","button","handleStopSeek","handleDateClick","renderFirstLine","title","fileName","captureEvents","onCapture","onRelease","onDrag","fullClassName","AudioOrigin","buttonClassNames","push","contentClassName","renderWithTitle","dir","renderText","Link","formatPastTimeShort","formatMediaDuration","performer","renderSecondLine","Button","ripple","color","join","ariaLabel","backgroundImage","ProgressSpinner","transparent","noCross","showProgress","showSeekline","getTranslation","getFileSizeString","formatMediaDateTime","renderAudio","draggable","renderVoice","withGlobal","global","chatOrUserId","countryList","phoneCodes","phoneCodeList","chat","selectChat","user","isUserId","selectUser","isMuted","selectIsChatMuted","selectNotifySettings","selectNotifyExceptions","canInviteUsers","isChatChannel","isUserRightBanned","getHasAdminRight","forceShowSelf","loadFullUser","showNotification","updateChatMutedState","userId","fullInfo","username","phoneNumber","isSelf","handleNotificationChange","isRestricted","copy","text","entity","copyTextToClipboard","formattedNumber","formatPhoneNumberWithCode","link","getChatLink","description","bio","getChatDescription","icon","multiline","narrow","isStatic","label","checked","inactive","isPrivateChat","isChatWithSelf","selectIsChatWithSelf","getPrivateChatUserId","isBot","isUserBot","isSupport","canDeleteForAll","contactName","getUserFirstOrLastName","isChannel","isBasicGroup","isChatBasicGroup","isSuperGroup","isChatSuperGroup","currentUserId","isOpen","onClose","onCloseAnimationEnd","leaveChannel","deleteHistory","deleteChannel","deleteChatUser","blockContact","chatTitle","getChatTitle","handleDeleteMessageForAll","shouldDeleteForAll","handleDeleteAndStop","contactId","accessHash","handleDeleteChat","isCreator","header","isSavedMessages","isText","smaller","canAutoLoad","autoLoadFileMaxSizeMb","withDate","datetime","sender","onMediaClick","document","timestamp","extension","getDocumentExtension","wasIntersected","markIntersected","useFlag","isLoadAllowed","setIsLoadAllowed","shouldDownload","documentHash","isLoaded","hasPreview","getDocumentHasPreview","getMessageMediaThumbDataUri","localBlobUrl","previewData","withMediaViewer","mediaType","name","thumbnailDataUri","actionIcon","isMessageDocumentVideo","elementRef","shouldSpinnerRender","getColorFromExtension","sizeString","getDocumentThumbnailDimensions","onlineCount","selectChatOnlineCount","areMessagesLoaded","selectChatMessages","typingStatus","avatarSize","status","withDots","withUsername","withFullInfo","withUpdatingStatus","withChatType","noRtl","loadFullChat","openMediaViewer","isMin","handleAvatarViewerOpen","hasPhoto","avatarOwnerId","MediaViewerOrigin","isVerified","getChatTypeString","handle","groupStatus","chatTypeString","membersCount","getGroupStatus","onlineStatus","renderStatusOrTyping","outgoingStatus","idPrefix","isProtected","mediaBlobUrl","getMessageVideo","decoding","onContextMenu","stopEvent","isGif","Keys","activeKey","DEFAULT_TEXT","itemIds","selectedIds","filterValue","filterPlaceholder","notFoundText","searchInputId","isLoading","noScrollRestore","onSelectedIdsChange","onFilterChange","onLoadMore","inputRef","shouldMinimize","setTimeout","requestAnimationFrame","focus","handleItemClick","newSelectedIds","includes","splice","indexOf","handleFilterChange","currentTarget","viewportIds","getMore","useInfiniteScroll","map","isMinimized","canClose","clickArg","onChange","placeholder","items","iconElement","titleText","serverTimeOffset","userStatus","selectUserStatus","noStatusOrTyping","fullName","getUserFullName","isUserOnline","getUserStatus","photo","isFirstPhoto","isDeleted","isDeletedUser","isRepliesChat","isChatWithRepliesBot","getMediaHash","forceAvatar","hash","getChatAvatarHash","photoBlobUrl","avatarMediaHash","avatarBlobUrl","useBlurSync","imageSrc","prevImageSrc","usePrevious","userFullName","getFirstLetters","Spinner","getUserColorKey","connectionState","animationLevel","settings","byKey","photos","slideAnimation","currentPhotoIndex","setCurrentPhotoIndex","isFirst","isLast","profile","currentIndex","slice","mediaLoader","usePhotosPreload","handleProfilePhotoClick","profilePhotoIndex","selectPreviousMedia","selectNextMedia","element","querySelector","selectorToPreventScroll","onSwipe","IS_TOUCH_ENV","direction","SwipeDirection","isVerifiedIconShown","_","renderPhotoTabs","Transition","renderPhoto","type","VerifiedIcon","reaction","staticIconId","getGlobal","availableReactions","find","staticIcon","noAnimate","onUnfaveClick","stickerSelector","shouldPlay","lottieData","isLottie","isLottieLoaded","markLoaded","unmarkLoaded","canLottiePlay","IS_WEBM_SUPPORTED","gifBlobUrl","canGifPlay","previewTransitionClassNames","safePlay","onMouseDown","preventMessageInputBlurWithBubbling","autoPlay","loop","playsInline","muted","isLowPriority","preventDefault","props","StickerSetModal","useModuleLoader","Bundles","typingUser","typingUserName","action","replace","trim","onMessageClick","linkData","getMessageWebPage","getFirstLinkInMessage","url","domain","siteName","formattedDescription","getMessageText","renderMessageSummary","handleMessageClick","displayUrl","truncatedDescription","trimText","MEDIA_VIEWER_MEDIA_QUERY","REM","parseInt","getComputedStyle","documentElement","fontSize","ROUND_VIDEO_DIMENSIONS_PX","AVATAR_FULL_DIMENSIONS","DEFAULT_MEDIA_DIMENSIONS","cachedMaxWidthOwn","cachedMaxWidth","cachedMaxWidthNoAvatar","getAvailableWidth","fromOwnMessage","isForwarded","isWebPagePhoto","noAvatars","extraPaddingRem","availableWidthRem","regularMaxWidth","windowWidth","windowSize","getMaxMessageWidthRem","calculateDimensionsForMessageMedia","aspectRatio","availableWidth","availableHeight","getAvailableHeight","mediaWidth","calculateDimensions","getMediaViewerAvailableDimensions","withFooter","isVideo","mql","window","matchMedia","windowHeight","occupiedHeightRem","matches","calculateInlineImageDimensions","getPhotoInlineDimensions","calculateVideoDimensions","getVideoDimensions","getPictogramDimensions","getStickerDimensions","baseWidth","STICKER_SIZE_INLINE_MOBILE_FACTOR","STICKER_SIZE_INLINE_DESKTOP_FACTOR","calculatedHeight","calculateMediaViewerDimensions","mediaHeight","calculatedWidth","WIDTH","large","medium","small","localEffect","interactWithAnimatedEmoji","sendEmojiInteraction","sendWatchingEmojiInteraction","hasEffect","audioRef","soundMediaData","setPlayKey","String","random","interactions","startedInteractions","sendInteractionBunch","remove","Audio","addEventListener","once","container","startSize","isReversed","performance","now","interactionMessageId","emoticon","selectLocalAnimatedEmojiEffectByName","ChatFolderModal","ChatAnimationTypes","isPinned","isShown","unreadCount","hasUnreadMark","ShowTransition","isCustom","unreadMentionsCount","formatIntegerCompact","isActive","lastMessage","senderId","replyToMessageId","isOutgoing","lastMessageSender","lastMessageAction","getMessageAction","actionTargetMessage","selectChatMessage","targetUserIds","actionTargetUserIds","targetChatId","actionTargetChatId","privateChatUserId","currentChatId","threadId","currentThreadId","messageListType","selectCurrentMessageList","MAIN_THREAD_ID","draft","selectDraft","canScrollDown","canChangeFolder","chatFolders","orderedIds","lastMessageOutgoingStatus","selectOutgoingStatus","folderId","orderDiff","animationType","openChat","focusLastMessage","isDeleteModalOpen","openDeleteModal","closeDeleteModal","isChatFolderModalOpen","openChatFolderModal","closeChatFolderModal","shouldRenderDeleteModal","markRenderDeleteModal","unmarkRenderDeleteModal","shouldRenderChatFolderModal","markRenderChatFolderModal","unmarkRenderChatFolderModal","isAction","isActionMessage","useEnsureMessage","mediaThumbnail","getMessageSticker","isRoundVideo","getMessageRoundVideo","actionTargetUsers","usersById","users","byId","filter","Opacity","opacity","fastRaf","classList","add","Move","transform","ANIMATION_END_DELAY","shouldReplaceHistory","contextActions","useChatContextActions","handleDelete","handleChatFolderChange","ListItem","Avatar","isCallActive","isCallNotEmpty","LastMessageMeta","TypingStatus","isChat","renderActionMessageText","asTextWithSpoilers","senderName","getMessageSenderName","blobUrl","renderSummary","renderLastMessageOrTyping","DeleteChatModal","folderType","chatFolder","selectChatFolder","animatedEmoji","selectAnimatedEmoji","foldersDispatch","onScreenSelect","handleEditFolder","payload","SettingsScreens","AnimatedEmoji","fluid","pill","openNextChat","resolvedFolderId","ALL_FOLDER_ID","ARCHIVED_FOLDER_ID","useFolderManagerForOrderedIds","orderById","reduce","acc","prevOrderById","orderDiffById","mapValues","order","CHAT_LIST_SLICE","handleKeyDown","removeEventListener","IS_PWA","IS_MAC_OS","metaKey","ctrlKey","code","startsWith","digit","match","position","Number","altKey","targetIndexDelta","getAnimationType","orderDiffs","Object","values","numberOfUp","diff","numberOfDown","None","Infinity","useChatAnimationType","InfiniteScroll","preloadBackwards","withAbsolutePositioning","maxHeight","CHAT_HEIGHT_PX","viewportOffset","pinnedCount","getPinnedChatsCount","teactOrderKey","renderChats","Loading","getSenderName","chatsById","getSenderTitle","isChatGroup","isQuick","onFileSelect","isHovered","markHovered","unmarkHovered","onDrop","onDragEnter","onDragLeave","relatedTarget","toTarget","DropAreaState","withQuick","onHide","hideTimeoutRef","prevWithQuick","captureEscKeyListener","handleFilesDrop","async","dataTransfer","dt","files","folderFiles","getFilesFromDataTransferItems","concat","from","handleQuickFilesDrop","handleDragLeave","target","fromTarget","Portal","containerId","onDragOver","clearTimeout","EmojiTooltip","MAX_INPUT_HEIGHT","messageSendKeyCombo","replyingToId","selectReplyingToId","noTabCapture","isPollModalOpen","payment","isPaymentModalOpen","isAttachmentModalInput","editableInputId","html","forcedPlaceholder","canAutoFocus","shouldSuppressFocus","shouldSuppressTextFormatter","onUpdate","onSuppressedFocus","onSend","editLastMessage","replyToNextMessage","cloneRef","isContextMenuOpenRef","isTextFormatterOpen","openTextFormatter","closeTextFormatter","textFormatterAnchorPosition","setTextFormatterAnchorPosition","selectedRange","setSelectedRange","sendMessageAction","useSendMessageAction","updateInputHeight","useLayoutEffectWithPrevDeps","prevHtml","innerHTML","focusInput","isHeavyAnimating","focusEditableElement","handleCloseTextFormatter","selection","getSelection","removeAllRanges","empty","clearSelection","checkSelection","IS_IOS","rangeCount","selectionRange","getRangeAt","selectedText","toString","isSelectionInsideInput","EDITABLE_INPUT_ID","parseEmojiOnlyString","START_TO_END","processSelection","selectionRect","inputRect","top","willSend","input","clone","currentHeight","newHeight","scrollHeight","transitionDuration","log","abs","exec","toggle","captureFirstTab","debounce","captureKeyboardListeners","onTab","suppressFocus","blur","contentEditable","textContent","IS_EMOJI_SUPPORTED","onKeyDown","shiftKey","handleKeyUp","IS_ANDROID","event","closeContextMenuMouseListener","closeContextMenuKeyListener","handleMouseUp","onTouchCancel","anchorPosition","TEXT_FORMAT_BY_TAG_NAME","B","STRONG","I","EM","U","DEL","CODE","SPAN","fragmentEl","createElement","containerRef","linkUrlInputRef","isLinkControlOpen","openLinkControl","closeLinkControl","linkUrl","setLinkUrl","isEditingLink","setIsEditingLink","inputClassName","setInputClassName","selectedTextFormats","setSelectedTextFormats","useVirtualBackdrop","selectedFormats","parentElement","commonAncestorContainer","textFormat","tagName","updateSelectedRange","getSelectedText","innerText","getSelectedElement","updateInputStyles","offsetWidth","scrollWidth","scrollLeft","getFormatButtonClassName","keys","some","fKey","monospace","strikethrough","handleSpoilerText","spoiler","dataset","entityType","ApiMessageEntityTypes","replaceWith","execCommand","handleBoldText","bold","handleItalicText","italic","handleUnderlineText","underline","handleStrikethroughText","handleMonospaceText","handleLinkUrlConfirm","formattedLinkUrl","encodeURI","ensureProtocol","href","addRange","restoreSelection","handler","k","b","u","m","s","p","getKeyFromEvent","linkUrlConfirmClassName","autoComplete","inputMode","onScroll","dataTransferItems","traverseFileTreePromise","entry","Promise","resolve","File","isFile","itemFile","getAsFile","file","isDirectory","createReader","readEntries","entries","entriesPromises","entr","all","kind","webkitGetAsEntry","RE_BR","RE_SPACE","RE_CLEAN_HTML","RE_EXTRA_NEW_LINE","prepareForRegExp","inputId","parentNode","iterations","cache","WeakMap","memoized","fn","cached","get","args","areSortedArraysEqual","lastArgs","lastResult","set","emojiDataPromise","emojiRawData","emojiData","RE_EMOJI_SEARCH","prepareRecentEmojisMemo","recentEmojiIds","limit","pickTruthy","MEMO_EMPTY_ARRAY","prepareLibraryMemo","baseEmojiKeywords","emojiKeywords","emojis","byNative","buildCollectionByKey","baseEmojisByKeyword","natives","emojisByKeyword","byKeyword","keywords","byName","names","searchInLibraryMemo","library","matched","matchedKeywords","keyword","sort","flatten","matchedNames","unique","RegExp","useEmojiTooltip","isAllowed","htmlRef","onUpdateHtml","isDisabled","markIsOpen","unmarkIsOpen","setById","shouldForceInsertEmoji","setShouldForceInsertEmoji","filteredEmojis","setFilteredEmojis","ensureEmojiData","then","getEmojiCode","forceSend","endsWith","substr","insertEmoji","textEmoji","isForce","currentHtml","atIndex","lastIndexOf","messageInput","getElementById","native","isEmojiTooltipOpen","closeEmojiTooltip","default","uncompressEmoji","runThrottled","throttle","cb","RE_USERNAME_SEARCH","useMentionTooltip","canSuggestMembers","groupChatMembers","topInlineBotIds","usersToMention","setUsersToMention","updateFilteredUsers","withInlineBots","memberIds","member","filteredIds","filterUsersByName","usernameFilter","getUsernameFilter","canSuggestInlineBots","insertMention","forceFocus","insertedHtml","isMentionTooltipOpen","closeMentionTooltip","mentionFilteredUsers","useAsyncRendering","dependencies","delay","shouldRenderRef","timeoutRef","forceUpdate","useForceUpdate","useOnChange","options","selected","disabled","loadingOptions","setValues","handleChange","newValues","v","option","subLabel","children","buttonClassName","tabIndex","buttonRef","secondaryIcon","destructive","onSecondaryIconClick","isTouched","markIsTouched","unmarkIsTouched","isContextMenuOpen","contextMenuPosition","handleBeforeContextMenu","handleContextMenu","handleContextMenuClose","handleContextMenuHide","useContextMenuHandlers","getTriggerElement","getRootElement","closest","getMenuElement","positionX","positionY","transformOriginX","transformOriginY","menuStyle","useContextMenuPosition","handleSecondaryIconClick","handleMouseDown","role","autoClose","DEFAULT_DURATION","onDismiss","setIsOpen","timerRef","closeAndDismiss","handleMouseEnter","handleMouseLeave","onMouseEnter","onMouseLeave","RADIUSES","xl","square","circleRadius","STROKE_WIDTH","borderRadius","circumference","PI","svg","firstElementChild","strokeDashOffset","setAttribute","hidden","loadingOption","step","renderValue","trackWidth","index","parentContainerClassName","focused","spinnerColor","spinnerBackgroundColor","autoFocusSearch","onReset","onFocus","onBlur","onSpinnerClick","isInputFocused","markInputFocused","unmarkInputFocused","useInputFocusOnOpen","backgroundColor","prevIsOpen","prevChildren","fromChildrenRef","noAnimation","onCheck","classNames","badgeCount","isBadgeActive","previousActiveTab","tabRef","tabEl","prevTabEl","platformEl","prevPlatformEl","shiftLeft","offsetLeft","scaleFactor","clientWidth","forceReflow","SCROLL_DURATION","tabs","activeTab","big","onSwitchTab","useHorizontalScroll","activeTabElement","childNodes","activeTabOffsetLeft","activeTabOffsetWidth","newLeft","fastSmoothScrollHorizontal","tab","renderCount","shouldRestoreHeight","shouldCleanup","cleanupExceptionKey","onStart","onStop","currentKeyRef","rendersRef","prevActiveKey","activeKeyChanged","cleanup","preservedRender","childElements","transition","isBackwards","prevActiveIndex","activeIndex","toSlide","fromSlide","ANIMATION_LEVEL_MIN","dispatchHeavyAnimationStop","dispatchHeavyAnimationEvent","waitForTransitionEnd","clientHeight","performSlideOptimized","node","HTMLElement","onAnimationEnd","activeElement","watchedNode","firstChild","waitForAnimationEnd","flexBasis","renders","contents","render","teactFastList","INCLUDED_CHAT_TYPES","EXCLUDED_CHAT_TYPES","INCLUDE_FILTER_FIELDS","EXCLUDE_FILTER_FIELDS","selectChatFilters","state","mode","selectTemp","selectedChatIds","selectedChatTypes","includedChatIds","includeFilters","pick","folder","excludedChatIds","excludeFilters","getSuggestedFolderName","filters","bots","groups","channels","contacts","nonContacts","INITIAL_STATE","chatFilter","foldersReducer","omit","error","useReducer","makeMediaHandlers","controllerRef","mediaHandlers","proxy","requestNextTrack","requestPreviousTrack","stop","closeAudioPlayer","seekbackward","skipTime","seekOffset","currentTime","seekforward","seekTo","seekTime","nexttrack","previoustrack","trackId","originalDuration","trackType","handlers","metadata","onInit","onForcePlay","onTrackChange","noPlaylist","noProgressUpdates","setIsPlaying","isPlayingSync","setPlayProgress","register","eventName","setVolume","setPlaybackRate","toggleMuted","registerMediaSession","setPlaybackState","audioPlayer","volume","playbackRate","setPositionState","isFinite","paused","updateMetadata","destroy","isSafariPatchInProgress","useEffectWithPrevDeps","prevShouldPlay","prevSrc","playIfPresent","setTime","time","audioProxy","Map","blurredRef","isChanged","img","Image","imgToCanvas","fastBlur","toDataURL","blurredAsync","onload","blurredDataUri","clear","useBlur","noInitiallyBuffered","setIsBuffered","setBufferedProgress","setIsBufferedDebounced","handleBuffering","media","buffered","end","readyState","onLoadedData","onPlaying","onLoadStart","onPause","onTimeUpdate","onProgress","useCanvasBlur","withRaf","processBlur","alpha","IS_CANVAS_FILTER_SUPPORTED","drawImage","RADIUS","isInSearch","isServiceNotifications","SERVICE_NOTIFICATIONS_USER_ID","toggleChatPinned","toggleChatArchived","toggleChatUnread","actionAddToFolder","actionPin","compact","actionUnreadMark","actionMute","actionArchive","isChatArchived","actionDelete","getCanDeleteChat","isInFolder","stopImmediatePropagation","isMenuDisabled","shouldDisableOnLink","shouldDisableOnLongTap","setIsContextMenuOpen","setContextMenuPosition","clientY","body","timer","clearLongPressTimer","startLongPressTimer","contains","originalEvent","touches","cancelClickOnce","emulateContextMenuEvent","passive","EMPTY_RECT","anchor","getLayout","setPositionX","setPositionY","setTransformOriginX","setTransformOriginY","withScroll","setWithScroll","setStyle","setMenuStyle","triggerEl","anchorX","anchorY","menuEl","rootEl","extraPaddingX","extraTopPadding","marginSides","extraMarginTop","marginTop","menuRect","offsetHeight","rootRect","horizontalPosition","verticalPosition","triggerRect","menuMaxHeight","offsetX","offsetY","useDebounce","ms","noFirst","noLast","replyOriginForId","loadMessage","loadMessageThrottled","throttled","setOrderedIds","getOrderedIds","addOrderedIdsCallback","useFolderManagerForUnreadCounters","unreadCounters","setUnreadCounters","getUnreadCounters","addUnreadCountersCallback","useFolderManagerForChatsCount","chatsCount","setChatsCount","getChatsCount","addChatsCountCallback","handleScroll","deltaX","deltaY","useIntersectionObserver","rootCallback","rootRef","throttleMs","debounceMs","shouldSkipFirst","margin","threshold","rootCallbackRef","freezeFlagsRef","onUnfreezeRef","freeze","unfreeze","useHeavyAnimationCheck","observer","disconnect","callbacks","observe","targetCallback","entriesAccumulator","observerCallbackSync","callback","scheduler","observerCallback","IntersectionObserver","root","rootMargin","initController","controller","delete","unobserve","useOnIntersect","targetRef","setIsIntersecting","savedCallback","setInterval","clearInterval","debugKey","prevDeps","isMediaReady","store","idRef","generateIdFor","mediaHash","noLoad","mediaFormat","cacheBuster","isHtmlAllowed","isStreaming","IS_PROGRESSIVE_SUPPORTED","useUniqueId","setLoadProgress","startedAtRef","handleProgress","Date","spentTime","closeTimeout","useMouseInside","menuCloseTimeout","isMouseInside","markMouseInside","usePrevDuringAnimation","prev","isCurrentPresent","isPrevPresent","reducer","initialState","reducerRef","setState","currentState","SEND_MESSAGE_ACTION_INTERVAL","useStateRef","useVideoCleanup","videoRef","videoEl","load","mul_table","shg_table","boxBlurCanvasRGB","context","top_x","top_y","isNaN","imageData","getImageData","pixels","rsum","gsum","bsum","p1","p2","yp","yi","yw","wm","hm","rad1","r","g","mul_sum","shg_sum","vmin","vmax","putImageData","tracks","currentTrackId","voiceQueue","musicQueue","playNext","isReverseOrder","currentTrack","nextTrackId","findNextInQueue","has","openAudioPlayer","parseMessageKey","splitTrackId","messageKey","nextTrack","stopCurrentAudio","track","handleEvent","Proxy","createAudio","trackIdComparator","addTrackToQueue","preventPlayAfterPatch","preload","IS_SAFARI","patchSafariProgressiveAudio","globalSearch","currentContent","GlobalSearchContent","openedChatId","queueFilter","cleanUpQueue","fastSeek","rate","shouldRemoveFromQueue","h","trackIdFilter","el","removeFromQueue","getTrackQueue","currentId","queue","chatAudio","getMessageKey","split","pop","one","two","dateOne","keyOne","dateTwo","keyTwo","localeCompare","IOS_SCREEN_EDGE_THRESHOLD","getDistance","a","sqrt","pageX","pageY","getTouchCenter","lastClickTime","captureEvent","initialSwipeAxis","hasMoved","hasSwiped","initialDistance","initialTouchCenter","innerWidth","innerHeight","excludedClosestSelector","onMove","withCursor","querySelectorAll","scrollable","overflow","onDoubleClick","centerX","centerY","onZoom","endDistance","touchCenter","dragOffsetX","dragOffsetY","zoomFactor","initialCenterX","initialCenterY","currentCenterX","currentCenterY","shouldPreventScroll","xAbs","yAbs","axis","currentSwipeAxis","Left","Right","Up","Down","processSwipe","isNotPassive","propertyName","waitForEndEvent","animationName","eventType","detailedName","isHandled","handleAnimationEnd","TransitionEvent","AnimationEvent","cycleRestrict","isAnimating","fastSmoothScroll","maxDistance","FAST_SMOOTH_MAX_DISTANCE","forceDirection","forceDuration","forceNormalContainerHeight","scrollFrom","calculateScrollFrom","FocusDirection","scrollWithJs","isAnimatingScroll","offsetTop","elementTop","scrollTop","offset","elementHeight","currentScrollTop","containerHeight","targetContainerHeight","normalHeight","path","remainingPath","absPath","FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE","shortTransition","longTransition","FAST_SMOOTH_MIN_DURATION","FAST_SMOOTH_MAX_DURATION","startAt","onHeavyAnimationStop","animateSingle","t","currentPath","getAttribute","containerWidth","animate","force","forcePlaceCaretAtEnd","range","createRange","lastChild","nodeValue","selectNodeContents","collapse","toLowerCase","getMessageIdsForSelectedText","selectedFragments","cloneContents","childElementCount","messageIds","nodeType","messageEl","removeChild","DEFAULT_HANDLERS","mediaSession","navigator","setMediaSessionHandlers","console","warn","setActionHandler","err","clearMediaSession","playbackState","buildMediaMetadata","artist","album","artwork","MediaMetadata","ENTITY_CLASS_BY_NODE_NAME","S","STRIKE","PRE","BLOCKQUOTE","parseMessageInput","fragment","parsedHtml","parseMarkdown","textIndex","recursionDeepness","entities","addEntity","rawText","nodeName","getEntityTypeFromNode","rawIndex","substring","getEntityDataFromNode","hasChildNodes","audioEl","patchedForSafari","patchForSafariInProgress"],"sourceRoot":""}