/*! For license information please see 4565b79afd02863ca2d5.worker.js.LICENSE.txt */ !function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(s,i,function(t){return e[t]}.bind(null,i));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=109)}([function(e,t,n){const s=n(6),i=n(81),a=n(40),r=n(20),o=n(98),c=n(99),u=n(21),l=n(27),d=n(103),f=n(33),g=n(8);e.exports={Api:s,TelegramClient:i,sessions:d,connection:a,extensions:f,tl:r,version:o,events:c,utils:u,errors:l,helpers:g}},function(e,t,n){"use strict";n.d(t,"f",(function(){return k})),n.d(t,"a",(function(){return M})),n.d(t,"b",(function(){return E})),n.d(t,"e",(function(){return R})),n.d(t,"g",(function(){return U})),n.d(t,"c",(function(){return T})),n.d(t,"i",(function(){return B})),n.d(t,"h",(function(){return D})),n.d(t,"d",(function(){return x}));var s={};n.r(s),n.d(s,"Type",(function(){return m})),n.d(s,"fetch",(function(){return y})),n.d(s,"save",(function(){return b})),n.d(s,"clear",(function(){return _}));var i=n(0),a=n(33),r=n(4),o=n(17),c=n(26),u=n(9),l=n(43),d=n(11),f=n(5),g=n(2),p=n(35);const h=self.caches;let m;async function y(e,t,n){if(h)try{const s=new Request(t),i=await h.open(e),a=await i.match(s);if(!a)return;switch(n){case m.Text:return await a.text();case m.Blob:{const e=await a.blob();if("sticker"===t.substr(0,7))return new Blob([e],{type:"image/webp"});if(!e.type){const t=a.headers.get("Content-Type");if(t)return new Blob([e],{type:t})}return e}case m.Json:return await a.json();default:return}}catch(e){return void console.warn(e)}}async function b(e,t,n){if(h)try{const s="string"==typeof n||n instanceof Blob?n:JSON.stringify(n),i=new Request(t),a=new Response(s),r=await h.open(e);return await r.put(i,a)}catch(e){return void console.warn(e)}}async function _(e){try{if(!h)return;return await h.delete(e)}catch(e){return void console.warn(e)}}async function w({url:e,mediaFormat:t,start:n,end:a},o,c,u){const{data:h,mimeType:m,fullSize:y}=await async function(e,t,n,s,a,o,c){const u=e.match(/(avatar|profile|photo|msg|stickerSet|sticker|wallpaper|gif|file)([-\d\w./]+)(\?size=\w+)?/);if(!u)return;if("file"===u[1]){const e=await fetch(u[2]);return{data:await e.arrayBuffer()}}if(!n)return Promise.reject(new Error("ERROR: Client is not connected"));let l,p=u[2];const h=u[3]?u[3].replace("?size=",""):void 0;let m;"avatar"===u[1]||"profile"===u[1]?(l=Object(g.s)(Number(p)),p=Math.abs(Number(p))):l=u[1];switch(l){case"channel":case"chat":m=f.a.chats[p];break;case"user":m=f.a.users[p];break;case"msg":m=f.a.messages[p];break;case"sticker":case"gif":case"wallpaper":m=f.a.documents[p];break;case"photo":m=f.a.photos[p];break;case"stickerSet":m=f.a.stickerSets[p]}if(!m)return;if(["msg","sticker","gif","wallpaper","photo"].includes(l)){c===d.ApiMediaFormat.Stream&&(s.acceptsBuffer=!0);const e=await t.downloadMedia(m,{sizeType:h,start:a,end:o,progressCallback:s,workers:r.j});let n,u;return m instanceof i.Api.Message?(n=function(e,t){if(!e||!e.media)return;if(e.media instanceof i.Api.MessageMediaPhoto)return"image/jpeg";if(e.media instanceof i.Api.MessageMediaDocument&&e.media.document instanceof i.Api.Document)return t?e.media.document.attributes.some(e=>e instanceof i.Api.DocumentAttributeSticker)?"image/webp":"image/jpeg":e.media.document.mimeType;return}(m,h),m.media instanceof i.Api.MessageMediaDocument&&m.media.document instanceof i.Api.Document&&(u=m.media.document.size)):m instanceof i.Api.Photo?n="image/jpeg":"sticker"===l&&h?n="image/webp":(n=m.mimeType,u=m.size),{mimeType:n,data:e,fullSize:u}}if("stickerSet"===l){const e=await t.downloadStickerSetThumb(m);return{mimeType:c===d.ApiMediaFormat.Lottie?"application/json":v(e),data:e}}{const e=await t.downloadProfilePhoto(m,"profile"===u[1]);return{mimeType:v(e),data:e}}}(e,o,c,u,n,a,t)||{};if(!h)return;const _=await async function(e,t,n){switch(t){case d.ApiMediaFormat.DataUri:return Object(p.a)(new Blob([e],{type:n}));case d.ApiMediaFormat.BlobUrl:return new Blob([e],{type:n});case d.ApiMediaFormat.Lottie:{const t=Object(l.inflate)(e,{to:"string"});return JSON.parse(t)}case d.ApiMediaFormat.Progressive:return e.buffer}return}(h,t,m);if(!_)return;const w=t!==d.ApiMediaFormat.Progressive&&(t!==d.ApiMediaFormat.BlobUrl||_.size<=r.n);if(!r.m&&s&&w){b(e.startsWith("avatar")?r.p:r.o,e,_)}return{prepared:t===d.ApiMediaFormat.Progressive?"":function(e){if(e instanceof Blob)return URL.createObjectURL(e);return e}(_),arrayBuffer:t===d.ApiMediaFormat.Progressive?_:void 0,mimeType:m,fullSize:y}}function v(e,t="image/jpeg"){if(e.length<4)return t;let n=t;switch(e.subarray(0,4).reduce((e,t)=>e+t.toString(16),"")){case"89504e47":n="image/png";break;case"47494638":n="image/gif";break;case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":n="image/jpeg";break;case"52494646":n="image/webp"}return n}!function(e){e[e.Text=0]="Text",e[e.Blob=1]="Blob",e[e.Json=2]="Json"}(m||(m={}));var A=n(13);a.Logger.setLevel(r.g?"debug":"warn");const I={build:e=>e};let P,S,C=!1;async function k(e,t){P=t,r.f&&console.log(">>> START INIT API");const n=r.k?new i.sessions.LocalStorageSession(e):new i.sessions.IdbSession(e);S=new i.TelegramClient(n,"739222","60d1e1063c72d4bc4cfdda99e8906f94",{useWSS:!0,additionalDcsDisabled:r.k}),S.addEventHandler(O,I),S.addEventHandler(c.b,I);try{r.f&&console.log("[GramJs/client] CONNECTING"),await S.start({phoneNumber:o.g,phoneCode:o.e,password:o.f,firstAndLastNames:o.i,qrCode:o.h,onError:o.b});const e=await n.save();r.f&&(console.log(">>> FINISH INIT API"),console.log("[GramJs/client] CONNECTED as ",e)),Object(o.c)(e),P({"@type":"updateApiReady"}),x()}catch(e){throw r.f&&console.log("[GramJs/client] CONNECTING ERROR",e),e}}async function M(){await U(new i.Api.auth.LogOut),await S.destroy()}async function E(){await S.disconnect()}function R(){return S}function O(e){e instanceof i.connection.UpdateConnectionState?C=e.state===i.connection.UpdateConnectionState.connected:e instanceof i.Api.UpdatesTooLong&&async function(){try{await U(new i.Api.users.GetFullUser({id:new i.Api.InputUserSelf}),void 0,!0)}catch(e){"AUTH_KEY_UNREGISTERED"===e.message&&P({"@type":"updateConnectionState",connectionState:"connectionStateBroken"})}}()}async function U(e,t=!1,n=!1){if(C)try{r.f&&console.log("[GramJs/client] INVOKE "+e.className);const n=await S.invoke(e);if(r.f&&console.log("[GramJs/client] INVOKE RESPONSE "+e.className,n),t){let t;n instanceof i.Api.Updates||n instanceof i.Api.UpdatesCombined?t=n:"updates"in n&&(n.updates instanceof i.Api.Updates||n.updates instanceof i.Api.UpdatesCombined)&&(t=n.updates),t?(!function(e){const t=[...e.users,...e.chats];e.updates.forEach(e=>{t&&(e._entities=t)})}(t),t.updates.forEach(t=>{Object(c.b)(t,e)})):n instanceof i.Api.UpdatesTooLong||Object(c.b)(n,e)}return n}catch(t){if(r.f&&(console.log("[GramJs/client] INVOKE ERROR "+e.className),console.error(t)),function(e,t){const n=e.message.startsWith("A wait of")&&(t instanceof i.Api.messages.SendMessage||t instanceof i.Api.messages.SendMedia||t instanceof i.Api.messages.SendMultiMedia),{message:s}=e;P({"@type":"error",error:{message:s,isSlowMode:n}})}(t,e),n)throw t;return}else r.f&&console.warn(`[GramJs/client] INVOKE ${e.className} ERROR: Client is not connected`)}function T(e,t){return w(e,S,C,t)}function B(e,t){return S.uploadFile({file:e,onProgress:t,workers:r.v})}function D(e){return S.updateTwoFaSettings(e)}async function x(){const e=await U(new i.Api.users.GetFullUser({id:new i.Api.InputUserSelf}));if(!(e&&e.user instanceof i.Api.User))return;f.a.users[e.user.id]=e.user;const t=Object(A.b)(e);Object(u.o)(t.id),Object(o.d)(t)}},function(e,t,n){"use strict";(function(e){n.d(t,"s",(function(){return l})),n.d(t,"o",(function(){return d})),n.d(t,"i",(function(){return f})),n.d(t,"g",(function(){return p})),n.d(t,"l",(function(){return h})),n.d(t,"f",(function(){return m})),n.d(t,"h",(function(){return y})),n.d(t,"j",(function(){return b})),n.d(t,"d",(function(){return _})),n.d(t,"r",(function(){return w})),n.d(t,"m",(function(){return v})),n.d(t,"n",(function(){return A})),n.d(t,"q",(function(){return I})),n.d(t,"t",(function(){return P})),n.d(t,"u",(function(){return S})),n.d(t,"c",(function(){return C})),n.d(t,"e",(function(){return k})),n.d(t,"b",(function(){return M})),n.d(t,"a",(function(){return E})),n.d(t,"p",(function(){return R})),n.d(t,"k",(function(){return O}));var s=n(15),i=n.n(s),a=n(0),r=n(8),o=n(11),c=n(5),u=n(14);function l(e){return e>0?"user":e<=-1e9?"channel":"chat"}function d(e){return e>0?new a.Api.PeerUser({userId:e}):e<=-1e9?new a.Api.PeerChannel({channelId:-e}):new a.Api.PeerChat({chatId:-e})}function f(e,t){return e>0||e<=-1e9?e>0?new a.Api.InputPeerUser({userId:e,accessHash:i()(t)}):new a.Api.InputPeerChannel({channelId:-e,accessHash:i()(t)}):new a.Api.InputPeerChat({chatId:-e})}function g(e){if(e>0){const{accessHash:t}=c.a.users[e]||{};return t?new a.Api.InputPeerUser({userId:e,accessHash:t}):void 0}if(e<=-1e9){const{accessHash:t}=c.a.chats[-e]||{};return t?new a.Api.InputPeerChannel({channelId:-e,accessHash:t}):void 0}return new a.Api.InputPeerChat({chatId:-e})}function p(e,t){return e>0?new a.Api.InputUser({userId:e,accessHash:i()(t)}):e<=-1e9?new a.Api.InputChannel({channelId:-e,accessHash:i()(t)}):-e}function h(e,t){return new a.Api.InputStickerSetID({id:i()(e),accessHash:i()(t)})}function m(e){const t=c.a.documents[e.id];if(t)return new a.Api.InputDocument(Object(u.b)(t,["id","accessHash","fileReference"]))}function y(e){const t=m(e);if(t)return new a.Api.InputMediaDocument({id:t})}function b(t,n){const{summary:s,quiz:i}=t,r=new a.Api.Poll({id:n,publicVoters:s.isPublic,question:s.question,answers:s.answers.map(({text:t,option:n})=>new a.Api.PollAnswer({text:t,option:e.from(n)})),quiz:s.quiz,multipleChoice:s.multipleChoice});if(!i)return new a.Api.InputMediaPoll({poll:r});const o=i.correctAnswers.map(t=>e.from(t)),{solution:c}=i,u=i.solutionEntities?i.solutionEntities.map(A):[];return new a.Api.InputMediaPoll({poll:r,correctAnswers:o,...c&&{solution:c,solutionEntities:u}})}function _(e){const{emoticon:t,contacts:n,nonContacts:s,groups:i,channels:r,bots:o,excludeArchived:c,excludeMuted:u,excludeRead:l,pinnedChatIds:d,includedChatIds:f,excludedChatIds:p}=e,h=d?d.map(g).filter(Boolean):[],m=f?f.map(g).filter(Boolean):[],y=p?p.map(g).filter(Boolean):[];return new a.Api.DialogFilter({id:e.id,title:e.title,emoticon:t||void 0,contacts:n||void 0,nonContacts:s||void 0,groups:i||void 0,bots:o||void 0,excludeArchived:c||void 0,excludeMuted:u||void 0,excludeRead:l||void 0,broadcasts:r||void 0,pinnedPeers:h,includePeers:m,excludePeers:y})}function w(){return Object(r.readBigIntFromBuffer)(Object(r.generateRandomBytes)(8),!0,!0)}function v(e,t,n){return new a.Api.Message({id:e,peerId:d(t),fromId:d(t),media:n.media})}function A(e){const{type:t,offset:n,length:s,url:i,userId:r}=e,u=r?c.a.users[r]:void 0;switch(t){case o.ApiMessageEntityTypes.Bold:return new a.Api.MessageEntityBold({offset:n,length:s});case o.ApiMessageEntityTypes.Italic:return new a.Api.MessageEntityItalic({offset:n,length:s});case o.ApiMessageEntityTypes.Underline:return new a.Api.MessageEntityUnderline({offset:n,length:s});case o.ApiMessageEntityTypes.Strike:return new a.Api.MessageEntityStrike({offset:n,length:s});case o.ApiMessageEntityTypes.Code:return new a.Api.MessageEntityCode({offset:n,length:s});case o.ApiMessageEntityTypes.Pre:return new a.Api.MessageEntityPre({offset:n,length:s,language:""});case o.ApiMessageEntityTypes.Blockquote:return new a.Api.MessageEntityBlockquote({offset:n,length:s});case o.ApiMessageEntityTypes.TextUrl:return new a.Api.MessageEntityTextUrl({offset:n,length:s,url:i});case o.ApiMessageEntityTypes.Url:return new a.Api.MessageEntityUrl({offset:n,length:s});case o.ApiMessageEntityTypes.Hashtag:return new a.Api.MessageEntityHashtag({offset:n,length:s});case o.ApiMessageEntityTypes.MentionName:return new a.Api.InputMessageEntityMentionName({offset:n,length:s,userId:new a.Api.InputUser({userId:r,accessHash:u.accessHash})});default:return new a.Api.MessageEntityUnknown({offset:n,length:s})}}function I(e){let t=0;return e.forEach(e=>{t=(20261*t&2147483647)+e&2147483647}),t}function P(e){const{media:t}=e;return!!t&&(t instanceof a.Api.MessageMediaPhoto||t instanceof a.Api.MessageMediaDocument||t instanceof a.Api.MessageMediaWebPage&&t.webpage instanceof a.Api.WebPage&&t.webpage.photo instanceof a.Api.Photo)}function S(e){return"photo"in e.action&&e.action.photo instanceof a.Api.Photo}function C(e){if(e instanceof a.Api.PhotoEmpty)return new a.Api.ChatPhotoEmpty;const{dcId:t}=e,n=e.sizes.filter(e=>e instanceof a.Api.PhotoSize||e instanceof a.Api.PhotoCachedSize);if(!n.length)return new a.Api.ChatPhotoEmpty;const s=n.find(e=>"a"===e.type),i=n.find(e=>"c"===e.type)||n.find(e=>"b"===e.type);return s&&i?new a.Api.ChatPhoto({dcId:t,photoSmall:s&&s.location,photoBig:i&&i.location}):new a.Api.ChatPhotoEmpty}function k({phone:e,firstName:t,lastName:n}){return new a.Api.InputPhoneContact({clientId:i()(1),phone:e,firstName:t,lastName:n})}function M(e,t=0){return new a.Api.ChatBannedRights({...e,untilDate:t})}function E(e){return new a.Api.ChatAdminRights(e)}function R(e){const{shippingAddress:t}=e;return new a.Api.PaymentRequestedInfo({...e,shippingAddress:t?new a.Api.PostAddress(t):void 0})}function O(e){switch(e){case"phoneNumber":return new a.Api.InputPrivacyKeyPhoneNumber;case"lastSeen":return new a.Api.InputPrivacyKeyStatusTimestamp;case"profilePhoto":return new a.Api.InputPrivacyKeyProfilePhoto;case"forwards":return new a.Api.InputPrivacyKeyForwards;case"chatInvite":return new a.Api.InputPrivacyKeyChatInvite}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return p})),n.d(t,"k",(function(){return h})),n.d(t,"j",(function(){return m})),n.d(t,"l",(function(){return b})),n.d(t,"e",(function(){return v})),n.d(t,"g",(function(){return A})),n.d(t,"h",(function(){return I})),n.d(t,"f",(function(){return P})),n.d(t,"i",(function(){return S})),n.d(t,"a",(function(){return C})),n.d(t,"b",(function(){return k}));var s=n(0),i=n(14);function a(e){return e.hasOwnProperty("userId")}function r(e){return e.hasOwnProperty("chatId")}var o=n(18);function c(e,t=!1){const n=Boolean("min"in e&&e.min),i="accessHash"in e&&String(e.accessHash),a="photo"in e&&v(e.photo),r=Boolean("signatures"in e&&e.signatures);return{isMin:n,hasPrivateLink:Boolean("hasLink"in e&&e.hasLink),isSignaturesShown:r,...i&&{accessHash:i},...a&&{avatarHash:a},...(e instanceof s.Api.Channel||e instanceof s.Api.User)&&{username:e.username},..."verified"in e&&{isVerified:e.verified},...(e instanceof s.Api.Chat||e instanceof s.Api.Channel)&&{...e.participantsCount&&{membersCount:e.participantsCount},joinDate:e.date},...t&&{isSupport:!0},...l(e),..."creator"in e&&{isCreator:e.creator},...d(e),...f(e)}}function u(e,t){const{peer:n,folderId:s,unreadMark:i,unreadCount:a,unreadMentionsCount:r,notifySettings:{silent:o,muteUntil:u},readOutboxMaxId:l,readInboxMaxId:d}=e,f=o||"number"==typeof u&&Date.now()<1e3*u;return{id:h(n),...s&&{folderId:s},type:y(t),title:_(n,t),lastReadOutboxMessageId:l,lastReadInboxMessageId:d,unreadCount:a,unreadMentionsCount:r,isMuted:f,...i&&{hasUnreadMark:!0},...c(t)}}function l(e){return e instanceof s.Api.Chat||e instanceof s.Api.Channel?{adminRights:Object(o.b)(e.adminRights),currentUserBannedRights:e instanceof s.Api.Channel?Object(o.b)(e.bannedRights):void 0,defaultBannedRights:Object(o.b)(e.defaultBannedRights)}:{}}function d(e){if(e instanceof s.Api.ChatForbidden||e instanceof s.Api.ChannelForbidden)return{isRestricted:!0};if(e instanceof s.Api.User)return{isRestricted:e.restricted,restrictionReason:g(e.restrictionReason)};if(e instanceof s.Api.Chat)return{isNotJoined:e.left,isRestricted:e.kicked};if(e instanceof s.Api.Channel){const t=e.restricted&&e.restrictionReason&&e.restrictionReason.some(e=>"all"===e.platform);return{isNotJoined:e.left,isRestricted:t,restrictionReason:g(e.restrictionReason)}}return{}}function f(e){return e instanceof s.Api.Chat&&e.migratedTo&&!(e.migratedTo instanceof s.Api.InputChannelEmpty)?{migratedTo:{chatId:h(e.migratedTo),...e.migratedTo instanceof s.Api.InputChannel&&{accessHash:e.migratedTo.accessHash.toString()}}}:{}}function g(e){if(!e)return;const t=e.find(({platform:e})=>"all"===e);return t?Object(i.b)(t,["reason","text"]):void 0}function p(e,t=!1,n=!1){if(e instanceof s.Api.Chat||e instanceof s.Api.Channel||e instanceof s.Api.User||n&&(e instanceof s.Api.ChatForbidden||e instanceof s.Api.ChannelForbidden))return{id:e instanceof s.Api.User?e.id:-e.id,type:y(e),title:e instanceof s.Api.User?w(e):e.title,...c(e,t)}}function h(e){return a(e)?e.userId:r(e)?-e.chatId:-e.channelId}function m(e){return function(e){return e.hasOwnProperty("userId")}(e)?e.userId:function(e){return e.hasOwnProperty("chatId")}(e)?-e.chatId:function(e){return e.hasOwnProperty("channelId")}(e)?-e.channelId:void 0}function y(e){return e instanceof s.Api.User||e instanceof s.Api.UserEmpty?"chatTypePrivate":e instanceof s.Api.Chat||e instanceof s.Api.ChatForbidden||e instanceof s.Api.ChatEmpty?"chatTypeBasicGroup":e.megagroup?"chatTypeSuperGroup":"chatTypeChannel"}function b(e){return a(e)?"user"+e.userId:r(e)?"chat"+e.chatId:"chat"+e.channelId}function _(e,t){return a(e)?w(t):t.title}function w(e){return e.firstName?`${e.firstName}${e.lastName?" "+e.lastName:""}`:e.lastName||void 0}function v(e){if(e instanceof s.Api.UserProfilePhoto)return e.photoId.toString();if(e instanceof s.Api.ChatPhoto){const{dcId:t,photoSmall:{volumeId:n,localId:s}}=e;return`${t}-${n}-${s}`}}function A(e){return{userId:e.userId,inviterId:"inviterId"in e?e.inviterId:void 0,joinedDate:"date"in e?e.date:void 0,kickedByUserId:"kickedBy"in e?e.kickedBy:void 0,promotedByUserId:"promotedBy"in e?e.promotedBy:void 0,bannedRights:"bannedRights"in e?Object(o.b)(e.bannedRights):void 0,adminRights:"adminRights"in e?Object(o.b)(e.adminRights):void 0,customTitle:"rank"in e?e.rank:void 0,...(e instanceof s.Api.ChannelParticipantAdmin||e instanceof s.Api.ChatParticipantAdmin)&&{isAdmin:!0},...(e instanceof s.Api.ChannelParticipantCreator||e instanceof s.Api.ChatParticipantCreator)&&{isOwner:!0}}}function I(e){return e instanceof s.Api.ChatParticipants||e instanceof s.Api.channels.ChannelParticipants?e.participants.map(A):void 0}function P(e){return e instanceof s.Api.ChatInviteExported?e.link:void 0}function S(e){let t="";if(!(e.action instanceof s.Api.SendMessageCancelAction))return e.action instanceof s.Api.SendMessageTypingAction?t="typing":e.action instanceof s.Api.SendMessageRecordVideoAction?t="recording a video":e.action instanceof s.Api.SendMessageUploadVideoAction?t="uploading a video":e.action instanceof s.Api.SendMessageRecordAudioAction?t="recording a voice message":e.action instanceof s.Api.SendMessageUploadAudioAction?t="uploading a voice message":e.action instanceof s.Api.SendMessageUploadPhotoAction?t="uploading a photo":e.action instanceof s.Api.SendMessageUploadDocumentAction?t="uploading a file":e.action instanceof s.Api.SendMessageGeoLocationAction?t="selecting a location to share":e.action instanceof s.Api.SendMessageChooseContactAction?t="selecting a contact to share":e.action instanceof s.Api.SendMessageGamePlayAction?t="playing a game":e.action instanceof s.Api.SendMessageRecordRoundAction?t="recording a round video":e.action instanceof s.Api.SendMessageUploadRoundAction&&(t="uploading a round video"),{action:t,...e instanceof s.Api.UpdateChatUserTyping&&{userId:e.userId},...e instanceof s.Api.UpdateChannelUserTyping&&{userId:e.userId},timestamp:Date.now()}}function C(e){return{...Object(i.c)(e,["id","title","emoticon","contacts","nonContacts","groups","bots","excludeMuted","excludeRead","excludeArchived"]),channels:e.broadcasts,pinnedChatIds:e.pinnedPeers.map(m).filter(Boolean),includedChatIds:e.includePeers.map(m).filter(Boolean),excludedChatIds:e.excludePeers.map(m).filter(Boolean)}}function k({filter:e,description:t}){return{...C(e),description:t}}},function(e,t,n){"use strict";n.d(t,"f",(function(){return s})),n.d(t,"k",(function(){return i})),n.d(t,"g",(function(){return a})),n.d(t,"m",(function(){return r})),n.d(t,"o",(function(){return o})),n.d(t,"p",(function(){return c})),n.d(t,"n",(function(){return u})),n.d(t,"c",(function(){return l})),n.d(t,"b",(function(){return d})),n.d(t,"j",(function(){return f})),n.d(t,"v",(function(){return g})),n.d(t,"q",(function(){return p})),n.d(t,"s",(function(){return h})),n.d(t,"e",(function(){return m})),n.d(t,"t",(function(){return y})),n.d(t,"l",(function(){return b})),n.d(t,"r",(function(){return _})),n.d(t,"u",(function(){return w})),n.d(t,"a",(function(){return v})),n.d(t,"d",(function(){return A})),n.d(t,"i",(function(){return I})),n.d(t,"h",(function(){return P}));const s=!1,i=!1,a=!1,r=!1,o="tt-media",c="tt-media-avatars",u=524288,l=300,d=new Set(["newMessage","newScheduledMessage","deleteMessages","deleteScheduledMessages","deleteHistory"]),f=16,g=16,p=("undefined"!=typeof window&&window.innerHeight,200),h=50,m=100,y=40,b=1e9,_="MEMOJI_STICKER",w=777e3,v=0,A=1,I=777,P="android"},function(e,t,n){"use strict";t.a={localMessages:{},chats:{},users:{},messages:{},documents:{},stickerSets:{},photos:{}}},function(e,t,n){(function(t){function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{parseTl:i,serializeBytes:a,serializeDate:r}=n(45),{readBufferFromBigInt:o,toSignedLittleBuffer:c}=n(8),u=n(79),l=n(80),d="undefined"!=typeof self&&void 0!==self.localStorage;function f(e){const t=i(e,109),n=[],s=[];for(const e of t)e.isFunction?s.push(e):n.push(e);return[n,s]}function g(e,n){switch(n){case"int":const n=t.alloc(4);return n.writeInt32LE(e,0),n;case"long":return c(e,8);case"int128":return c(e,16);case"int256":return c(e,32);case"double":const s=t.alloc(8);return s.writeDoubleLE(e,0),s;case"string":return a(e);case"Bool":return e?t.from("b5757299","hex"):t.from("379779bc","hex");case"true":return t.alloc(0);case"bytes":return a(e);case"date":return r(e);default:return e.getBytes()}}function p(e,t){if(t.isVector){t.useVectorId&&e.readInt();const n=[],s=e.readInt();t.isVector=!1;for(let i=0;i{this[e]=t[e]})}static fromReader(e){const t={};for(const n in c)if(c.hasOwnProperty(n)){const s=c[n];if(s.isFlag){if("true"===s.type){t[n]=Boolean(t.flags&1<g(t,c[e].type))))}else if(c[e].flagIndicator)if(Object.values(c).some(e=>e.isFlag)){let e=0;for(const t in c)c[t].isFlag&&(!1===this[t]&&"true"===c[t].type||void 0===this[t]||null===this[t]?e|=0:e|=1</);if(n){t.readInt();const e=[],s=t.readInt();if("int"===n[1])for(let n=0;n{"function"!=typeof t[e]&&n[e]?Object.assign(n[e],t[e]):n[e]=t[e]}),n}(h("constructor",e.constructors),h("request",e.requests))}()}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.d(t,"p",(function(){return p})),n.d(t,"j",(function(){return h})),n.d(t,"k",(function(){return m})),n.d(t,"w",(function(){return y})),n.d(t,"h",(function(){return b})),n.d(t,"u",(function(){return _})),n.d(t,"v",(function(){return w})),n.d(t,"a",(function(){return v})),n.d(t,"H",(function(){return A})),n.d(t,"b",(function(){return I})),n.d(t,"q",(function(){return P})),n.d(t,"r",(function(){return S})),n.d(t,"d",(function(){return C})),n.d(t,"c",(function(){return k})),n.d(t,"g",(function(){return M})),n.d(t,"z",(function(){return E})),n.d(t,"y",(function(){return R})),n.d(t,"i",(function(){return O})),n.d(t,"n",(function(){return U})),n.d(t,"f",(function(){return T})),n.d(t,"e",(function(){return B})),n.d(t,"A",(function(){return D})),n.d(t,"o",(function(){return x})),n.d(t,"B",(function(){return j})),n.d(t,"F",(function(){return N})),n.d(t,"G",(function(){return F})),n.d(t,"E",(function(){return V})),n.d(t,"I",(function(){return L})),n.d(t,"D",(function(){return q})),n.d(t,"C",(function(){return H})),n.d(t,"m",(function(){return z})),n.d(t,"l",(function(){return K})),n.d(t,"x",(function(){return G})),n.d(t,"s",(function(){return W})),n.d(t,"t",(function(){return $}));var s=n(0),i=n(4),a=n(1),r=n(3),o=n(9),c=n(13),u=n(14),l=n(5),d=n(2),f=n(16);let g;function p(e){g=e}async function h({limit:e,offsetDate:t,archived:n,withPinned:l}){const d=await Object(a.g)(new s.Api.messages.GetDialogs({offsetPeer:new s.Api.InputPeerEmpty,limit:e,offsetDate:t,folderId:n?i.d:void 0,...l&&{excludePinned:!0}})),f=l?await Object(a.g)(new s.Api.messages.GetPinnedDialogs({folderId:n?i.d:void 0})):void 0;if(!d||d instanceof s.Api.messages.DialogsNotModified)return;Z(d),f&&Z(f);const g=Object(u.a)([...d.messages,...f?f.messages:[]].map(o.b).filter(Boolean),"chatId"),p={...J(d),...f&&J(f)},h=[],m={},y={},b=[...f?f.dialogs:[],...d.dialogs],_=[];b.forEach(e=>{if(!(e instanceof s.Api.Dialog)||!n&&e.folderId===i.d||n&&e.folderId!==i.d)return;const t=p[Object(r.l)(e.peer)],a=Object(r.c)(e,t);if(a.lastMessage=g[a.id],h.push(a),l&&e.pinned&&_.push(a.id),e.draft){const{formattedText:t,replyingToId:n}=Object(o.h)(e.draft)||{};t&&(m[a.id]=t),n&&(y[a.id]=n)}});const w=[...d.users,...f?f.users:[]].map(c.a).filter(Boolean),v=h.map(e=>e.id);let A;return A=d instanceof s.Api.messages.DialogsSlice?d.count:v.length,{chatIds:v,chats:h,users:w,draftsById:m,replyingToById:y,orderedPinnedIds:l?_:void 0,totalChatCount:A}}function m(e){const{id:t,accessHash:n,adminRights:i}=e;return Object(d.g)(t,n)instanceof s.Api.InputChannel?async function(e,t,n){const i=await Object(a.g)(new s.Api.channels.GetFullChannel({channel:Object(d.g)(e,t)}));if(!(i&&i.fullChat instanceof s.Api.ChannelFull))return;const{about:o,onlineCount:c,exportedInvite:u,slowmodeSeconds:l,slowmodeNextSendDate:f,migratedFromChatId:g,migratedFromMaxId:p,canViewParticipants:h,linkedChatId:m,hiddenPrehistory:y}=i.fullChat,b=u instanceof s.Api.ChatInviteExported?u.link:void 0,{members:_,users:w}=h&&await z(e,t)||{},{members:v,users:A}=h&&n&&await z(e,t,"kicked")||{},{members:I,users:P}=h&&n&&await z(e,t,"admin")||{};return{fullInfo:{about:o,onlineCount:c,inviteLink:b,slowMode:l?{seconds:l,nextSendDate:f}:void 0,migratedFrom:g?{chatId:Object(r.k)({chatId:g}),maxMessageId:p}:void 0,canViewMembers:h,isPreHistoryHidden:y,members:_,kickedMembers:v,adminMembers:I,linkedChatId:m?Object(r.k)({chatId:m}):void 0},users:[...w||[],...A||[],...P||[]]}}(t,n,i):async function(e){const t=await Object(a.g)(new s.Api.messages.GetFullChat({chatId:Object(d.g)(e)}));if(!(t&&t.fullChat instanceof s.Api.ChatFull))return;Z(t);const{about:n,participants:i,exportedInvite:o}=t.fullChat,u=Object(r.h)(i),l=u?u.filter(({isAdmin:e,isOwner:t})=>e||t):void 0;return{fullInfo:{about:n,members:u,adminMembers:l,inviteLink:Object(r.f)(o),canViewMembers:!0},users:t.users.map(c.a).filter(Boolean)}}(t)}async function y({query:e}){const t=await Object(a.g)(new s.Api.contacts.Search({q:e}));if(!t)return;Z(t);const n=t.myResults.map(r.k),i=[...t.chats,...t.users].map(e=>Object(r.d)(e)).filter(Boolean),o=t.users.map(c.a).filter(e=>!!e&&!e.isSelf);return{localChats:i.filter(e=>n.includes(e.id)),localUsers:o.filter(e=>n.includes(e.id)),globalChats:i.filter(e=>!n.includes(e.id)),globalUsers:o.filter(e=>!n.includes(e.id))}}async function b({type:e,user:t}){let n;if("self"===e||"user"===e){const i=await Object(a.g)(new s.Api.users.GetUsers({id:["user"===e&&t?Object(d.g)(t.id,t.accessHash):new s.Api.InputUserSelf]}));if(!i||!i.length)return;[n]=i}else if("support"===e){const e=await Object(a.g)(new s.Api.help.GetSupport);if(!e||!e.user)return;n=e.user}const i=Object(r.d)(n,"support"===e);if(i)return g({"@type":"updateChat",id:i.id,chat:i}),{chatId:i.id}}async function _(e){const{id:t,accessHash:n}=e,i=await Object(a.g)(new s.Api.messages.GetPeerDialogs({peers:[new s.Api.InputDialogPeer({peer:Object(d.i)(t,n)})]}));if(!i)return;const c=i.dialogs[0];if(!(c&&c instanceof s.Api.Dialog))return;const u=J(i)[Object(r.l)(c.peer)];if(!u)return;Z(i);const l=Object(o.b)(i.messages[0]);g({"@type":"updateChat",id:t,chat:{...Object(r.c)(c,u),lastMessage:l}})}function w({chat:e,text:t,entities:n,replyToMsgId:i}){return Object(a.g)(new s.Api.messages.SaveDraft({peer:Object(d.i)(e.id,e.accessHash),message:t,...n&&{entities:n.map(d.n)},replyToMsgId:i}))}function v(e){return Object(a.g)(new s.Api.messages.SaveDraft({peer:Object(d.i)(e.id,e.accessHash),message:""}))}async function A({chat:e,isMuted:t}){await Object(a.g)(new s.Api.account.UpdateNotifySettings({peer:new s.Api.InputNotifyPeer({peer:Object(d.i)(e.id,e.accessHash)}),settings:new s.Api.InputPeerNotifySettings({muteUntil:t?2**31-1:void 0})})),_(e)}async function I({title:e,about:t,users:n}){const o=await Object(a.g)(new s.Api.channels.CreateChannel({broadcast:!0,title:e,about:t}),!0);if(!(o instanceof s.Api.Updates))return void(i.f&&console.error("Unexpected channel creation update",o));const c=o.chats[0];if(!(c&&c instanceof s.Api.Channel))return void(i.f&&console.error("Created channel not found",o));const u=Object(r.d)(c);return await Object(a.g)(new s.Api.channels.InviteToChannel({channel:Object(d.g)(u.id,u.accessHash),users:n.map(({id:e,accessHash:t})=>Object(d.g)(e,t))})),u}function P({channelId:e,accessHash:t}){return Object(a.g)(new s.Api.channels.JoinChannel({channel:Object(d.g)(e,t)}),!0)}function S({channelId:e,accessHash:t}){return Object(a.g)(new s.Api.channels.LeaveChannel({channel:Object(d.g)(e,t)}),!0)}function C({channelId:e,accessHash:t}){return Object(a.g)(new s.Api.channels.DeleteChannel({channel:Object(d.g)(e,t)}),!0)}async function k({title:e,users:t}){const n=await Object(a.g)(new s.Api.messages.CreateChat({title:e,users:t.map(({id:e,accessHash:t})=>Object(d.g)(e,t))}),!0);if(!(n instanceof s.Api.Updates))return void(i.f&&console.error("Unexpected chat creation update",n));const o=n.chats[0];if(o&&o instanceof s.Api.Chat)return Object(r.d)(o);i.f&&console.error("Created chat not found",n)}async function M({chatId:e,accessHash:t,photo:n}){const i=await Object(a.i)(n),r=Object(d.g)(e,t);return Object(a.g)(r instanceof s.Api.InputChannel?new s.Api.channels.EditPhoto({channel:r,photo:new s.Api.InputChatUploadedPhoto({file:i})}):new s.Api.messages.EditChatPhoto({chatId:r,photo:new s.Api.InputChatUploadedPhoto({file:i})}),!0)}async function E({chat:e,shouldBePinned:t}){const{id:n,accessHash:i}=e;await Object(a.g)(new s.Api.messages.ToggleDialogPin({peer:new s.Api.InputDialogPeer({peer:Object(d.i)(n,i)}),pinned:t||void 0}))&&g({"@type":"updateChatPinned",id:e.id,isPinned:t})}function R({chat:e,folderId:t}){const{id:n,accessHash:i}=e;return Object(a.g)(new s.Api.folders.EditPeerFolders({folderPeers:[new s.Api.InputFolderPeer({peer:Object(d.i)(n,i),folderId:t})]}),!0)}async function O(){const e=await Object(a.g)(new s.Api.messages.GetDialogFilters);if(e)return{byId:Object(u.a)(e.map(r.a),"id"),orderedIds:e.map(({id:e})=>e)}}async function U(){const e=await Object(a.g)(new s.Api.messages.GetSuggestedDialogFilters);if(e)return e.map(r.b)}async function T({id:e,folderUpdate:t}){const n=Object(d.d)(t);await Object(a.g)(new s.Api.messages.UpdateDialogFilter({id:e,filter:n}))&&g({"@type":"updateChatFolder",id:e,folder:t})}async function B(e){const t=await Object(a.g)(new s.Api.messages.UpdateDialogFilter({id:e,filter:void 0})),n=await U();t&&g({"@type":"updateChatFolder",id:e,folder:void 0}),n&&g({"@type":"updateRecommendedChatFolders",folders:n})}async function D({chat:e,hasUnreadMark:t}){const{id:n,accessHash:i}=e;await Object(a.g)(new s.Api.messages.MarkDialogUnread({peer:new s.Api.InputDialogPeer({peer:Object(d.i)(n,i)}),unread:t||void 0}))&&g({"@type":"updateChat",id:e.id,chat:{hasUnreadMark:t}})}async function x(e){const t=await Object(a.g)(new s.Api.contacts.ResolveUsername({username:e}));if(!t)return;const{users:n,chats:i}=t,o=i.length?Object(r.d)(i[0]):Object(r.d)(n[0]);return o?(Z(t),o):void 0}function j({chat:e,isEnabled:t}){const{id:n,accessHash:i}=e,r=Object(d.g)(n,i);return Object(a.g)(new s.Api.channels.TogglePreHistoryHidden({channel:r,enabled:t}),!0)}function N({chat:e,bannedRights:t}){const{id:n,accessHash:i}=e,r=Object(d.i)(n,i);return Object(a.g)(new s.Api.messages.EditChatDefaultBannedRights({peer:r,bannedRights:Object(d.b)(t)}),!0)}function F({chat:e,user:t,bannedRights:n}){const i=Object(d.g)(e.id,e.accessHash),r=Object(d.g)(t.id,t.accessHash);return Object(a.g)(new s.Api.channels.EditBanned({channel:i,userId:r,bannedRights:Object(d.b)(n)}),!0)}function V({chat:e,user:t,adminRights:n,customTitle:i=""}){const r=Object(d.g)(e.id,e.accessHash),o=Object(d.g)(t.id,t.accessHash);return Object(a.g)(new s.Api.channels.EditAdmin({channel:r,userId:o,adminRights:Object(d.a)(n),rank:i}),!0)}async function L(e,t){const n=Object(d.g)(e.id,e.accessHash);await Object(a.g)(n instanceof s.Api.InputChannel?new s.Api.channels.EditTitle({channel:n,title:t}):new s.Api.messages.EditChatTitle({chatId:n,title:t}),!0)}async function q(e,t){await Object(a.g)(new s.Api.messages.EditChatAbout({peer:Object(d.i)(e.id,e.accessHash),about:t}))&&g({"@type":"updateChatFullInfo",id:e.id,fullInfo:{about:t}})}function H({chat:e,isEnabled:t}){const{id:n,accessHash:i}=e,r=Object(d.g)(n,i);return Object(a.g)(new s.Api.channels.ToggleSignatures({channel:r,enabled:t}),!0)}async function z(e,t,n="recent",o){let u;switch(n){case"kicked":u=new s.Api.ChannelParticipantsKicked({q:""});break;case"admin":u=new s.Api.ChannelParticipantsAdmins;break;default:u=new s.Api.ChannelParticipantsRecent}const l=await Object(a.g)(new s.Api.channels.GetParticipants({channel:Object(d.g)(e,t),filter:u,offset:o,limit:i.q}));if(l&&!(l instanceof s.Api.channels.ChannelParticipantsNotModified))return Z(l),{members:Object(r.h)(l),users:l.users.map(c.a).filter(Boolean)}}async function K(){const e=await Object(a.g)(new s.Api.channels.GetGroupsForDiscussion);if(e)return Z(e),e.chats.map(e=>Object(r.d)(e))}function G({channel:e,chat:t}){return Object(a.g)(new s.Api.channels.SetDiscussionGroup({broadcast:Object(d.i)(e.id,e.accessHash),group:t?Object(d.i)(t.id,t.accessHash):new s.Api.InputChannelEmpty}))}async function W(e){const t=await Object(a.g)(new s.Api.messages.MigrateChat({chatId:Object(d.g)(e.id)}),!0);if(t&&t instanceof s.Api.Updates)return Z(t),Object(r.d)(t.chats[1]);i.f&&console.error("Unexpected channel creation update",t)}async function $(e){const t=await Object(a.g)(new s.Api.messages.CheckChatInvite({hash:e}));if(t)return t instanceof s.Api.ChatInvite?void await Object(a.g)(new s.Api.messages.ImportChatInvite({hash:e}),!0):Object(r.d)(t.chat)}function J(e){const t={};return e.chats.forEach(e=>{t["chat"+e.id]=e}),e.users.forEach(e=>{t["user"+e.id]=e}),t}function Z(e){"users"in e&&e.users.forEach(e=>{e instanceof s.Api.User&&(l.a.users[e.id]=e)}),"chats"in e&&e.chats.forEach(e=>{(e instanceof s.Api.Chat||e instanceof s.Api.Channel)&&(l.a.chats[e.id]=e)}),"messages"in e&&e.messages.forEach(e=>{e instanceof s.Api.Message&&Object(d.t)(e)&&Object(f.a)(e)})}},function(e,t,n){(function(t){const s=n(15),i=n(36);function a(e,n=!0,i=!1){let a=t.from(e);const r=a.length;n&&(a=a.reverse());let o=s(a.toString("hex"),16);return i&&Math.floor(o.toString("2").length/8)>=r&&(o=o.subtract(s(2).pow(s(8*r)))),o}function r(e,n=8){const i=s(e),a=[];for(let e=0;e>>1:e>>>1;t[n]=e}return t}()),t.isBuffer(e)||(e=t.from(e));let n=-1;for(let t=0;t>>8}return(-1^n)>>>0},generateRandomBytes:c,generateKeyDataFromNonce:async function(e,n){e=r(e,16),n=r(n,32);const[s,i,a]=await Promise.all([u(t.concat([n,e])),u(t.concat([e,n])),u(t.concat([n,n]))]);return{key:t.concat([s,i.slice(0,12)]),iv:t.concat([i.slice(12,20),a,n.slice(0,4)])}},sha1:u,sha256:function(e){const t=i.createHash("sha256");return t.update(e),t.digest()},bigIntMod:function(e,t){return e.remainder(t).add(t).remainder(t)},modExp:function(e,t,n){e=e.remainder(n);let i=s.one,a=e;for(;t.greater(s.zero);){const e=t.remainder(s(2));t=t.divide(s(2)),e.eq(s.one)&&(i=i.multiply(a),i=i.remainder(n)),a=a.multiply(a),a=a.remainder(n)}return i},getRandomInt:function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e},sleep:e=>new Promise(t=>setTimeout(t,e)),getByteArray:function(e,t=!1){const n=e.toString(2).length,i=Math.floor((n+8-1)/8);return o(s(e),i,!1,t)},toSignedLittleBuffer:r,convertToLittle:function(e){const n=t.alloc(4*e.length);for(let t=0;t1?"s":""})`}}else if(e instanceof s.Api.MessageActionContactSignUp)o="%action_origin% joined Telegram";else if(e instanceof s.Api.MessageActionPaymentSent){const t=d(e.currency),n=(Number(e.totalAmount)/100).toFixed(2);o=`You successfully transferred ${t}${n} to shop for %product%`}else o="%ACTION_NOT_IMPLEMENTED%";"photo"in e&&e.photo instanceof s.Api.Photo&&(Object(g.b)(e.photo),a=Object(c.a)(e.photo));return{text:o,type:u,targetUserId:l,targetChatId:f,photo:a}}(t.action,n,Boolean(t.post),a);u&&(o.action=u);const{replyToMsgId:l,replyToTopId:f}=t.replyTo||{},h=t.editDate&&!t.editHide,{inlineButtons:m,keyboardButtons:y}=function(e){const{id:t,replyMarkup:n,media:i}=e;if(!n)return i instanceof s.Api.MessageMediaWebPage&&i.webpage instanceof s.Api.WebPage&&"telegram_message"===i.webpage.type?{inlineButtons:[[{type:"url",text:"Show Message",messageId:t,value:i.webpage.url}]]}:void 0;if(!(n instanceof s.Api.ReplyKeyboardMarkup||n instanceof s.Api.ReplyInlineMarkup))return;const a=n.rows.map(({buttons:e})=>e.map(e=>{let n,a,{text:r}=e;return e instanceof s.Api.KeyboardButton?(n="command",a=r):e instanceof s.Api.KeyboardButtonUrl?(n="url",a=e.url):e instanceof s.Api.KeyboardButtonCallback?(n="callback",a=String(e.data)):e instanceof s.Api.KeyboardButtonRequestPoll?n="requestPoll":e instanceof s.Api.KeyboardButtonBuy?(i instanceof s.Api.MessageMediaInvoice&&i.receiptMsgId&&(r="Receipt",a=i.receiptMsgId),n="buy"):n="NOT_SUPPORTED",{type:n,text:r,messageId:t,value:a}}));return{[n instanceof s.Api.ReplyKeyboardMarkup?"keyboardButtons":"inlineButtons"]:a}}(t)||{},b=t.fwdFrom&&function(e,t=!1){const n=e.savedFromPeer&&Object(r.k)(e.savedFromPeer),s=e.fromId&&Object(r.k)(e.fromId);return{isChannelPost:Boolean(e.channelPost),isLinkedChannelPost:Boolean(e.channelPost&&n&&!t),fromChatId:n||s,fromMessageId:e.channelPost||e.savedFromMsgId,senderUserId:s,hiddenUserName:e.fromName,adminTitle:e.postAuthor}}(t.fwdFrom,i),{replies:_,mediaUnread:w,postAuthor:v}=t,I=t.groupedId&&t.groupedId.toString(),S=Boolean(I)&&!(o.document||o.audio),C=t.replyMarkup instanceof s.Api.ReplyKeyboardHide;return{id:t.id,chatId:e,isOutgoing:a,content:o,date:t.date,senderId:n||t.out&&t.post&&p||e,views:t.views,isFromScheduled:t.fromScheduled,...l&&{replyToMessageId:l},...f&&{replyToTopMessageId:f},...b&&{forwardInfo:b},...h&&{isEdited:h},...w&&{isMediaUnread:w},...t.mentioned&&w&&{hasUnreadMention:!0},...I&&{groupedId:I,isInAlbum:S},inlineButtons:m,...y&&{keyboardButtons:y},...C&&{shouldHideKeyboardButtons:C},...t.viaBotId&&{viaBotId:t.viaBotId},..._&&_.comments&&{threadInfo:D(_,t.id,e)},...v&&{adminTitle:v}}}function A(e,t){return{text:e,...t&&{entities:t.map(B)}}}function I(e){if(!(e instanceof s.Api.DraftMessageEmpty)&&e.message)return{formattedText:A(e.message,e.entities),replyingToId:e.replyToMsgId}}function P(e){const t=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document&&e.document instanceof s.Api.Document))return;return Object(o.a)(e.document)}(e);if(t)return{sticker:t};const n=function(e){if(!(e instanceof s.Api.MessageMediaPhoto&&e.photo&&e.photo instanceof s.Api.Photo))return;if(e.ttlSeconds)return;return Object(c.a)(e.photo)}(e);if(n)return{photo:n};const i=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document instanceof s.Api.Document&&e.document.mimeType.startsWith("video")))return;return S(e.document)}(e);if(i)return{video:i};const r=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document&&e.document instanceof s.Api.Document))return;const t=e.document.attributes.find(e=>e instanceof s.Api.DocumentAttributeAudio);if(!t||t.voice)return;return{fileName:R(e.document,"audio"),...Object(a.b)(e.document,["size","mimeType"]),...Object(a.b)(t,["duration","performer","title"])}}(e);if(r)return{audio:r};const u=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document&&e.document instanceof s.Api.Document))return;const t=e.document.attributes.find(e=>e instanceof s.Api.DocumentAttributeAudio);if(!t||!t.voice)return;const{duration:n,waveform:i}=t;return{duration:n,waveform:i?Array.from(i):void 0}}(e);if(u)return{voice:u};const l=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document))return;if(e.ttlSeconds)return;return C(e.document)}(e);if(l)return{document:l};const f=function(e){if(!(e instanceof s.Api.MessageMediaContact))return;return Object(a.b)(e,["firstName","lastName","phoneNumber","userId"])}(e);if(f)return{contact:f};const g=function(e){if(!(e instanceof s.Api.MessageMediaPoll))return;return k(e.poll,e.results)}(e);if(g)return{poll:g};const p=E(e);if(p)return{webPage:p};const h=function(e){if(!(e instanceof s.Api.MessageMediaInvoice))return;return function(e){const{description:t,title:n,photo:s,test:i,totalAmount:a,currency:r,receiptMsgId:o}=e,c=d(r);return{text:t,title:n,photoUrl:s&&s.url,receiptMsgId:o,description:`${c}${(Number(a)/100).toFixed(2)} ${i?"TEST INVOICE":""}`}}(e)}(e);return h?{invoice:h}:void 0}function S(e){if(e instanceof s.Api.DocumentEmpty)return;const{id:t,mimeType:n,thumbs:i,size:a,attributes:r}=e,o=r.find(e=>e instanceof s.Api.DocumentAttributeVideo);if(!o)return;const u=r.find(e=>e instanceof s.Api.DocumentAttributeAnimated),{duration:l,w:d,h:f,supportsStreaming:g=!1,roundMessage:p=!1}=o;return{id:String(t),mimeType:n,duration:l,fileName:R(e,"video"),width:d,height:f,supportsStreaming:g,isRound:p,isGif:Boolean(u),thumbnail:Object(c.e)(i),size:a}}function C(e){if(!(e instanceof s.Api.Document))return;const{id:t,size:n,mimeType:i,date:a,thumbs:r}=e,o=r&&Object(c.e)(r);return{id:String(t),size:n,mimeType:i,timestamp:a,fileName:R(e),thumbnail:o}}function k(e,t){const{id:n,answers:s}=e,i=s.map(e=>({text:e.text,option:String.fromCharCode(...e.option)}));return{id:n.toString(),summary:{isPublic:e.publicVoters,...Object(a.b)(e,["closed","multipleChoice","quiz","question","closePeriod","closeDate"]),answers:i},results:M(t)}}function M(e){const{results:t,totalVoters:n,recentVoters:s,solution:i,solutionEntities:a}=e;return{totalVoters:n,recentVoterIds:s,results:t&&t.map(({option:e,chosen:t,correct:n,voters:s})=>({isChosen:t,isCorrect:n,option:String.fromCharCode(...e),votersCount:s})),solution:i,...a&&{solutionEntities:a.map(B)}}}function E(e){if(!(e instanceof s.Api.MessageMediaWebPage&&e.webpage instanceof s.Api.WebPage))return;const{id:t,photo:n,document:i}=e.webpage;return{id:Number(t),...Object(a.b)(e.webpage,["url","displayUrl","siteName","title","description"]),photo:n&&n instanceof s.Api.Photo?{id:String(n.id),thumbnail:Object(c.e)(n.sizes),sizes:n.sizes.filter(e=>e instanceof s.Api.PhotoSize).map(c.b)}:void 0,...i&&{hasDocument:!0}}}function R(e,t="file"){const{mimeType:n,attributes:i}=e,a=i.find(e=>e instanceof s.Api.DocumentAttributeFilename);if(a)return a.fileName;const r=n.split("/")[1];return`${t}${String(e.id)}.${r}`}function O(e,t,n,s,i,a,r,o,c,l){const d=h++,f=i&&function(e){const{filename:t,blobUrl:n,previewBlobUrl:s,mimeType:i,size:a}=e;if(e.quick){const{width:r,height:o,duration:c}=e.quick;return i.startsWith("image/")?{photo:{id:"temp",sizes:[],thumbnail:{width:r,height:o,dataUri:""},blobUrl:n}}:{video:{id:"temp",mimeType:i,duration:c||0,fileName:t,width:r,height:o,blobUrl:n,...s&&{thumbnail:{width:r,height:o,dataUri:s}},size:a}}}if(e.voice){const{duration:t,waveform:n}=e.voice,{data:s}=Object(u.a)(n,63);return{voice:{duration:t,waveform:s}}}return i.startsWith("audio/")?{audio:{mimeType:i,fileName:t,size:a,duration:200}}:{document:{mimeType:i,fileName:t,size:a,...s&&{previewBlobUrl:s}}}}(i),g="chatTypeChannel"===e.type;return{id:d,chatId:e.id,content:{...t&&{text:{text:t,entities:n}},...f,...a&&{sticker:a},...r&&{video:r},...o&&T(o,d)},date:l||Math.round(Date.now()/1e3),isOutgoing:!g,senderId:p,...s&&{replyToMessageId:s},...c&&{groupedId:c,...f&&(f.photo||f.video)&&{isInAlbum:!0}},...l&&{isScheduled:!0}}}function U(e,t){const n=h++,{content:s,chatId:i,id:a,senderId:r,groupedId:o,isInAlbum:c}=t,u=s.audio,l=e.id===p&&(i!==e.id||t.forwardInfo)&&!u;return{id:n,chatId:e.id,content:s,date:Math.round(Date.now()/1e3),isOutgoing:!l&&"chatTypeChannel"!==e.type,senderId:p,sendingState:"messageSendingStatePending",...r!==p&&!u&&{forwardInfo:{isChannelPost:!1,fromChatId:i,fromMessageId:a,senderUserId:r}},groupedId:o,isInAlbum:c}}function T(e,t){return{poll:{id:t.toString(),summary:Object(a.b)(e.summary,["question","answers"]),results:{}}}}function B(e){const{className:t,offset:n,length:s}=e;return{type:t,offset:n,length:s,..."userId"in e&&"number"==typeof e.userId&&{userId:e.userId},..."url"in e&&{url:e.url}}}function D(e,t,n){const{channelId:s,replies:a,maxId:o,readMaxId:c,recentRepliers:u}=e;if(s===i.i)return;return{threadId:t,...n!==s?{chatId:Object(r.k)({channelId:s}),originChannelId:n}:{chatId:n},messagesCount:a,lastMessageId:o,lastReadInboxMessageId:c,...u&&{recentReplierIds:u.map(r.k)}}}},function(e,t,n){"use strict";(function(e){n.d(t,"m",(function(){return y})),n.d(t,"g",(function(){return b})),n.d(t,"e",(function(){return _})),n.d(t,"v",(function(){return v})),n.d(t,"d",(function(){return I})),n.d(t,"s",(function(){return P})),n.d(t,"q",(function(){return C})),n.d(t,"y",(function(){return k})),n.d(t,"b",(function(){return M})),n.d(t,"c",(function(){return E})),n.d(t,"a",(function(){return R})),n.d(t,"o",(function(){return O})),n.d(t,"p",(function(){return U})),n.d(t,"r",(function(){return T})),n.d(t,"u",(function(){return B})),n.d(t,"t",(function(){return D})),n.d(t,"j",(function(){return x})),n.d(t,"w",(function(){return j})),n.d(t,"n",(function(){return N})),n.d(t,"l",(function(){return F})),n.d(t,"k",(function(){return V})),n.d(t,"i",(function(){return L})),n.d(t,"x",(function(){return q})),n.d(t,"f",(function(){return H})),n.d(t,"h",(function(){return K}));var s=n(0),i=n(11),a=n(4),r=n(1),o=n(9),c=n(13),u=n(2),l=n(5),d=n(3),f=n(35),g=n(16),p=n(34),h=n(7);let m;function y(e){m=e}async function b({chat:e,threadId:t,...n}){const a=t===i.MAIN_THREAD_ID?s.Api.messages.GetHistory:s.Api.messages.GetReplies;let l;try{l=await Object(r.g)(new a({peer:Object(u.i)(e.id,e.accessHash),...t!==i.MAIN_THREAD_ID&&{msgId:t},...n}),void 0,!0)}catch(t){"CHANNEL_PRIVATE"===t.message&&m({"@type":"updateChat",id:e.id,chat:{isRestricted:!0}})}if(!l||l instanceof s.Api.messages.MessagesNotModified||!l.messages)return;z(l);const f=l.messages.map(o.b).filter(Boolean),g=l.users.map(c.a).filter(Boolean),p=l.chats.map(e=>Object(d.d)(e)).filter(Boolean),h=f.map(({threadInfo:e})=>e).filter(Boolean);return{messages:f,users:g,chats:p,threadInfos:h}}async function _({chat:e,messageId:t}){const n="channel"===Object(u.s)(e.id),a=await Object(r.g)(n?new s.Api.channels.GetMessages({channel:Object(u.g)(e.id,e.accessHash),id:[new s.Api.InputMessageID({id:t})]}):new s.Api.messages.GetMessages({id:[new s.Api.InputMessageID({id:t})]}));if(!a||a instanceof s.Api.messages.MessagesNotModified)return;const l=a.messages[0];if(!l)return;if(l instanceof s.Api.MessageEmpty)return i.MESSAGE_DELETED;const d=l&&Object(o.b)(l);if(!d)return;l instanceof s.Api.Message&&Object(g.a)(l);return{message:d,users:a.users.map(c.a).filter(Boolean)}}let w=Promise.resolve();function v({chat:e,text:t,entities:n,replyingTo:i,attachment:c,sticker:d,gif:f,poll:g,isSilent:p,scheduledAt:h,groupedId:y,noWebPage:b},_){const v=Object(o.g)(e,t,n,i,c,d,f,g,y,h);m({"@type":v.isScheduled?"newScheduledMessage":"newMessage",id:v.id,chatId:e.id,message:v}),setTimeout(()=>{m({"@type":v.isScheduled?"updateScheduledMessage":"updateMessage",id:v.id,chatId:e.id,message:{sendingState:"messageSendingStatePending"}})},1e3);const I=Object(u.r)();if(l.a.localMessages[I.toString()]=v,y)return function({chat:e,text:t,entities:n,replyingTo:i,attachment:o,groupedId:c,isSilent:l,scheduledAt:d},f,g,p){let h=-1;A[c]||(A[c]={counter:0,singleMediaByIndex:{}});h=A[c].counter++;const m=w;return w=(async()=>{let y;try{y=await S(g,o,p)}catch(e){return a.f&&console.warn(e),A[c].counter--,void await m}const b=await async function(e,t){const n=await Object(r.g)(new s.Api.messages.UploadMedia({peer:e,media:t}));if(n instanceof s.Api.MessageMediaPhoto&&n.photo&&n.photo instanceof s.Api.Photo){const{photo:{id:e,accessHash:t,fileReference:i}}=n;return new s.Api.InputMediaPhoto({id:new s.Api.InputPhoto({id:e,accessHash:t,fileReference:i})})}if(n instanceof s.Api.MessageMediaDocument&&n.document&&n.document instanceof s.Api.Document){const{document:{id:e,accessHash:t,fileReference:i}}=n;return new s.Api.InputMediaDocument({id:new s.Api.InputDocument({id:e,accessHash:t,fileReference:i})})}return}(Object(u.i)(e.id,e.accessHash),y);if(await m,!b)return A[c].counter--,void(a.f&&console.warn("Failed to upload grouped media"));if(A[c].singleMediaByIndex[h]=new s.Api.InputSingleMedia({media:b,randomId:f,message:t||"",entities:n?n.map(u.n):void 0}),Object.keys(A[c].singleMediaByIndex).length{let o;if(c)try{o=await S(v,c,_)}catch(e){return a.f&&console.warn(e),void await P}else d?o=Object(u.h)(d):f?o=Object(u.h)(f):g&&(o=Object(u.j)(g,I));await P;const l=o?s.Api.messages.SendMedia:s.Api.messages.SendMessage;await Object(r.g)(new l({clearDraft:!0,message:t||"",entities:n?n.map(u.n):void 0,peer:Object(u.i)(e.id,e.accessHash),randomId:I,...p&&{silent:p},...h&&{scheduleDate:h},...i&&{replyToMsgId:i},...o&&{media:o},...b&&{noWebpage:b}}),!0)})(),w}const A={};async function I({chat:e,message:t,text:n,entities:i,noWebPage:a}){const o=1e3*t.date>Date.now(),c={content:{...t.content,...n&&{text:{text:n,entities:i}}}};m({"@type":o?"updateScheduledMessage":"updateMessage",id:t.id,chatId:e.id,message:c}),l.a.localMessages[t.id]={...t,...c};const d=i&&i.map(u.n);await Object(r.g)(new s.Api.messages.EditMessage({message:n||"",entities:d,peer:Object(u.i)(e.id,e.accessHash),id:t.id,...o&&{scheduleDate:t.date},...a&&{noWebpage:a}}),!0)}async function P({chat:e,message:t,scheduledAt:n}){await Object(r.g)(new s.Api.messages.EditMessage({peer:Object(u.i)(e.id,e.accessHash),id:t.id,scheduleDate:n}),!0)}async function S(t,n,i){const{filename:a,blobUrl:o,mimeType:c,quick:u,voice:l}=n,d=await Object(f.b)(o,a),g=e=>{i.isCanceled?g.isCanceled=!0:i(e,t.id)},h=await Object(r.i)(d,g),m=[new s.Api.DocumentAttributeFilename({fileName:a})];if(u){if(c.startsWith("image/"))return new s.Api.InputMediaUploadedPhoto({file:h});{const{width:e,height:t,duration:n}=u;void 0!==n&&m.push(new s.Api.DocumentAttributeVideo({duration:n,w:e,h:t}))}}if(l){const{duration:t,waveform:n}=l,{data:i}=Object(p.a)(n,63);m.push(new s.Api.DocumentAttributeAudio({voice:!0,duration:t,waveform:e.from(i)}))}return new s.Api.InputMediaUploadedDocument({file:h,mimeType:c,attributes:m})}async function C({chat:e,messageId:t,isUnpin:n,isOneSide:i,isSilent:a}){await Object(r.g)(new s.Api.messages.UpdatePinnedMessage({peer:Object(u.i)(e.id,e.accessHash),id:t,...n&&{unpin:!0},...i&&{pmOneside:!0},...a&&{silent:!0}}),!0)}async function k({chat:e}){await Object(r.g)(new s.Api.messages.UnpinAllMessages({peer:Object(u.i)(e.id,e.accessHash)}),!0)}async function M({chat:e,messageIds:t,shouldDeleteForAll:n}){const i="channel"===Object(u.s)(e.id);await Object(r.g)(i?new s.Api.channels.DeleteMessages({channel:Object(u.g)(e.id,e.accessHash),id:t}):new s.Api.messages.DeleteMessages({id:t,...n&&{revoke:!0}}))&&m({"@type":"deleteMessages",ids:t,...i&&{chatId:e.id}})}async function E({chat:e,messageIds:t}){await Object(r.g)(new s.Api.messages.DeleteScheduledMessages({peer:Object(u.i)(e.id,e.accessHash),id:t}))&&m({"@type":"deleteScheduledMessages",ids:t,chatId:e.id})}async function R({chat:e,shouldDeleteForAll:t,maxId:n}){const i="channel"===Object(u.s)(e.id);await Object(r.g)(i?new s.Api.channels.DeleteHistory({channel:Object(u.g)(e.id,e.accessHash),maxId:n}):new s.Api.messages.DeleteHistory({peer:Object(u.i)(e.id,e.accessHash),...t&&{revoke:!0},...!t&&{just_clear:!0},maxId:n}))&&m({"@type":"deleteHistory",chatId:e.id})}async function O({chat:e,threadId:t,maxId:n}){const a="channel"===Object(u.s)(e.id);a&&t===i.MAIN_THREAD_ID?await Object(r.g)(new s.Api.channels.ReadHistory({channel:Object(u.g)(e.id,e.accessHash),maxId:n})):a?await Object(r.g)(new s.Api.messages.ReadDiscussion({peer:Object(u.i)(e.id,e.accessHash),msgId:t,readMaxId:n})):await Object(r.g)(new s.Api.messages.ReadHistory({peer:Object(u.i)(e.id,e.accessHash),maxId:n})),t===i.MAIN_THREAD_ID?Object(h.u)(e):T({chat:e,threadId:t})}async function U({chat:e,messageIds:t}){const n="channel"===Object(u.s)(e.id);await Object(r.g)(n?new s.Api.channels.ReadMessageContents({channel:Object(u.g)(e.id,e.accessHash),id:t}):new s.Api.messages.ReadMessageContents({id:t})),m({...n?{"@type":"updateChannelMessages",channelId:e.id}:{"@type":"updateCommonBoxMessages"},ids:t,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}})}async function T({chat:e,threadId:t}){const[n,i]=await Promise.all([Object(r.g)(new s.Api.messages.GetDiscussionMessage({peer:Object(u.i)(e.id,e.accessHash),msgId:t})),Object(r.g)(new s.Api.messages.GetReplies({peer:Object(u.i)(e.id,e.accessHash),msgId:t,offsetId:1,addOffset:-1,limit:1}))]);if(!n||!n.messages.length)return;const a=Object(g.c)(n.messages[0]);if(!a)return;m({"@type":"updateThreadInfo",chatId:a,threadId:t,threadInfo:{topMessageId:n.messages[n.messages.length-1].id,lastReadInboxMessageId:n.readInboxMaxId,messagesCount:i instanceof s.Api.messages.ChannelMessages?i.count:void 0},firstMessageId:i&&"messages"in i&&i.messages.length?i.messages[0].id:void 0});n.chats.map(e=>Object(d.d)(e)).filter(Boolean).forEach(e=>{m({"@type":"updateChat",id:e.id,chat:e,noTopChatsRequest:!0})})}async function B({chatOrUser:e,type:t,query:n,topMessageId:i,minDate:a,maxDate:l,...d}){let f;switch(t){case"media":f=new s.Api.InputMessagesFilterPhotoVideo;break;case"documents":f=new s.Api.InputMessagesFilterDocument;break;case"links":f=new s.Api.InputMessagesFilterUrl;break;case"audio":f=new s.Api.InputMessagesFilterMusic;break;case"voice":f=new s.Api.InputMessagesFilterVoice;break;case"profilePhoto":f=new s.Api.InputMessagesFilterChatPhotos;break;case"text":default:f=new s.Api.InputMessagesFilterEmpty}const g=await Object(r.g)(new s.Api.messages.Search({peer:Object(u.i)(e.id,e.accessHash),filter:f,q:n||"",topMsgId:i,minDate:a,maxDate:l,...d}));if(!g||g instanceof s.Api.messages.MessagesNotModified||!g.messages)return;z(g);const p=g.messages.map(o.b).filter(Boolean),h=g.users.map(c.a).filter(Boolean);let m,y=p.length;return(g instanceof s.Api.messages.MessagesSlice||g instanceof s.Api.messages.ChannelMessages)&&(y=g.count,p.length&&(m=p[p.length-1].id)),{messages:p,users:h,totalCount:y,nextOffsetId:m}}async function D({query:e,offsetRate:t=0,limit:n,type:i="text",minDate:u,maxDate:l}){let f;switch(i){case"media":f=new s.Api.InputMessagesFilterPhotoVideo;break;case"documents":f=new s.Api.InputMessagesFilterDocument;break;case"links":f=new s.Api.InputMessagesFilterUrl;break;case"audio":f=new s.Api.InputMessagesFilterMusic;break;case"voice":f=new s.Api.InputMessagesFilterVoice;break;case"text":default:if(!(e||l&&u))return;f=new s.Api.InputMessagesFilterEmpty}const g=await Object(r.g)(new s.Api.messages.SearchGlobal({q:e,offsetRate:t,offsetPeer:new s.Api.InputPeerEmpty,limit:n,filter:f,folderId:a.a,minDate:u,maxDate:l}));if(!g||g instanceof s.Api.messages.MessagesNotModified||!g.messages)return;z({chats:g.chats,users:g.users,messages:g.messages});const p=g.chats.map(e=>Object(d.d)(e)).filter(Boolean),h=g.users.map(c.a).filter(Boolean),m=g.messages.map(o.b).filter(Boolean);let y,b=m.length;return(g instanceof s.Api.messages.MessagesSlice||g instanceof s.Api.messages.ChannelMessages)&&(b=g.count,m.length&&(y=m[m.length-1].id)),{messages:m,users:h,chats:p,totalCount:b,nextRate:"nextRate"in g&&g.nextRate?g.nextRate:y}}async function x({message:e}){const t=await Object(r.g)(new s.Api.messages.GetWebPagePreview({message:e}));return t&&Object(o.n)(t)}async function j({chat:t,messageId:n,options:i}){const{id:a,accessHash:o}=t;await Object(r.g)(new s.Api.messages.SendVote({peer:Object(u.i)(a,o),msgId:n,options:i.map(t=>e.from(t))}),!0)}async function N({chat:t,messageId:n,option:i,offset:a,limit:o,shouldResetVoters:l}){const{id:d,accessHash:f}=t,g=await Object(r.g)(new s.Api.messages.GetPollVotes({peer:Object(u.i)(d,f),id:n,...i&&{option:e.from(i)},...a&&{offset:a},...o&&{limit:o}}));if(!g)return;z({chats:[],users:g.users,messages:[]});const p=g.users.map(c.a).filter(Boolean),h=g.votes.map(e=>({userId:e.userId,date:e.date}));return{count:g.count,votes:h,users:p,nextOffset:g.nextOffset,shouldResetVoters:l}}async function F({fromChat:e,toChat:t,messages:n}){const i=n.map(({id:e})=>e),a=n.map(u.r);n.forEach((e,n)=>{const s=Object(o.f)(t,e);l.a.localMessages[String(a[n])]=s,m({"@type":"newMessage",id:s.id,chatId:t.id,message:s})}),await Object(r.g)(new s.Api.messages.ForwardMessages({fromPeer:Object(u.i)(e.id,e.accessHash),toPeer:Object(u.i)(t.id,t.accessHash),randomId:a,id:i}),!0)}async function V({chat:e,timestamp:t}){const n=await Object(r.g)(new s.Api.messages.GetHistory({peer:Object(u.i)(e.id,e.accessHash),offsetDate:t,addOffset:-1,limit:1}));if(n&&!(n instanceof s.Api.messages.MessagesNotModified)&&n.messages&&n.messages.length)return n.messages[0].id}async function L({chat:e,hash:t=0}){const{id:n,accessHash:i}=e,a=await Object(r.g)(new s.Api.messages.GetScheduledHistory({peer:Object(u.i)(n,i),hash:t}));if(!a||a instanceof s.Api.messages.MessagesNotModified||!a.messages)return;z(a);const c=a.messages.map(o.b).filter(Boolean);return{messages:c,hash:Object(u.q)(c.map(e=>e.id))}}async function q({chat:e,ids:t}){const{id:n,accessHash:i}=e;await Object(r.g)(new s.Api.messages.SendScheduledMessages({peer:Object(u.i)(n,i),id:t}),!0)}function H({chat:e,message:t}){return Object(r.g)(new s.Api.channels.ExportMessageLink({id:t.id,channel:Object(u.g)(e.id,e.accessHash),...t.isInAlbum&&{grouped:!0},...t.threadInfo&&t.threadInfo.topMessageId!==t.id&&{thread:!0}}))}function z(e){e.users.forEach(e=>{e instanceof s.Api.User&&(l.a.users[e.id]=e)}),e.chats.forEach(e=>{(e instanceof s.Api.Chat||e instanceof s.Api.Channel)&&(l.a.chats[e.id]=e)}),e.messages.forEach(e=>{(e instanceof s.Api.Message&&Object(u.t)(e)||e instanceof s.Api.MessageService&&Object(u.u)(e))&&Object(g.a)(e)})}async function K({chat:e}){const t=await Object(r.g)(new s.Api.messages.Search({peer:Object(u.i)(e.id,e.accessHash),filter:new s.Api.InputMessagesFilterPinned,q:"",limit:a.s}));if(!t||t instanceof s.Api.messages.MessagesNotModified||!t.messages)return;z(t);return{messages:t.messages.map(o.b).filter(Boolean),users:t.users.map(c.a).filter(Boolean),chats:t.chats.map(e=>Object(d.d)(e)).filter(Boolean)}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";var s=n(65);n.o(s,"ApiMediaFormat")&&n.d(t,"ApiMediaFormat",(function(){return s.ApiMediaFormat})),n.o(s,"ApiMessageEntityTypes")&&n.d(t,"ApiMessageEntityTypes",(function(){return s.ApiMessageEntityTypes})),n.o(s,"MAIN_THREAD_ID")&&n.d(t,"MAIN_THREAD_ID",(function(){return s.MAIN_THREAD_ID})),n.o(s,"MESSAGE_DELETED")&&n.d(t,"MESSAGE_DELETED",(function(){return s.MESSAGE_DELETED}));var i=n(66);n.o(i,"ApiMediaFormat")&&n.d(t,"ApiMediaFormat",(function(){return i.ApiMediaFormat})),n.o(i,"ApiMessageEntityTypes")&&n.d(t,"ApiMessageEntityTypes",(function(){return i.ApiMessageEntityTypes})),n.o(i,"MAIN_THREAD_ID")&&n.d(t,"MAIN_THREAD_ID",(function(){return i.MAIN_THREAD_ID})),n.o(i,"MESSAGE_DELETED")&&n.d(t,"MESSAGE_DELETED",(function(){return i.MESSAGE_DELETED}));var a=n(67);n.d(t,"ApiMessageEntityTypes",(function(){return a.a})),n.d(t,"MAIN_THREAD_ID",(function(){return a.b})),n.d(t,"MESSAGE_DELETED",(function(){return a.c}));var r=n(68);n.o(r,"ApiMediaFormat")&&n.d(t,"ApiMediaFormat",(function(){return r.ApiMediaFormat}));var o=n(69);n.d(t,"ApiMediaFormat",(function(){return o.a}));n(70),n(71)},function(e,t,n){"use strict";(function(e){var s=n(73),i=n(74),a=n(75);function r(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return L(e).length;default:if(s)return V(e).length;t=(""+t).toLowerCase(),s=!0}}function h(e,t,n){var s=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(s)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function m(e,t,n){var s=e[t];e[t]=e[n],e[n]=s}function y(e,t,n,s,i){if(0===e.length)return-1;if("string"==typeof n?(s=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,s)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,s,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,s,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,s,i){var a,r=1,o=e.length,c=t.length;if(void 0!==s&&("ucs2"===(s=String(s).toLowerCase())||"ucs-2"===s||"utf16le"===s||"utf-16le"===s)){if(e.length<2||t.length<2)return-1;r=2,o/=2,c/=2,n/=2}function u(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(i){var l=-1;for(a=n;ao&&(n=o-c),a=n;a>=0;a--){for(var d=!0,f=0;fi&&(s=i):s=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");s>a/2&&(s=a/2);for(var r=0;r>8,i=n%256,a.push(i),a.push(s);return a}(t,e.length-n),e,n,s)}function S(e,t,n){return 0===t&&n===e.length?s.fromByteArray(e):s.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var s=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(l=u);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&u)<<6|63&a)>127&&(l=c);break;case 3:a=e[i+1],r=e[i+2],128==(192&a)&&128==(192&r)&&(c=(15&u)<<12|(63&a)<<6|63&r)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:a=e[i+1],r=e[i+2],o=e[i+3],128==(192&a)&&128==(192&r)&&128==(192&o)&&(c=(15&u)<<18|(63&a)<<12|(63&r)<<6|63&o)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,s.push(l>>>10&1023|55296),l=56320|1023&l),s.push(l),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",s=0;for(;s0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,s,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===s&&(s=0),void 0===i&&(i=this.length),t<0||n>e.length||s<0||i>this.length)throw new RangeError("out of range index");if(s>=i&&t>=n)return 0;if(s>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(s>>>=0),r=(n>>>=0)-(t>>>=0),o=Math.min(a,r),u=this.slice(s,i),l=e.slice(t,n),d=0;di)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var a=!1;;)switch(s){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return A(this,e,t,n);case"base64":return I(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),a=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,t,n){var s="";n=Math.min(e.length,n);for(var i=t;is)&&(n=s);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,s,i,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function T(e,t,n,s){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i>>8*(s?i:1-i)}function B(e,t,n,s){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i>>8*(s?i:3-i)&255}function D(e,t,n,s,i,a){if(n+s>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function x(e,t,n,s,a){return a||D(e,0,n,4),i.write(e,t,n,s,23,4),n+4}function j(e,t,n,s,a){return a||D(e,0,n,8),i.write(e,t,n,s,52,8),n+8}c.prototype.slice=function(e,t){var n,s=this.length;if((e=~~e)<0?(e+=s)<0&&(e=0):e>s&&(e=s),(t=void 0===t?s:~~t)<0?(t+=s)<0&&(t=0):t>s&&(t=s),t0&&(i*=256);)s+=this[e+--t]*i;return s},c.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var s=this[e],i=1,a=0;++a=(i*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var s=t,i=1,a=this[e+--s];s>0&&(i*=256);)a+=this[e+--s]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},c.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,s){(e=+e,t|=0,n|=0,s)||U(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+i]=e/a&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,s){if(e=+e,t|=0,!s){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var a=0,r=1,o=0;for(this[t]=255&e;++a>0)-o&255;return t+n},c.prototype.writeIntBE=function(e,t,n,s){if(e=+e,t|=0,!s){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var a=n-1,r=1,o=0;for(this[t+a]=255&e;--a>=0&&(r*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/r>>0)-o&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return x(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return x(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,s){if(n||(n=0),s||0===s||(s=this.length),t>=e.length&&(t=e.length),t||(t=0),s>0&&s=this.length)throw new RangeError("sourceStart out of bounds");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(r+1===s){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function L(e){return s.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,s){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(44))},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return o}));var s=n(0);function i(e){const{about:t,commonChatsCount:n,pinnedMsgId:s,botInfo:i,notifySettings:{silent:r,muteUntil:o}}=e,c=r||"number"==typeof o&&Date.now()<1e3*o;return{...a(e.user),fullInfo:{bio:t,commonChatsCount:n,pinnedMessageId:s,isMuted:c,...i&&{botDescription:i.description}}}}function a(e){if(!(e instanceof s.Api.User))return;const{id:t,firstName:n,lastName:i}=e,a=e.photo instanceof s.Api.UserProfilePhoto?String(e.photo.photoId):void 0;return{id:t,isMin:Boolean(e.min),...e.self&&{isSelf:!0},...e.verified&&{isVerified:!0},...(e.contact||e.mutualContact)&&{isContact:!0},type:r(e),...n&&{firstName:n},...i&&{lastName:i},username:e.username||"",phoneNumber:e.phone||"",status:o(e.status),...e.accessHash&&{accessHash:String(e.accessHash)},...a&&{avatarHash:a}}}function r(e){return e.bot?"userTypeBot":e.deleted?"userTypeDeleted":"userTypeRegular"}function o(e){return!e||e instanceof s.Api.UserStatusEmpty?{type:"userStatusEmpty"}:e instanceof s.Api.UserStatusOnline?{type:"userStatusOnline",expires:e.expires}:e instanceof s.Api.UserStatusOffline?{type:"userStatusOffline",wasOnline:e.wasOnline}:e instanceof s.Api.UserStatusRecently?{type:"userStatusRecently"}:e instanceof s.Api.UserStatusLastWeek?{type:"userStatusLastWeek"}:{type:"userStatusLastMonth"}}},function(e,t,n){"use strict";function s(e,t){return e.reduce((e,n)=>(e[n[t]]=n,e),{})}function i(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function a(e,t){return t.reduce((t,n)=>(e[n]&&(t[n]=e[n]),t),{})}n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a}))},function(e,t,n){(function(e){var s,i=function(e){"use strict";var t=1e7,n=9007199254740992,s=d(n),a="function"==typeof BigInt;function r(e,t,n,s){return void 0===e?r[0]:void 0!==t&&(10!=+t||n)?V(e,t,n,s):K(e)}function o(e,t){this.value=e,this.sign=t,this.isSmall=!1}function c(e){this.value=e,this.sign=e<0,this.isSmall=!0}function u(e){this.value=e}function l(e){return-n0?Math.floor(e):Math.ceil(e)}function m(e,n){var s,i,a=e.length,r=n.length,o=new Array(a),c=0,u=t;for(i=0;i=u?1:0,o[i]=s-c*u;for(;i0&&o.push(c),o}function y(e,t){return e.length>=t.length?m(e,t):m(t,e)}function b(e,n){var s,i,a=e.length,r=new Array(a),o=t;for(i=0;i0;)r[i++]=n%o,n=Math.floor(n/o);return r}function _(e,t){var n,s,i=e.length,a=t.length,r=new Array(i),o=0;for(n=0;n0;)r[i++]=c%o,c=Math.floor(c/o);return r}function I(e,t){for(var n=[];t-- >0;)n.push(0);return n.concat(e)}function P(e,n,s){return new o(e=0;--n)i=(a=1e7*i+e[n])-(s=h(a/t))*t,o[n]=0|s;return[o,0|i]}function k(e,n){var s,i=K(n);if(a)return[new u(e.value/i.value),new u(e.value%i.value)];var l,m=e.value,y=i.value;if(0===y)throw new Error("Cannot divide by zero");if(e.isSmall)return i.isSmall?[new c(h(m/y)),new c(m%y)]:[r[0],e];if(i.isSmall){if(1===y)return[e,r[0]];if(-1==y)return[e.negate(),r[0]];var b=Math.abs(y);if(b=0;i--){for(s=g-1,b[i+d]!==m&&(s=Math.floor((b[i+d]*g+b[i+d-1])/m)),a=0,r=0,c=_.length,o=0;oc&&(i=1e7*(i+1)),n=Math.ceil(i/a);do{if(M(r=A(t,n),l)<=0)break;n--}while(n);u.push(n),l=_(l,r)}return u.reverse(),[f(u),f(l)]}(m,y))[0];var I=e.sign!==i.sign,P=s[1],S=e.sign;return"number"==typeof l?(I&&(l=-l),l=new c(l)):l=new o(l,I),"number"==typeof P?(S&&(P=-P),P=new c(P)):P=new o(P,S),[l,P]}function M(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return e[n]>t[n]?1:-1;return 0}function E(e){var t=e.abs();return!t.isUnit()&&(!!(t.equals(2)||t.equals(3)||t.equals(5))||!(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))&&(!!t.lesser(49)||void 0))}function R(e,t){for(var n,s,a,r=e.prev(),o=r,c=0;o.isEven();)o=o.divide(2),c++;e:for(s=0;s=0?s=_(e,t):(s=_(t,e),n=!n),"number"==typeof(s=f(s))?(n&&(s=-s),new c(s)):new o(s,n)}(n,s,this.sign)},o.prototype.minus=o.prototype.subtract,c.prototype.subtract=function(e){var t=K(e),n=this.value;if(n<0!==t.sign)return this.add(t.negate());var s=t.value;return t.isSmall?new c(n-s):w(s,Math.abs(n),n>=0)},c.prototype.minus=c.prototype.subtract,u.prototype.subtract=function(e){return new u(this.value-K(e).value)},u.prototype.minus=u.prototype.subtract,o.prototype.negate=function(){return new o(this.value,!this.sign)},c.prototype.negate=function(){var e=this.sign,t=new c(-this.value);return t.sign=!e,t},u.prototype.negate=function(){return new u(-this.value)},o.prototype.abs=function(){return new o(this.value,!1)},c.prototype.abs=function(){return new c(Math.abs(this.value))},u.prototype.abs=function(){return new u(this.value>=0?this.value:-this.value)},o.prototype.multiply=function(e){var n,s,i,a=K(e),c=this.value,u=a.value,l=this.sign!==a.sign;if(a.isSmall){if(0===u)return r[0];if(1===u)return this;if(-1===u)return this.negate();if((n=Math.abs(u))0?function e(t,n){var s=Math.max(t.length,n.length);if(s<=30)return v(t,n);s=Math.ceil(s/2);var i=t.slice(s),a=t.slice(0,s),r=n.slice(s),o=n.slice(0,s),c=e(a,o),u=e(i,r),l=e(y(a,i),y(o,r)),d=y(y(c,I(_(_(l,c),u),s)),I(u,2*s));return g(d),d}(c,u):v(c,u),l)},o.prototype.times=o.prototype.multiply,c.prototype._multiplyBySmall=function(e){return l(e.value*this.value)?new c(e.value*this.value):P(Math.abs(e.value),d(Math.abs(this.value)),this.sign!==e.sign)},o.prototype._multiplyBySmall=function(e){return 0===e.value?r[0]:1===e.value?this:-1===e.value?this.negate():P(Math.abs(e.value),this.value,this.sign!==e.sign)},c.prototype.multiply=function(e){return K(e)._multiplyBySmall(this)},c.prototype.times=c.prototype.multiply,u.prototype.multiply=function(e){return new u(this.value*K(e).value)},u.prototype.times=u.prototype.multiply,o.prototype.square=function(){return new o(S(this.value),!1)},c.prototype.square=function(){var e=this.value*this.value;return l(e)?new c(e):new o(S(d(Math.abs(this.value))),!1)},u.prototype.square=function(e){return new u(this.value*this.value)},o.prototype.divmod=function(e){var t=k(this,e);return{quotient:t[0],remainder:t[1]}},u.prototype.divmod=c.prototype.divmod=o.prototype.divmod,o.prototype.divide=function(e){return k(this,e)[0]},u.prototype.over=u.prototype.divide=function(e){return new u(this.value/K(e).value)},c.prototype.over=c.prototype.divide=o.prototype.over=o.prototype.divide,o.prototype.mod=function(e){return k(this,e)[1]},u.prototype.mod=u.prototype.remainder=function(e){return new u(this.value%K(e).value)},c.prototype.remainder=c.prototype.mod=o.prototype.remainder=o.prototype.mod,o.prototype.pow=function(e){var t,n,s,i=K(e),a=this.value,o=i.value;if(0===o)return r[1];if(0===a)return r[0];if(1===a)return r[1];if(-1===a)return i.isEven()?r[1]:r[-1];if(i.sign)return r[0];if(!i.isSmall)throw new Error("The exponent "+i.toString()+" is too large.");if(this.isSmall&&l(t=Math.pow(a,o)))return new c(h(t));for(n=this,s=r[1];!0&o&&(s=s.times(n),--o),0!==o;)o/=2,n=n.square();return s},c.prototype.pow=o.prototype.pow,u.prototype.pow=function(e){var t=K(e),n=this.value,s=t.value,i=BigInt(0),a=BigInt(1),o=BigInt(2);if(s===i)return r[1];if(n===i)return r[0];if(n===a)return r[1];if(n===BigInt(-1))return t.isEven()?r[1]:r[-1];if(t.isNegative())return new u(i);for(var c=this,l=r[1];(s&a)===a&&(l=l.times(c),--s),s!==i;)s/=o,c=c.square();return l},o.prototype.modPow=function(e,t){if(e=K(e),(t=K(t)).isZero())throw new Error("Cannot take modPow with modulus 0");var n=r[1],s=this.mod(t);for(e.isNegative()&&(e=e.multiply(r[-1]),s=s.modInv(t));e.isPositive();){if(s.isZero())return r[0];e.isOdd()&&(n=n.multiply(s).mod(t)),e=e.divide(2),s=s.square().mod(t)}return n},u.prototype.modPow=c.prototype.modPow=o.prototype.modPow,o.prototype.compareAbs=function(e){var t=K(e),n=this.value,s=t.value;return t.isSmall?1:M(n,s)},c.prototype.compareAbs=function(e){var t=K(e),n=Math.abs(this.value),s=t.value;return t.isSmall?n===(s=Math.abs(s))?0:n>s?1:-1:-1},u.prototype.compareAbs=function(e){var t=this.value,n=K(e).value;return(t=t>=0?t:-t)===(n=n>=0?n:-n)?0:t>n?1:-1},o.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=K(e),n=this.value,s=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:M(n,s)*(this.sign?-1:1)},o.prototype.compareTo=o.prototype.compare,c.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=K(e),n=this.value,s=t.value;return t.isSmall?n==s?0:n>s?1:-1:n<0!==t.sign?n<0?-1:1:n<0?1:-1},c.prototype.compareTo=c.prototype.compare,u.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=this.value,n=K(e).value;return t===n?0:t>n?1:-1},u.prototype.compareTo=u.prototype.compare,o.prototype.equals=function(e){return 0===this.compare(e)},u.prototype.eq=u.prototype.equals=c.prototype.eq=c.prototype.equals=o.prototype.eq=o.prototype.equals,o.prototype.notEquals=function(e){return 0!==this.compare(e)},u.prototype.neq=u.prototype.notEquals=c.prototype.neq=c.prototype.notEquals=o.prototype.neq=o.prototype.notEquals,o.prototype.greater=function(e){return this.compare(e)>0},u.prototype.gt=u.prototype.greater=c.prototype.gt=c.prototype.greater=o.prototype.gt=o.prototype.greater,o.prototype.lesser=function(e){return this.compare(e)<0},u.prototype.lt=u.prototype.lesser=c.prototype.lt=c.prototype.lesser=o.prototype.lt=o.prototype.lesser,o.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},u.prototype.geq=u.prototype.greaterOrEquals=c.prototype.geq=c.prototype.greaterOrEquals=o.prototype.geq=o.prototype.greaterOrEquals,o.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},u.prototype.leq=u.prototype.lesserOrEquals=c.prototype.leq=c.prototype.lesserOrEquals=o.prototype.leq=o.prototype.lesserOrEquals,o.prototype.isEven=function(){return 0==(1&this.value[0])},c.prototype.isEven=function(){return 0==(1&this.value)},u.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},o.prototype.isOdd=function(){return 1==(1&this.value[0])},c.prototype.isOdd=function(){return 1==(1&this.value)},u.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},o.prototype.isPositive=function(){return!this.sign},c.prototype.isPositive=function(){return this.value>0},u.prototype.isPositive=c.prototype.isPositive,o.prototype.isNegative=function(){return this.sign},c.prototype.isNegative=function(){return this.value<0},u.prototype.isNegative=c.prototype.isNegative,o.prototype.isUnit=function(){return!1},c.prototype.isUnit=function(){return 1===Math.abs(this.value)},u.prototype.isUnit=function(){return this.abs().value===BigInt(1)},o.prototype.isZero=function(){return!1},c.prototype.isZero=function(){return 0===this.value},u.prototype.isZero=function(){return this.value===BigInt(0)},o.prototype.isDivisibleBy=function(e){var t=K(e);return!t.isZero()&&(!!t.isUnit()||(0===t.compareAbs(2)?this.isEven():this.mod(t).isZero()))},u.prototype.isDivisibleBy=c.prototype.isDivisibleBy=o.prototype.isDivisibleBy,o.prototype.isPrime=function(e){var t=E(this);if(void 0!==t)return t;var n=this.abs(),s=n.bitLength();if(s<=64)return R(n,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var a=Math.log(2)*s.toJSNumber(),r=Math.ceil(!0===e?2*Math.pow(a,2):a),o=[],c=0;c-n?new c(e-1):new o(s,!0)},u.prototype.prev=function(){return new u(this.value-BigInt(1))};for(var O=[1];2*O[O.length-1]<=t;)O.push(2*O[O.length-1]);var U=O.length,T=O[U-1];function B(e){return Math.abs(e)<=t}function D(e,t,n){t=K(t);for(var s=e.isNegative(),a=t.isNegative(),r=s?e.not():e,o=a?t.not():t,c=0,u=0,l=null,d=null,f=[];!r.isZero()||!o.isZero();)c=(l=k(r,T))[1].toJSNumber(),s&&(c=T-1-c),u=(d=k(o,T))[1].toJSNumber(),a&&(u=T-1-u),r=l[0],o=d[0],f.push(n(c,u));for(var g=0!==n(s?1:0,a?1:0)?i(-1):i(0),p=f.length-1;p>=0;p-=1)g=g.multiply(T).add(i(f[p]));return g}o.prototype.shiftLeft=function(e){var t=K(e).toJSNumber();if(!B(t))throw new Error(String(t)+" is too large for shifting.");if(t<0)return this.shiftRight(-t);var n=this;if(n.isZero())return n;for(;t>=U;)n=n.multiply(T),t-=U-1;return n.multiply(O[t])},u.prototype.shiftLeft=function(e){return e=K(e),new u(this.value<=U;){if(s.isZero()||s.isNegative()&&s.isUnit())return s;s=(t=k(s,T))[1].isNegative()?t[0].prev():t[0],n-=U-1}return(t=k(s,O[n]))[1].isNegative()?t[0].prev():t[0]},u.prototype.shiftRight=function(e){return e=K(e),new u(this.value>>e.value)},c.prototype.shiftRight=o.prototype.shiftRight,o.prototype.not=function(){return this.negate().prev()},u.prototype.not=c.prototype.not=o.prototype.not,o.prototype.and=function(e){return D(this,e,(function(e,t){return e&t}))},u.prototype.and=c.prototype.and=o.prototype.and,o.prototype.or=function(e){return D(this,e,(function(e,t){return e|t}))},u.prototype.or=c.prototype.or=o.prototype.or,o.prototype.xor=function(e){return D(this,e,(function(e,t){return e^t}))},u.prototype.xor=c.prototype.xor=o.prototype.xor;function x(e){var n=e.value,s="number"==typeof n?n|1<<30:"bigint"==typeof n?n|BigInt(1<<30):n[0]+n[1]*t|1073758208;return s&-s}function j(e,t){return e=K(e),t=K(t),e.greater(t)?e:t}function N(e,t){return e=K(e),t=K(t),e.lesser(t)?e:t}function F(e,t){if(e=K(e).abs(),t=K(t).abs(),e.equals(t))return e;if(e.isZero())return t;if(t.isZero())return e;for(var n,s,i=r[1];e.isEven()&&t.isEven();)n=N(x(e),x(t)),e=e.divide(n),t=t.divide(n),i=i.multiply(n);for(;e.isEven();)e=e.divide(x(e));do{for(;t.isEven();)t=t.divide(x(t));e.greater(t)&&(s=t,t=e,e=s),t=t.subtract(e)}while(!t.isZero());return i.isUnit()?e:e.multiply(i)}o.prototype.bitLength=function(){var e=this;return e.compareTo(i(0))<0&&(e=e.negate().subtract(i(1))),0===e.compareTo(i(0))?i(0):i(function e(t,n){if(n.compareTo(t)<=0){var s=e(t,n.square(n)),a=s.p,r=s.e,o=a.multiply(n);return o.compareTo(t)<=0?{p:o,e:2*r+1}:{p:a,e:2*r}}return{p:i(1),e:0}}(e,i(2)).e).add(i(1))},u.prototype.bitLength=c.prototype.bitLength=o.prototype.bitLength;var V=function(e,t,n,s){n=n||"0123456789abcdefghijklmnopqrstuvwxyz",e=String(e),s||(e=e.toLowerCase(),n=n.toLowerCase());var i,a=e.length,r=Math.abs(t),o={};for(i=0;i=r)){if("1"===l&&1===r)continue;throw new Error(l+" is not a valid digit in base "+t+".")}}t=K(t);var c=[],u="-"===e[0];for(i=u?1:0;i"!==e[i]&&i=0;s--)i=i.add(e[s].times(a)),a=a.times(t);return n?i.negate():i}function q(e,t){if((t=i(t)).isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var n=Array.apply(null,Array(e.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return n.unshift([1]),{value:[].concat.apply([],n),isNegative:!1}}var s=!1;if(e.isNegative()&&t.isPositive()&&(s=!0,e=e.abs()),t.isUnit())return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(e.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:s};for(var a,r=[],o=e;o.isNegative()||o.compareAbs(t)>=0;){a=o.divmod(t),o=a.quotient;var c=a.remainder;c.isNegative()&&(c=t.minus(c).abs(),o=o.next()),r.push(c.toJSNumber())}return r.push(o.toJSNumber()),{value:r.reverse(),isNegative:s}}function H(e,t,n){var s=q(e,t);return(s.isNegative?"-":"")+s.value.map((function(e){return function(e,t){return e<(t=t||"0123456789abcdefghijklmnopqrstuvwxyz").length?t[e]:"<"+e+">"}(e,n)})).join("")}function z(e){if(l(+e)){var t=+e;if(t===h(t))return a?new u(BigInt(t)):new c(t);throw new Error("Invalid integer: "+e)}var n="-"===e[0];n&&(e=e.slice(1));var s=e.split(/e/i);if(s.length>2)throw new Error("Invalid integer: "+s.join("e"));if(2===s.length){var i=s[1];if("+"===i[0]&&(i=i.slice(1)),(i=+i)!==h(i)||!l(i))throw new Error("Invalid integer: "+i+" is not a valid exponent.");var r=s[0],d=r.indexOf(".");if(d>=0&&(i-=r.length-d-1,r=r.slice(0,d)+r.slice(d+1)),i<0)throw new Error("Cannot include negative exponent part for integers");e=r+=new Array(i+1).join("0")}if(!/^([0-9][0-9]*)$/.test(e))throw new Error("Invalid integer: "+e);if(a)return new u(BigInt(n?"-"+e:e));for(var f=[],p=e.length,m=p-7;p>0;)f.push(+e.slice(m,p)),(m-=7)<0&&(m=0),p-=7;return g(f),new o(f,n)}function K(e){return"number"==typeof e?function(e){if(a)return new u(BigInt(e));if(l(e)){if(e!==h(e))throw new Error(e+" is not an integer.");return new c(e)}return z(e.toString())}(e):"string"==typeof e?z(e):"bigint"==typeof e?new u(e):e}o.prototype.toArray=function(e){return q(this,e)},c.prototype.toArray=function(e){return q(this,e)},u.prototype.toArray=function(e){return q(this,e)},o.prototype.toString=function(e,t){if(void 0===e&&(e=10),10!==e)return H(this,e,t);for(var n,s=this.value,i=s.length,a=String(s[--i]);--i>=0;)n=String(s[i]),a+="0000000".slice(n.length)+n;return(this.sign?"-":"")+a},c.prototype.toString=function(e,t){return void 0===e&&(e=10),10!=e?H(this,e,t):String(this.value)},u.prototype.toString=c.prototype.toString,u.prototype.toJSON=o.prototype.toJSON=c.prototype.toJSON=function(){return this.toString()},o.prototype.valueOf=function(){return parseInt(this.toString(),10)},o.prototype.toJSNumber=o.prototype.valueOf,c.prototype.valueOf=function(){return this.value},c.prototype.toJSNumber=c.prototype.valueOf,u.prototype.valueOf=u.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var G=0;G<1e3;G++)r[G]=K(G),G>0&&(r[-G]=K(-G));return r.one=r[1],r.zero=r[0],r.minusOne=r[-1],r.max=j,r.min=N,r.gcd=F,r.lcm=function(e,t){return e=K(e).abs(),t=K(t).abs(),e.divide(F(e,t)).multiply(t)},r.isInstance=function(e){return e instanceof o||e instanceof c||e instanceof u},r.randBetween=function(e,n,s){e=K(e),n=K(n);var i=s||Math.random,a=N(e,n),o=j(e,n).subtract(a).add(1);if(o.isSmall)return a.add(Math.floor(i()*o));for(var c=q(o,t).value,u=[],l=!0,d=0;d{r.resolve=e,r.reject=t})}function l(e=!1){return o({...y("authorizationStateWaitCode"),isCodeViaApp:e}),new Promise((e,t)=>{r.resolve=e,r.reject=t})}function d(e){return o({...y("authorizationStateWaitPassword"),hint:e}),new Promise(e=>{r.resolve=e})}function f(){return o(y("authorizationStateWaitRegistration")),new Promise(e=>{r.resolve=e})}function g(e){return o({...y("authorizationStateWaitQrCode"),qrCode:{token:btoa(String.fromCharCode(...e.token)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),expires:e.expires}}),new Promise((e,t)=>{r.reject=t})}function p(e){let t;if(e instanceof s.errors.FloodWaitError){const n=Math.ceil(Number(e.seconds)/60/60);t="Too many attempts. Try again in "+(n>1?n+" hours":"an hour")}else t=a[e.message];t||(t="Unexpected Error",i.f&&console.error(e)),o({"@type":"updateAuthorizationError",message:t})}function h(e){o({...y("authorizationStateReady"),sessionId:e})}function m(e){o({"@type":"updateCurrentUser",currentUser:e})}function y(e){return{"@type":"updateAuthorizationState",authorizationState:e}}function b(e){r.resolve&&r.resolve(e)}function _(e){r.resolve&&r.resolve(e)}function w(e){r.resolve&&r.resolve(e)}function v(e){const{firstName:t,lastName:n}=e;r.resolve&&r.resolve([t,n])}function A(){r.reject&&r.reject(new Error("RESTART_AUTH"))}function I(){r.reject&&r.reject(new Error("RESTART_AUTH_WITH_QR"))}},function(e,t,n){"use strict";function s(e,t=!1,n="image/jpeg"){return`${t?"":`data:${n};base64,`}${btoa(String.fromCharCode(...e))}`}function i(e){if(!e)return;const{flags:t,CONSTRUCTOR_ID:n,SUBCLASS_OF_ID:s,className:i,classType:a,...r}=e;return r}n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}))},function(e,t,n){"use strict";n.d(t,"e",(function(){return c})),n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return l})),n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return f}));var s=n(0),i=n(21),a=n(18);function r(e,t,n){return''.replace("{{path}}",function(e){let t="M";const n=e.length;for(let s=0;s=192?t+="AACAAAAHAAALMAAAQASTAVAAAZaacaaaahaaalmaaaqastava.az0123456789-,"[n-128-64]:(n>=128?t+=",":n>=64&&(t+="-"),t+=String(63&n))}return t+="z",t}(e)).replace("{{width}}",String(t)).replace("{{height}}",String(n))}const o={w:100,h:100};function c(e,t){if(!e||!e.length)return;const n=e.find(e=>e instanceof s.Api.PhotoStrippedSize);if(!n)return;const r=e.filter(e=>e instanceof s.Api.PhotoSize),{w:c,h:u}=r&&r.length?r[r.length-1]:o,{bytes:l}=n;return{dataUri:Object(a.a)(t&&"image/jpeg"!==t?l:Object(i.strippedPhotoToJpg)(l),void 0,t),width:c,height:u}}function u(e){const{w:t,h:n,bytes:s}=e;return{dataUri:Object(a.a)(s,void 0,"image/webp"),width:t,height:n}}function l(e,t){const{w:n,h:s}=t;return{dataUri:"data:image/svg+xml;utf8,"+r(e.bytes,n,s),width:n,height:s}}function d(e){const t=e.sizes.filter(e=>e instanceof s.Api.PhotoSize).map(f);return{id:String(e.id),thumbnail:c(e.sizes),sizes:t}}function f(e){const{w:t,h:n,type:s}=e;return{width:t,height:n,type:s}}},function(e,t,n){const s=n(6),{serializeBytes:i,serializeDate:a}=n(45);e.exports={constructors:s,requests:s,patched:null,serializeBytes:i,serializeDate:a}},function(e,t,n){(function(t){const{constructors:s}=n(20),i=(new RegExp("@|(?:https?:\\/\\/)?(?:www\\.)?(?:telegram\\.(?:me|dog)|t\\.me)\\/(@|joinchat\\/)?"),t.from("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00","hex")),a=t.from("ffd9","hex");new RegExp("tg:\\/\\/(join)\\?invite="),new RegExp("^([a-z]((?!__)[\\w\\d]){3,30}[a-z\\d]|gif|vid|pic|bing|wiki|imdb|bold|vote|like|coub)$");function r(e,t){throw new Error(`Cannot cast ${e.className} to any kind of ${t}`)}e.exports={getMessageId:function(e){if(null==e)return null;if("number"==typeof e)return e;if(2030045667===e.SUBCLASS_OF_ID)return e.id;throw new Error("Invalid message type: "+e.constructor.name)},getInputPeer:function e(t,n=!0,i=!0){if(void 0===t.SUBCLASS_OF_ID){if(n&&"inputEntity"in t)return t.inputEntity;if("entity"in t)return e(t.entity);r(t,"InputPeer")}if(3374092470===t.SUBCLASS_OF_ID)return t;if(t instanceof s.User){if(t.isSelf&&n)return new s.InputPeerSelf;if(void 0===t.accessHash&&i)throw new Error("User without accessHash or min info cannot be input");return new s.InputPeerUser({userId:t.id,accessHash:t.accessHash})}if(t instanceof s.Chat||t instanceof s.ChatEmpty||t instanceof s.ChatForbidden)return new s.InputPeerChat({chatId:t.id});if(t instanceof s.Channel){if(void 0===t.accessHash&&i)throw new TypeError("Channel without accessHash or min info cannot be input");return new s.InputPeerChannel({channelId:t.id,accessHash:t.accessHash})}return t instanceof s.ChannelForbidden?new s.InputPeerChannel({channelId:t.id,accessHash:t.accessHash}):t instanceof s.InputUser?new s.InputPeerUser({userId:t.userId,accessHash:t.accessHash}):t instanceof s.InputChannel?new s.InputPeerChannel({channelId:t.channelId,accessHash:t.accessHash}):t instanceof s.UserEmpty?new s.InputPeerEmpty:t instanceof s.UserFull?e(t.user):t instanceof s.ChatFull?new s.InputPeerChat({chatId:t.id}):t instanceof s.PeerChat?new s.InputPeerChat(t.chatId):void r(t,"InputPeer")},getDisplayName:function(e){return e instanceof s.User?e.lastName&&e.firstName?`${e.firstName} ${e.lastName}`:e.firstName?e.firstName:e.lastName?e.lastName:"":e instanceof s.Chat||e instanceof s.Channel?e.title:""},getAppropriatedPartSize:function(e){if(e<=104857600)return 128;if(e<=786432e3)return 256;if(e<=1572864e3)return 512;throw new Error("File size too large")},strippedPhotoToJpg:function(e){if(e.length<3||1!==e[0])return e;const n=t.from(i);return n[164]=e[1],n[166]=e[2],t.concat([n,e.slice(3),a])},getDC:function(e,t=!1){switch(e){case 1:return{id:1,ipAddress:"pluto.web.telegram.org",port:443};case 2:return{id:2,ipAddress:"venus.web.telegram.org",port:443};case 3:return{id:3,ipAddress:"aurora.web.telegram.org",port:443};case 4:return{id:4,ipAddress:"vesta.web.telegram.org",port:443};case 5:return{id:5,ipAddress:"flora.web.telegram.org",port:443};default:throw new Error("Cannot find the DC with the ID of "+e)}}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return u}));var s=n(0),i=n(4),a=n(19),r=n(5);function o(e){if(e instanceof s.Api.DocumentEmpty)return;const t=e.attributes.find(e=>e instanceof s.Api.DocumentAttributeSticker);if(!t)return;const n=e.attributes.find(e=>e instanceof s.Api.DocumentAttributeImageSize),r=t.stickerset,o=t.alt,c="application/x-tgsticker"===e.mimeType,u=e.thumbs&&e.thumbs.find(e=>e instanceof s.Api.PhotoCachedSize),l=e.thumbs&&e.thumbs.find(e=>e instanceof s.Api.PhotoPathSize),d=u?Object(a.c)(u):l&&n?Object(a.d)(l,n):void 0,{w:f,h:g}=u||n||{};return{id:String(e.id),stickerSetId:r.id?String(r.id):i.r,stickerSetAccessHash:String(r.accessHash),emoji:o,isAnimated:c,width:f,height:g,thumbnail:d}}function c(e){const{archived:t,animated:n,installedDate:s,id:i,accessHash:a,title:r,thumb:o,count:c,hash:u}=e;return{archived:t,isAnimated:n,installedDate:s,id:String(i),accessHash:String(a),title:r,hasThumbnail:Boolean(o),count:c,hash:u}}function u(e){const t=c(e.set),n=e instanceof s.Api.StickerSetMultiCovered?e.covers:[e.cover];return t.covers=[],n.forEach(e=>{if(e instanceof s.Api.Document){const n=o(e);n&&(t.covers.push(n),r.a.documents[String(e.id)]=e)}}),t}},function(e,t){class n extends Error{constructor(){super("The read operation was cancelled.")}}class s extends Error{constructor(e,t){super(`Could not find a matching Constructor ID for the TLObject that was supposed to be\n read with ID ${e}. Most likely, a TLObject was trying to be read when\n it should not be read. Remaining bytes: ${t.length}`),"undefined"!=typeof alert&&alert("Missing MTProto Entity: Please, make sure to add TL definition for ID "+e),this.invalidConstructorId=e,this.remaining=t}}class i extends Error{constructor(e,t){super(`Invalid checksum (${e} when ${t} was expected). This packet should be skipped.`),this.checksum=e,this.validChecksum=t}}class a extends Error{constructor(e){let t=null;4===e.length?(t=-e.readInt32LE(0),super(`Invalid response buffer (HTTP code ${t})`)):super(`Invalid response buffer (too short ${e})`),this.code=t,this.payload=e}}class r extends Error{constructor(...e){e.length||(e=["A security check failed."]),super(...e)}}class o extends Error{constructor(e,t){let n=o.ErrorMessages[t]||`Unknown error code (this should not happen): ${t}.`;n+=" Caused by "+e.className,super(n),this.message=n,this.code=t}}var c,u,l;l={16:"msg_id too low (most likely, client time is wrong it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the “correct” msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted).",17:"msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id).",18:"Incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4).",19:"Container msg_id is the same as msg_id of a previously received message (this must never happen).",20:"Message too old, and it cannot be verified whether the server has received a message with this msg_id or not.",32:"msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno).",33:"msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno).",34:"An even msg_seqno expected (irrelevant message), but odd received.",35:"Odd msg_seqno expected (relevant message), but even received.",48:"Incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it).",64:"Invalid container."},(u="ErrorMessages")in(c=o)?Object.defineProperty(c,u,{value:l,enumerable:!0,configurable:!0,writable:!0}):c[u]=l,e.exports={ReadCancelledError:n,TypeNotFoundError:s,InvalidChecksumError:i,InvalidBufferError:a,SecurityError:r,CdnFileTamperedError:class extends r{constructor(){super("The CDN file has been altered and its download cancelled.")}},BadMessageError:o}},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return c})),n.d(t,"d",(function(){return u}));var s=n(0),i=n(9),a=n(14);function r(e){if(e instanceof s.Api.WallPaperNoFile)return;const{slug:t}=e,n=Object(i.a)(e.document);return n?{slug:t,document:n}:void 0}function o(e){return{isCurrent:Boolean(e.current),isOfficialApp:Boolean(e.officialApp),isPasswordPending:Boolean(e.passwordPending),hash:String(e.hash),...Object(a.b)(e,["deviceModel","platform","systemVersion","appName","appVersion","dateCreated","dateActive","ip","country","region"])}}function c(e){switch(e.className){case"PrivacyKeyPhoneNumber":return"phoneNumber";case"PrivacyKeyStatusTimestamp":return"lastSeen";case"PrivacyKeyProfilePhoto":return"profilePhoto";case"PrivacyKeyForwards":return"forwards";case"PrivacyKeyChatInvite":return"chatInvite"}}function u(e){let t,n,i,a,r;return e.forEach(e=>{e instanceof s.Api.PrivacyValueAllowAll?t=t||"everybody":e instanceof s.Api.PrivacyValueAllowContacts?t=t||"contacts":e instanceof s.Api.PrivacyValueDisallowContacts?t=t||"nonContacts":e instanceof s.Api.PrivacyValueDisallowAll?t=t||"nobody":e instanceof s.Api.PrivacyValueAllowUsers?n=e.users:e instanceof s.Api.PrivacyValueDisallowUsers?a=e.users:e instanceof s.Api.PrivacyValueAllowChatParticipants?i=e.chats.map(e=>-e):e instanceof s.Api.PrivacyValueDisallowChatParticipants&&(r=e.chats.map(e=>-e))}),t||(t="nobody"),{visibility:t,allowUserIds:n||[],allowChatIds:i||[],blockUserIds:a||[],blockChatIds:r||[]}}},function(e,t,n){const{TypeNotFoundError:s}=n(23),{coreObjects:i}=n(51),{tlobjects:a}=n(53),{readBigIntFromBuffer:r}=n(8);e.exports=class{constructor(e){this.stream=e,this._last=null,this.offset=0}readByte(){return this.read(1)[0]}readInt(e=!0){let t;return t=e?this.stream.readInt32LE(this.offset):this.stream.readUInt32LE(this.offset),this.offset+=4,t}readLong(e=!0){return this.readLargeInt(64,e)}readFloat(){return this.read(4).readFloatLE(0)}readDouble(){return this.read(8).readDoubleLE(0)}readLargeInt(e,t=!0){const n=this.read(Math.floor(e/8));return r(n,!0,t)}read(e=-1){-1===e&&(e=this.stream.length-this.offset);const t=this.stream.slice(this.offset,this.offset+e);if(this.offset+=e,t.length!==e)throw Error(`No more data left to read (need ${e}, got ${t.length}: ${t}); last read ${this._last}`);return this._last=t,t}getBuffer(){return this.stream}tgReadBytes(){const e=this.readByte();let t,n;254===e?(n=this.readByte()|this.readByte()<<8|this.readByte()<<16,t=n%4):(n=e,t=(n+1)%4);const s=this.read(n);return t>0&&(t=4-t,this.read(t)),s}tgReadString(){return this.tgReadBytes().toString("utf-8")}tgReadBool(){const e=this.readInt(!1);if(2574415285===e)return!0;if(3162085175===e)return!1;throw new Error("Invalid boolean code "+e.toString("16"))}tgReadDate(){const e=this.readInt();return new Date(1e3*e)}tgReadObject(){const e=this.readInt(!1);let t=a[e];if(void 0===t){if(2574415285===e)return!0;if(3162085175===e)return!1;if(481674261===e){const e=[],t=this.readInt();for(let n=0;ne instanceof s.Api.User).map(o.a).forEach(e=>{e&&h({"@type":"updateUser",id:e.id,user:e})}),n.filter(e=>e instanceof s.Api.Chat||e instanceof s.Api.Channel).map(e=>Object(r.d)(e)).forEach(e=>{e&&h({"@type":"updateChat",id:e.id,chat:e})})),e instanceof s.Api.UpdateNewScheduledMessage?h({"@type":y.has(t.id)?"updateScheduledMessage":"newScheduledMessage",id:t.id,chatId:t.chatId,message:t}):h({"@type":y.has(t.id)?"updateMessage":"newMessage",id:t.id,chatId:t.chatId,message:t}),e.message instanceof s.Api.MessageService){const{action:n}=e.message;if(n instanceof s.Api.MessageActionChatEditTitle)h({"@type":"updateChat",id:t.chatId,chat:{title:n.title}});else if(n instanceof s.Api.MessageActionChatEditPhoto){const i=Object(c.c)(n.photo),a=Object(r.e)(i),o=Math.abs(Object(f.c)(e.message));u.a.chats[o]&&(u.a.chats[o].photo=i),Object(f.b)(n.photo),a&&h({"@type":"updateChat",id:t.chatId,chat:{avatarHash:a},...n.photo instanceof s.Api.Photo&&{newProfilePhoto:Object(p.a)(n.photo)}})}else if(n instanceof s.Api.MessageActionChatDeletePhoto){const n=Math.abs(Object(f.c)(e.message));u.a.chats[n]&&(u.a.chats[n].photo=new s.Api.ChatPhotoEmpty),h({"@type":"updateChat",id:t.chatId,chat:{avatarHash:void 0}})}else n instanceof s.Api.MessageActionChatDeleteUser?e._entities&&e._entities.some(e=>e instanceof s.Api.User&&!!e.self&&e.id===n.userId)&&h({"@type":"updateChatLeave",id:t.chatId}):n instanceof s.Api.MessageActionChatAddUser&&e._entities&&e._entities.some(e=>e instanceof s.Api.User&&!!e.self&&n.users.includes(e.id))&&h({"@type":"updateChatJoin",id:t.chatId})}}else if(e instanceof s.Api.UpdateEditMessage||e instanceof s.Api.UpdateEditChannelMessage){if(e.message instanceof s.Api.MessageEmpty)return void(d.f&&console.error("Unexpected update:",e.className,e));e.message instanceof s.Api.Message&&Object(c.t)(e.message)&&Object(f.a)(e.message);const t=Object(a.b)(e.message);h({"@type":"updateMessage",id:t.id,chatId:t.chatId,message:t})}else if(e instanceof s.Api.UpdateDeleteMessages)h({"@type":"deleteMessages",ids:e.messages});else if(e instanceof s.Api.UpdateDeleteScheduledMessages)h({"@type":"deleteScheduledMessages",ids:e.messages,chatId:Object(r.j)(e.peer)});else if(e instanceof s.Api.UpdateDeleteChannelMessages){const t=Object(r.k)({channelId:e.channelId}),n=e.messages,i=n.filter(e=>u.a.messages[`${t}-${e}`]),a=n.filter(e=>!u.a.messages[`${t}-${e}`]),o=n.map(e=>{const n=u.a.messages[`${t}-${e}`];return n&&n instanceof s.Api.MessageService&&"photo"in n.action?String(n.action.photo.id):void 0}).filter(Boolean);i.length&&h({"@type":"deleteMessages",ids:i,chatId:t}),o.length&&h({"@type":"deleteProfilePhotos",ids:o,chatId:t}),a.length&&setTimeout(()=>{h({"@type":"deleteMessages",ids:a,chatId:t})},1e3)}else if((t instanceof s.Api.messages.SendMessage||t instanceof s.Api.messages.SendMedia||t instanceof s.Api.messages.SendMultiMedia||t instanceof s.Api.messages.ForwardMessages)&&(e instanceof s.Api.UpdateMessageID||e instanceof s.Api.UpdateShortSentMessage)){let n;"randomId"in e?n=e.randomId:"randomId"in t&&(n=t.randomId);const i=n&&u.a.localMessages[n.toString()];if(!i)throw new Error("Local message not found");let r;if(e instanceof s.Api.UpdateShortSentMessage){i.content.text&&e.entities&&(r={text:Object(a.j)(i.content.text.text,e.entities)}),e.media&&(r={...r,...Object(a.i)(e.media)});const t=Object(c.m)(e.id,i.chatId,e);Object(c.t)(t)&&Object(f.a)(t)}y.add(e.id);const o="date"in e&&1e3*e.dateString.fromCharCode(...e))});else if(e instanceof s.Api.UpdateChannelMessageViews)h({"@type":"updateMessage",chatId:Object(r.k)({channelId:e.channelId}),id:e.id,message:{views:e.views}});else if(e instanceof s.Api.UpdateReadHistoryInbox)h({"@type":"updateChatInbox",id:Object(r.k)(e.peer),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof s.Api.UpdateReadHistoryOutbox)h({"@type":"updateChat",id:Object(r.k)(e.peer),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof s.Api.UpdateReadChannelInbox)h({"@type":"updateChat",id:Object(r.k)({channelId:e.channelId}),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof s.Api.UpdateReadChannelOutbox)h({"@type":"updateChat",id:Object(r.k)({channelId:e.channelId}),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof s.Api.UpdateDialogPinned&&e.peer instanceof s.Api.DialogPeer)h({"@type":"updateChatPinned",id:Object(r.k)(e.peer.peer),isPinned:e.pinned||!1});else if(e instanceof s.Api.UpdatePinnedDialogs){const t=e.order?e.order.filter(e=>e instanceof s.Api.DialogPeer).map(e=>Object(r.k)(e.peer)):[];h({"@type":"updatePinnedChatIds",ids:t,folderId:e.folderId||void 0})}else if(e instanceof s.Api.UpdateFolderPeers)e.folderPeers.forEach(e=>{const{folderId:t,peer:n}=e;h({"@type":"updateChatListType",id:Object(r.k)(n),folderId:t})});else if(e instanceof s.Api.UpdateDialogFilter){const{id:t,filter:n}=e,s=n?Object(r.a)(n):void 0;h({"@type":"updateChatFolder",id:t,folder:s})}else if(e instanceof s.Api.UpdateDialogFilterOrder)h({"@type":"updateChatFoldersOrder",orderedIds:e.order});else if(e instanceof s.Api.UpdateChatParticipants){const t=Object(r.h)(e.participants);h({"@type":"updateChatMembers",id:Object(r.k)({chatId:e.participants.chatId}),replacedMembers:t})}else if(e instanceof s.Api.UpdateChatParticipantAdd){const t=Object(r.g)(Object(i.b)(e,["userId","inviterId","date"]));h({"@type":"updateChatMembers",id:Object(r.k)({chatId:e.chatId}),addedMember:t})}else if(e instanceof s.Api.UpdateChatParticipantDelete){const{userId:t}=e;h({"@type":"updateChatMembers",id:Object(r.k)({chatId:e.chatId}),deletedMemberId:t})}else if(e instanceof s.Api.UpdatePinnedMessages||e instanceof s.Api.UpdatePinnedChannelMessages){const t=e instanceof s.Api.UpdatePinnedMessages?e.peer:{channelId:e.channelId},n=Object(r.k)(t);h({"@type":"updatePinnedIds",chatId:n,messageIds:e.messages,isPinned:e.pinned})}else if(e instanceof s.Api.UpdateNotifySettings&&e.peer instanceof s.Api.NotifyPeer){const{silent:t,muteUntil:n}=e.notifySettings;h({"@type":"updateChat",id:Object(r.k)(e.peer.peer),chat:{isMuted:t||"number"==typeof n&&Date.now()<1e3*n}})}else if(e instanceof s.Api.UpdateUserTyping||e instanceof s.Api.UpdateChatUserTyping){const t=e instanceof s.Api.UpdateUserTyping?e.userId:Object(r.k)({chatId:e.chatId});h({"@type":"updateChatTypingStatus",id:t,typingStatus:Object(r.i)(e)})}else if(e instanceof s.Api.UpdateChannelUserTyping){const t=Object(r.k)({channelId:e.channelId});h({"@type":"updateChatTypingStatus",id:t,typingStatus:Object(r.i)(e)})}else if(e instanceof s.Api.UpdateChannel){const{_entities:t}=e;if(!t)return;const n=t.find(e=>e instanceof s.Api.Channel||e instanceof s.Api.ChannelForbidden);if(n instanceof s.Api.Channel){const t=Object(r.d)(n);t&&(h({"@type":"updateChat",id:t.id,chat:t}),h({"@type":t.isNotJoined?"updateChatLeave":"updateChatJoin",id:Object(r.k)({channelId:e.channelId})}))}else if(n instanceof s.Api.ChannelForbidden){const t=Object(r.k)({channelId:e.channelId});h({"@type":"updateChat",id:t,chat:{isRestricted:!0}}),h({"@type":"updateChatLeave",id:t})}else 0===t.length&&h({"@type":"resetMessages",id:Object(r.k)({chatId:e.channelId})})}else if(e instanceof s.Api.UpdateDialogUnreadMark&&e.peer instanceof s.Api.DialogPeer)h({"@type":"updateChat",id:Object(r.k)(e.peer.peer),chat:{hasUnreadMark:e.unread}});else if(e instanceof s.Api.UpdateChatDefaultBannedRights)h({"@type":"updateChat",id:Object(r.k)(e.peer),chat:{defaultBannedRights:Object(l.b)(e.defaultBannedRights)}});else if(e instanceof s.Api.UpdateUserStatus){const{userId:t,status:n}=e;h({"@type":"updateUserStatus",userId:t,status:Object(o.c)(n)})}else if(e instanceof s.Api.UpdateUserName){const t=u.a.users[e.userId],n=t&&t.mutualContact&&!t.self?Object(i.b)(e,["username"]):Object(i.b)(e,["firstName","lastName","username"]);h({"@type":"updateUser",id:e.userId,user:n})}else if(e instanceof s.Api.UpdateUserPhoto){const{userId:t,photo:n}=e,s=Object(r.e)(n);u.a.users[t]&&(u.a.users[t].photo=n),h({"@type":"updateUser",id:t,user:{avatarHash:s}})}else if(e instanceof s.Api.UpdateUserPhone){const{userId:t,phone:n}=e;h({"@type":"updateUser",id:t,user:{phoneNumber:n}})}else if(e instanceof s.Api.UpdatePeerSettings){const{_entities:t}=e;if(!t)return;t&&t.length&&(t.filter(e=>e instanceof s.Api.User&&!e.contact).forEach(e=>{h({"@type":"deleteUser",id:e.id})}),t.filter(e=>e instanceof s.Api.User&&e.contact).map(o.a).forEach(e=>{e&&h({"@type":"updateUser",id:e.id,user:e})}))}else if(e instanceof s.Api.UpdateNotifySettings){const{notifySettings:{showPreviews:t,silent:n,muteUntil:s},peer:{className:i}}=e,a="NotifyUsers"===i?"contact":"NotifyChats"===i?"group":"NotifyBroadcasts"===i?"broadcast":void 0;if(!a)return;h({"@type":"updateNotifySettings",peerType:a,isSilent:Boolean(n||"number"==typeof s&&Date.now()<1e3*s),isShowPreviews:Boolean(t)})}else if(e instanceof s.Api.UpdatePeerBlocked)h({"@type":"updatePeerBlocked",id:Object(r.k)(e.peerId),isBlocked:e.blocked});else if(e instanceof s.Api.UpdatePrivacy){const t=Object(g.c)(e.key);t&&h({"@type":"updatePrivacy",key:t,rules:Object(g.d)(e.rules)})}else if(e instanceof s.Api.UpdateContactsReset)h({"@type":"updateResetContactList"});else if(e instanceof s.Api.UpdateFavedStickers)h({"@type":"updateFavoriteStickers"});else if(d.f){const t="object"==typeof e&&"className"in e?e.className:e;console.warn("[GramJs/updater] Unexpected update:",t)}}},function(e,t,n){const{RPCError:s}=n(37),{rpcErrorRe:i}=n(48);e.exports={RPCMessageToError:function(e,t){for(const[n,s]of i){const i=e.errorMessage.match(n);if(i){return new s({request:t,capture:2===i.length?parseInt(i[1]):null})}}return new s(e.errorMessage,t)},...n(23),...n(37),...n(48)}},function(e,t,n){"use strict";function s(e,t,n=!0){let s,i,a;return(...r)=>{i=!0,a=r,s||(n&&(i=!1,e(...a)),s=self.setInterval(()=>{if(!i)return self.clearInterval(s),void(s=void 0);i=!1,e(...a)},t))}}function i(e){return a(r,e)}function a(e,t){let n,s=!1;return(...i)=>{n=i,s||(s=!0,e(()=>{s=!1,t(...n)}))}}function r(e){Promise.resolve().then(e)}n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return o}));const o=e=>new Promise(t=>{setTimeout(()=>t(),e)})},function(e,t,n){(function(t){const s=n(15),{constructors:i}=(n(62),n(20)),{readBigIntFromBuffer:a,readBufferFromBigInt:r,sha256:o,bigIntMod:c,modExp:u,generateRandomBytes:l}=n(8),d=n(36);function f(e,n){if(!t.from([199,28,174,185,198,177,201,4,142,108,82,47,112,241,63,115,152,13,64,35,142,62,33,193,73,52,208,55,86,61,147,15,72,25,138,10,167,193,64,88,34,148,147,210,37,48,244,219,250,51,111,110,10,201,37,19,149,67,174,212,76,206,124,55,32,253,81,246,148,88,112,90,198,140,212,254,107,107,19,171,220,151,70,81,41,105,50,132,84,241,143,175,140,89,95,100,36,119,254,150,187,42,148,29,91,205,29,74,200,204,73,136,7,8,250,155,55,142,60,79,58,144,96,190,230,124,249,164,164,166,149,129,16,81,144,126,22,39,83,181,107,15,107,65,13,186,116,216,168,75,42,20,179,20,78,14,241,40,71,84,253,23,237,149,13,89,101,180,185,221,70,88,45,177,23,141,22,156,107,196,101,176,214,255,156,163,146,143,239,91,154,228,228,24,252,21,232,62,190,160,248,127,169,255,94,237,112,5,13,237,40,73,244,123,249,89,217,86,133,12,233,41,133,31,13,129,21,246,53,177,5,238,46,78,21,208,75,36,84,191,111,79,173,240,52,177,4,3,17,156,216,227,185,47,204,91]).equals(e)||![3,4,5,7].includes(n))throw new Error("Changing passwords unsupported")}function g(e){return t.concat([t.alloc(256-e.length),e])}function p(e){return r(e,256,!1)}function h(e,t){const n=t.subtract(e);return!(n.lesser(s(0))||n.bitLength()<1984||e.bitLength()<1984||Math.floor((e.bitLength()+7)/8)>256)}function m(e,t){const n=Math.min(e.length,t.length);for(let s=0;s{for(;;){const e=l(256),n=a(e,!1),i=u(s(_),n,b);if(h(i,b)){const e=p(i),r=a(await o(t.concat([e,P])),!1);if(r.greater(s(0)))return[n,e,r]}}})(),O=c(w.subtract(k),b);if(!h(O,b))throw new Error("bad gB");const U=R.multiply(v),T=M.add(U),B=u(O,T,b),[D,x,j,N,F]=await Promise.all([o(p(B)),o(A),o(I),o(r.salt1),o(r.salt2)]),V=await o(t.concat([m(x,j),N,F,E,P,D]));return new i.InputCheckPasswordSRP({srpId:e.srpId,A:t.from(E),M1:V})},computeDigest:async function(e,t){try{f(e.p,e.g)}catch(e){throw new Error("bad p/g in password")}return p(u(s(e.g),a(await y(e,t),!1),a(e.p,!1)))}}}).call(this,n(12).Buffer)},function(e,t,n){n(21),n(20).constructors;const s=n(49);e.exports=class extends s{constructor(){super(),this._serverAddress=null,this._dcId=0,this._port=null,this._takeoutId=null,this._entities=new Set,this._updateStates={}}get dcId(){return this._dcId}get serverAddress(){return this._serverAddress}get port(){return this._port}get authKey(){return this._authKey}set authKey(e){this._authKey=e}setDC(e,t,n){this._dcId=0|e,this._serverAddress=t,this._port=n}}},function(e,t,n){(function(t){function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{inflate:i}=n(43),{serializeBytes:a}=n(20);class r{constructor(e){this.data=e,this.CONSTRUCTOR_ID=812830625,this.classType="constructor"}static async gzipIfSmaller(e,t){if(e&&t.length>512){const e=await new r(t).toBytes();if(e.length{const s=new FileReader;s.onload=e=>{const{result:s}=e.target||{};"string"==typeof s&&t(s),n(new Error("Failed to read blob"))},s.onerror=n,s.readAsDataURL(e)})}async function a(e,t){return function(e,t){return new File([e],t,{lastModified:Date.now(),type:e.type})}(await async function(e){return(await fetch(e)).blob()}(e),t)}},function(e,t,n){(function(t){const s=n(46).default,{i2ab:i,ab2i:a}=n(77),{getWords:r}=n(78);class o{constructor(e){this.setBytes(e)}setBytes(e){e=t.from(e),this._counter=e}increment(){for(let e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}}}class c{constructor(e,t){t instanceof o||(t=new o(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new s(r(e))}update(e){return this.encrypt(e)}encrypt(e){const n=t.from(e);for(let e=0;e{s[e]&&r[e]&&(this._authKeys[e]=new i(t.from(s[e].data),t.from(r[e].data)))})}catch(e){console.warn("Failed to retrieve or parse session from storage"),console.warn(e)}}setDC(e,t,n,s=!1){this._dcId=e,this._serverAddress=t,this._port=n,delete this._authKeys[e],s||this._updateStorage()}async save(){return this._storageKey||(this._storageKey="GramJs-session-"+Date.now()),await this._updateStorage(),this._storageKey}getAuthKey(e=this._dcId){return this._authKeys[e]}setAuthKey(e,t=this._dcId){this._authKeys[t]=e,this._updateStorage()}async _updateStorage(){if(!this._storageKey)return;const e={mainDcId:this._dcId,keys:{},hashes:{}};Object.keys(this._authKeys).map(t=>{const n=this._authKeys[t];e.keys[t]=n._key,e.hashes[t]=n._hash});try{await this._saveToCache(JSON.stringify(e))}catch(e){console.warn("Failed to update session in storage"),console.warn(e)}}async delete(){try{return await this._delete()}catch(e){console.warn("Failed to delete session from storage"),console.warn(e)}}async _delete(){throw new Error("Not Implemented")}async _fetchFromCache(){throw new Error("Not Implemented")}async _saveToCache(e){throw new Error("Not Implemented")}}}).call(this,n(12).Buffer)},function(e,t,n){e.exports=function e(t,n,s){function i(r,o){if(!n[r]){if(!t[r]){if(a)return a(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[r]={exports:{}};t[r][0].call(u.exports,(function(e){return i(t[r][1][e]||e)}),u,u.exports,e,t,n,s)}return n[r].exports}for(var a=!1,r=0;r=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function c(e,t){if(t<65534&&(e.subarray&&a||!e.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var n="",r=0;r>>6,t[r++]=128|63&n):n<65536?(t[r++]=224|n>>>12,t[r++]=128|n>>>6&63,t[r++]=128|63&n):(t[r++]=240|n>>>18,t[r++]=128|n>>>12&63,t[r++]=128|n>>>6&63,t[r++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new s.Buf8(e.length),n=0,i=t.length;n4)u[s++]=65533,n+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&n1?u[s++]=65533:i<65536?u[s++]=i:(i-=65536,u[s++]=55296|i>>10&1023,u[s++]=56320|1023&i)}return c(u,s)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+r[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,s){for(var i=65535&e|0,a=e>>>16&65535|0,r=0;0!==n;){n-=r=n>2e3?2e3:n;do{a=a+(i=i+t[s++]|0)|0}while(--r);i%=65521,a%=65521}return i|a<<16|0}},{}],4:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,n){"use strict";var s=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=s,r=i+n;e^=-1;for(var o=i;o>>8^a[255&(e^t[o])];return-1^e}},{}],6:[function(e,t,n){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(e,t,n){"use strict";t.exports=function(e,t){var n,s,i,a,r,o,c,u,l,d,f,g,p,h,m,y,b,_,w,v,A,I,P,S,C;n=e.state,s=e.next_in,S=e.input,i=s+(e.avail_in-5),a=e.next_out,C=e.output,r=a-(t-e.avail_out),o=a+(e.avail_out-257),c=n.dmax,u=n.wsize,l=n.whave,d=n.wnext,f=n.window,g=n.hold,p=n.bits,h=n.lencode,m=n.distcode,y=(1<>>=w=_>>>24,p-=w,0==(w=_>>>16&255))C[a++]=65535&_;else{if(!(16&w)){if(0==(64&w)){_=h[(65535&_)+(g&(1<>>=w,p-=w),p<15&&(g+=S[s++]<>>=w=_>>>24,p-=w,!(16&(w=_>>>16&255))){if(0==(64&w)){_=m[(65535&_)+(g&(1<c){e.msg="invalid distance too far back",n.mode=30;break e}if(g>>>=w,p-=w,A>(w=a-r)){if((w=A-w)>l&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(I=0,P=f,0===d){if(I+=u-w,w2;)C[a++]=P[I++],C[a++]=P[I++],C[a++]=P[I++],v-=3;v&&(C[a++]=P[I++],v>1&&(C[a++]=P[I++]))}else{I=a-A;do{C[a++]=C[I++],C[a++]=C[I++],C[a++]=C[I++],v-=3}while(v>2);v&&(C[a++]=C[I++],v>1&&(C[a++]=C[I++]))}break}}break}}while(s>3,g&=(1<<(p-=v<<3))-1,e.next_in=s,e.next_out=a,e.avail_in=s>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function l(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(852),t.distcode=t.distdyn=new s.Buf32(592),t.sane=1,t.back=-1,0):-2}function d(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,l(e)):-2}function f(e,t){var n,s;return e&&e.state?(s=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,d(e))):-2}function g(e,t){var n,s;return e?(s=new u,e.state=s,s.window=null,0!==(n=f(e,t))&&(e.state=null),n):-2}var p,h,m=!0;function y(e){if(m){var t;for(p=new s.Buf32(512),h=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(o(1,e.lens,0,288,p,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;o(2,e.lens,0,32,h,0,e.work,{bits:5}),m=!1}e.lencode=p,e.lenbits=9,e.distcode=h,e.distbits=5}function b(e,t,n,i){var a,r=e.state;return null===r.window&&(r.wsize=1<=r.wsize?(s.arraySet(r.window,t,n-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):((a=r.wsize-r.wnext)>i&&(a=i),s.arraySet(r.window,t,n-i,a,r.wnext),(i-=a)?(s.arraySet(r.window,t,n-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,n.check=a(n.check,D,2,0),h=0,m=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&h)){e.msg="unknown compression method",n.mode=30;break}if(m-=4,R=8+(15&(h>>>=4)),0===n.wbits)n.wbits=R;else if(R>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(D[0]=255&h,D[1]=h>>>8&255,n.check=a(n.check,D,2,0)),h=0,m=0,n.mode=3;case 3:for(;m<32;){if(0===g)break e;g--,h+=u[d++]<>>8&255,D[2]=h>>>16&255,D[3]=h>>>24&255,n.check=a(n.check,D,4,0)),h=0,m=0,n.mode=4;case 4:for(;m<16;){if(0===g)break e;g--,h+=u[d++]<>8),512&n.flags&&(D[0]=255&h,D[1]=h>>>8&255,n.check=a(n.check,D,2,0)),h=0,m=0,n.mode=5;case 5:if(1024&n.flags){for(;m<16;){if(0===g)break e;g--,h+=u[d++]<>>8&255,n.check=a(n.check,D,2,0)),h=0,m=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((v=n.length)>g&&(v=g),v&&(n.head&&(R=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),s.arraySet(n.head.extra,u,d,v,R)),512&n.flags&&(n.check=a(n.check,u,v,d)),g-=v,d+=v,n.length-=v),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===g)break e;v=0;do{R=u[d+v++],n.head&&R&&n.length<65536&&(n.head.name+=String.fromCharCode(R))}while(R&&v>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;m<32;){if(0===g)break e;g--,h+=u[d++]<>>=7&m,m-=7&m,n.mode=27;break}for(;m<3;){if(0===g)break e;g--,h+=u[d++]<>>=1)){case 0:n.mode=14;break;case 1:if(y(n),n.mode=20,6===t){h>>>=2,m-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}h>>>=2,m-=2;break;case 14:for(h>>>=7&m,m-=7&m;m<32;){if(0===g)break e;g--,h+=u[d++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&h,h=0,m=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(v=n.length){if(v>g&&(v=g),v>p&&(v=p),0===v)break e;s.arraySet(l,u,d,v,f),g-=v,d+=v,p-=v,f+=v,n.length-=v;break}n.mode=12;break;case 17:for(;m<14;){if(0===g)break e;g--,h+=u[d++]<>>=5,m-=5,n.ndist=1+(31&h),h>>>=5,m-=5,n.ncode=4+(15&h),h>>>=4,m-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have>>=3,m-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,U={bits:n.lenbits},O=o(0,n.lens,0,19,n.lencode,0,n.work,U),n.lenbits=U.bits,O){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,C=65535&B,!((P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<>>=P,m-=P,n.lens[n.have++]=C;else{if(16===C){for(T=P+2;m>>=P,m-=P,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}R=n.lens[n.have-1],v=3+(3&h),h>>>=2,m-=2}else if(17===C){for(T=P+3;m>>=P)),h>>>=3,m-=3}else{for(T=P+7;m>>=P)),h>>>=7,m-=7}if(n.have+v>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;v--;)n.lens[n.have++]=R}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,U={bits:n.lenbits},O=o(1,n.lens,0,n.nlen,n.lencode,0,n.work,U),n.lenbits=U.bits,O){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,U={bits:n.distbits},O=o(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,U),n.distbits=U.bits,O){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(g>=6&&p>=258){e.next_out=f,e.avail_out=p,e.next_in=d,e.avail_in=g,n.hold=h,n.bits=m,r(e,w),f=e.next_out,l=e.output,p=e.avail_out,d=e.next_in,u=e.input,g=e.avail_in,h=n.hold,m=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;S=(B=n.lencode[h&(1<>>16&255,C=65535&B,!((P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<>k)])>>>16&255,C=65535&B,!(k+(P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<>>=k,m-=k,n.back+=k}if(h>>>=P,m-=P,n.back+=P,n.length=C,0===S){n.mode=26;break}if(32&S){n.back=-1,n.mode=12;break}if(64&S){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&S,n.mode=22;case 22:if(n.extra){for(T=n.extra;m>>=n.extra,m-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;S=(B=n.distcode[h&(1<>>16&255,C=65535&B,!((P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<>k)])>>>16&255,C=65535&B,!(k+(P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<>>=k,m-=k,n.back+=k}if(h>>>=P,m-=P,n.back+=P,64&S){e.msg="invalid distance code",n.mode=30;break}n.offset=C,n.extra=15&S,n.mode=24;case 24:if(n.extra){for(T=n.extra;m>>=n.extra,m-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===p)break e;if(v=w-p,n.offset>v){if((v=n.offset-v)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}v>n.wnext?(v-=n.wnext,A=n.wsize-v):A=n.wnext-v,v>n.length&&(v=n.length),I=n.window}else I=l,A=f-n.offset,v=n.length;v>p&&(v=p),p-=v,n.length-=v;do{l[f++]=I[A++]}while(--v);0===n.length&&(n.mode=21);break;case 26:if(0===p)break e;l[f++]=n.length,p--,n.mode=21;break;case 27:if(n.wrap){for(;m<32;){if(0===g)break e;g--,h|=u[d++]<=1&&0===D[C];C--);if(k>C&&(k=C),0===C)return u[l++]=20971520,u[l++]=20971520,f.bits=1,0;for(S=1;S0&&(0===e||1!==C))return-1;for(x[1]=0,I=1;I<15;I++)x[I+1]=x[I]+D[I];for(P=0;P852||2===e&&O>592)return 1;for(;;){_=I-E,d[P]b?(w=j[N+d[P]],v=T[B+d[P]]):(w=96,v=0),g=1<>E)+(p-=g)]=_<<24|w<<16|v|0}while(0!==p);for(g=1<>=1;if(0!==g?(U&=g-1,U+=g):U=0,P++,0==--D[I]){if(I===C)break;I=t[n+d[P]]}if(I>k&&(U&m)!==h){for(0===E&&(E=k),y+=S,R=1<<(M=I-E);M+E852||2===e&&O>592)return 1;u[h=U&m]=k<<24|M<<16|y-l|0}}return 0!==U&&(u[y+U]=I-E<<24|64<<16|0),f.bits=k,0}},{"../utils/common":1}],10:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/lib/inflate.js":[function(e,t,n){"use strict";var s=e("./zlib/inflate"),i=e("./utils/common"),a=e("./utils/strings"),r=e("./zlib/constants"),o=e("./zlib/messages"),c=e("./zlib/zstream"),u=e("./zlib/gzheader"),l=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=s.inflateInit2(this.strm,t.windowBits);if(n!==r.Z_OK)throw new Error(o[n]);if(this.header=new u,s.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=a.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=s.inflateSetDictionary(this.strm,t.dictionary))!==r.Z_OK))throw new Error(o[n])}function f(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}d.prototype.push=function(e,t){var n,o,c,u,d,f=this.strm,g=this.options.chunkSize,p=this.options.dictionary,h=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?r.Z_FINISH:r.Z_NO_FLUSH,"string"==typeof e?f.input=a.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new i.Buf8(g),f.next_out=0,f.avail_out=g),(n=s.inflate(f,r.Z_NO_FLUSH))===r.Z_NEED_DICT&&p&&(n=s.inflateSetDictionary(this.strm,p)),n===r.Z_BUF_ERROR&&!0===h&&(n=r.Z_OK,h=!1),n!==r.Z_STREAM_END&&n!==r.Z_OK)return this.onEnd(n),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&n!==r.Z_STREAM_END&&(0!==f.avail_in||o!==r.Z_FINISH&&o!==r.Z_SYNC_FLUSH)||("string"===this.options.to?(c=a.utf8border(f.output,f.next_out),u=f.next_out-c,d=a.buf2string(f.output,c),f.next_out=u,f.avail_out=g-u,u&&i.arraySet(f.output,f.output,c,u,0),this.onData(d)):this.onData(i.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(h=!0)}while((f.avail_in>0||0===f.avail_out)&&n!==r.Z_STREAM_END);return n===r.Z_STREAM_END&&(o=r.Z_FINISH),o===r.Z_FINISH?(n=s.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===r.Z_OK):o!==r.Z_SYNC_FLUSH||(this.onEnd(r.Z_OK),f.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===r.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=f,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},n.ungzip=f},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){const n=e=>e.replace(/(?:^|_)([a-z])/g,(e,t)=>t.toUpperCase()).replace(/_/g,""),s=e=>e.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_","")),i=new Set([3162085175,2574415285,1072550713,3300522427,1450380236]),a=new Set([85337187,2211011308,2851430293,1013613780,1459478408,3504867164,3045658042,1715713620,3608339646,4110704415,812830625]);let r=null;function o(e){r||(r=function(){let e;const t=[];for(let n=0;n<256;n++){e=n;for(let t=0;t<8;t++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}()),t.isBuffer(e)||(e=t.from(e));let n=-1;for(let t=0;t>>8}return(-1^n)>>>0}const c=(e,i)=>{const a=e.match(/([\w.]+)(?:#([0-9a-fA-F]+))?(?:\s{?\w+:[\w\d<>#.?!]+}?)*\s=\s([\w\d<>#.?]+);$/);if(!a)throw new Error("Cannot parse TLObject "+e);const r=l(/({)?(\w+):([\w\d<>#.?!]+)}?/,e),c={name:a[1],constructorId:parseInt(a[2],16),argsConfig:{},subclassOfId:o(a[3]),result:a[3],isFunction:i,namespace:null};if(!c.constructorId){const e="";let n;n=Object.values(c.argsConfig).length?" "+Object.keys(c.argsConfig).map(e=>e.toString()).join(" "):"";const s=`${c.name}${e}${n} = ${c.result}`.replace(/(:|\?)bytes /g,"$1string ").replace(/|{|}/g,"").replace(/ \w+:flags\.\d+\?true/g,"");"inputMediaInvoice"===c.name&&c.name,c.constructorId=o(t.from(s,"utf8"))}for(const[e,t,n]of r)void 0===e&&(c.argsConfig[s(t)]=u(t,n));return c.name.includes(".")&&([c.namespace,c.name]=c.name.split(/\.(.+)/)),c.name=n(c.name),c};function u(e,t){const n={isVector:!1,isFlag:!1,skipConstructorId:!1,flagIndex:-1,flagIndicator:!0,type:null,useVectorId:null};e="self"===e?"is_self":e;if("#"!==t){n.flagIndicator=!1,n.type=t.replace(/^!+/,"");const e=n.type.match(/flags.(\d+)\?([\w<>.]+)/);e&&(n.isFlag=!0,n.flagIndex=Number(e[1]),[,,n.type]=e);const s=n.type.match(/[Vv]ector<([\w\d.]+)>/);s&&(n.isVector=!0,n.useVectorId="V"===n.type.charAt(0),[,n.type]=s),/^[a-z]$/.test(n.type.split(".").pop().charAt(0))&&(n.skipConstructorId=!0)}return n}const l=(e,t,n=[])=>{e.flags.includes("g")||(e=new RegExp(e.source,"g"));const s=e.exec(t);return s&&(n.push(s.slice(1)),l(e,t,n)),n};e.exports={findAll:l,parseTl:function*(e,t,n=[],s=i){(n||[]).reduce((e,t)=>({...e,[t.name]:t}),{});const r=[],o={},u={},l=e;let d=!1;for(let e of l.split("\n")){const t=e.indexOf("//");if(-1!==t&&(e=e.slice(0,t)),e=e.trim(),!e)continue;const n=e.match(/---(\w+)---/);if(n){const[,e]=n;d="functions"===e}else try{const t=c(e,d);if(s.has(t.constructorId))continue;r.push(t),t.isFunction||(u[t.result]||(u[t.result]=[]),o[t.name]=t,u[t.result].push(t))}catch(e){if(!e.toString().includes("vector#1cb5c415"))throw e}}for(const e of r)if(a.has(e.constructorId))for(const t in e.argsConfig)"string"===e.argsConfig[t].type&&(e.argsConfig[t].type="bytes");for(const e of r)yield e},buildArgConfig:u,fromLine:c,CORE_TYPES:i,serializeDate:function(e){if(!e)return t.alloc(4).fill(0);if(e instanceof Date&&(e=Math.floor((Date.now()-e.getTime())/1e3)),"number"==typeof e){const n=t.alloc(4);return n.writeInt32LE(e,0),n}throw Error(`Cannot interpret "${e}" as a date`)},serializeBytes:function(e){if(!(e instanceof t)){if("string"!=typeof e)throw Error("Bytes or str expected, not "+e.constructor.name);e=t.from(e)}const n=[];let s;return e.length<254?(s=(e.length+1)%4,0!==s&&(s=4-s),n.push(t.from([e.length])),n.push(e)):(s=e.length%4,0!==s&&(s=4-s),n.push(t.from([254,e.length%256,(e.length>>8)%256,(e.length>>16)%256])),n.push(e)),n.push(t.alloc(s).fill(0)),t.concat(n)},snakeToCamelCase:n,variableSnakeToCamelCase:s}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),n.d(t,"CTR",(function(){return y})),n.d(t,"IGE",(function(){return m}));var s=new Uint8Array(256),i=new Uint8Array(256),a=new Uint32Array(256),r=new Uint32Array(256),o=new Uint32Array(256),c=new Uint32Array(256),u=new Uint32Array(256),l=new Uint32Array(256),d=new Uint32Array(256),f=new Uint32Array(256);function g(e){if(e instanceof Uint32Array)return e;if("string"==typeof e){if(e.length%4!=0)for(var t=e.length%4;t<=4;t++)e+="\0x00";var n=new Uint32Array(e.length/4);for(t=0;t>7),m[h[_]^_]=_;for(;!s[y];y^=e||1)n=(n=b^b<<1^b<<2^b<<3^b<<4)>>8^255&n^99,s[y]=n,i[n]=y,p=16843009*h[t=h[e=h[y]]]^65537*t^257*e^16843008*y,g=257*h[n]^16843008*n,a[y]=g=g<<24^g>>>8,r[y]=g=g<<24^g>>>8,o[y]=g=g<<24^g>>>8,c[y]=g=g<<24^g>>>8,u[n]=p=p<<24^p>>>8,l[n]=p=p<<24^p>>>8,d[n]=p=p<<24^p>>>8,f[n]=p=p<<24^p>>>8,b=m[b]||1}();var h=function(){function e(e){var t=g(e);if(4!==t.length&&6!==t.length&&8!==t.length)throw new Error("Invalid key size");this.encKey=new Uint32Array(4*t.length+28),this.decKey=new Uint32Array(4*t.length+28),this.encKey.set(t);for(var n,i=1,a=t.length;a<4*t.length+28;a++)n=this.encKey[a-1],(a%t.length==0||8===t.length&&a%t.length==4)&&(n=s[n>>>24]<<24^s[n>>16&255]<<16^s[n>>8&255]<<8^s[255&n],a%t.length==0&&(n=n<<8^n>>>24^i<<24,i=i<<1^283*(i>>7))),this.encKey[a]=this.encKey[a-t.length]^n;for(var r=0;a;r++,a--)n=this.encKey[3&r?a:a-4],this.decKey[r]=a<=4||r<4?n:u[s[n>>>24]]^l[s[n>>16&255]]^d[s[n>>8&255]]^f[s[255&n]]}return e.prototype.encrypt=function(e){for(var t,n,i,u=g(e),l=new Uint32Array(4),d=u[0]^this.encKey[0],f=u[1]^this.encKey[1],p=u[2]^this.encKey[2],h=u[3]^this.encKey[3],m=this.encKey.length/4-2,y=4,b=0;b>>24]^r[f>>16&255]^o[p>>8&255]^c[255&h]^this.encKey[y],n=a[f>>>24]^r[p>>16&255]^o[h>>8&255]^c[255&d]^this.encKey[y+1],i=a[p>>>24]^r[h>>16&255]^o[d>>8&255]^c[255&f]^this.encKey[y+2],h=a[h>>>24]^r[d>>16&255]^o[f>>8&255]^c[255&p]^this.encKey[y+3],d=t,f=n,p=i,y+=4;for(b=0;b<4;b++)l[b]=s[d>>>24]<<24^s[f>>16&255]<<16^s[p>>8&255]<<8^s[255&h]^this.encKey[y++],t=d,d=f,f=p,p=h,h=t;return l},e.prototype.decrypt=function(e){for(var t,n,s,a=g(e),r=new Uint32Array(4),o=a[0]^this.decKey[0],c=a[3]^this.decKey[1],p=a[2]^this.decKey[2],h=a[1]^this.decKey[3],m=this.decKey.length/4-2,y=4,b=0;b>>24]^l[c>>16&255]^d[p>>8&255]^f[255&h]^this.decKey[y],n=u[c>>>24]^l[p>>16&255]^d[h>>8&255]^f[255&o]^this.decKey[y+1],s=u[p>>>24]^l[h>>16&255]^d[o>>8&255]^f[255&c]^this.decKey[y+2],h=u[h>>>24]^l[o>>16&255]^d[c>>8&255]^f[255&p]^this.decKey[y+3],o=t,c=n,p=s,y+=4;for(b=0;b<4;b++)r[3&-b]=i[o>>>24]<<24^i[c>>16&255]<<16^i[p>>8&255]<<8^i[255&h]^this.decKey[y++],t=o,o=c,c=p,p=h,h=t;return r},e}(),m=function(){function e(e,t,n){void 0===n&&(n=16),this.key=g(e),this.iv=g(t),this.cipher=new h(e),this.blockSize=n/4}return e.prototype.encrypt=function(e,t){for(var n=g(e),s=t||new Uint32Array(n.length),i=this.iv.subarray(this.blockSize,this.iv.length),a=this.iv.subarray(0,this.blockSize),r=new Uint32Array(this.blockSize),o=0;o=this.blockSize&&this.incrementCounter(),i&&(a-=i,i=0)}return this.offset=(this.offset+n.length%4)%4,s},e.prototype.decrypt=function(e,t){return this.encrypt(e,t)},e.prototype.incrementCounter=function(){for(var e=this.counter.length-1;e>=0&&!(++this.counter[e]<4294967295);e--);},e}();t.default=h},function(e,t,n){(function(t){let n=null;class s{constructor(e){n||(n=e||"debug"),this.isBrowser=void 0===t||"renderer"===t.type||!0===t.browser||t.__nwjs,this.isBrowser?this.colors={start:"%c",warn:"color : #ff00ff",info:"color : #ffff00",debug:"color : #00ffff",error:"color : #ff0000",end:""}:this.colors={start:"",warn:"",info:"",debug:"",error:"",end:""},this.messageFormat="[%t] [%l] - [%m]"}static setLevel(e){n=e}canSend(e){return s.levels.indexOf(n)>=s.levels.indexOf(e)}warn(e){this._log("warn",e,this.colors.warn)}info(e){this._log("info",e,this.colors.info)}debug(e){this._log("debug",e,this.colors.debug)}error(e){this._log("error",e,this.colors.error)}format(e,t){return this.messageFormat.replace("%t",(new Date).toISOString()).replace("%l",t.toUpperCase()).replace("%m",e)}_log(e,t,s){n&&this.canSend(e)&&(this.isBrowser?console.log(this.colors.start+this.format(t,e),s):console.log(s+this.format(t,e)+this.colors.end))}}var i,a,r;r=["error","warn","info","debug"],(a="levels")in(i=s)?Object.defineProperty(i,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[a]=r,e.exports=s}).call(this,n(83))},function(e,t,n){const{RPCError:s,InvalidDCError:i,FloodError:a,BadRequestError:r}=n(37);class o extends i{constructor(e){const t=Number(e.capture||0);super(`The user whose identity is being used to execute queries is associated with DC ${t}${s._fmtRequest(e.request)}`),this.message=`The user whose identity is being used to execute queries is associated with DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class c extends i{constructor(e){const t=Number(e.capture||0);super(`The phone number a user is trying to use for authorization is associated with DC ${t}${s._fmtRequest(e.request)}`),this.message=`The phone number a user is trying to use for authorization is associated with DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class u extends a{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required before sending another message in this chat${s._fmtRequest(e.request)}`),this.message=`A wait of ${t} seconds is required before sending another message in this chat${s._fmtRequest(e.request)}`,this.seconds=t}}class l extends a{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required${s._fmtRequest(e.request)}`),this.message=`A wait of ${t} seconds is required${s._fmtRequest(e.request)}`,this.seconds=t}}class d extends a{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required in the test servers${s._fmtRequest(e.request)}`),this.message=`A wait of ${t} seconds is required in the test servers${s._fmtRequest(e.request)}`,this.seconds=t}}class f extends i{constructor(e){const t=Number(e.capture||0);super(`The file to be accessed is currently stored in DC ${t}${s._fmtRequest(e.request)}`),this.message=`The file to be accessed is currently stored in DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class g extends i{constructor(e){const t=Number(e.capture||0);super(`The source IP address is associated with DC ${t}${s._fmtRequest(e.request)}`),this.message=`The source IP address is associated with DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class p extends r{constructor(e){const t=Number(e.capture||0);super(`Email unconfirmed, the length of the code must be ${t}${s._fmtRequest(e.request)}`),this.message=`Email unconfirmed, the length of the code must be ${t}${s._fmtRequest(e.request)}`,this.codeLength=t}}const h=[[/FILE_MIGRATE_(\d+)/,f],[/FLOOD_TEST_PHONE_WAIT_(\d+)/,d],[/FLOOD_WAIT_(\d+)/,l],[/PHONE_MIGRATE_(\d+)/,c],[/SLOWMODE_WAIT_(\d+)/,u],[/USER_MIGRATE_(\d+)/,o],[/NETWORK_MIGRATE_(\d+)/,g],[/EMAIL_UNCONFIRMED_(\d+)/,p]];e.exports={rpcErrorRe:h,FileMigrateError:f,FloodTestPhoneWaitError:d,FloodWaitError:l,PhoneMigrateError:c,SlowModeWaitError:u,UserMigrateError:o,NetworkMigrateError:g,EmailUnconfirmedError:p}},function(e,t){e.exports=class{constructor(){}get dcId(){throw new Error("Not Implemented")}get serverAddress(){throw new Error("Not Implemented")}get port(){throw new Error("Not Implemented")}get authKey(){throw new Error("Not Implemented")}set authKey(e){throw new Error("Not Implemented")}setDC(e,t,n){throw new Error("Not implemented")}save(){throw new Error("Not Implemented")}delete(){throw new Error("Not Implemented")}}},function(e,t,n){(function(t){e.exports=class{constructor(e){this._stream=e}write(e){this._stream=t.concat([this._stream,e])}getValue(){return this._stream}}}).call(this,n(12).Buffer)},function(e,t,n){const s=n(38),i=n(52),a=n(39),r=n(31),o={[i.CONSTRUCTOR_ID]:i,[r.CONSTRUCTOR_ID]:r,[a.CONSTRUCTOR_ID]:a};e.exports={TLMessage:s,RPCResult:i,MessageContainer:a,GZIPPacked:r,coreObjects:o}},function(e,t,n){function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{RpcError:i}=n(20).constructors,a=n(31);class r{constructor(e,t,n){this.CONSTRUCTOR_ID=4082920705,this.reqMsgId=e,this.body=t,this.error=n,this.classType="constructor"}static async fromReader(e){const t=e.readLong(),n=e.readInt(!1);return n===i.CONSTRUCTOR_ID?new r(t,null,i.fromReader(e)):n===a.CONSTRUCTOR_ID?new r(t,(await a.fromReader(e)).data):(e.seek(-4),new r(t,e.read(),null))}}s(r,"CONSTRUCTOR_ID",4082920705),s(r,"classType","constructor"),e.exports=r},function(e,t,n){const s=n(6),i={};for(const e of Object.values(s))if(e.CONSTRUCTOR_ID)i[e.CONSTRUCTOR_ID]=e;else for(const t of Object.values(e))i[t.CONSTRUCTOR_ID]=t;e.exports={LAYER:121,tlobjects:i}},function(e,t,n){(function(t){const{Mutex:s}=n(84),i=new s,a=n(86).w3cwebsocket,r=new Error("WebSocket was closed");e.exports=class{constructor(){this.client=null,this.closed=!0}async readExactly(e){let n=t.alloc(0);for(;;){const s=await this.read(e);if(n=t.concat([n,s]),!(e-=s.length))return n}}async read(e){if(this.closed)throw r;if(await this.canRead,this.closed)throw r;const t=this.stream.slice(0,e);return this.stream=this.stream.slice(e),0===this.stream.length&&(this.canRead=new Promise(e=>{this.resolveRead=e})),t}async readAll(){if(this.closed||!await this.canRead)throw r;const e=this.stream;return this.stream=t.alloc(0),this.canRead=new Promise(e=>{this.resolveRead=e}),e}getWebSocketLink(e,t){return 443===t?`wss://${e}:${t}/apiws`:`ws://${e}:${t}/apiws`}async connect(e,n){return this.stream=t.alloc(0),this.canRead=new Promise(e=>{this.resolveRead=e}),this.closed=!1,this.website=this.getWebSocketLink(n,e),this.client=new a(this.website,"binary"),new Promise((e,t)=>{this.client.onopen=()=>{this.receive(),e(this)},this.client.onerror=e=>{t(e)},this.client.onclose=()=>{this.resolveRead(!1),this.closed=!0},self.addEventListener("offline",async()=>{await this.close(),this.resolveRead(!1)})})}write(e){if(this.closed)throw r;this.client.send(e)}async close(){await this.client.close(),this.closed=!0}async receive(){this.client.onmessage=async e=>{const n=await i.acquire();try{const s=e.data instanceof ArrayBuffer?t.from(e.data):t.from(await new Response(e.data).arrayBuffer());this.stream=t.concat([this.stream,s]),this.resolveRead(!0)}finally{n()}}}}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const s=n(39),i=n(38),a=n(50);e.exports=class{constructor(e,t){this._state=e,this._queue=[],this._pendingStates=[],this._ready=new Promise(e=>{this.setReady=e}),this._log=t}values(){return this._queue}append(e){this._queue.push(e),this.setReady(!0),e&&(this._pendingStates.push(e),e.promise.catch(()=>{}).finally(()=>{this._pendingStates=this._pendingStates.filter(t=>t!==e)}))}extend(e){for(const t of e)this._queue.push(t);this.setReady(!0)}async get(){if(this._queue.length||(this._ready=new Promise(e=>{this.setReady=e}),await this._ready),!this._queue[this._queue.length-1])return void(this._queue=[]);let e,n=new a(t.alloc(0));const r=[];let o=0;for(;this._queue.length&&r.length<=s.MAXIMUM_LENGTH;){const e=this._queue.shift();if(o+=e.data.length+i.SIZE_OVERHEAD,o<=s.MAXIMUM_SIZE){let t;e.after&&(t=e.after.msgId),e.msgId=await this._state.writeDataAsMessage(n,e.data,"request"===e.request.classType,t),this._log.debug(`Assigned msgId = ${e.msgId} to ${e.request.className||e.request.constructor.name}`),r.push(e)}else{if(r.length){this._queue.unshift(e);break}this._log.warn(`Message payload for ${e.request.className||e.request.constructor.name} is too long ${e.data.length} and cannot be sent`),e.reject("Request Payload is too big"),o=0}}if(!r.length)return null;if(r.length>1){const i=t.alloc(8);i.writeUInt32LE(s.CONSTRUCTOR_ID,0),i.writeInt32LE(r.length,4),e=t.concat([i,n.getValue()]),n=new a(t.alloc(0));const o=await this._state.writeDataAsMessage(n,e,!1);for(const e of r)e.containerId=o}return e=n.getValue(),{batch:r,data:e}}rejectAll(){this._pendingStates.forEach(e=>{e.reject(new Error("Disconnect"))})}}}).call(this,n(12).Buffer)},function(e,t){e.exports=class{constructor(){this._queue=[],this.canGet=new Promise(e=>{this.resolveGet=e}),this.canPush=!0}async push(e){await this.canPush,this._queue.push(e),this.resolveGet(!0),this.canPush=new Promise(e=>{this.resolvePush=e})}async pop(){await this.canGet;const e=this._queue.pop();return this.resolvePush(!0),this.canGet=new Promise(e=>{this.resolveGet=e}),e}}},function(e,t,n){const s=n(58),i=n(59),a=n(8),r=n(32),o=n(61),c=n(52),u=n(39),l=n(31),d=n(90),{MsgsAck:f,upload:g,MsgsStateInfo:p,Pong:h}=n(20).constructors,m=n(55),y=n(25),{UpdateConnectionState:b}=n(40),{BadMessageError:_}=n(23),{BadServerSalt:w,BadMsgNotification:v,MsgDetailedInfo:A,MsgNewDetailedInfo:I,NewSessionCreated:P,FutureSalts:S,MsgsStateReq:C,MsgResendReq:k,MsgsAllInfo:M}=n(20).constructors,{SecurityError:E}=n(23),{InvalidBufferError:R}=n(23),{LogOut:O}=n(20).requests.auth,{RPCMessageToError:U}=n(27),{TypeNotFoundError:T}=n(23);class B{constructor(e,t){const n={...B.DEFAULT_OPTIONS,...t};this._connection=null,this._log=n.logger,this._dcId=n.dcId,this._retries=n.retries,this._delay=n.delay,this._autoReconnect=n.autoReconnect,this._connectTimeout=n.connectTimeout,this._authKeyCallback=n.authKeyCallback,this._updateCallback=n.updateCallback,this._autoReconnectCallback=n.autoReconnectCallback,this._isMainSender=n.isMainSender,this._onConnectionBreak=n.onConnectionBreak,this._user_connected=!1,this._reconnecting=!1,this._disconnected=!0,this._send_loop_handle=null,this._recv_loop_handle=null,this.authKey=e||new r,this._state=new i(this.authKey,this._log),this._send_queue=new m(this._state,this._log),this._pending_state={},this._pending_ack=new Set,this._last_acks=[],this._handlers={[c.CONSTRUCTOR_ID]:this._handleRPCResult.bind(this),[u.CONSTRUCTOR_ID]:this._handleContainer.bind(this),[l.CONSTRUCTOR_ID]:this._handleGzipPacked.bind(this),[h.CONSTRUCTOR_ID]:this._handlePong.bind(this),[w.CONSTRUCTOR_ID]:this._handleBadServerSalt.bind(this),[v.CONSTRUCTOR_ID]:this._handleBadNotification.bind(this),[A.CONSTRUCTOR_ID]:this._handleDetailedInfo.bind(this),[I.CONSTRUCTOR_ID]:this._handleNewDetailedInfo.bind(this),[P.CONSTRUCTOR_ID]:this._handleNewSessionCreated.bind(this),[f.CONSTRUCTOR_ID]:this._handleAck.bind(this),[S.CONSTRUCTOR_ID]:this._handleFutureSalts.bind(this),[C.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[k.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[M.CONSTRUCTOR_ID]:this._handleMsgAll.bind(this)}}async connect(e,t){if(this._user_connected&&!t)return this._log.info("User is already connected!"),!1;this._connection=e;for(let e=0;e1024)throw new c("Server replied with the wrong message padding");const y=f.tgReadObject();return new o(g,p,y)}_getNewMsgId(){const e=(new Date).getTime()/1e3+this.timeOffset,t=Math.floor(1e9*(e-Math.floor(e)));let n=d(Math.floor(e)).shiftLeft(d(32)).or(d(t).shiftLeft(d(2)));return this._lastMsgId.greaterOrEquals(n)&&(n=this._lastMsgId.add(d(4))),this._lastMsgId=n,n}updateTimeOffset(e){const t=this._getNewMsgId(),n=this.timeOffset,s=Math.floor((new Date).getTime()/1e3),i=e.shiftRight(d(32));return this.timeOffset=i-s,this.timeOffset!==n&&(this._lastMsgId=d(0),this._log.debug(`Updated time offset (old offset ${n}, bad ${t}, good ${e}, new ${this.timeOffset})`)),this.timeOffset}_getSeqNo(e){if(e){const e=2*this._sequence+1;return this._sequence+=1,e}return 2*this._sequence}}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const{IGE:s}=n(46),i=n(8);e.exports=class{constructor(e,t){this.ige=new s(e,t)}decryptIge(e){return i.convertToLittle(this.ige.decrypt(e))}encryptIge(e){const n=e.length%16;return n&&(e=t.concat([e,i.generateRandomBytes(16-n)])),i.convertToLittle(this.ige.encrypt(e))}}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const s=n(15),i=n(60),a=n(32),r=n(62),o=n(89),c=n(8),{constructors:u,requests:l}=n(20),d=n(25),{SecurityError:f}=n(23);e.exports=async function(e,n){let g=c.generateRandomBytes(16);const p=c.readBigIntFromBuffer(g,!1,!0),h=await e.send(new l.ReqPqMulti({nonce:p}));if(n.debug("Starting authKey generation step 1"),!(h instanceof u.ResPQ))throw new Error("Step 1 answer was "+h);if(h.nonce.neq(p))throw new f("Step 1 invalid nonce from server");const m=c.readBigIntFromBuffer(h.pq,!1,!0);n.debug("Finished authKey generation step 1"),n.debug("Starting authKey generation step 2");let{p:y,q:b}=r.factorize(m);y=c.getByteArray(y),b=c.getByteArray(b),g=c.generateRandomBytes(32);const _=c.readBigIntFromBuffer(g,!0,!0),w=new u.PQInnerData({pq:c.getByteArray(m),p:y,q:b,nonce:h.nonce,serverNonce:h.serverNonce,newNonce:_});let v=null,A=null;for(const e of h.serverPublicKeyFingerprints)if(v=await o.encrypt(e.toString(),w.getBytes()),null!=v){A=e;break}if(null==v)throw new f("Step 2 could not find a valid key for fingerprints");const I=await e.send(new l.ReqDHParams({nonce:h.nonce,serverNonce:h.serverNonce,p:y,q:b,publicKeyFingerprint:A,encryptedData:v}));if(!(I instanceof u.ServerDHParamsOk||I instanceof u.ServerDHParamsFail))throw new Error("Step 2.1 answer was "+I);if(I.nonce.neq(h.nonce))throw new f("Step 2 invalid nonce from server");if(I.serverNonce.neq(h.serverNonce))throw new f("Step 2 invalid server nonce from server");if(I instanceof u.ServerDHParamsFail){const e=await c.sha1(c.toSignedLittleBuffer(_,32).slice(4,20)),t=c.readBigIntFromBuffer(e,!0,!0);if(I.newNonceHash.neq(t))throw new f("Step 2 invalid DH fail nonce from server")}if(!(I instanceof u.ServerDHParamsOk))throw new Error("Step 2.2 answer was "+I);n.debug("Finished authKey generation step 2"),n.debug("Starting authKey generation step 3");const{key:P,iv:S}=await c.generateKeyDataFromNonce(h.serverNonce,_);if(I.encryptedAnswer.length%16!=0)throw new f("Step 3 AES block size mismatch");const C=new i(P,S),k=C.decryptIge(I.encryptedAnswer),M=new d(k);M.read(20);const E=M.tgReadObject();if(!(E instanceof u.ServerDHInnerData))throw new Error("Step 3 answer was "+E);if(E.nonce.neq(h.nonce))throw new f("Step 3 Invalid nonce in encrypted answer");if(E.serverNonce.neq(h.serverNonce))throw new f("Step 3 Invalid server nonce in encrypted answer");const R=c.readBigIntFromBuffer(E.dhPrime,!1,!1),O=c.readBigIntFromBuffer(E.gA,!1,!1),U=E.serverTime-Math.floor((new Date).getTime()/1e3),T=c.readBigIntFromBuffer(c.generateRandomBytes(256),!1,!1),B=c.modExp(s(E.g),T,R),D=c.modExp(O,T,R),x=new u.ClientDHInnerData({nonce:h.nonce,serverNonce:h.serverNonce,retryId:0,gB:c.getByteArray(B,!1)}).getBytes(),j=t.concat([await c.sha1(x),x]),N=C.encryptIge(j),F=await e.send(new l.SetClientDHParams({nonce:h.nonce,serverNonce:h.serverNonce,encryptedData:N})),V=[u.DhGenOk,u.DhGenRetry,u.DhGenFail];if(!(F instanceof V[0]||F instanceof V[1]||F instanceof V[2]))throw new Error("Step 3.1 answer was "+F);const{name:L}=F.constructor;if(F.nonce.neq(h.nonce))throw new f(`Step 3 invalid ${L} nonce from server`);if(F.serverNonce.neq(h.serverNonce))throw new f(`Step 3 invalid ${L} server nonce from server`);const q=new a;await q.setKey(c.getByteArray(D));const H=1+V.indexOf(F.constructor),z=await q.calcNewNonceHash(_,H);if(F["newNonceHash"+H].neq(z))throw new f("Step 3 invalid new nonce hash");if(!(F instanceof u.DhGenOk))throw new Error("Step 3.2 answer was "+F);return n.debug("Finished authKey generation step 3"),{authKey:q,timeOffset:U}}}).call(this,n(12).Buffer)},function(e,t,n){const s=n(15),{modExp:i}=n(8);class a{static gcd(e,t){for(;t.neq(s.zero);){const n=t;t=e.remainder(t),e=n}return e}static factorize(e){if(e.remainder(2).equals(s.zero))return{p:s(2),q:e.divide(s(2))};let t=s.randBetween(s(1),e.minus(1));const n=s.randBetween(s(1),e.minus(1)),r=s.randBetween(s(1),e.minus(1));let o,c=s.one,u=s.one,l=s.one,d=s.zero,f=s.zero;for(;c.eq(s.one);){d=t;for(let a=0;s(a).lesser(u);a++)t=i(t,s(2),e).add(n).remainder(e);for(o=s.zero;o.lesser(u)&&c.eq(s.one);){f=t;const g=s.min(r,u.minus(o));for(let a=0;s(a).lesser(g);a++)t=i(t,s(2),e).add(n).remainder(e),l=l.multiply(d.minus(t).abs()).remainder(e);c=a.gcd(l,e),o=o.add(r)}u=u.multiply(2)}if(c.eq(e))for(;f=i(f,s(2),e).add(n).remainder(e),c=a.gcd(d.minus(f).abs(),e),!c.greater(1););const g=c;return l=e.divide(c),g>2;if(n<127){const e=t.alloc(1);e.writeUInt8(n,0),n=e}else n=t.concat([t.from("7f","hex"),a(i(n),3)]);return t.concat([n,e])}async readPacket(e){let n=(await e.read(1))[0];return n>=127&&(n=t.concat([await e.read(3),t.alloc(1)]).readInt32LE(0)),await e.read(n<<2)}}s(c,"tag",t.from("ef","hex")),s(c,"obfuscateTag",t.from("efefefef","hex"));e.exports={ConnectionTCPAbridged:class extends r{constructor(...e){super(...e),s(this,"PacketCodecClass",c)}},AbridgedPacketCodec:c}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{generateRandomBytes:i}=n(8),{ObfuscatedConnection:a}=n(41),{AbridgedPacketCodec:r}=n(63),o=n(93);class c{constructor(e){s(this,"header",null),this.connection=e.socket;const t=this.initHeader(e.PacketCodecClass);this.header=t.random,this._encrypt=t.encryptor,this._decrypt=t.decryptor}initHeader(e){const n=[t.from("50567247","hex"),t.from("474554","hex"),t.from("504f5354","hex"),t.from("eeeeeeee","hex")];let s;for(;;)if(s=i(64),239!==s[0]&&!s.slice(4,8).equals(t.alloc(4))){let e=!0;for(const t of n)if(t.equals(s.slice(0,4))){e=!1;break}if(e)break}s=s.toJSON().data;const a=t.from(s.slice(8,56)).reverse(),r=t.from(s.slice(8,40)),c=t.from(s.slice(40,56)),u=t.from(a.slice(0,32)),l=t.from(a.slice(32,48)),d=new o(r,c),f=new o(u,l);return s=t.concat([t.from(s.slice(0,56)),e.obfuscateTag,t.from(s.slice(60))]),s=t.concat([t.from(s.slice(0,56)),t.from(d.encrypt(s).slice(56,64)),t.from(s.slice(64))]),{random:s,encryptor:d,decryptor:f}}async read(e){const t=await this.connection.readExactly(e);return this._decrypt.encrypt(t)}write(e){this.connection.write(this._encrypt.encrypt(e))}}e.exports={ConnectionTCPObfuscated:class extends a{constructor(...e){super(...e),s(this,"ObfuscatedIO",c),s(this,"PacketCodecClass",r)}}}}).call(this,n(12).Buffer)},function(e,t){},function(e,t){},function(e,t,n){"use strict";let s;n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),function(e){e.Bold="MessageEntityBold",e.Blockquote="MessageEntityBlockquote",e.BotCommand="MessageEntityBotCommand",e.Cashtag="MessageEntityCashtag",e.Code="MessageEntityCode",e.Email="MessageEntityEmail",e.Hashtag="MessageEntityHashtag",e.Italic="MessageEntityItalic",e.MentionName="MessageEntityMentionName",e.Mention="MessageEntityMention",e.Phone="MessageEntityPhone",e.Pre="MessageEntityPre",e.Strike="MessageEntityStrike",e.TextUrl="MessageEntityTextUrl",e.Url="MessageEntityUrl",e.Underline="MessageEntityUnderline",e.Unknown="MessageEntityUnknown"}(s||(s={}));const i=-1,a="MESSAGE_DELETED"},function(e,t){},function(e,t,n){"use strict";let s;n.d(t,"a",(function(){return s})),function(e){e[e.DataUri=0]="DataUri",e[e.BlobUrl=1]="BlobUrl",e[e.Lottie=2]="Lottie",e[e.Progressive=3]="Progressive",e[e.Stream=4]="Stream"}(s||(s={}))},function(e,t){},function(e,t){},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r}));var s=n(1),i=n(0),a=n(2);async function r({chatId:t,accessHash:n,messageId:r,data:o}){const c=await Object(s.g)(new i.Api.messages.GetBotCallbackAnswer({peer:Object(a.i)(t,n),msgId:r,data:e.from(o)}));if(c)return c}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],s=t[1];return 3*(n+s)/4-s},t.toByteArray=function(e){var t,n,s=u(e),r=s[0],o=s[1],c=new a(function(e,t,n){return 3*(t+n)/4-n}(0,r,o)),l=0,d=o>0?r-4:r;for(n=0;n>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===o&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===o&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],r=0,o=n-i;ro?o:r+16383));1===i?(t=e[n-1],a.push(s[t>>2]+s[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return a.join("")};for(var s=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=r.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,a,r=[],o=t;o>18&63]+s[a>>12&63]+s[a>>6&63]+s[63&a]);return r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,s,i){var a,r,o=8*i-s-1,c=(1<>1,l=-7,d=n?i-1:0,f=n?-1:1,g=e[t+d];for(d+=f,a=g&(1<<-l)-1,g>>=-l,l+=o;l>0;a=256*a+e[t+d],d+=f,l-=8);for(r=a&(1<<-l)-1,a>>=-l,l+=s;l>0;r=256*r+e[t+d],d+=f,l-=8);if(0===a)a=1-u;else{if(a===c)return r?NaN:1/0*(g?-1:1);r+=Math.pow(2,s),a-=u}return(g?-1:1)*r*Math.pow(2,a-s)},t.write=function(e,t,n,s,i,a){var r,o,c,u=8*a-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=s?0:a-1,p=s?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-r))<1&&(r--,c*=2),(t+=r+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(r++,c/=2),r+d>=l?(o=0,r=l):r+d>=1?(o=(t*c-1)*Math.pow(2,i),r+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),r=0));i>=8;e[n+g]=255&o,g+=p,o/=256,i-=8);for(r=r<0;e[n+g]=255&r,g+=p,r/=256,u-=8);e[n+g-p]|=128*h}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function s(e){const t=new Uint8Array(4*e.length);let n=0;for(let s=0;s>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=255&i}return t.buffer}function i(e){return e.buffer}function a(e){const t=new Uint8Array(e),n=new Uint32Array(t.length/4);for(let e=0;enew p.InvokeWithLayer({layer:f,query:new p.InitConnection({apiId:this.apiId,deviceModel:r.deviceModel||s.type().toString()||"Unknown",systemVersion:r.systemVersion||s.release().toString()||"1.0",appVersion:r.appVersion||"1.0",langCode:r.langCode,langPack:"",systemLangCode:r.systemLangCode,query:e,proxy:null})}),this._args=r,this._config=null,this.phoneCodeHashes=[],this._borrowedSenderPromises={},this._additionalDcsDisabled=r.additionalDcsDisabled}async connect(){await this._initSession(),this._sender=new h(this.session.getAuthKey(),{logger:this._log,dcId:this.session.dcId,retries:this._connectionRetries,delay:this._retryDelay,autoReconnect:this._autoReconnect,connectTimeout:this._timeout,authKeyCallback:this._authKeyCallback.bind(this),updateCallback:this._handleUpdate.bind(this),isMainSender:!0});const e=new this._connection(this.session.serverAddress,this.session.port,this.session.dcId,this._log);await this._sender.connect(e),this.session.setAuthKey(this._sender.authKey),await this._sender.send(this._initWith(new p.help.GetConfig({}))),this._updateLoop()}async _initSession(){await this.session.load(),this.session.serverAddress&&this.session.serverAddress.includes(":")===this._useIPV6||this.session.setDC(2,this._useIPV6?"[2001:67c:4e8:f002::a]":"venus.web.telegram.org",this._args.useWSS?443:80)}async _updateLoop(){for(;this.isConnected();){await c.sleep(3e3);try{await E(()=>M(this._sender.send(new p.Ping({pingId:c.getRandomInt(Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)})),1500),3,100)}catch(e){return await this.disconnect(),void this.connect()}if((new Date).getTime()-this._lastRequest>18e5)try{await this.invoke(new p.updates.GetState)}catch(e){}}}async disconnect(){this._sender&&await this._sender.disconnect(),await Promise.all(Object.values(this._borrowedSenderPromises).map(e=>e.then(e=>{if(e)return e.disconnect()}))),this._borrowedSenderPromises={}}async destroy(){await this.disconnect(),this.session.delete(),this._eventBuilders=[]}async _switchDC(e){this._log.info("Reconnecting to new data center "+e);const t=l.getDC(e);return this.session.setDC(e,t.ipAddress,t.port),await this._sender.authKey.setKey(null),this.session.setAuthKey(null),await this.disconnect(),this.connect()}async _authKeyCallback(e,t){this.session.setAuthKey(e,t)}_cleanupBorrowedSender(e){delete this._borrowedSenderPromises[e]}async _borrowExportedSender(e){if(this._additionalDcsDisabled)return;let t=this._borrowedSenderPromises[e];return t||(t=this._createExportedSender(e),this._borrowedSenderPromises[e]=t,t.then(t=>{t||delete this._borrowedSenderPromises[e]})),t}async _createExportedSender(e){const t=l.getDC(e),n=new h(this.session.getAuthKey(e),{logger:this._log,dcId:e,retries:this._connectionRetries,delay:this._retryDelay,autoReconnect:this._autoReconnect,connectTimeout:this._timeout,authKeyCallback:this._authKeyCallback.bind(this),isMainSender:e===this.session.dcId,onConnectionBreak:this._cleanupBorrowedSender.bind(this)});for(let s=0;s<5;s++)try{if(await n.connect(new this._connection(t.ipAddress,t.port,e,this._log)),this.session.dcId!==e){this._log.info("Exporting authorization for data center "+t.ipAddress);const s=await this.invoke(new p.auth.ExportAuthorization({dcId:e})),i=this._initWith(new p.auth.ImportAuthorization({id:s.id,bytes:s.bytes}));await n.send(i)}return n.dcId=e,n}catch(e){await n.disconnect()}return null}async downloadFile(e,t={}){return w(this,e,t)}async downloadMedia(e,t){let n,s;if(e instanceof g.Message?(n=e.date,s=e.media):(n=(new Date).getTime(),s=e),"string"==typeof s)throw new Error("not implemented");return s instanceof g.MessageMediaWebPage&&s.webpage instanceof g.WebPage&&(s=s.webpage.document||s.webpage.photo),s instanceof g.MessageMediaPhoto||s instanceof g.Photo?this._downloadPhoto(s,t):s instanceof g.MessageMediaDocument||s instanceof g.Document?this._downloadDocument(s,t):s instanceof g.MessageMediaContact?this._downloadContact(s,t):s instanceof g.WebDocument||s instanceof g.WebDocumentNoProxy?this._downloadWebDocument(s,t):void 0}async downloadProfilePhoto(e,t=!1){const n=t?"x":"m";let s,i,a;if([765557111,3316604308,524706233,3566872215].includes(e.SUBCLASS_OF_ID)){if(!e.photo)return e.chatPhoto?this._downloadPhoto(e.chatPhoto,{sizeType:n}):null;s=e.photo}else s=e;if(!(s instanceof g.UserProfilePhoto||s instanceof g.ChatPhoto))return null;{i=s.dcId;const n=t?s.photoBig:s.photoSmall;a=new g.InputPeerPhotoFileLocation({peer:l.getInputPeer(e),localId:n.localId,volumeId:n.volumeId,big:t})}try{return this.downloadFile(a,{dcId:i})}catch(e){throw e}}async downloadStickerSetThumb(e){if(!e.thumb||!e.thumb.location)return;const{location:t}=e.thumb;return this.downloadFile(new g.InputStickerSetThumb({stickerset:new g.InputStickerSetID({id:e.id,accessHash:e.accessHash}),localId:t.localId,volumeId:t.volumeId}),{dcId:e.thumbDcId})}_pickFileSize(e,t){if(!t||!e||!e.length)return null;let n;for(let s=I.indexOf(t);se.type===I[s]),n)return n;return null}_downloadCachedPhotoSize(e){let t;return t=e instanceof g.PhotoStrippedSize?l.strippedPhotoToJpg(e.bytes):e.bytes,t}async _downloadPhoto(e,t){if(e instanceof g.MessageMediaPhoto&&(e=e.photo),!(e instanceof g.Photo))return;const n=this._pickFileSize(e.sizes,t.sizeType);return!n||n instanceof g.PhotoSizeEmpty?void 0:n instanceof g.PhotoCachedSize||n instanceof g.PhotoStrippedSize?this._downloadCachedPhotoSize(n):this.downloadFile(new g.InputPhotoFileLocation({id:e.id,accessHash:e.accessHash,fileReference:e.fileReference,thumbSize:n.type}),{dcId:e.dcId,fileSize:n.size,progressCallback:t.progressCallback})}async _downloadDocument(e,t){if(e instanceof g.MessageMediaDocument&&(e=e.document),!(e instanceof g.Document))return;let n=null;if(t.sizeType){if(n=e.thumbs?this._pickFileSize(e.thumbs,t.sizeType):null,!n&&e.mimeType.startsWith("video/"))return;if(n&&(n instanceof g.PhotoCachedSize||n instanceof g.PhotoStrippedSize))return this._downloadCachedPhotoSize(n)}return this.downloadFile(new g.InputDocumentFileLocation({id:e.id,accessHash:e.accessHash,fileReference:e.fileReference,thumbSize:n?n.type:""}),{fileSize:n?n.size:e.size,progressCallback:t.progressCallback,start:t.start,end:t.end,dcId:e.dcId,workers:t.workers})}_downloadContact(e,t){throw new Error("not implemented")}_downloadWebDocument(e,t){throw new Error("not implemented")}async invoke(e){if("request"!==e.classType)throw new Error("You can only invoke MTProtoRequests");this._lastRequest=(new Date).getTime();let t=0;for(t=0;tPromise.reject(new Error("TIMEOUT")))])}async function E(e,t,n){for(let s=0;s1)for(var n=1;n0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}();t.default=s},function(e,t,n){(function(t){var s=function(){return this||void 0===t?this:t}(),i=s.WebSocket||s.MozWebSocket,a=n(87);function r(e,t){return t?new i(e,t):new i(e)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(r,e,{get:function(){return i[e]}})})),e.exports={w3cwebsocket:i?r:null,version:a}}).call(this,n(44))},function(e,t,n){e.exports=n(88).version},function(e){e.exports=JSON.parse('{"_args":[["websocket@1.0.30","/Users/alexander/dev/telegram-t"]],"_from":"websocket@1.0.30","_id":"websocket@1.0.30","_inBundle":false,"_integrity":"sha512-aO6klgaTdSMkhfl5VVJzD5fm+Srhh5jLYbS15+OiI1sN6h/RU/XW6WN9J1uVIpUKNmsTvT3Hs35XAFjn9NMfOw==","_location":"/websocket","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"websocket@1.0.30","name":"websocket","escapedName":"websocket","rawSpec":"1.0.30","saveSpec":null,"fetchSpec":"1.0.30"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/websocket/-/websocket-1.0.30.tgz","_spec":"1.0.30","_where":"/Users/alexander/dev/telegram-t","author":{"name":"Brian McKelvey","email":"theturtle32@gmail.com","url":"https://github.com/theturtle32"},"browser":"lib/browser.js","bugs":{"url":"https://github.com/theturtle32/WebSocket-Node/issues"},"config":{"verbose":false},"contributors":[{"name":"Iñaki Baz Castillo","email":"ibc@aliax.net","url":"http://dev.sipdoc.net"}],"dependencies":{"debug":"^2.2.0","nan":"^2.14.0","typedarray-to-buffer":"^3.1.5","yaeti":"^0.0.6"},"description":"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.","devDependencies":{"buffer-equal":"^1.0.0","faucet":"^0.0.1","gulp":"^4.0.2","gulp-jshint":"^2.0.4","jshint":"^2.0.0","jshint-stylish":"^2.2.1","tape":"^4.9.1"},"directories":{"lib":"./lib"},"engines":{"node":">=0.10.0"},"homepage":"https://github.com/theturtle32/WebSocket-Node","keywords":["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],"license":"Apache-2.0","main":"index","name":"websocket","repository":{"type":"git","url":"git+https://github.com/theturtle32/WebSocket-Node.git"},"scripts":{"gulp":"gulp","install":"(node-gyp rebuild 2> builderror.log) || (exit 0)","test":"faucet test/unit"},"version":"1.0.30"}')},function(e,t,n){(function(t){const s=n(15),{readBigIntFromBuffer:i,readBufferFromBigInt:a,getByteArray:r,sha1:o,generateRandomBytes:c,modExp:u}=n(8),l=[{fingerprint:[40,85,94,156,117,240,61,22,65,244,169,2,33,107,232,108,2,43,180,195],n:s("24403446649145068056824081744112065346446136066297307473868293895086332508101251964919587745984311372853053253457835208829824428441874946556659953519213382748319518214765985662663680818277989736779506318868003755216402538945900388706898101286548187286716959100102939636333452457308619454821845196109544157601096359148241435922125602449263164512290854366930013825808102403072317738266383237191313714482187326643144603633877219028262697593882410403273959074350849923041765639673335775605842311578109726403165298875058941765362622936097839775380070572921007586266115476975819175319995527916042178582540628652481530373407"),e:65537},{fingerprint:[140,171,9,34,146,246,166,50,10,170,229,247,155,114,28,177,29,106,153,154],n:s("25081407810410225030931722734886059247598515157516470397242545867550116598436968553551465554653745201634977779380884774534457386795922003815072071558370597290368737862981871277312823942822144802509055492512145589734772907225259038113414940384446493111736999668652848440655603157665903721517224934142301456312994547591626081517162758808439979745328030376796953660042629868902013177751703385501412640560275067171555763725421377065095231095517201241069856888933358280729674273422117201596511978645878544308102076746465468955910659145532699238576978901011112475698963666091510778777356966351191806495199073754705289253783"),e:65537},{fingerprint:[243,218,109,239,16,202,176,78,167,8,255,209,120,234,205,112,111,42,91,176],n:s("22347337644621997830323797217583448833849627595286505527328214795712874535417149457567295215523199212899872122674023936713124024124676488204889357563104452250187725437815819680799441376434162907889288526863223004380906766451781702435861040049293189979755757428366240570457372226323943522935844086838355728767565415115131238950994049041950699006558441163206523696546297006014416576123345545601004508537089192869558480948139679182328810531942418921113328804749485349441503927570568778905918696883174575510385552845625481490900659718413892216221539684717773483326240872061786759868040623935592404144262688161923519030977"),e:65537},{fingerprint:[128,80,214,72,77,244,98,7,201,250,37,244,227,51,96,199,182,37,224,113],n:s("24573455207957565047870011785254215390918912369814947541785386299516827003508659346069416840622922416779652050319196701077275060353178142796963682024347858398319926119639265555410256455471016400261630917813337515247954638555325280392998950756512879748873422896798579889820248358636937659872379948616822902110696986481638776226860777480684653756042166610633513404129518040549077551227082262066602286208338952016035637334787564972991208252928951876463555456715923743181359826124083963758009484867346318483872552977652588089928761806897223231500970500186019991032176060579816348322451864584743414550721639495547636008351"),e:65537}],d={};l.forEach(({fingerprint:e,...t})=>{d[i(e.slice(-8),!0,!0)]=t}),e.exports={encrypt:async function(e,n){const r=d[e];if(!r)return;const l=c(235-n.length),f=t.concat([await o(n),n,l]),g=i(f,!1),p=u(g,s(r.e),r.n);return a(p,256,!1)}}}).call(this,n(12).Buffer)},function(e,t){e.exports=class{constructor(e,t=null){this.containerId=null,this.msgId=null,this.request=e,this.data=e.getBytes(),this.after=t,this.result=null,this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}},function(e,t,n){const{Connection:s}=n(41),{ConnectionTCPFull:i}=n(92),{ConnectionTCPAbridged:a}=n(63),{ConnectionTCPObfuscated:r}=n(64);e.exports={Connection:s,ConnectionTCPFull:i,ConnectionTCPAbridged:a,ConnectionTCPObfuscated:r}},function(e,t){},function(e,t,n){(function(t){const s=n(36);e.exports=class{constructor(e,n){if(!t.isBuffer(e)||!t.isBuffer(n)||16!==n.length)throw new Error("Key and iv need to be a buffer");this.cipher=s.createCipheriv("AES-256-CTR",e,n)}encrypt(e){return t.from(this.cipher.update(e))}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),n.d(t,"authFlow",(function(){return u})),n.d(t,"checkAuthorization",(function(){return l}));var s=n(6),i=n.n(s),a=n(21),r=n.n(a),o=n(8),c=n(29);async function u(e,t,n){const s="phoneNumber"in n?await d(e,t,n):await async function(e,t,n){const{apiId:s,apiHash:a}=t,{botAuthToken:r}=n,{user:o}=await e.invoke(new i.a.auth.ImportBotAuthorization({apiId:s,apiHash:a,botAuthToken:r}));return o}(e,t,n);e._log.info("Signed in successfully as",r.a.getDisplayName(s))}async function l(e){try{return await e.invoke(new i.a.updates.GetState),!0}catch(e){return!1}}async function d(e,t,n){let s,a,r,o=!1;for(;;)try{if("function"==typeof n.phoneNumber)try{s=await n.phoneNumber()}catch(s){if("RESTART_AUTH_WITH_QR"===s.message)return f(e,t,n);throw s}else s=n.phoneNumber;const i=await g(e,t,s,n.forceSMS);if(a=i.phoneCodeHash,o=i.isCodeViaApp,"string"!=typeof a)throw new Error("Failed to retrieve phone code hash");break}catch(e){if("function"!=typeof n.phoneNumber)throw e;n.onError(e)}let c,u=!1;for(;;)try{try{r=await n.phoneCode(o)}catch(s){if("RESTART_AUTH"===s.message)return d(e,t,n)}if(!r)throw new Error("Code is empty");const l=await e.invoke(new i.a.auth.SignIn({phoneNumber:s,phoneCodeHash:a,phoneCode:r}));if(l instanceof i.a.auth.AuthorizationSignUpRequired){u=!0,c=l.termsOfService;break}return l.user}catch(s){if("SESSION_PASSWORD_NEEDED"===s.message)return p(e,t,n);n.onError(s)}if(u)for(;;)try{const[t,r]=await n.firstAndLastNames();if(!t)throw new Error("First name is required");const{user:o}=await e.invoke(new i.a.auth.SignUp({phoneNumber:s,phoneCodeHash:a,firstName:t,lastName:r}));return c&&await e.invoke(new i.a.help.AcceptTermsOfService({id:c.id})),o}catch(e){n.onError(e)}return n.onError(new Error("Auth failed")),d(e,t,n)}async function f(e,t,n){let s=!1;const a=(async()=>{for(;!s;){const t=await e.invoke(new i.a.auth.ExportLoginToken({apiId:Number("739222"),apiHash:"60d1e1063c72d4bc4cfdda99e8906f94",exceptIds:[]}));if(!(t instanceof i.a.auth.LoginToken))throw new Error("Unexpected");const{token:s,expires:a}=t;await Promise.race([n.qrCode({token:s,expires:a}),Object(o.sleep)(3e4)])}})(),r=new Promise(t=>{e.addEventHandler(e=>{e instanceof i.a.UpdateLoginToken&&t()},{build:e=>e})});try{await Promise.race([r,a])}catch(s){if("RESTART_AUTH"===s.message)return d(e,t,n);throw s}finally{s=!0}try{const t=await e.invoke(new i.a.auth.ExportLoginToken({apiId:Number("739222"),apiHash:"60d1e1063c72d4bc4cfdda99e8906f94",exceptIds:[]}));if(t instanceof i.a.auth.LoginTokenSuccess&&t.authorization instanceof i.a.auth.Authorization)return t.authorization.user;if(t instanceof i.a.auth.LoginTokenMigrateTo){await e._switchDC(t.dcId);const n=await e.invoke(new i.a.auth.ImportLoginToken({token:t.token}));if(n instanceof i.a.auth.LoginTokenSuccess&&n.authorization instanceof i.a.auth.Authorization)return n.authorization.user}}catch(s){if("SESSION_PASSWORD_NEEDED"===s.message)return p(e,t,n);throw s}throw void 0}async function g(e,t,n,s=!1){try{const{apiId:a,apiHash:r}=t,o=await e.invoke(new i.a.auth.SendCode({phoneNumber:n,apiId:a,apiHash:r,settings:new i.a.CodeSettings}));if(!s||o.type instanceof i.a.auth.SentCodeTypeSms)return{phoneCodeHash:o.phoneCodeHash,isCodeViaApp:o.type instanceof i.a.auth.SentCodeTypeApp};const c=await e.invoke(new i.a.auth.ResendCode({phoneNumber:n,phoneCodeHash:o.phoneCodeHash}));return{phoneCodeHash:c.phoneCodeHash,isCodeViaApp:c.type instanceof i.a.auth.SentCodeTypeApp}}catch(i){if("AUTH_RESTART"===i.message)return g(e,t,n,s);throw i}}async function p(e,t,n){for(;;)try{const t=await e.invoke(new i.a.account.GetPassword),s=await n.password(t.hint);if(!s)throw new Error("Password is empty");const a=await Object(c.computeCheck)(t,s),{user:r}=await e.invoke(new i.a.auth.CheckPassword({password:a}));return r}catch(e){n.onError(e)}}},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"downloadFile",(function(){return c}));var s=n(6),i=n.n(s),a=n(21),r=n(8);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}async function c(t,n,s){let{partSizeKb:o,fileSize:c,workers:l=1,end:d}=s;const{dcId:f,progressCallback:g,start:p=0}=s;d=d&&d{try{const s=await Promise.race([await y.send(new i.a.upload.GetFile({location:n,offset:w,limit:e,precise:t||void 0})),Object(r.sleep)(15e3).then(()=>Promise.reject(new Error("REQUEST_TIMEOUT")))]);if(g){if(g.isCanceled)throw new Error("USER_CANCELED");A+=1/m,g(A)}return!d&&s.bytes.lengthd)break}const I=(await Promise.all(_)).filter(Boolean),P=d?d+1-p:void 0;return e.concat(I,P)}class u{constructor(e){this.maxWorkers=e,o(this,"deferred",void 0),o(this,"activeWorkers",0)}requestWorker(){return this.activeWorkers++,this.activeWorkers>this.maxWorkers?(this.deferred=function(){let e;return{promise:new Promise(t=>{e=t}),resolve:e}}(),this.deferred.promise):Promise.resolve()}releaseWorker(){this.activeWorkers--,this.deferred&&this.activeWorkers<=this.maxWorkers&&this.deferred.resolve()}}}.call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"uploadFile",(function(){return o}));var s=n(6),i=n.n(s),a=n(8),r=n(21);async function o(t,n){const{file:s,onProgress:o}=n;let{workers:c}=n;const{name:u,size:l}=s,d=Object(a.readBigIntFromBuffer)(Object(a.generateRandomBytes)(8),!0,!0),f=l>10485760,g=1024*Object(r.getAppropriatedPartSize)(l),p=Math.floor((l+g-1)/g),h=e.from(await function(e){return new Response(e).arrayBuffer()}(s)),m=await t._borrowExportedSender(t.session.dcId);c&&l||(c=1),c>=p&&(c=p);let y=0;o&&o(y);for(let e=0;ep&&(n=p);for(let s=e;s{if(await m.send(f?new i.a.upload.SaveBigFilePart({fileId:d,filePart:s,fileTotalParts:p,bytes:e}):new i.a.upload.SaveFilePart({fileId:d,filePart:s,bytes:e})),o){if(o.isCanceled)throw new Error("USER_CANCELED");y+=1/p,o(y)}})())}try{await Promise.race([await Promise.all(t),Object(a.sleep)(15e3*c).then(()=>Promise.reject(new Error("TIMEOUT")))])}catch(t){if("TIMEOUT"===t.message){console.warn("Upload timeout. Retrying..."),e-=c;continue}throw t}}return f?new i.a.InputFileBig({id:d,parts:p,name:u}):new i.a.InputFile({id:d,parts:p,name:u,md5Checksum:""})}}.call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"updateTwoFaSettings",(function(){return u}));var s=n(6),i=n.n(s),a=n(8),r=n(29),o=n(27),c=n.n(o);async function u(t,{isCheckPassword:n,currentPassword:s,newPassword:o,hint:u="",email:l,emailCodeCallback:d,onEmailCodeError:f}){if(!o&&!s)throw new Error("Neither `currentPassword` nor `newPassword` is present");if(l&&(!d||!f))throw new Error("`email` present without `emailCodeCallback` and `onEmailCodeError`");const g=await t.invoke(new i.a.account.GetPassword);g.newAlgo instanceof i.a.PasswordKdfAlgoUnknown||(g.newAlgo.salt1=e.concat([g.newAlgo.salt1,Object(a.generateRandomBytes)(32)])),!g.hasPassword&&s&&(s=void 0);const p=s?await Object(r.computeCheck)(g,s):new i.a.InputCheckPasswordEmpty;if(n)await t.invoke(new i.a.auth.CheckPassword({password:p}));else try{await t.invoke(new i.a.account.UpdatePasswordSettings({password:p,newSettings:new i.a.account.PasswordInputSettings({newAlgo:g.newAlgo,newPasswordHash:o?await Object(r.computeDigest)(g.newAlgo,o):e.alloc(0),hint:u,email:l,newSecureSettings:void 0})}))}catch(e){if(!(e instanceof c.a.EmailUnconfirmedError))throw e;for(;;)try{const n=await d(e.codeLength);if(!n)throw new Error("Code is empty");await t.invoke(new i.a.account.ConfirmPasswordEmail({code:n}));break}catch(e){f(e)}}}}.call(this,n(12).Buffer)},function(e,t){e.exports="0.0.2"},function(e,t,n){const s=n(100),i=n(101);class a extends Error{}e.exports={NewMessage:s,StopPropagation:a,Raw:i}},function(e,t){},function(e,t,n){const{EventBuilder:s}=n(102);e.exports=class extends s{constructor(e={types:null,func:null}){super(),e.types?this.types=e.types:this.types=!0}build(e,t=null){return e}}},function(e,t){e.exports={EventBuilder:class{constructor(e={chats:null,blacklistChats:null,func:null}){this.chats=e.chats,this.blacklistChats=Boolean(e.blacklistChats),this.resolved=!1,this.func=e.func}build(e,t=null){}},EventCommon:class{}}},function(e,t,n){const s=n(30),i=n(104),a=n(105),r=n(106),o=n(107);e.exports={Memory:s,StringSession:i,CacheApiSession:a,LocalStorageSession:r,IdbSession:o}},function(e,t,n){(function(t){const s=n(30),i=n(32),a=n(25);class r extends s{constructor(e=null){if(super(),e){if("1"!==e[0])throw new Error("Not a valid string");e=e.slice(1);const t=r.decode(e),n=new a(t);this._dcId=n.read(1).readUInt8(0);const s=n.read(2).readInt16BE(0);this._serverAddress=String(n.read(s)),this._port=n.read(2).readInt16BE(0),this._key=n.read(-1)}}static encode(e){return e.toString("base64")}static decode(e){return t.from(e,"base64")}async load(){this._key&&(this._authKey=new i,await this._authKey.setKey(this._key))}save(){if(!this.authKey)return"";const e=t.from([this.dcId]),n=t.from(this.serverAddress),s=t.alloc(2);s.writeInt16BE(n.length,0);const i=t.alloc(2);return i.writeInt16BE(this.port,0),"1"+r.encode(t.concat([e,s,n,i,this.authKey.getKey()]))}getAuthKey(e){if(!e||e===this.dcId)return this.authKey}setAuthKey(e,t){t&&t!==this.dcId||(this.authKey=e)}}e.exports=r}).call(this,n(12).Buffer)},function(e,t,n){const s=n(42);e.exports=class extends s{async _delete(){const e=new Request(this._storageKey);return(await self.caches.open("GramJs")).delete(e)}async _fetchFromCache(){const e=new Request(this._storageKey),t=await self.caches.open("GramJs"),n=await t.match(e);return n?n.text():null}async _saveToCache(e){const t=new Request(this._storageKey),n=new Response(e);return(await self.caches.open("GramJs")).put(t,n)}}},function(e,t,n){const s=n(42);e.exports=class extends s{async _delete(){return localStorage.removeItem(this._storageKey)}async _fetchFromCache(e){return localStorage.getItem(this._storageKey)}async _saveToCache(e,t){return localStorage.setItem(this._storageKey,t)}}},function(e,t,n){const s=n(108),i=n(42);e.exports=class extends i{async _delete(){return s.del("GramJs:"+this._storageKey)}async _fetchFromCache(){return s.get("GramJs:"+this._storageKey)}async _saveToCache(e){return s.set("GramJs:"+this._storageKey,e)}}},function(e,t,n){"use strict";function s(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function i(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const i=s(n);return(e,n)=>i.then(s=>n(s.transaction(t,e).objectStore(t)))}let a;function r(){return a||(a=i("keyval-store","keyval")),a}function o(e,t=r()){return t("readonly",t=>s(t.get(e)))}function c(e,t,n=r()){return n("readwrite",n=>(n.put(t,e),s(n.transaction)))}function u(e,t=r()){return t("readwrite",t=>(e.forEach(e=>t.put(e[1],e[0])),s(t.transaction)))}function l(e,t=r()){return t("readonly",t=>Promise.all(e.map(e=>s(t.get(e)))))}function d(e,t,n=r()){return n("readwrite",n=>new Promise((i,a)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),i(s(n.transaction))}catch(e){a(e)}}}))}function f(e,t=r()){return t("readwrite",t=>(t.delete(e),s(t.transaction)))}function g(e=r()){return e("readwrite",e=>(e.clear(),s(e.transaction)))}function p(e,t){return e("readonly",e=>(e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},s(e.transaction)))}function h(e=r()){const t=[];return p(e,e=>t.push(e.key)).then(()=>t)}function m(e=r()){const t=[];return p(e,e=>t.push(e.value)).then(()=>t)}function y(e=r()){const t=[];return p(e,e=>t.push([e.key,e.value])).then(()=>t)}n.r(t),n.d(t,"clear",(function(){return g})),n.d(t,"createStore",(function(){return i})),n.d(t,"del",(function(){return f})),n.d(t,"entries",(function(){return y})),n.d(t,"get",(function(){return o})),n.d(t,"getMany",(function(){return l})),n.d(t,"keys",(function(){return h})),n.d(t,"promisifyRequest",(function(){return s})),n.d(t,"set",(function(){return c})),n.d(t,"setMany",(function(){return u})),n.d(t,"update",(function(){return d})),n.d(t,"values",(function(){return m}))},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"destroy",(function(){return g.a})),n.d(s,"disconnect",(function(){return g.b})),n.d(s,"downloadMedia",(function(){return g.c})),n.d(s,"fetchCurrentUser",(function(){return g.d})),n.d(s,"provideAuthPhoneNumber",(function(){return o.l})),n.d(s,"provideAuthCode",(function(){return o.j})),n.d(s,"provideAuthPassword",(function(){return o.k})),n.d(s,"provideAuthRegistration",(function(){return o.m})),n.d(s,"restartAuth",(function(){return o.n})),n.d(s,"restartAuthWithQr",(function(){return o.o})),n.d(s,"fetchChats",(function(){return c.j})),n.d(s,"fetchFullChat",(function(){return c.k})),n.d(s,"searchChats",(function(){return c.w})),n.d(s,"requestChatUpdate",(function(){return c.u})),n.d(s,"saveDraft",(function(){return c.v})),n.d(s,"clearDraft",(function(){return c.a})),n.d(s,"fetchChat",(function(){return c.h})),n.d(s,"updateChatMutedState",(function(){return c.H})),n.d(s,"createChannel",(function(){return c.b})),n.d(s,"joinChannel",(function(){return c.q})),n.d(s,"leaveChannel",(function(){return c.r})),n.d(s,"deleteChannel",(function(){return c.d})),n.d(s,"createGroupChat",(function(){return c.c})),n.d(s,"editChatPhoto",(function(){return c.g})),n.d(s,"toggleChatPinned",(function(){return c.z})),n.d(s,"toggleChatArchived",(function(){return c.y})),n.d(s,"toggleDialogUnread",(function(){return c.A})),n.d(s,"fetchChatFolders",(function(){return c.i})),n.d(s,"editChatFolder",(function(){return c.f})),n.d(s,"deleteChatFolder",(function(){return c.e})),n.d(s,"fetchRecommendedChatFolders",(function(){return c.n})),n.d(s,"getChatByUsername",(function(){return c.o})),n.d(s,"togglePreHistoryHidden",(function(){return c.B})),n.d(s,"updateChatDefaultBannedRights",(function(){return c.F})),n.d(s,"updateChatMemberBannedRights",(function(){return c.G})),n.d(s,"updateChatTitle",(function(){return c.I})),n.d(s,"updateChatAbout",(function(){return c.D})),n.d(s,"toggleSignatures",(function(){return c.C})),n.d(s,"updateChatAdmin",(function(){return c.E})),n.d(s,"fetchGroupsForDiscussion",(function(){return c.l})),n.d(s,"setDiscussionGroup",(function(){return c.x})),n.d(s,"migrateChat",(function(){return c.s})),n.d(s,"openChatByInvite",(function(){return c.t})),n.d(s,"fetchMembers",(function(){return c.m})),n.d(s,"fetchMessages",(function(){return u.g})),n.d(s,"fetchMessage",(function(){return u.e})),n.d(s,"sendMessage",(function(){return u.v})),n.d(s,"pinMessage",(function(){return u.q})),n.d(s,"unpinAllMessages",(function(){return u.y})),n.d(s,"deleteMessages",(function(){return u.b})),n.d(s,"deleteHistory",(function(){return u.a})),n.d(s,"markMessageListRead",(function(){return u.o})),n.d(s,"markMessagesRead",(function(){return u.p})),n.d(s,"requestThreadInfoUpdate",(function(){return u.r})),n.d(s,"searchMessagesLocal",(function(){return u.u})),n.d(s,"searchMessagesGlobal",(function(){return u.t})),n.d(s,"fetchWebPagePreview",(function(){return u.j})),n.d(s,"editMessage",(function(){return u.d})),n.d(s,"forwardMessages",(function(){return u.l})),n.d(s,"loadPollOptionResults",(function(){return u.n})),n.d(s,"sendPollVote",(function(){return u.w})),n.d(s,"findFirstMessageIdAfterDate",(function(){return u.k})),n.d(s,"fetchPinnedMessages",(function(){return u.h})),n.d(s,"fetchScheduledHistory",(function(){return u.i})),n.d(s,"sendScheduledMessages",(function(){return u.x})),n.d(s,"rescheduleMessage",(function(){return u.s})),n.d(s,"deleteScheduledMessages",(function(){return u.c})),n.d(s,"fetchMessageLink",(function(){return u.f})),n.d(s,"fetchFullUser",(function(){return v})),n.d(s,"fetchNearestCountry",(function(){return A})),n.d(s,"fetchTopUsers",(function(){return I})),n.d(s,"fetchContactList",(function(){return P})),n.d(s,"fetchUsers",(function(){return S})),n.d(s,"updateContact",(function(){return C})),n.d(s,"deleteUser",(function(){return k})),n.d(s,"fetchProfilePhotos",(function(){return M})),n.d(s,"fetchStickerSets",(function(){return B})),n.d(s,"fetchRecentStickers",(function(){return D})),n.d(s,"fetchFavoriteStickers",(function(){return x})),n.d(s,"fetchFeaturedStickers",(function(){return j})),n.d(s,"faveSticker",(function(){return N})),n.d(s,"fetchStickers",(function(){return F})),n.d(s,"fetchSavedGifs",(function(){return q})),n.d(s,"searchStickers",(function(){return L})),n.d(s,"installStickerSet",(function(){return H})),n.d(s,"uninstallStickerSet",(function(){return z})),n.d(s,"searchGifs",(function(){return K})),n.d(s,"fetchAnimatedEmojis",(function(){return V})),n.d(s,"fetchStickersForEmoji",(function(){return G})),n.d(s,"checkChatUsername",(function(){return J})),n.d(s,"setChatUsername",(function(){return Z})),n.d(s,"updatePrivateLink",(function(){return Y})),n.d(s,"updateProfile",(function(){return fe})),n.d(s,"checkUsername",(function(){return ge})),n.d(s,"updateUsername",(function(){return pe})),n.d(s,"fetchBlockedContacts",(function(){return _e})),n.d(s,"blockContact",(function(){return we})),n.d(s,"unblockContact",(function(){return ve})),n.d(s,"updateProfilePhoto",(function(){return he})),n.d(s,"uploadProfilePhoto",(function(){return me})),n.d(s,"fetchWallpapers",(function(){return ye})),n.d(s,"uploadWallpaper",(function(){return be})),n.d(s,"fetchAuthorizations",(function(){return Ae})),n.d(s,"terminateAuthorization",(function(){return Ie})),n.d(s,"terminateAllAuthorizations",(function(){return Pe})),n.d(s,"loadNotificationsSettings",(function(){return Se})),n.d(s,"updateContactSignUpNotification",(function(){return Ce})),n.d(s,"updateNotificationSettings",(function(){return ke})),n.d(s,"fetchLanguages",(function(){return Me})),n.d(s,"fetchLangPack",(function(){return Ee})),n.d(s,"fetchPrivacySettings",(function(){return Re})),n.d(s,"setPrivacySettings",(function(){return Te})),n.d(s,"registerDevice",(function(){return Oe})),n.d(s,"unregisterDevice",(function(){return Ue})),n.d(s,"getPasswordInfo",(function(){return te})),n.d(s,"checkPassword",(function(){return se})),n.d(s,"clearPassword",(function(){return ie})),n.d(s,"updatePassword",(function(){return ae})),n.d(s,"updateRecoveryEmail",(function(){return re})),n.d(s,"provideRecoveryEmailCode",(function(){return oe})),n.d(s,"answerCallbackButton",(function(){return De.a})),n.d(s,"validateRequestedInfo",(function(){return je})),n.d(s,"sendPaymentForm",(function(){return Ne})),n.d(s,"getPaymentForm",(function(){return Fe})),n.d(s,"getReceipt",(function(){return Ve}));var i=n(4),a=n(28),r=n(26),o=n(17),c=n(7),u=n(10),l=n(15),d=n.n(l),f=n(0),g=n(1),p=n(2),h=n(13),m=n(3),y=n(19),b=n(5),_=n(16);let w;async function v({id:e,accessHash:t}){const n=Object(p.g)(e,t);if(!(n instanceof f.Api.InputUser))return;const s=await Object(g.g)(new f.Api.users.GetFullUser({id:n}));if(!s)return;const i=Object(h.b)(s);w({"@type":"updateUser",id:e,user:{fullInfo:i.fullInfo}})}async function A(){const e=await Object(g.g)(new f.Api.help.GetNearestDc);return e?e.country:void 0}async function I({hash:e=0}){const t=await Object(g.g)(new f.Api.contacts.GetTopPeers({hash:e,correspondents:!0}));if(!(t instanceof f.Api.contacts.TopPeers))return;const n=t.users.map(h.a).filter(e=>!!e&&!e.isSelf),s=n.map(({id:e})=>e);return{hash:Object(p.q)(s),ids:s,users:n}}async function P({hash:e=0}){const t=await Object(g.g)(new f.Api.contacts.GetContacts({hash:e}));if(t&&!(t instanceof f.Api.contacts.ContactsNotModified))return t.users.forEach(e=>{e instanceof f.Api.User&&(b.a.users[e.id]=e)}),{hash:Object(p.q)([t.savedCount,...t.contacts.map(({userId:e})=>e)]),users:t.users.map(h.a).filter(Boolean),chats:t.users.map(e=>Object(m.d)(e)).filter(Boolean)}}async function S({users:e}){const t=await Object(g.g)(new f.Api.users.GetUsers({id:e.map(({id:e,accessHash:t})=>Object(p.i)(e,t))}));if(t&&t.length)return t.forEach(e=>{e instanceof f.Api.User&&(b.a.users[e.id]=e)}),t.map(h.a).filter(Boolean)}function C({phone:e,firstName:t,lastName:n}){return Object(g.g)(new f.Api.contacts.ImportContacts({contacts:[Object(p.e)({phone:e||"",firstName:t||"",lastName:n||""})]}))}async function k({id:e,accessHash:t}){const n=Object(p.g)(e,t);if(!(n instanceof f.Api.InputUser))return;await Object(g.g)(new f.Api.contacts.DeleteContacts({id:[n]}))&&w({"@type":"deleteUser",id:e})}async function M(e,t){if(e){const{id:t,accessHash:n}=e,s=await Object(g.g)(new f.Api.photos.GetUserPhotos({userId:Object(p.g)(t,n),limit:i.t,offset:0,maxId:d()("0")}));if(!s)return;return function(e){e.photos.forEach(_.b)}(s),{photos:s.photos.filter(e=>e instanceof f.Api.Photo).map(y.a)}}const n=await Object(u.u)({chatOrUser:t,type:"profilePhoto",limit:i.t});if(!n)return;const{messages:s,users:a}=n;return{photos:s.map(e=>e.content.action.photo).filter(Boolean),users:a}}var E=n(22),R=n(9);let O,U,T;async function B({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetAllStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.AllStickersNotModified))return t.sets.forEach(e=>{e.thumb&&(b.a.stickerSets[String(e.id)]=e)}),{hash:t.hash,sets:t.sets.map(E.b)}}async function D({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetRecentStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.RecentStickersNotModified))return{hash:t.hash,stickers:W(t.stickers)}}async function x({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetFavedStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.FavedStickersNotModified))return{hash:t.hash,stickers:W(t.stickers)}}async function j({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetFeaturedStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.FeaturedStickersNotModified))return{hash:t.hash,sets:t.sets.map(E.c)}}async function N({sticker:e,unfave:t}){const n=new f.Api.messages.FaveSticker({id:Object(p.f)(e),unfave:t});await Object(g.g)(n)&&O({"@type":"updateFavoriteStickers"})}async function F({stickerSetId:e,accessHash:t}){const n=await Object(g.g)(new f.Api.messages.GetStickerSet({stickerset:Object(p.l)(e,t)}));var s;if(n)return{set:Object(E.b)(n.set),stickers:W(n.documents),packs:(s=n.packs,s.reduce((e,{emoticon:t,documents:n})=>(e[t]=n.map(e=>Object(E.a)(b.a.documents[String(e)])).filter(Boolean),e),{}))}}async function V(){const e=await Object(g.g)(new f.Api.messages.GetStickerSet({stickerset:new f.Api.InputStickerSetAnimatedEmoji}));if(e)return{set:Object(E.b)(e.set),stickers:W(e.documents)}}async function L({query:e,hash:t}){const n=await Object(g.g)(new f.Api.messages.SearchStickerSets({q:e,hash:t}));if(n&&!(n instanceof f.Api.messages.FoundStickerSetsNotModified))return{hash:n.hash,sets:n.sets.map(E.c)}}async function q({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetSavedGifs({hash:e}));if(t&&!(t instanceof f.Api.messages.SavedGifsNotModified))return{hash:t.hash,gifs:$(t.gifs)}}async function H({stickerSetId:e,accessHash:t}){await Object(g.g)(new f.Api.messages.InstallStickerSet({stickerset:Object(p.l)(e,t)}))&&O({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:Date.now()}})}async function z({stickerSetId:e,accessHash:t}){await Object(g.g)(new f.Api.messages.UninstallStickerSet({stickerset:Object(p.l)(e,t)}))&&O({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:void 0}})}async function K({query:e,offset:t=""}){if(!U){const e=await Object(g.g)(new f.Api.help.GetConfig);if(!e)return;const t=await Object(g.g)(new f.Api.contacts.ResolveUsername({username:e.gifSearchUsername}));if(!(t&&t.users[0]instanceof f.Api.User))return;U=new f.Api.InputUser({userId:t.peer.userId,accessHash:t.users[0].accessHash})}const n=await Object(g.g)(new f.Api.messages.GetInlineBotResults({bot:U,peer:new f.Api.InputPeerEmpty,query:e,offset:t}));if(!n)return;const s=n.results.map(e=>{if(e instanceof f.Api.BotInlineMediaResult)return e.document}).filter(Boolean);return{nextOffset:n.nextOffset,gifs:$(s)}}async function G({emoji:e,hash:t=0}){const n=await Object(g.g)(new f.Api.messages.GetStickers({emoticon:e,hash:t}));if(n&&!(n instanceof f.Api.messages.StickersNotModified))return{stickers:W(n.stickers),hash:n.hash}}function W(e){return e.map(e=>{if(e instanceof f.Api.Document){const t=Object(E.a)(e);if(t)return b.a.documents[String(e.id)]=e,t}}).filter(Boolean)}function $(e){return e.map(e=>{if(e instanceof f.Api.Document){const t=Object(R.m)(e);if(t)return b.a.documents[String(e.id)]=e,t}}).filter(Boolean)}async function J({username:e}){try{return await Object(g.g)(new f.Api.channels.CheckUsername({channel:new f.Api.InputChannelEmpty,username:e}),void 0,!0)}catch(e){return!1}}async function Z({chat:e,username:t}){await Object(g.g)(new f.Api.channels.UpdateUsername({channel:Object(p.g)(e.id,e.accessHash),username:t}))&&T({"@type":"updateChat",id:e.id,chat:{username:t}})}async function Y({chat:e}){const t=await Object(g.g)(new f.Api.messages.ExportChatInvite({peer:Object(p.i)(e.id,e.accessHash)}));t&&t instanceof f.Api.ChatInviteExported&&T({"@type":"updateChatFullInfo",id:e.id,fullInfo:{inviteLink:t.link}})}const Q={EMAIL_UNCONFIRMED:"Email unconfirmed",EMAIL_HASH_EXPIRED:"Email hash expired",NEW_SALT_INVALID:"The new salt is invalid",NEW_SETTINGS_INVALID:"The new password settings are invalid",CODE_INVALID:"Invalid Code",PASSWORD_HASH_INVALID:"Invalid Password"},X={};let ee;async function te(){const e=await Object(g.g)(new f.Api.account.GetPassword);if(!e)return;const{hint:t,hasPassword:n}=e;return{hint:t,hasPassword:n}}function ne(e){return ee({"@type":"updateTwoFaStateWaitCode",length:e}),new Promise((e,t)=>{X.resolve=e,X.reject=t})}async function se(e){try{return await Object(g.h)({isCheckPassword:!0,currentPassword:e}),!0}catch(e){return ce(e),!1}}async function ie(e){try{return await Object(g.h)({currentPassword:e}),!0}catch(e){return ce(e),!1}}async function ae(e,t,n,s){try{return await Object(g.h)({currentPassword:e,newPassword:t,hint:n,email:s,emailCodeCallback:ne,onEmailCodeError:ce}),!0}catch(e){return ce(e),!1}}async function re(e,t){try{return await Object(g.h)({currentPassword:e,newPassword:e,email:t,emailCodeCallback:ne,onEmailCodeError:ce}),!0}catch(e){return ce(e),!1}}function oe(e){X.resolve(e)}function ce(e){let t;if(e instanceof f.errors.FloodWaitError){const n=Math.ceil(Number(e.seconds)/60/60);t="Too many attempts. Try again in "+(n>1?n+" hours":"an hour")}else t=Q[e.message];t||(t="Unexpected Error",i.f&&console.error(e)),ee({"@type":"updateTwoFaError",message:t})}var ue=n(24),le=n(18),de=n(14);function fe({firstName:e,lastName:t,about:n}){return Object(g.g)(new f.Api.account.UpdateProfile({firstName:e||"",lastName:t||"",about:n||""}))}function ge(e){return Object(g.g)(new f.Api.account.CheckUsername({username:e}))}function pe(e){return Object(g.g)(new f.Api.account.UpdateUsername({username:e}))}async function he(e){const t=await Object(g.i)(e);return Object(g.g)(new f.Api.photos.UploadProfilePhoto({file:t}))}async function me(e){const t=await Object(g.i)(e);await Object(g.g)(new f.Api.photos.UploadProfilePhoto({file:t}))}async function ye(e){const t=await Object(g.g)(new f.Api.account.GetWallPapers({hash:e}));if(!t||t instanceof f.Api.account.WallPapersNotModified)return;const n=t.wallpapers.filter(e=>e instanceof f.Api.WallPaper&&e.document instanceof f.Api.Document&&(!e.pattern&&"application/x-tgwallpattern"!==e.document.mimeType));return n.forEach(e=>{b.a.documents[String(e.document.id)]=e.document}),{hash:t.hash,wallpapers:n.map(ue.b).filter(Boolean)}}async function be(e){const t=await Object(g.i)(e),n=await Object(g.g)(new f.Api.account.UploadWallPaper({file:t,mimeType:e.type,settings:new f.Api.WallPaperSettings}));if(!(n&&n instanceof f.Api.WallPaper))return;const s=Object(ue.b)(n);return s?(b.a.documents[String(n.document.id)]=n.document,{wallpaper:s}):void 0}async function _e(){const e=await Object(g.g)(new f.Api.contacts.GetBlocked({limit:i.e}));if(e)return Be(e),{users:e.users.map(h.a).filter(Boolean),chats:e.chats.map(e=>Object(m.d)(e,void 0,!0)).filter(Boolean),blockedIds:e.blocked.map(e=>Object(m.k)(e.peerId)),totalCount:e instanceof f.Api.contacts.BlockedSlice?e.count:e.blocked.length}}function we(e){return Object(g.g)(new f.Api.contacts.Block({id:Object(p.o)(e)}))}function ve(e,t){return Object(g.g)(new f.Api.contacts.Unblock({id:Object(p.i)(e,t)}))}async function Ae(){const e=await Object(g.g)(new f.Api.account.GetAuthorizations);if(e)return e.authorizations.map(ue.a)}function Ie(e){return Object(g.g)(new f.Api.account.ResetAuthorization({hash:d()(e)}))}function Pe(){return Object(g.g)(new f.Api.auth.ResetAuthorizations)}async function Se(){const[e,t,n,s]=await Promise.all([Object(g.g)(new f.Api.account.GetContactSignUpNotification),Object(g.g)(new f.Api.account.GetNotifySettings({peer:new f.Api.InputNotifyUsers})),Object(g.g)(new f.Api.account.GetNotifySettings({peer:new f.Api.InputNotifyChats})),Object(g.g)(new f.Api.account.GetNotifySettings({peer:new f.Api.InputNotifyBroadcasts}))]);if(!t||!n||!s)return!1;const{silent:i,muteUntil:a,showPreviews:r}=t,{silent:o,muteUntil:c,showPreviews:u}=n,{silent:l,muteUntil:d,showPreviews:p}=s;return{hasContactJoinedNotifications:!e,hasPrivateChatsNotifications:!(i||"number"==typeof a&&Date.now()<1e3*a),hasPrivateChatsMessagePreview:r,hasGroupNotifications:!(o||"number"==typeof c&&Date.now()<1e3*c),hasGroupMessagePreview:u,hasBroadcastNotifications:!(l||"number"==typeof d&&Date.now()<1e3*d),hasBroadcastMessagePreview:p}}function Ce(e){return Object(g.g)(new f.Api.account.SetContactSignUpNotification({silent:e}))}function ke(e,{isSilent:t,isShowPreviews:n}){let s;s="contact"===e?new f.Api.InputNotifyUsers:"group"===e?new f.Api.InputNotifyChats:new f.Api.InputNotifyBroadcasts;const i={showPreviews:n,silent:t,muteUntil:t?2**31-1:void 0};return Object(g.g)(new f.Api.account.UpdateNotifySettings({peer:s,settings:new f.Api.InputPeerNotifySettings(i)}))}async function Me(){const e=await Object(g.g)(new f.Api.langpack.GetLanguages({langPack:i.h}));if(e)return e.map(le.b)}async function Ee({sourceLangPacks:e,langCode:t}){const n=(await Promise.all(e.map(e=>Object(g.g)(new f.Api.langpack.GetLangPack({langPack:e,langCode:t}))))).filter(Boolean).map(e=>Object(de.a)(e.strings.map(le.b),"key"));if(n.length)return{langPack:Object.assign({},...n.reverse())}}async function Re(e){const t=Object(p.k)(e),n=await Object(g.g)(new f.Api.account.GetPrivacy({key:t}));if(n)return Be(n),Object(ue.d)(n.rules)}function Oe(e){const t=Object(g.e)().session.getAuthKey().getKey();return Object(g.g)(new f.Api.account.RegisterDevice({tokenType:10,secret:t,appSandbox:!1,otherUids:[],token:e}))}function Ue(e){return Object(g.g)(new f.Api.account.UnregisterDevice({tokenType:10,otherUids:[],token:e}))}async function Te(e,t){const n=Object(p.k)(e),s=[];switch(t.allowedUsers&&s.push(new f.Api.InputPrivacyValueAllowUsers({users:t.allowedUsers.map(({id:e,accessHash:t})=>Object(p.i)(e,t))})),t.allowedChats&&s.push(new f.Api.InputPrivacyValueAllowChatParticipants({chats:t.allowedChats.map(({id:e})=>-e)})),t.blockedUsers&&s.push(new f.Api.InputPrivacyValueDisallowUsers({users:t.blockedUsers.map(({id:e,accessHash:t})=>Object(p.i)(e,t))})),t.blockedChats&&s.push(new f.Api.InputPrivacyValueDisallowChatParticipants({chats:t.blockedChats.map(({id:e})=>-e)})),t.visibility){case"everybody":s.push(new f.Api.InputPrivacyValueAllowAll);break;case"contacts":s.push(new f.Api.InputPrivacyValueAllowContacts);break;case"nonContacts":s.push(new f.Api.InputPrivacyValueDisallowContacts);break;case"nobody":s.push(new f.Api.InputPrivacyValueDisallowAll)}const i=await Object(g.g)(new f.Api.account.SetPrivacy({key:n,rules:s}));if(i)return Be(i),Object(ue.d)(i.rules)}function Be(e){e.users.forEach(e=>{e instanceof f.Api.User&&(b.a.users[e.id]=e)}),e.chats.forEach(e=>{(e instanceof f.Api.Chat||e instanceof f.Api.Channel)&&(b.a.chats[e.id]=e)})}var De=n(72);function xe(e){if(e)return Object.values(e).map(e=>({id:e.id,title:e.title,amount:e.prices.reduce((e,t)=>e+Number(t.amount.value),0),prices:e.prices.map(({label:e,amount:t})=>({label:e,amount:Number(t.value)}))}))}async function je({messageId:e,requestInfo:t,shouldSave:n}){const s=await Object(g.g)(new f.Api.payments.ValidateRequestedInfo({msgId:e,save:n||void 0,info:Object(p.p)(t)}));if(!s)return;const{id:i,shippingOptions:a}=s;return i?{id:i,shippingOptions:xe(a)}:void 0}function Ne({messageId:e,requestedInfoId:t,shippingOptionId:n,credentials:s}){return Object(g.g)(new f.Api.payments.SendPaymentForm({msgId:e,requestedInfoId:t,shippingOptionId:n,credentials:new f.Api.InputPaymentCredentials({save:s.save,data:new f.Api.DataJSON({data:JSON.stringify(s.data)})})}),!0)}async function Fe({messageId:e}){const t=await Object(g.g)(new f.Api.payments.GetPaymentForm({msgId:e}));if(t)return function(e){const{canSaveCredentials:t,passwordMissing:n,providerId:s,nativeProvider:i,nativeParams:a,savedInfo:r,invoice:o}=e,{test:c,nameRequested:u,phoneRequested:l,emailRequested:d,shippingAddressRequested:f,flexible:g,phoneToProvider:p,emailToProvider:h,currency:m,prices:y}=o,b=y.map(({label:e,amount:t})=>({label:e,amount:Number(t.value)})),_=a?JSON.parse(a.data):{};return{canSaveCredentials:t,passwordMissing:n,providerId:s,nativeProvider:i,savedInfo:r,invoice:{test:c,nameRequested:u,phoneRequested:l,emailRequested:d,shippingAddressRequested:f,flexible:g,phoneToProvider:p,emailToProvider:h,currency:m,prices:b},nativeParams:{needCardholderName:_.need_cardholder_name,needCountry:_.need_country,needZip:_.need_zip,publishableKey:_.publishable_key}}}(t)}async function Ve(e){const t=await Object(g.g)(new f.Api.payments.GetPaymentReceipt({msgId:e}));if(t)return function(e){const{invoice:t,info:n,shipping:s,currency:i,totalAmount:a,credentialsTitle:r}=e,{shippingAddress:o,phone:c,name:u}=n||{},{prices:l}=t,d=l.map(({label:e,amount:t})=>({label:e,amount:Number(t.value)}));let f,g;return s&&(f=s.prices.map(({label:e,amount:t})=>({label:e,amount:Number(t.value)})),g=s.title),{currency:i,prices:d,info:{shippingAddress:o,phone:c,name:u},totalAmount:Number(a.value),credentialsTitle:r,shippingPrices:f,shippingMethod:g}}(t)}let Le;async function qe(e,t=""){Le=e,Object(r.a)(We),Object(o.a)(We),Object(c.p)(We),Object(u.m)(We),function(e){w=e}(We),function(e){O=e}(We),function(e){T=e}(We),function(e){ee=e}(We),await Object(g.f)(t,We)}const He=Object(a.c)((function(e){if(!Ge||e!==Ke)return;const t=Ge;Ge=void 0,t.forEach(Le)}));let ze,Ke,Ge;function We(e){Ge?Ge.push(e):Ge=[e],ze&&!i.b.has(e["@type"])||(ze=Object(a.b)(He,i.c,!0),Ke=Math.random()),ze(Ke)}self.onerror=e=>{console.error(e),Ze({type:"unhandledError",error:{message:e.error.message||"Uncaught exception in worker"}})},self.addEventListener("unhandledrejection",e=>{console.error(e),Ze({type:"unhandledError",error:{message:e.reason.message||"Uncaught rejection in worker"}})});const $e=new Map;function Je(e){Ze({type:"update",update:e})}function Ze(e,t){t?postMessage(e,[t]):postMessage(e)}i.f&&console.log(">>> FINISH LOAD WORKER"),onmessage=async e=>{const{data:t}=e;switch(t.type){case"initApi":await qe(Je,t.args[0]);break;case"callMethod":{const{messageId:e,name:n,args:a}=t;try{if(e){const t=(...t)=>{const n=t[t.length-1];Ze({type:"methodCallback",messageId:e,callbackArgs:t},n instanceof ArrayBuffer?n:void 0)};$e.set(e,t),a.push(t)}const t=await function(e,...t){return s[e](...t)}(n,...a),{arrayBuffer:i}="object"==typeof t&&"arrayBuffer"in t&&t||{};e&&Ze({type:"methodResponse",messageId:e,response:t},i)}catch(t){i.f&&console.error(t),e&&Ze({type:"methodResponse",messageId:e,error:{message:t.message}})}e&&$e.delete(e);break}case"cancelProgress":{const e=$e.get(t.messageId);e&&(e.isCanceled=!0);break}}}}]); //# sourceMappingURL=4565b79afd02863ca2d5.worker.js.map