tweb/public/725.9001d7f388095d71a058.chunk.js.map
Eduard Kuzmenko 3cc5df683e Build
2022-08-22 13:05:40 +02:00

1 line
33 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":"725.9001d7f388095d71a058.chunk.js","mappings":"2FAAe,SAASA,EAAkBC,EAAiBC,GACzD,IAAI,IAA2BC,EAAdF,EAAMG,OAAqB,EAAGD,GAAK,IAAKA,EACvDD,EAASD,EAAME,GAAIA,EAAGF,G,gECM1B,IAAII,EAAW,EACA,SAASC,EAAqBC,GAC3C,IAAIC,EACJ,MAAMC,EAAWF,MAAAA,OAAI,EAAJA,EAAMG,KACvB,GAAGD,EAAU,CACX,MAAME,EAAM,GAAG,OAASN,6BAGtBG,EADC,CAAC,aAAc,YAAa,aAAaI,QAAQH,IAAa,EACpD,QAAUE,EACkB,IAA/BF,EAASG,QAAQ,WAAmB,CAAC,aAAaA,QAAQH,IAAa,EACpE,QAAUE,EACkB,IAA/BF,EAASG,QAAQ,UACd,QAAUD,EAEV,WAAaA,OAG1BH,EAAW,UAAU,OAASH,MAGhC,OAAOG,I,8CClBM,SAASK,EAA2BC,EAAwBC,EAAyCC,EAAkBC,GACpI,MAAMC,GAAoB,OAA6BJ,EAAKC,MAAAA,OAAK,EAALA,EAAOL,MAEnE,IAAID,EAOJ,OALEA,EADc,eAAbM,MAAAA,OAAK,EAALA,EAAOI,GACGL,EAAIM,QAAU,aAAe,aAE7BN,EAAIO,WAAa,2BAGvB,CACLC,KAAMR,EAAIS,MACVC,SAAUN,EACVO,KAAMV,EAAQA,EAAMU,KAAOX,EAAIW,KAC/BhB,SAAAA,EACAD,SAAUM,EAAIY,UACdV,QAAAA,EACAC,UAAAA,K,eCnBW,SAASU,EAA6Bb,EAAwBc,GAC3E,MAAO,CACLT,EAAG,4BACHU,GAAIf,EAAIe,GACRC,YAAahB,EAAIgB,YACjBC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AAGpF,cAIlB,GAAGoF,EAAM,GACdE,EAASnB,KAAK,CACZpD,EAAG,yBACH6C,OAAQ2B,EACRvF,OAAQ,SAEL,GAAGoF,EAAM,GAAI,CAElB,MAAMF,EAAUF,EAAgBI,EAAM,IACnCF,GACDI,EAASnB,KAAK,CACZpD,EAAG,qBACH6C,OAAQ2B,EACRvF,OAAQoF,EAAM,GAAGpF,OACjB+F,QAASb,SAGLE,EAAM,IACdE,EAASnB,KAAK,CACZpD,EAAG,uBACH6C,OAAQ2B,GAAcH,EAAM,IAAMA,EAAM,IAAIpF,OAAS,GACrDA,OAAQoF,EAAM,IAAIpF,SAEZoF,EAAM,KACdE,EAASnB,KAAK,CACZpD,EAAG,0BACH6C,OAAQ2B,GAAcH,EAAM,IAAMA,EAAM,IAAIpF,OAAS,IAAMoF,EAAM,IAAMA,EAAM,IAAIpF,OAAS,GAC1FA,OAAQ,EAAIoF,EAAM,IAAIpF,QAAUoF,EAAM,IAAM,EAAIA,EAAM,IAAIpF,OAAS,GACnEgG,QAAQ,IAIZX,EAAMA,EAAIP,OAAOM,EAAMK,MAAQL,EAAM,GAAGpF,QACxCwF,GAAaJ,EAAMK,MAAQL,EAAM,GAAGpF,OAMtC,OAAOsF","sources":["webpack://tweb/./src/helpers/array/forEachReverse.ts","webpack://tweb/./src/helpers/getFileNameForUpload.ts","webpack://tweb/./src/lib/appManagers/utils/docs/getDocumentDownloadOptions.ts","webpack://tweb/./src/lib/appManagers/utils/docs/getDocumentInputFileLocation.ts","webpack://tweb/./src/lib/appManagers/utils/download/getDownloadFileNameFromOptions.ts","webpack://tweb/./src/lib/appManagers/utils/download/getDownloadMediaDetails.ts","webpack://tweb/./src/lib/appManagers/utils/webDocs/getWebDocumentDownloadOptions.ts","webpack://tweb/./src/lib/appManagers/utils/messageId/generateMessageId.ts","webpack://tweb/./src/lib/appManagers/utils/messageId/getServerMessageId.ts","webpack://tweb/./src/lib/appManagers/utils/messageId/clearMessageId.ts","webpack://tweb/./src/lib/appManagers/utils/messageId/index.ts","webpack://tweb/./src/lib/appManagers/utils/photos/getPhotoDownloadOptions.ts","webpack://tweb/./src/lib/appManagers/utils/webDocs/isWebDocument.ts","webpack://tweb/./src/lib/richTextProcessor/encodeSpoiler.ts","webpack://tweb/./src/lib/richTextProcessor/spoiler.ts","webpack://tweb/./src/config/tld.ts","webpack://tweb/./src/lib/richTextProcessor/checkBrackets.ts","webpack://tweb/./src/lib/richTextProcessor/getEmojiUnified.ts","webpack://tweb/./src/lib/richTextProcessor/parseEntities.ts"],"sourcesContent":["export default function forEachReverse<T>(array: Array<T>, callback: (value: T, index?: number, array?: Array<T>) => void) {\n for(let length = array.length, i = length - 1; i >= 0; --i) {\n callback(array[i], i, array);\n }\n};\n","/*\r\n * https://github.com/morethanwords/tweb\r\n * Copyright (C) 2019-2021 Eduard Kuzmenko\r\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\r\n */\r\n\r\nimport tabId from '../config/tabId';\r\n\r\nlet uploadId = 0;\r\nexport default function getFileNameForUpload(file: File | Blob) {\r\n let fileName: string;\r\n const mimeType = file?.type;\r\n if(mimeType) { // the same like apiFileName in appMessagesManager for upload!\r\n const ext = `${tabId}_${uploadId++}.mimeType.split('/')[1]`;\r\n\r\n if(['image/jpeg', 'image/png', 'image/bmp'].indexOf(mimeType) >= 0) {\r\n fileName = 'photo' + ext;\r\n } else if(mimeType.indexOf('audio/') === 0 || ['video/ogg'].indexOf(mimeType) >= 0) {\r\n fileName = 'audio' + ext;\r\n } else if(mimeType.indexOf('video/') === 0) {\r\n fileName = 'video' + ext;\r\n } else {\r\n fileName = 'document' + ext;\r\n }\r\n } else {\r\n fileName = `upload-${tabId}_${uploadId++}`;\r\n }\r\n\r\n return fileName;\r\n}\r\n","/*\r\n * https://github.com/morethanwords/tweb\r\n * Copyright (C) 2019-2021 Eduard Kuzmenko\r\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\r\n */\r\n\r\nimport type {Document, PhotoSize, VideoSize} from '../../../../layer';\r\nimport type {DownloadOptions} from '../../../mtproto/apiFileManager';\r\nimport getDocumentInputFileLocation from './getDocumentInputFileLocation';\r\n\r\nexport default function getDocumentDownloadOptions(doc: Document.document, thumb?: PhotoSize.photoSize | VideoSize, queueId?: number, onlyCache?: boolean): DownloadOptions {\r\n const inputFileLocation = getDocumentInputFileLocation(doc, thumb?.type);\r\n\r\n let mimeType: MTMimeType;\r\n if(thumb?._ === 'photoSize') {\r\n mimeType = doc.sticker ? 'image/webp' : 'image/jpeg'/* doc.mime_type */;\r\n } else {\r\n mimeType = doc.mime_type || 'application/octet-stream';\r\n }\r\n\r\n return {\r\n dcId: doc.dc_id,\r\n location: inputFileLocation,\r\n size: thumb ? thumb.size : doc.size,\r\n mimeType,\r\n fileName: doc.file_name,\r\n queueId,\r\n onlyCache\r\n };\r\n}\r\n","/*\r\n * https://github.com/morethanwords/tweb\r\n * Copyright (C) 2019-2021 Eduard Kuzmenko\r\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\r\n */\r\n\r\nimport {Document, InputFileLocation} from '../../../../layer';\r\n\r\nexport default function getDocumentInputFileLocation(doc: Document.document, thumbSize?: string): InputFileLocation.inputDocumentFileLocation {\r\n return {\r\n _: 'inputDocumentFileLocation',\r\n id: doc.id,\r\n access_hash: doc.access_hash,\r\n file_reference: doc.file_reference,\r\n thumb_size: thumbSize\r\n };\r\n}\r\n","/*\r\n * https://github.com/morethanwords/tweb\r\n * Copyright (C) 2019-2021 Eduard Kuzmenko\r\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\r\n */\r\n\r\nimport {getFileNameByLocation} from '../../../../helpers/fileName';\r\nimport {DownloadOptions} from '../../../mtproto/apiFileManager';\r\n\r\nexport default function getDownloadFileNameFromOptions(options: DownloadOptions) {\r\n return getFileNameByLocation(options.location, options);\r\n}\r\n","/*\r\n * https://github.com/morethanwords/tweb\r\n * Copyright (C) 2019-2021 Eduard Kuzmenko\r\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\r\n */\r\n\r\nimport type {DownloadMediaOptions, DownloadOptions} from '../../../mtproto/apiFileManager';\r\nimport getDocumentDownloadOptions from '../docs/getDocumentDownloadOptions';\r\nimport getPhotoDownloadOptions from '../photos/getPhotoDownloadOptions';\r\nimport getWebDocumentDownloadOptions from '../webDocs/getWebDocumentDownloadOptions';\r\nimport isWebDocument from '../webDocs/isWebDocument';\r\nimport getDownloadFileNameFromOptions from './getDownloadFileNameFromOptions';\r\n\r\nexport default function getDownloadMediaDetails(options: DownloadMediaOptions) {\r\n const {media, thumb, queueId, onlyCache} = options;\r\n\r\n let downloadOptions: DownloadOptions;\r\n if(media._ === 'document') downloadOptions = getDocumentDownloadOptions(media, thumb as any, queueId, onlyCache);\r\n else if(media._ === 'photo') downloadOptions = getPhotoDownloadOptions(media, thumb as any, queueId, onlyCache);\r\n else if(isWebDocument(media)) downloadOptions = getWebDocumentDownloadOptions(media);\r\n\r\n downloadOptions.downloadId = options.downloadId;\r\n\r\n const fileName = getDownloadFileNameFromOptions(downloadOptions);\r\n return {fileName, downloadOptions};\r\n}\r\n","import {WebDocument} from '../../../../layer';\nimport {DownloadOptions} from '../../../mtproto/apiFileManager';\n\nexport default function getWebDocumentDownloadOptions(webDocument: WebDocument): DownloadOptions {\n return {\n dcId: 0,\n location: {\n _: 'inputWebFileLocation',\n access_hash: (webDocument as WebDocument.webDocument).access_hash,\n url: webDocument.url\n },\n size: webDocument.size,\n mimeType: webDocument.mime_type\n };\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport {MESSAGE_ID_OFFSET, MESSAGE_ID_INCREMENT} from '.';\n\nexport default function generateMessageId(messageId: number) {\n const q = MESSAGE_ID_OFFSET;\n if(messageId >= q) {\n return messageId;\n }\n\n return q + (messageId * MESSAGE_ID_INCREMENT);\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport clearMessageId from './clearMessageId';\n\n/**\n * * will ignore outgoing offset\n */\nexport default function getServerMessageId(messageId: number) {\n return clearMessageId(messageId, true);\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport {MESSAGE_ID_OFFSET, MESSAGE_ID_INCREMENT} from '.';\n\nexport default function clearMessageId(messageId: number, toServer?: boolean) {\n const q = MESSAGE_ID_OFFSET;\n if(messageId < q) { // id 0 -> mid 0xFFFFFFFF, so 0xFFFFFFFF must convert to 0\n return messageId;\n }\n\n const l = MESSAGE_ID_INCREMENT - 1;\n const used = messageId & l;\n if(used !== l) {\n messageId -= used + 1;\n }\n\n return toServer ? (messageId - q) / MESSAGE_ID_INCREMENT : messageId;\n}\n","export const MESSAGE_ID_INCREMENT = 0x10000;\nexport const MESSAGE_ID_OFFSET = 0xFFFFFFFF;\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport type {PhotoSize, InputFileLocation} from '../../../../layer';\nimport type {DownloadOptions} from '../../../mtproto/apiFileManager';\nimport type {MyDocument} from '../../appDocsManager';\nimport type {MyPhoto} from '../../appPhotosManager';\n\nexport default function getPhotoDownloadOptions(photo: MyPhoto | MyDocument, photoSize: PhotoSize, queueId?: number, onlyCache?: boolean): DownloadOptions {\n const isDocument = photo._ === 'document';\n\n if(!photoSize || photoSize._ === 'photoSizeEmpty') {\n // console.error('no photoSize by photo:', photo);\n throw new Error('photoSizeEmpty!');\n }\n\n // maybe it's a thumb\n const isPhoto = !!((photoSize._ === 'photoSize' || photoSize._ === 'photoSizeProgressive') && photo.access_hash && photo.file_reference);\n const location: InputFileLocation.inputPhotoFileLocation | InputFileLocation.inputDocumentFileLocation = {\n _: isDocument ? 'inputDocumentFileLocation' : 'inputPhotoFileLocation',\n id: photo.id,\n access_hash: photo.access_hash,\n file_reference: photo.file_reference,\n thumb_size: photoSize.type\n };\n\n return {\n dcId: photo.dc_id,\n location,\n size: isPhoto ? (photoSize as PhotoSize.photoSize).size : undefined,\n mimeType: 'image/jpeg',\n queueId,\n onlyCache\n };\n}\n","import {WebDocument} from '../../../../layer';\n\nexport default function isWebDocument(webDocument: any): webDocument is WebDocument {\n return !!(webDocument && (webDocument._ === 'webDocument' || webDocument._ === 'webDocumentNoProxy'));\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport {MessageEntity} from '../../layer';\nimport spoiler from './spoiler';\n\nexport default function encodeSpoiler(text: string, entity: MessageEntity.messageEntitySpoiler) {\n const before = text.slice(0, entity.offset);\n const spoilerBefore = text.slice(entity.offset, entity.offset + entity.length);\n const spoilerAfter = spoiler(spoilerBefore)/* '▚'.repeat(entity.length) */;\n const after = text.slice(entity.offset + entity.length);\n text = before + spoilerAfter + after;\n return {text, entityText: spoilerAfter};\n};\n","export default function spoiler(text: string): string {\n const chars = '⠁⠂⠄⠈⠐⠠⡀⢀⠃⠅⠆⠉⠊⠌⠑⠒⠔⠘⠡⠢⠤⠨⠰⡁⡂⡄⡈⡐⡠⢁⢂⢄⢈⢐⢠⣀⠇⠋⠍⠎⠓⠕⠖⠙⠚⠜⠣⠥⠦⠩⠪⠬⠱⠲⠴⠸⡃⡅⡆⡉⡊⡌⡑⡒⡔⡘⡡⡢⡤⡨⡰⢃⢅⢆⢉⢊⢌⢑⢒⢔⢘⢡⢢⢤⢨⢰⣁⣂⣄⣈⣐⣠⠏⠗⠛⠝⠞⠧⠫⠭⠮⠳⠵⠶⠹⠺⠼⡇⡋⡍⡎⡓⡕⡖⡙⡚⡜⡣⡥⡦⡩⡪⡬⡱⡲⡴⡸⢇⢋⢍⢎⢓⢕⢖⢙⢚⢜⢣⢥⢦⢩⢪⢬⢱⢲⢴⢸⣃⣅⣆⣉⣊⣌⣑⣒⣔⣘⣡⣢⣤⣨⣰⠟⠯⠷⠻⠽⠾⡏⡗⡛⡝⡞⡧⡫⡭⡮⡳⡵⡶⡹⡺⡼⢏⢗⢛⢝⢞⢧⢫⢭⢮⢳⢵⢶⢹⢺⢼⣇⣋⣍⣎⣓⣕⣖⣙⣚⣜⣣⣥⣦⣩⣪⣬⣱⣲⣴⣸⠿⡟⡯⡷⡻⡽⡾⢟⢯⢷⢻⢽⢾⣏⣗⣛⣝⣞⣧⣫⣭⣮⣳⣵⣶⣹⣺⣼⡿⢿⣟⣯⣷⣻⣽⣾⣿';\n const charsLength = chars.length;\n\n const out: string[] = [];\n for(let i = 0; i < text.length; ++i) {\n const char = text.charCodeAt(i);\n out.push(chars[char % charsLength]);\n }\n\n return out.join('');\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n *\n * Originally from:\n * https://github.com/zhukov/webogram\n * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>\n * https://github.com/zhukov/webogram/blob/master/LICENSE\n */\n\n// From https://github.com/stephenmathieson/node-tlds/blob/master/index.js\nconst TLD = ['abogado', 'ac', 'academy', 'accountants', 'active', 'actor', 'ad', 'adult', 'ae', 'aero', 'af', 'ag', 'agency', 'ai', 'airforce', 'al', 'allfinanz', 'alsace', 'am', 'amsterdam', 'an', 'android', 'ao', 'apartments', 'aq', 'aquarelle', 'ar', 'archi', 'army', 'arpa', 'as', 'asia', 'associates', 'at', 'attorney', 'au', 'auction', 'audio', 'autos', 'aw', 'ax', 'axa', 'az', 'ba', 'band', 'bank', 'bar', 'barclaycard', 'barclays', 'bargains', 'bayern', 'bb', 'bd', 'be', 'beer', 'berlin', 'best', 'bf', 'bg', 'bh', 'bi', 'bid', 'bike', 'bingo', 'bio', 'biz', 'bj', 'black', 'blackfriday', 'bloomberg', 'blue', 'bm', 'bmw', 'bn', 'bnpparibas', 'bo', 'boo', 'boutique', 'br', 'brussels', 'bs', 'bt', 'budapest', 'build', 'builders', 'business', 'buzz', 'bv', 'bw', 'by', 'bz', 'bzh', 'ca', 'cab', 'cal', 'camera', 'camp', 'cancerresearch', 'canon', 'capetown', 'capital', 'caravan', 'cards', 'care', 'career', 'careers', 'cartier', 'casa', 'cash', 'cat', 'catering', 'cc', 'cd', 'center', 'ceo', 'cern', 'cf', 'cg', 'ch', 'channel', 'chat', 'cheap', 'christmas', 'chrome', 'church', 'ci', 'citic', 'city', 'ck', 'cl', 'claims', 'cleaning', 'click', 'clinic', 'clothing', 'club', 'cm', 'cn', 'co', 'coach', 'codes', 'coffee', 'college', 'cologne', 'com', 'community', 'company', 'computer', 'condos', 'construction', 'consulting', 'contractors', 'cooking', 'cool', 'coop', 'country', 'cr', 'credit', 'creditcard', 'cricket', 'crs', 'cruises', 'cu', 'cuisinella', 'cv', 'cw', 'cx', 'cy', 'cymru', 'cz', 'dabur', 'dad', 'dance', 'dating', 'day', 'dclk', 'de', 'deals', 'degree', 'delivery', 'democrat', 'dental', 'dentist', 'desi', 'design', 'dev', 'diamonds', 'diet', 'digital', 'direct', 'directory', 'discount', 'dj', 'dk', 'dm', 'dnp', 'do', 'docs', 'domains', 'doosan', 'durban', 'dvag', 'dz', 'eat', 'ec', 'edu', 'education', 'ee', 'eg', 'email', 'emerck', 'energy', 'engineer', 'engineering', 'enterprises', 'equipment', 'er', 'es', 'esq', 'estate', 'et', 'eu', 'eurovision', 'eus', 'events', 'everbank', 'exchange', 'expert', 'exposed', 'fail', 'farm', 'fashion', 'feedback', 'fi', 'finance', 'financial', 'firmdale', 'fish', 'fishing', 'fit', 'fitness', 'fj', 'fk', 'flights', 'florist', 'flowers', 'flsmidth', 'fly', 'fm', 'fo', 'foo', 'forsale', 'foundation', 'fr', 'frl', 'frogans', 'fund', 'furniture', 'futbol', 'ga', 'gal', 'gallery', 'garden', 'gb', 'gbiz', 'gd', 'ge', 'gent', 'gf', 'gg', 'ggee', 'gh', 'gi', 'gift', 'gifts', 'gives', 'gl', 'glass', 'gle', 'global', 'globo', 'gm', 'gmail', 'gmo', 'gmx', 'gn', 'goog', 'google', 'gop', 'gov', 'gp', 'gq', 'gr', 'graphics', 'gratis', 'green', 'gripe', 'gs', 'gt', 'gu', 'guide', 'guitars', 'guru', 'gw', 'gy', 'hamburg', 'hangout', 'haus', 'healthcare', 'help', 'here', 'hermes', 'hiphop', 'hiv', 'hk', 'hm', 'hn', 'holdings', 'holiday', 'homes', 'horse', 'host', 'hosting', 'house', 'how', 'hr', 'ht', 'hu', 'ibm', 'id', 'ie', 'ifm', 'il', 'im', 'immo', 'immobilien', 'in', 'industries', 'info', 'ing', 'ink', 'institute', 'insure', 'int', 'international', 'investments', 'io', 'iq', 'ir', 'irish', 'is', 'it', 'iwc', 'jcb', 'je', 'jetzt', 'jm', 'jo', 'jobs', 'joburg', 'jp', 'juegos', 'kaufen', 'kddi', 'ke', 'kg', 'kh', 'ki', 'kim', 'kitchen', 'kiwi', 'km', 'kn', 'koeln', 'kp', 'kr', 'krd', 'kred', 'kw', 'ky', 'kyoto', 'kz', 'la', 'lacaixa', 'land', 'lat', 'latrobe', 'lawyer', 'lb', 'lc', 'lds', 'lease', 'legal', 'lgbt', 'li', 'lidl', 'life', 'lighting', 'limited', 'limo', 'link', 'lk', 'loans', 'london', 'lotte', 'lotto', 'lr', 'ls', 'lt', 'ltda', 'lu', 'luxe', 'luxury', 'lv', 'ly', 'ma', 'madrid', 'maison', 'management', 'mango', 'market', 'marketing', 'marriott', 'mc', 'md', 'me', 'media', 'meet', 'melbourne', 'meme', 'memorial', 'menu', 'mg', 'mh', 'miami', 'mil', 'mini', 'mk', 'ml', 'mm', 'mn', 'mo', 'mobi', 'moda', 'moe', 'monash', 'money', 'mormon', 'mortgage', 'moscow', 'motorcycles', 'mov', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nagoya', 'name', 'navy', 'nc', 'ne', 'net', 'network', 'neustar', 'new', 'nexus', 'nf', 'ng', 'ngo', 'nhk', 'ni', 'nico', 'ninja', 'nl', 'no', 'np', 'nr', 'nra', 'nrw', 'ntt', 'nu', 'nyc', 'nz', 'okinawa', 'om', 'one', 'ong', 'onl', 'ooo', 'org', 'organic', 'osaka', 'otsuka', 'ovh', 'pa', 'paris', 'partners', 'parts', 'party', 'pe', 'pf', 'pg', 'ph', 'pharmacy', 'photo', 'photography', 'photos', 'physio', 'pics', 'pictures', 'pink', 'pizza', 'pk', 'pl', 'place', 'plumbing', 'pm', 'pn', 'pohl', 'poker', 'porn', 'post', 'pr', 'praxi', 'press', 'pro', 'prod', 'productions', 'prof', 'properties', 'property', 'ps', 'pt', 'pub', 'pw', 'py', 'qa', 'qpon', 'quebec', 're', 'realtor', 'recipes', 'red', 'rehab', 'reise', 'reisen', 'reit', 'ren', 'rentals', 'repair', 'report', 'republican', 'rest', 'restaurant', 'reviews', 'rich', 'rio', 'rip', 'ro', 'rocks', 'rodeo', 'rs', 'rsvp', 'ru', 'ruhr', 'rw', 'ryukyu', 'sa', 'saarland', 'sale', 'samsung', 'sarl', 'saxo', 'sb', 'sc', 'sca', 'scb', 'schmidt', 'schule', 'schwarz', 'science', 'scot', 'sd', 'se', 'services', 'sew', 'sexy', 'sg', 'sh', 'shiksha', 'shoes', 'shriram', 'si', 'singles', 'sj', 'sk', 'sky', 'sl', 'sm', 'sn', 'so', 'social', 'software', 'sohu', 'solar', 'solutions', 'soy', 'space', 'spiegel', 'sr', 'st', 'style', 'su', 'supplies', 'supply', 'support', 'surf', 'surgery', 'suzuki', 'sv', 'sx', 'sy', 'sydney', 'systems', 'sz', 'taipei', 'tatar', 'tattoo', 'tax', 'tc', 'td', 'technology', 'tel', 'temasek', 'tennis', 'tf', 'tg', 'th', 'tienda', 'tips', 'tires', 'tirol', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'today', 'tokyo', 'tools', 'top', 'toshiba', 'town', 'toys', 'tp', 'tr', 'trade', 'training', 'travel', 'trust', 'tt', 'tui', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'university', 'uno', 'uol', 'us', 'uy', 'uz', 'va', 'vacations', 'vc', 've', 'vegas', 'ventures', 'versicherung', 'vet', 'vg', 'vi', 'viajes', 'video', 'villas', 'vision', 'vlaanderen', 'vn', 'vodka', 'vote', 'voting', 'voto', 'voyage', 'vu', 'wales', 'wang', 'watch', 'webcam', 'website', 'wed', 'wedding', 'wf', 'whoswho', 'wien', 'wiki', 'williamhill', 'wme', 'work', 'works', 'world', 'ws', 'wtc', 'wtf', '佛山', '集团', '在线', '한국', 'ভারত', '八卦', 'موقع', '公益', '公司', '移动', '我爱你', 'москва', 'қаз', 'онлайн', 'сайт', 'срб', '淡马锡', 'орг', '삼성', 'சிங்கப்பூர்', '商标', '商店', '商城', 'дети', 'мкд', '中文网', '中信', '中国', '中國', '谷歌', 'భారత్', 'ලංකා', 'ભારત', 'भारत', '网店', 'संगठन', '网络', 'укр', '香港', '台湾', '台灣', '手机', 'мон', 'الجزائر', 'عمان', 'ایران', 'امارات', 'بازار', 'الاردن', 'بھارت', 'المغرب', 'السعودية', 'مليسيا', 'شبكة', 'გე', '机构', '组织机构', 'ไทย', 'سورية', 'рус', 'рф', 'تونس', 'みんな', 'グーグル', '世界', 'ਭਾਰਤ', '网址', '游戏', 'vermögensberater', 'vermögensberatung', '企业', 'مصر', 'قطر', '广东', 'இலங்கை', 'இந்தியா', '新加坡', 'فلسطين', '政务', 'xxx', 'xyz', 'yachts', 'yandex', 'ye', 'yoga', 'yokohama', 'youtube', 'yt', 'za', 'zip', 'zm', 'zone', 'zuerich', 'zw'];\n\nexport default TLD;\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n *\n * Originally from:\n * https://github.com/zhukov/webogram\n * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>\n * https://github.com/zhukov/webogram/blob/master/LICENSE\n */\n\nexport default function checkBrackets(url: string) {\n var urlLength = url.length;\n var urlOpenBrackets = url.split('(').length - 1;\n var urlCloseBrackets = url.split(')').length - 1;\n while(urlCloseBrackets > urlOpenBrackets &&\n url.charAt(urlLength - 1) === ')') {\n url = url.substr(0, urlLength - 1)\n urlCloseBrackets--;\n urlLength--;\n }\n if(urlOpenBrackets > urlCloseBrackets) {\n url = url.replace(/\\)+$/, '');\n }\n return url;\n}\n","import Emoji from '../../config/emoji';\nimport {encodeEmoji} from '../../vendor/emoji';\n\nexport default function getEmojiUnified(emojiCode: string) {\n const unified = encodeEmoji(emojiCode).replace(/-?fe0f/g, '');\n\n /* if(unified === '1f441-200d-1f5e8') {\n //unified = '1f441-fe0f-200d-1f5e8-fe0f';\n unified = '1f441-fe0f-200d-1f5e8';\n } */\n\n if(!Emoji.hasOwnProperty(unified)\n // && !emojiData.hasOwnProperty(unified.replace(/-?fe0f$/, ''))\n ) {\n // console.error('lol', unified);\n return;\n }\n\n return unified;\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n *\n * Originally from:\n * https://github.com/zhukov/webogram\n * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>\n * https://github.com/zhukov/webogram/blob/master/LICENSE\n */\n\nimport {EMAIL_REG_EXP, FULL_REG_EXP} from '.';\nimport TLD from '../../config/tld';\nimport {MessageEntity} from '../../layer';\nimport checkBrackets from './checkBrackets';\nimport getEmojiUnified from './getEmojiUnified';\n\nexport default function parseEntities(text: string) {\n let match: any;\n let raw = text;\n const entities: MessageEntity[] = [];\n let matchIndex;\n let rawOffset = 0;\n // var start = tsNow()\n FULL_REG_EXP.lastIndex = 0;\n while((match = raw.match(FULL_REG_EXP))) {\n matchIndex = rawOffset + match.index;\n\n // console.log('parseEntities match:', match);\n\n if(match[3]) { // mentions\n entities.push({\n _: 'messageEntityMention',\n offset: matchIndex + match[1].length,\n length: match[2].length + match[3].length\n });\n } else if(match[4]) {\n if(EMAIL_REG_EXP.test(match[4])) { // email\n entities.push({\n _: 'messageEntityEmail',\n offset: matchIndex,\n length: match[4].length\n });\n } else {\n let url: string;\n let protocol = match[5];\n const tld = match[6];\n // let excluded = '';\n if(tld) { // URL\n if(!protocol && (tld.substr(0, 4) === 'xn--' || TLD.indexOf(tld.toLowerCase()) !== -1)) {\n protocol = 'http://';\n }\n\n if(protocol) {\n const balanced = checkBrackets(match[4]);\n if(balanced.length !== match[4].length) {\n // excluded = match[4].substring(balanced.length);\n match[4] = balanced;\n }\n\n url = (match[5] ? '' : protocol) + match[4];\n }\n } else { // IP address\n url = (match[5] ? '' : 'http://') + match[4];\n }\n\n if(url) {\n entities.push({\n _: 'messageEntityUrl',\n offset: matchIndex,\n length: match[4].length\n });\n }\n }\n } else if(match[7]) { // New line\n entities.push({\n _: 'messageEntityLinebreak',\n offset: matchIndex,\n length: 1\n });\n } else if(match[8]) { // Emoji\n // console.log('hit', match[8]);\n const unified = getEmojiUnified(match[8]);\n if(unified) {\n entities.push({\n _: 'messageEntityEmoji',\n offset: matchIndex,\n length: match[8].length,\n unicode: unified\n });\n }\n } else if(match[11]) { // Hashtag\n entities.push({\n _: 'messageEntityHashtag',\n offset: matchIndex + (match[10] ? match[10].length : 0),\n length: match[11].length\n });\n } else if(match[13]) { // Bot command\n entities.push({\n _: 'messageEntityBotCommand',\n offset: matchIndex + (match[11] ? match[11].length : 0) + (match[12] ? match[12].length : 0),\n length: 1 + match[13].length + (match[14] ? 1 + match[14].length : 0),\n unsafe: true\n });\n }\n\n raw = raw.substr(match.index + match[0].length);\n rawOffset += match.index + match[0].length;\n }\n\n // if (entities.length) {\n // console.log('parse entities', text, entities.slice())\n // }\n return entities;\n}\n"],"names":["forEachReverse","array","callback","i","length","uploadId","getFileNameForUpload","file","fileName","mimeType","type","ext","indexOf","getDocumentDownloadOptions","doc","thumb","queueId","onlyCache","inputFileLocation","_","sticker","mime_type","dcId","dc_id","location","size","file_name","getDocumentInputFileLocation","thumbSize","id","access_hash","file_reference","thumb_size","getDownloadFileNameFromOptions","options","getDownloadMediaDetails","media","downloadOptions","webDocument","getPhotoDownloadOptions","isWebDocument","url","downloadId","generateMessageId","messageId","q","getServerMessageId","toServer","l","used","clearMessageId","MESSAGE_ID_INCREMENT","MESSAGE_ID_OFFSET","photo","photoSize","isDocument","Error","isPhoto","undefined","encodeSpoiler","text","entity","before","slice","offset","spoilerAfter","chars","charsLength","out","char","charCodeAt","push","join","spoiler","after","entityText","checkBrackets","urlLength","urlOpenBrackets","split","urlCloseBrackets","charAt","substr","replace","getEmojiUnified","emojiCode","unified","parseEntities","match","raw","entities","matchIndex","rawOffset","index","E","protocol","tld","toLowerCase","balanced","unicode","unsafe"],"sourceRoot":""}