TelegramPWA/dist/2012.3787307be72fe09f426e.js
Alexander Zinchuk a8ef2c245a [Build]
2025-03-21 14:03:32 +04:00

2 lines
592 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{"use strict";var e,t,n={2012:(e,t,n)=>{var s={};n.r(s),n.d(s,{Type:()=>cu,clear:()=>fu,fetch:()=>du,isCacheApiSupported:()=>ru,remove:()=>lu,save:()=>uu});var a={};n.r(a),n.d(a,{abortChatRequests:()=>Fu,abortRequestGroup:()=>Gu,acceptBotUrlAuth:()=>Kh,acceptCall:()=>Im,acceptLinkUrlAuth:()=>Jh,acceptPhoneCall:()=>iy,activateStealthMode:()=>My,addChatMembers:()=>Hl,allowBotSendMessages:()=>Xh,answerCallbackButton:()=>Ah,applyBoost:()=>xy,applyGiftCode:()=>qy,blockUser:()=>Np,broadcastLocalDbUpdateFull:()=>Ea,changeSessionSettings:()=>$u,changeSessionTtl:()=>Ju,changeStarsSubscription:()=>e_,checkBotDownloadFileParams:()=>em,checkChatInvite:()=>ql,checkChatUsername:()=>up,checkChatlistInvite:()=>sf,checkGiftCode:()=>Gy,checkPassword:()=>Ih,checkUsername:()=>kp,clearPassword:()=>Ph,clearRecentReactions:()=>Nm,clearRecentStickers:()=>Lg,clickSponsoredMessage:()=>rg,closePoll:()=>$f,confirmCall:()=>Pm,confirmPhoneCall:()=>ay,convertStarGift:()=>$y,createChalistInvite:()=>cf,createChannel:()=>cl,createGroupCall:()=>pm,createGroupChat:()=>pl,createPhoneCallState:()=>ey,createTopic:()=>Xl,deactivateAllUsernames:()=>fp,decodePhoneCallData:()=>sy,deleteChannel:()=>gl,deleteChat:()=>ll,deleteChatFolder:()=>Sl,deleteChatMember:()=>Ol,deleteChatUser:()=>ul,deleteChatlistInvite:()=>df,deleteContact:()=>Tg,deleteExportedChatInvite:()=>yp,deleteHistory:()=>Ef,deleteMessages:()=>kf,deleteParticipantHistory:()=>Af,deleteProfilePhotos:()=>Dp,deleteRevokedExportedChatInvites:()=>_p,deleteSavedHistory:()=>Uf,deleteScheduledMessages:()=>Tf,deleteStory:()=>py,deleteTopic:()=>ef,destroy:()=>Au,destroyPhoneCallState:()=>ty,discardCall:()=>bm,discardGroupCall:()=>rm,disconnect:()=>Tu,downloadMedia:()=>xu,editChatFolder:()=>wl,editChatPhoto:()=>hl,editChatlistInvite:()=>uf,editExportedChatInvite:()=>hp,editGroupCallParticipant:()=>cm,editGroupCallTitle:()=>dm,editMessage:()=>If,editStoryPrivacy:()=>wy,editTopic:()=>nf,encodePhoneCallData:()=>ny,exportChatInvite:()=>mp,exportGroupCallInvite:()=>um,exportMessageLink:()=>vg,faveSticker:()=>Hg,fetchAllStories:()=>ry,fetchAnimatedEmojiEffects:()=>Kg,fetchAnimatedEmojis:()=>zg,fetchAppConfig:()=>dh,fetchAuthorizations:()=>Gp,fetchAvailableEffects:()=>Am,fetchAvailableReactions:()=>km,fetchBlockedUsers:()=>Vp,fetchBoostList:()=>Ny,fetchBoostStatus:()=>Vy,fetchBotApp:()=>Gh,fetchBotCanSendMessage:()=>Qh,fetchBotsRecommendations:()=>am,fetchChannelMonetizationStatistics:()=>Om,fetchChannelRecommendations:()=>pf,fetchChannelStatistics:()=>Hm,fetchChat:()=>sl,fetchChatFolders:()=>bl,fetchChatInviteImporters:()=>bp,fetchChatSettings:()=>tl,fetchChatlistInvites:()=>lf,fetchChats:()=>Zu,fetchCollectibleEmojiStatuses:()=>Zg,fetchCollectionInfo:()=>Ly,fetchCommonChats:()=>Ig,fetchConfig:()=>uh,fetchContactList:()=>Mg,fetchContactSignUpSetting:()=>zp,fetchContentSettings:()=>rh,fetchCountryList:()=>gh,fetchCurrentUser:()=>qu,fetchCustomEmoji:()=>Wg,fetchCustomEmojiSets:()=>xg,fetchDefaultStatusEmojis:()=>Xg,fetchDefaultTagReactions:()=>Fm,fetchDefaultTopicIcons:()=>Qg,fetchDiscussionMessage:()=>Of,fetchEmojiKeywords:()=>rp,fetchExportedChatInvites:()=>pp,fetchExtendedMedia:()=>Qf,fetchFactChecks:()=>Gf,fetchFavoriteStickers:()=>Fg,fetchFeaturedEmojiStickers:()=>qg,fetchFeaturedStickers:()=>Gg,fetchFullChat:()=>el,fetchFullUser:()=>Sg,fetchGenericEmojiEffects:()=>$g,fetchGiveawayInfo:()=>Fy,fetchGlobalPrivacySettings:()=>ph,fetchGroupCallParticipants:()=>lm,fetchGroupStatistics:()=>Lm,fetchGroupsForDiscussion:()=>Nl,fetchInlineBot:()=>Uh,fetchInlineBotResults:()=>Dh,fetchLangDifference:()=>Xp,fetchLangPack:()=>Qp,fetchLangStrings:()=>eh,fetchLanguage:()=>Yp,fetchLanguages:()=>Zp,fetchLeaveChatlistSuggestions:()=>of,fetchMember:()=>Vl,fetchMembers:()=>xl,fetchMessage:()=>bf,fetchMessagePublicForwards:()=>Wm,fetchMessageReactions:()=>Um,fetchMessageReactionsList:()=>Dm,fetchMessageStatistics:()=>jm,fetchMessageViews:()=>Ff,fetchMessages:()=>_f,fetchMonetizationRevenueWithdrawalUrl:()=>Jm,fetchMyBoosts:()=>By,fetchNearestCountry:()=>Pg,fetchNotificationExceptions:()=>Wp,fetchNotifyDefaultSettings:()=>Kp,fetchOutboxReadDate:()=>yg,fetchPaidReactionPrivacy:()=>qf,fetchPeerColors:()=>lh,fetchPeerProfileStories:()=>dy,fetchPeerStories:()=>cy,fetchPeerStoriesByIds:()=>ly,fetchPinnedMessages:()=>tg,fetchPopularAppBots:()=>sm,fetchPremiumGifts:()=>Jg,fetchPremiumPromo:()=>Uy,fetchPreparedInlineMessage:()=>wg,fetchPreviewMedias:()=>Yh,fetchPrivacySettings:()=>nh,fetchProfilePhotos:()=>Eg,fetchQuickReplies:()=>_g,fetchRecentEmojiStatuses:()=>cp,fetchRecentReactions:()=>Vm,fetchRecentStickers:()=>Ng,fetchRecommendedChatFolders:()=>vl,fetchSavedChats:()=>Yu,fetchSavedGifs:()=>ep,fetchSavedReactionTags:()=>Gm,fetchSavedStarGifts:()=>zy,fetchScheduledHistory:()=>Yf,fetchSeenBy:()=>ng,fetchSendAs:()=>sg,fetchSponsoredMessages:()=>ig,fetchStarGiftUpgradePreview:()=>a_,fetchStarGiftWithdrawalUrl:()=>c_,fetchStarGifts:()=>Wy,fetchStarsGiveawayOptions:()=>jy,fetchStarsStatus:()=>Qy,fetchStarsSubscriptions:()=>Yy,fetchStarsTopupOptions:()=>n_,fetchStarsTransactionById:()=>Zy,fetchStarsTransactions:()=>Xy,fetchStatisticsAsyncGraph:()=>zm,fetchStickerSets:()=>Vg,fetchStickers:()=>jg,fetchStickersForEmoji:()=>op,fetchStoriesArchive:()=>uy,fetchStoriesMaxIds:()=>Iy,fetchStoriesViews:()=>_y,fetchStoryLink:()=>by,fetchStoryPublicForwards:()=>$m,fetchStoryStatistics:()=>Km,fetchStoryViewList:()=>yy,fetchTemporaryPaymentPassword:()=>Dy,fetchTimezones:()=>fh,fetchTopBotApps:()=>Eh,fetchTopInlineBots:()=>Th,fetchTopReactions:()=>xm,fetchTopUsers:()=>Cg,fetchTopicById:()=>Yl,fetchTopics:()=>Zl,fetchUniqueStarGift:()=>s_,fetchUnreadMentions:()=>lg,fetchUnreadReactions:()=>fg,fetchUsers:()=>Rg,fetchWallpapers:()=>Bp,fetchWebAuthorizations:()=>Op,fetchWebPagePreview:()=>zf,findFirstMessageIdAfterDate:()=>Zf,forwardMessages:()=>Xf,fulfillStarsSubscription:()=>t_,getChatByPhoneNumber:()=>Cl,getChatByUsername:()=>Ml,getDhConfig:()=>_m,getGroupCall:()=>om,getPassword:()=>Sh,getPasswordInfo:()=>bh,getPaymentForm:()=>Ty,getPremiumGiftCodeOptions:()=>Hy,getReceipt:()=>Ey,getStarsGiftOptions:()=>Jy,getTemporaryPaymentPassword:()=>wh,hideAllChatJoinRequests:()=>wp,hideChatJoinRequest:()=>vp,hideChatReportPane:()=>Sp,importChatInvite:()=>zl,importContact:()=>kg,installStickerSet:()=>np,invokeWebViewCustomMethod:()=>Zh,joinChannel:()=>dl,joinChatlistInvite:()=>af,joinGroupCall:()=>gm,joinGroupCallPresentation:()=>hm,launchPrepaidGiveaway:()=>Oy,leaveChannel:()=>fl,leaveChatlist:()=>rf,leaveGroupCall:()=>fm,leaveGroupCallPresentation:()=>ym,loadAttachBot:()=>jh,loadAttachBots:()=>Lh,loadPollOptionResults:()=>Jf,markMessageListRead:()=>Vf,markMessagesRead:()=>Nf,markStoryRead:()=>gy,migrateChat:()=>Gl,oldFetchLangPack:()=>th,pinMessage:()=>Mf,prolongWebView:()=>Hh,provideAuthCode:()=>eu,provideAuthPassword:()=>tu,provideAuthPhoneNumber:()=>Yd,provideAuthRegistration:()=>nu,provideRecoveryEmailCode:()=>Rh,readAllMentions:()=>dg,readAllReactions:()=>ug,receivedCall:()=>Sm,registerDevice:()=>sh,removeRecentSticker:()=>Og,reorderUsernames:()=>yh,repairFileReference:()=>Hu,reportChannelSpam:()=>Bf,reportMessages:()=>Df,reportMessagesDelivery:()=>Hf,reportPeer:()=>zu,reportProfilePhoto:()=>Ku,reportSpam:()=>Ug,reportSponsoredMessage:()=>cg,reportStory:()=>vy,requestAppWebView:()=>qh,requestBotUrlAuth:()=>zh,requestCall:()=>vm,requestChannelDifference:()=>Wu,requestChatUpdate:()=>al,requestLinkUrlAuth:()=>$h,requestMainWebView:()=>Nh,requestPhoneCall:()=>oy,requestSimpleWebView:()=>Fh,requestWebView:()=>Vh,rescheduleMessage:()=>Pf,resolveBusinessChatLink:()=>Qu,restartAuth:()=>su,restartAuthWithQr:()=>au,saveCloseFriends:()=>Bg,saveDefaultSendAs:()=>ag,saveDraft:()=>il,saveGif:()=>tp,saveStarGift:()=>Ky,searchChats:()=>nl,searchGifs:()=>ip,searchHashtagPosts:()=>Wf,searchMessagesGlobal:()=>jf,searchMessagesInChat:()=>Lf,searchStickers:()=>Yg,sendEmojiInteraction:()=>Rm,sendInlineBotResult:()=>Bh,sendMessage:()=>wf,sendMessageAction:()=>xf,sendPaidReaction:()=>Em,sendPaymentForm:()=>ky,sendPollVote:()=>Kf,sendQuickReply:()=>bg,sendReaction:()=>Tm,sendScheduledMessages:()=>eg,sendSignalingData:()=>Cm,sendStarPaymentForm:()=>Ay,sendStoryReaction:()=>Cy,sendWatchingEmojiInteraction:()=>Mm,sendWebViewData:()=>Oh,setAllowHttpTransport:()=>Lu,setBotInfo:()=>nm,setCallRating:()=>wm,setChatEnabledReactions:()=>Kl,setChatUsername:()=>lp,setDefaultReaction:()=>Bm,setDiscussionGroup:()=>Fl,setForceHttpTransport:()=>Ou,setPrivacySettings:()=>ih,setShouldDebugExportedSenders:()=>ju,setViewForumAsMessages:()=>gf,sortChatFolders:()=>Il,startBot:()=>xh,terminateAllAuthorizations:()=>Hp,terminateAllWebAuthorizations:()=>jp,terminateAuthorization:()=>qp,terminateWebAuthorization:()=>Lp,toggleAttachBot:()=>Wh,toggleChatArchived:()=>_l,toggleChatPinned:()=>ml,toggleDialogUnread:()=>Pl,toggleForum:()=>Ql,toggleGroupCallStartSubscription:()=>mm,toggleIsProtected:()=>$l,toggleJoinRequest:()=>jl,toggleJoinToSend:()=>Ll,toggleParticipantsHidden:()=>Jl,togglePeerTranslations:()=>ff,togglePinnedTopic:()=>tf,togglePreHistoryHidden:()=>kl,toggleSavedDialogPinned:()=>yl,toggleSavedGiftPinned:()=>r_,toggleSignatures:()=>Bl,toggleSponsoredMessages:()=>Xu,toggleStoriesHidden:()=>Sy,toggleStoryInProfile:()=>hy,toggleStoryPinnedToTop:()=>my,toggleUserEmojiStatusPermission:()=>tm,toggleUsername:()=>mh,transcribeAudio:()=>gg,transferStarGift:()=>o_,translateText:()=>pg,unblockUser:()=>Fp,uninstallStickerSet:()=>sp,unpinAllMessages:()=>Rf,unregisterDevice:()=>ah,updateChatAbout:()=>Dl,updateChatAdmin:()=>El,updateChatDefaultBannedRights:()=>Al,updateChatMemberBannedRights:()=>Tl,updateChatNotifySettings:()=>ol,updateChatTitle:()=>Ul,updateContact:()=>Ag,updateContactSignUpNotification:()=>$p,updateContentSettings:()=>ch,updateEmojiStatus:()=>Dg,updateGlobalPrivacySettings:()=>hh,updateIsOnline:()=>oh,updateNotificationSettings:()=>Jp,updatePassword:()=>Ch,updatePrivateLink:()=>gp,updateProfile:()=>Rp,updateProfilePhoto:()=>Tp,updateRecoveryEmail:()=>Mh,updateSavedReactionTag:()=>qm,updateTopicMutedState:()=>rl,updateUsername:()=>Ap,upgradeStarGift:()=>i_,uploadContactProfilePhoto:()=>Up,uploadProfilePhoto:()=>Ep,uploadWallpaper:()=>xp,validateRequestedInfo:()=>Ry,viewSponsoredMessage:()=>og,viewStory:()=>fy});const i="A",o=!1,r=!1,c=!1,d="https://telegram-a-host",u=!1,l="tt-media",f="tt-media-avatars",g=524288,p=16,h=16,m=("undefined"!=typeof window&&window.innerHeight,20),y=200,_=50,b=100,v=100,w=100,S=100,I=50,P=100,C=50,M=100,R=100,k=100,A=20,T=3e5,E=2**31-1,U=Math.round(450),D=new Set(["newMessage","newScheduledMessage","deleteMessages","deleteScheduledMessages","deleteHistory","deleteParticipantHistory"]),B=20,x=20,V="status-default-icon",N="video/webm",F="image/gif",G="application/x-tgsticker",q=N,H=new Set(["image/png","image/jpeg",F]),O=new Set(["video/mp4","video/quicktime"]),L=new Set(["audio/mp3","audio/ogg","audio/wav","audio/mpeg","audio/flac","audio/aac","audio/m4a","audio/mp4","audio/x-m4a"]),j=(new Set([...H,...O]),"MESSAGE_ID_REQUIRED"),W=new Set(["USERNAME_PURCHASE_AVAILABLE","USERNAME_INVALID"]),z=(new Set(["t.me","web.t.me","a.t.me","k.t.me","z.t.me"]),"weba"),K="weba",$=(new Set(["AU","BD","CA","CO","EG","HN","IE","IN","JO","MX","MY","NI","NZ","PH","PK","SA","SV","US"]),"777000"),J=14,Q="gif",X=0,Z=1,Y="-1000000000777",ee=1,te=86400,ne=86400,se=11,ae=(new Set(["USER_CANCELED"]),{uploadMaxFileparts:[4e3,8e3],stickersFaved:[5,10],savedGifs:[200,400],dialogFiltersChats:[100,200],dialogFilters:[10,20],dialogFolderPinned:[5,10],captionLength:[1024,4096],channels:[500,1e3],channelsPublic:[10,20],aboutLength:[70,140],chatlistInvites:[3,100],chatlistJoined:[2,20],recommendedChannels:[10,100],savedDialogsPinned:[5,100]}),ie=["log","error","warn","info","debug"];function oe(e,t,n=!0){let s,a,i;return(...o)=>{a=!0,i=o,s||(n&&(a=!1,e(...i)),s=self.setInterval((()=>{if(!a)return self.clearInterval(s),void(s=void 0);a=!1,e(...i)}),t))}}function re(e){return function(e,t){let n,s=!1;return(...a)=>{n=a,s||(s=!0,e((()=>{s=!1,t(...n)})))}}(ue,e)}ie.reduce(((e,t)=>(e[t]=console[t],e)),{});const ce=e=>new Promise((t=>{setTimeout((()=>t()),e)}));let de;function ue(e){de?de.push(e):(de=[e],Promise.resolve().then((()=>{const e=de;de=void 0,e.forEach((e=>e()))})))}var le=n(92096),fe=n.n(le),ge=n(7692);const pe=1===new Uint8Array(new Uint32Array([16909060]))[0],he=pe?function(e){return e.buffer}:function(e){const t=new Uint8Array(4*e.length);let n=0;for(let s=0;s<e.length;s++){const a=e[s];t[n++]=a>>>24,t[n++]=a>>16&255,t[n++]=a>>8&255,t[n++]=255&a}return t.buffer},me=pe?function(e){return new Uint32Array(e)}:function(e){const t=new Uint8Array(e),n=new Uint32Array(t.length/4);for(let e=0;e<t.length;e+=4)n[e/4]=t[e]<<24^t[e+1]<<16^t[e+2]<<8^t[e+3];return n};var ye=n(48287).hp;function _e(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class be{constructor(e){_e(this,"_counter",void 0),this._counter=ye.from(e)}increment(){for(let e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}}}class ve{constructor(e,t){_e(this,"_counter",void 0),_e(this,"_remainingCounter",void 0),_e(this,"_remainingCounterIndex",void 0),_e(this,"_aes",void 0),t instanceof be||(t=new be(t)),this._counter=t,this._remainingCounter=void 0,this._remainingCounterIndex=16,this._aes=new ge.Ay(function(e){if(e instanceof Uint32Array)return e;if("string"==typeof e){if(e.length%4!=0)for(let t=e.length%4;t<=4;t++)e+="\0x00";const s=new Uint32Array(e.length/4);for(let a=0;a<e.length;a+=4)s[a/4]=(n=a,(t=e).charCodeAt(n)<<24^t.charCodeAt(n+1)<<16^t.charCodeAt(n+2)<<8^t.charCodeAt(n+3));return s}var t,n;if(e instanceof Uint8Array){const t=new Uint32Array(e.length/4);for(let n=0;n<e.length;n+=4)t[n/4]=e[n]<<24^e[n+1]<<16^e[n+2]<<8^e[n+3];return t}throw new Error("Unable to create 32-bit words")}(e))}update(e){return this.encrypt(e)}encrypt(e){const t=ye.from(e);for(let e=0;e<t.length;e++)16===this._remainingCounterIndex&&(this._remainingCounter=ye.from(he(this._aes.encrypt(me(this._counter._counter)))),this._remainingCounterIndex=0,this._counter.increment()),this._remainingCounter&&(t[e]^=this._remainingCounter[this._remainingCounterIndex++]);return t}}class we{constructor(e){this.algorithm=e,_e(this,"data",new Uint8Array(0))}update(e){this.data=new Uint8Array(e)}async digest(){return"sha1"===this.algorithm?ye.from(await self.crypto.subtle.digest("SHA-1",this.data)):ye.from(await self.crypto.subtle.digest("SHA-256",this.data))}}function Se(e){return new we(e)}var Ie=n(48287).hp;function Pe(e,t=!0,n=!1){let s=Ie.from(e);const a=s.length;t&&(s=s.reverse());let i=fe()(s.toString("hex"),16);return n&&Math.floor(i.toString(2).length/8)>=a&&(i=i.subtract(fe()(2).pow(fe()(8*a)))),i}function Ce(e,t=8){const n=fe()(e),s=[];for(let e=0;e<t;e++)s[e]=n.shiftRight(8*e).and(255).toJSNumber();return Ie.from(s)}function Me(e,t,n=!0,s=!1){const a=e.bitLength().toJSNumber();if(t<Math.ceil(a/8))throw new Error("OverflowError: int too big to convert");if(!s&&e.lesser(fe()(0)))throw new Error("Cannot convert to unsigned");let i=!1;e.lesser(fe()(0))&&(i=!0,e=e.abs());const o=e.toString(16).padStart(2*t,"0");let r=Ie.from(o,"hex");if(s&&i){r[r.length-1]=256-r[r.length-1];for(let e=0;e<r.length-1;e++)r[e]=255-r[e]}return n&&(r=r.reverse()),r}function Re(e,t){return e.remainder(t).add(t).remainder(t)}function ke(e){return Ie.from(function(e){const t=new Uint8Array(e);return crypto.getRandomValues(t),t}(e))}function Ae(e){const t=Ie.alloc(4*e.length);for(let n=0;n<e.length;n++)t.writeUInt32BE(e[n],4*n);return t}function Te(e){const t=Se("sha1");return t.update(e),t.digest()}function Ee(e){const t=Se("sha256");return t.update(e),t.digest()}function Ue(e,t,n){e=e.remainder(n);let s=fe().one,a=e;for(;t.greater(fe().zero);){const e=t.remainder(fe()(2));t=t.divide(fe()(2)),e.eq(fe().one)&&(s=s.multiply(a),s=s.remainder(n)),a=a.multiply(a),a=a.remainder(n)}return s}function De(e,t=!1){const n=e.toString(2).length,s=Math.floor((n+8-1)/8);return Me(fe()(e),s,!1,t)}function Be(e){return new Promise((t=>{setTimeout(t,e)}))}function xe(e,t){const n=[];for(let s=0;s<e.length;s++)n.push(e[s]^t[s]);return Ie.from(n)}const Ve=(()=>{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})();function Ne(e){Ie.isBuffer(e)||(e=Ie.from(e));let t=-1;for(let n=0;n<e.length;n++){const s=e[n];t=Ve[255&(t^s)]^t>>>8}return~t>>>0}var Fe=n(48287).hp;const Ge=new Set([3162085175,2574415285,1072550713,3300522427,1450380236]),qe=new Set([85337187,2211011308,2851430293,1013613780,1459478408,3504867164,3045658042,1715713620,3608339646,4110704415,812830625]),He=(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)),He(e,t,n)),n},Oe=(e,t)=>{const n=e.match(/([\w.]+)(?:#([0-9a-fA-F]+))?(?:\s{?\w+:[\w\d<>#.?!]+}?)*\s=\s([\w\d<>#.?]+);$/);if(!n)throw new Error(`Cannot parse TLObject ${e}`);const s=He(/({)?(\w+):([\w\d<>#.?!]+)}?/,e),a={name:n[1],constructorId:parseInt(n[2],16),argsConfig:{},subclassOfId:Ne(n[3]),result:n[3],isFunction:t,namespace:void 0};if(!a.constructorId){const e="";let t;t=Object.values(a.argsConfig).length?` ${Object.keys(a.argsConfig).map((e=>e.toString())).join(" ")}`:"";const n=`${a.name}${e}${t} = ${a.result}`.replace(/(:|\?)bytes /g,"$1string ").replace(/</g," ").replace(/>|{|}/g,"").replace(/ \w+:flags\d*\.\d+\?true/g,"");"inputMediaInvoice"===a.name&&a.name,a.constructorId=Ne(Fe.from(n,"utf8"))}for(const[e,t,n]of s)void 0===e&&(a.argsConfig[(i=t,i.replace(/([-_][a-z])/g,(e=>e.toUpperCase().replace("-","").replace("_",""))))]=Le(t,n));var i;return a.name.includes(".")&&([a.namespace,a.name]=a.name.split(/\.(.+)/)),a.name=a.name.replace(/(?:^|_)([a-z])/g,((e,t)=>t.toUpperCase())).replace(/_/g,""),a};function Le(e,t){e="self"===e?"is_self":e;const n={isVector:!1,isFlag:!1,skipConstructorId:!1,flagGroup:0,flagIndex:-1,flagIndicator:!0,type:"",useVectorId:void 0};if("#"!==t){n.flagIndicator=!1,n.type=t.replace(/^!+/,"");const e=n.type.match(/flags(\d*)\.(\d+)\?([\w<>.]+)/);e&&(n.isFlag=!0,n.flagGroup=Number(e[1]||1),n.flagIndex=Number(e[2]),[,,,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}function je(e){if(!(e instanceof Fe)){if("string"!=typeof e)throw Error(`Bytes or str expected, not ${e.constructor.name}`);e=Fe.from(e)}const t=[];let n;return e.length<254?(n=(e.length+1)%4,0!==n&&(n=4-n),t.push(Fe.from([e.length])),t.push(e)):(n=e.length%4,0!==n&&(n=4-n),t.push(Fe.from([254,e.length%256,(e.length>>8)%256,(e.length>>16)%256])),t.push(e)),t.push(Fe.alloc(n).fill(0)),Fe.concat(t)}var We=n(48287).hp;function ze(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ke="undefined"!=typeof self&&void 0!==self.localStorage,$e="GramJs:apiCache";function Je(e){const t=function*(e,t=[],n=Ge){(t||[]).reduce(((e,t)=>({...e,[t.name]:t})),{});const s=[],a={},i={},o=e;let r=!1;for(let e of o.split("\n")){const t=e.indexOf("//");if(-1!==t&&(e=e.slice(0,t)),e=e.trim(),!e)continue;const o=e.match(/---(\w+)---/);if(o){const[,e]=o;r="functions"===e}else try{const t=Oe(e,r);if(n.has(t.constructorId))continue;s.push(t),t.isFunction||(i[t.result]||(i[t.result]=[]),a[t.name]=t,i[t.result].push(t))}catch(e){if(!e.toString().includes("vector#1cb5c415"))throw e}}for(const e of s)if(qe.has(e.constructorId))for(const t in e.argsConfig)"string"===e.argsConfig[t].type&&(e.argsConfig[t].type="bytes");for(const e of s)yield e}(e),n=[],s=[];for(const e of t)e.isFunction?s.push(e):n.push(e);return[n,s]}function Qe(e,t){switch(t){case"int":{const t=We.alloc(4);return t.writeInt32LE(e,0),t}case"long":return Ce(e,8);case"int128":return Ce(e,16);case"int256":return Ce(e,32);case"double":{const t=We.alloc(8);return t.writeDoubleLE(e,0),t}case"string":case"bytes":return je(e);case"Bool":return e?We.from("b5757299","hex"):We.from("379779bc","hex");case"true":return We.alloc(0);case"date":return function(e){if(!e)return Fe.alloc(4).fill(0);if(e instanceof Date&&(e=Math.floor((Date.now()-e.getTime())/1e3)),"number"==typeof e){const t=Fe.alloc(4);return t.writeInt32LE(e,0),t}throw Error(`Cannot interpret "${e}" as a date`)}(e);default:return e.getBytes()}}function Xe(e,t){if(t.isVector){t.useVectorId&&e.readInt();const n=[],s=e.readInt();t.isVector=!1;for(let a=0;a<s;a++)n.push(Xe(e,t));return t.isVector=!0,n}if(t.flagIndicator)return e.readInt();switch(t.type){case"int":return e.readInt();case"long":return e.readLong();case"int128":return e.readLargeInt(128);case"int256":return e.readLargeInt(256);case"double":return e.readDouble();case"string":return e.tgReadString();case"Bool":return e.tgReadBool();case"true":return!0;case"bytes":return e.tgReadBytes();case"date":return e.tgReadDate();default:if(t.skipConstructorId)throw new Error(`Unknown type ${t}`);return e.tgReadObject()}}function Ze(e,t){const n={};for(const s of t){const{name:t,constructorId:a,subclassOfId:i,argsConfig:o,namespace:r,result:c}=s,d=[r,t].join(".").replace(/^\./,"");class u{constructor(t){ze(this,"CONSTRUCTOR_ID",a),ze(this,"SUBCLASS_OF_ID",i),ze(this,"className",d),ze(this,"classType",e),t=t||{},Object.keys(t).forEach((e=>{this[e]=t[e]}))}static fromReader(e){const t={};for(const n in o)if(o.hasOwnProperty(n)){const s=o[n];if(s.isFlag){const a=t[`flags${s.flagGroup>1?s.flagGroup:""}`]&1<<s.flagIndex;if("true"===s.type){t[n]=Boolean(a);continue}t[n]=a?Xe(e,s):void 0}else t[n]=Xe(e,s)}return new u(t)}getBytes(){const e=this.CONSTRUCTOR_ID,t=We.alloc(4);t.writeUInt32LE(e,0);const n=[t];for(const e in o)if(o.hasOwnProperty(e)){if(o[e].isFlag&&(!1===this[e]&&"true"===o[e].type||void 0===this[e]))continue;if(o[e].isVector){o[e].useVectorId&&n.push(We.from("15c4b51c","hex"));const t=We.alloc(4);t.writeInt32LE(this[e].length,0),n.push(t,We.concat(this[e].map((t=>Qe(t,o[e].type)))))}else if(o[e].flagIndicator)if(Object.values(o).some((e=>e.isFlag))){let e=0;for(const t in o)o[t].isFlag&&(!1===this[t]&&"true"===o[t].type||void 0===this[t]?e|=0:e|=1<<o[t].flagIndex);const t=We.alloc(4);t.writeUInt32LE(e,0),n.push(t)}else n.push(We.alloc(4));else if(n.push(Qe(this[e],o[e].type)),this[e]&&"function"==typeof this[e].getBytes){const t=o[e].type.charAt(o[e].type.indexOf(".")+1);t===t.toUpperCase()||n.shift()}}return We.concat(n)}readResult(t){if("request"!==e)throw new Error("`readResult()` called for non-request instance");const n=c.match(/Vector<(int|long)>/);if(n){t.readInt();const e=[],s=t.readInt();if("int"===n[1])for(let n=0;n<s;n++)e.push(t.readInt());else for(let n=0;n<s;n++)e.push(t.readLong());return e}return t.tgReadObject()}}ze(u,"CONSTRUCTOR_ID",a),ze(u,"SUBCLASS_OF_ID",i),ze(u,"className",d),ze(u,"classType",e),r?(n[r]||(n[r]={}),n[r][t]=u):n[t]=u}return n}const Ye=function(){let e;const t=Ke&&function(){const e=localStorage.getItem($e);return e&&JSON.parse(e)}();return t?e=t:(e=function(){const[e,t]=Je("boolFalse#bc799737 = Bool;\nboolTrue#997275b5 = Bool;\ntrue#3fedd339 = True;\nvector#1cb5c415 {t:Type} # [ t ] = Vector t;\nerror#c4b9f9bb code:int text:string = Error;\nnull#56730bcc = Null;\ninputPeerEmpty#7f3b18ea = InputPeer;\ninputPeerSelf#7da07ec9 = InputPeer;\ninputPeerChat#35a95cb9 chat_id:long = InputPeer;\ninputPeerUser#dde8a54c user_id:long access_hash:long = InputPeer;\ninputPeerChannel#27bcbbfc channel_id:long access_hash:long = InputPeer;\ninputPeerUserFromMessage#a87b0a1c peer:InputPeer msg_id:int user_id:long = InputPeer;\ninputPeerChannelFromMessage#bd2a0840 peer:InputPeer msg_id:int channel_id:long = InputPeer;\ninputUserEmpty#b98886cf = InputUser;\ninputUserSelf#f7c1b13f = InputUser;\ninputUser#f21158c6 user_id:long access_hash:long = InputUser;\ninputUserFromMessage#1da448e2 peer:InputPeer msg_id:int user_id:long = InputUser;\ninputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact;\ninputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;\ninputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile;\ninputFileStoryDocument#62dc8b48 id:InputDocument = InputFile;\ninputMediaEmpty#9664f57f = InputMedia;\ninputMediaUploadedPhoto#1e287d04 flags:# spoiler:flags.2?true file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;\ninputMediaPhoto#b3ba0635 flags:# spoiler:flags.1?true id:InputPhoto ttl_seconds:flags.0?int = InputMedia;\ninputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;\ninputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;\ninputMediaUploadedDocument#37c9330 flags:# nosound_video:flags.3?true force_file:flags.4?true spoiler:flags.5?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> video_cover:flags.6?InputPhoto video_timestamp:flags.7?int ttl_seconds:flags.1?int = InputMedia;\ninputMediaDocument#a8763ab5 flags:# spoiler:flags.2?true id:InputDocument video_cover:flags.3?InputPhoto video_timestamp:flags.4?int ttl_seconds:flags.0?int query:flags.1?string = InputMedia;\ninputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;\ninputMediaPhotoExternal#e5bbfe1a flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int = InputMedia;\ninputMediaDocumentExternal#779600f9 flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int video_cover:flags.2?InputPhoto video_timestamp:flags.3?int = InputMedia;\ninputMediaGame#d33f43f3 id:InputGame = InputMedia;\ninputMediaInvoice#405fef0d flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:flags.3?string provider_data:DataJSON start_param:flags.1?string extended_media:flags.2?InputMedia = InputMedia;\ninputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;\ninputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;\ninputMediaDice#e66fbf7b emoticon:string = InputMedia;\ninputMediaStory#89fdd778 peer:InputPeer id:int = InputMedia;\ninputMediaWebPage#c21b8849 flags:# force_large_media:flags.0?true force_small_media:flags.1?true optional:flags.2?true url:string = InputMedia;\ninputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector<InputMedia> payload:flags.0?string = InputMedia;\ninputChatPhotoEmpty#1ca48f57 = InputChatPhoto;\ninputChatUploadedPhoto#bdcdaec0 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.3?VideoSize = InputChatPhoto;\ninputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto;\ninputGeoPointEmpty#e4c123d6 = InputGeoPoint;\ninputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint;\ninputPhotoEmpty#1cd7bf0d = InputPhoto;\ninputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto;\ninputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation;\ninputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;\ninputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;\ninputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;\ninputTakeoutFileLocation#29be5899 = InputFileLocation;\ninputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;\ninputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;\ninputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation;\ninputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation;\ninputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation;\npeerUser#59511722 user_id:long = Peer;\npeerChat#36c6019a chat_id:long = Peer;\npeerChannel#a2a5371e channel_id:long = Peer;\nstorage.fileUnknown#aa963b05 = storage.FileType;\nstorage.filePartial#40bc6f52 = storage.FileType;\nstorage.fileJpeg#7efe0e = storage.FileType;\nstorage.fileGif#cae1aadf = storage.FileType;\nstorage.filePng#a4f63c0 = storage.FileType;\nstorage.filePdf#ae1e508d = storage.FileType;\nstorage.fileMp3#528a0677 = storage.FileType;\nstorage.fileMov#4b09ebbc = storage.FileType;\nstorage.fileMp4#b3cea0e4 = storage.FileType;\nstorage.fileWebp#1081464c = storage.FileType;\nuserEmpty#d3bc4b7a id:long = User;\nuser#4b46c37e flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long = User;\nuserProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;\nuserProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;\nuserStatusEmpty#9d05049 = UserStatus;\nuserStatusOnline#edb93949 expires:int = UserStatus;\nuserStatusOffline#8c703f was_online:int = UserStatus;\nuserStatusRecently#7b197dc8 flags:# by_me:flags.0?true = UserStatus;\nuserStatusLastWeek#541a1d1a flags:# by_me:flags.0?true = UserStatus;\nuserStatusLastMonth#65899777 flags:# by_me:flags.0?true = UserStatus;\nchatEmpty#29562865 id:long = Chat;\nchat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;\nchatForbidden#6592a1a7 id:long title:string = Chat;\nchannel#e00998b7 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long = Chat;\nchannelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;\nchatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull;\nchannelFull#52d6806b flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int = ChatFull;\nchatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant;\nchatParticipantCreator#e46bcee4 user_id:long = ChatParticipant;\nchatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant;\nchatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants;\nchatParticipants#3cbc93f8 chat_id:long participants:Vector<ChatParticipant> version:int = ChatParticipants;\nchatPhotoEmpty#37c1011c = ChatPhoto;\nchatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;\nmessageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message;\nmessage#96fdbbe9 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int = Message;\nmessageService#d3d28540 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message;\nmessageMediaEmpty#3ded6320 = MessageMedia;\nmessageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;\nmessageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;\nmessageMediaContact#70322949 phone_number:string first_name:string last_name:string vcard:string user_id:long = MessageMedia;\nmessageMediaUnsupported#9f84f49e = MessageMedia;\nmessageMediaDocument#52d8ccd9 flags:# nopremium:flags.3?true spoiler:flags.4?true video:flags.6?true round:flags.7?true voice:flags.8?true document:flags.0?Document alt_documents:flags.5?Vector<Document> video_cover:flags.9?Photo video_timestamp:flags.10?int ttl_seconds:flags.2?int = MessageMedia;\nmessageMediaWebPage#ddf10c3b flags:# force_large_media:flags.0?true force_small_media:flags.1?true manual:flags.3?true safe:flags.4?true webpage:WebPage = MessageMedia;\nmessageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;\nmessageMediaGame#fdb19008 game:Game = MessageMedia;\nmessageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string extended_media:flags.4?MessageExtendedMedia = MessageMedia;\nmessageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;\nmessageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;\nmessageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;\nmessageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia;\nmessageMediaGiveaway#aa073beb flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector<long> countries_iso2:flags.1?Vector<string> prize_description:flags.3?string quantity:int months:flags.4?int stars:flags.5?long until_date:int = MessageMedia;\nmessageMediaGiveawayResults#ceaa3ea1 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector<long> months:flags.4?int stars:flags.5?long prize_description:flags.1?string until_date:int = MessageMedia;\nmessageMediaPaidMedia#a8852491 stars_amount:long extended_media:Vector<MessageExtendedMedia> = MessageMedia;\nmessageActionEmpty#b6aef7b0 = MessageAction;\nmessageActionChatCreate#bd47cbad title:string users:Vector<long> = MessageAction;\nmessageActionChatEditTitle#b5a1ce5a title:string = MessageAction;\nmessageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction;\nmessageActionChatDeletePhoto#95e3fbef = MessageAction;\nmessageActionChatAddUser#15cefd00 users:Vector<long> = MessageAction;\nmessageActionChatDeleteUser#a43f30cc user_id:long = MessageAction;\nmessageActionChatJoinedByLink#31224c3 inviter_id:long = MessageAction;\nmessageActionChannelCreate#95d2ac92 title:string = MessageAction;\nmessageActionChatMigrateTo#e1037f92 channel_id:long = MessageAction;\nmessageActionChannelMigrateFrom#ea3948e9 title:string chat_id:long = MessageAction;\nmessageActionPinMessage#94bd38ed = MessageAction;\nmessageActionHistoryClear#9fbab604 = MessageAction;\nmessageActionGameScore#92a72876 game_id:long score:int = MessageAction;\nmessageActionPaymentSentMe#ffa00ccc flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge subscription_until_date:flags.4?int = MessageAction;\nmessageActionPaymentSent#c624b16e flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string subscription_until_date:flags.4?int = MessageAction;\nmessageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction;\nmessageActionScreenshotTaken#4792929b = MessageAction;\nmessageActionCustomAction#fae69f56 message:string = MessageAction;\nmessageActionBotAllowed#c516d679 flags:# attach_menu:flags.1?true from_request:flags.3?true domain:flags.0?string app:flags.2?BotApp = MessageAction;\nmessageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;\nmessageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction;\nmessageActionContactSignUp#f3f25f76 = MessageAction;\nmessageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction;\nmessageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction;\nmessageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector<long> = MessageAction;\nmessageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction;\nmessageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction;\nmessageActionSetChatTheme#aa786345 emoticon:string = MessageAction;\nmessageActionChatJoinedByRequest#ebbca3cb = MessageAction;\nmessageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction;\nmessageActionWebViewDataSent#b4c38cb5 text:string = MessageAction;\nmessageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction;\nmessageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction;\nmessageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction;\nmessageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction;\nmessageActionRequestedPeer#31518e9b button_id:int peers:Vector<Peer> = MessageAction;\nmessageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction;\nmessageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction;\nmessageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction;\nmessageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction;\nmessageActionBoostApply#cc02aa6d boosts:int = MessageAction;\nmessageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector<RequestedPeer> = MessageAction;\nmessageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction;\nmessageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long crypto_currency:flags.0?string crypto_amount:flags.0?long transaction_id:flags.1?string = MessageAction;\nmessageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction;\nmessageActionStarGift#4717e8a4 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long = MessageAction;\nmessageActionStarGiftUnique#acdfcb81 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long = MessageAction;\ndialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;\ndialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;\nphotoEmpty#2331b22d id:long = Photo;\nphoto#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;\nphotoSizeEmpty#e17e23c type:string = PhotoSize;\nphotoSize#75c78e60 type:string w:int h:int size:int = PhotoSize;\nphotoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize;\nphotoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;\nphotoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize;\nphotoPathSize#d8214d41 type:string bytes:bytes = PhotoSize;\ngeoPointEmpty#1117dd5f = GeoPoint;\ngeoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint;\nauth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;\nauth.sentCodeSuccess#2390fe44 authorization:auth.Authorization = auth.SentCode;\nauth.authorization#2ea2c0d4 flags:# setup_password_required:flags.1?true otherwise_relogin_days:flags.1?int tmp_sessions:flags.0?int future_auth_token:flags.2?bytes user:User = auth.Authorization;\nauth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;\nauth.exportedAuthorization#b434e2b8 id:long bytes:bytes = auth.ExportedAuthorization;\ninputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer;\ninputNotifyUsers#193b4417 = InputNotifyPeer;\ninputNotifyChats#4a95e84e = InputNotifyPeer;\ninputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;\ninputNotifyForumTopic#5c467992 peer:InputPeer top_msg_id:int = InputNotifyPeer;\ninputPeerNotifySettings#cacb6ae2 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_sound:flags.8?NotificationSound = InputPeerNotifySettings;\npeerNotifySettings#99622c0c flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_ios_sound:flags.8?NotificationSound stories_android_sound:flags.9?NotificationSound stories_other_sound:flags.10?NotificationSound = PeerNotifySettings;\npeerSettings#acd66c5e flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true business_bot_paused:flags.11?true business_bot_can_reply:flags.12?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int business_bot_id:flags.13?long business_bot_manage_url:flags.13?string = PeerSettings;\nwallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;\nwallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;\ninputReportReasonSpam#58dbcab8 = ReportReason;\ninputReportReasonViolence#1e22c78d = ReportReason;\ninputReportReasonPornography#2e59d922 = ReportReason;\ninputReportReasonChildAbuse#adf44ee3 = ReportReason;\ninputReportReasonOther#c1e4a2b1 = ReportReason;\ninputReportReasonCopyright#9b89f93a = ReportReason;\ninputReportReasonGeoIrrelevant#dbd4feed = ReportReason;\ninputReportReasonFake#f5ddd6e7 = ReportReason;\ninputReportReasonIllegalDrugs#a8eb2be = ReportReason;\ninputReportReasonPersonalDetails#9ec7863d = ReportReason;\nuserFull#4d975bbc flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector<PremiumGiftOption> wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification = UserFull;\ncontact#145ade0b user_id:long mutual:Bool = Contact;\nimportedContact#c13e3c50 user_id:long client_id:long = ImportedContact;\ncontactStatus#16d9703b user_id:long status:UserStatus = ContactStatus;\ncontacts.contactsNotModified#b74ba9d2 = contacts.Contacts;\ncontacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts;\ncontacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;\ncontacts.blocked#ade1591 blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;\ncontacts.blockedSlice#e1664194 count:int blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;\nmessages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;\nmessages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;\nmessages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs;\nmessages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;\nmessages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;\nmessages.channelMessages#c776ba4e flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> topics:Vector<ForumTopic> chats:Vector<Chat> users:Vector<User> = messages.Messages;\nmessages.messagesNotModified#74535f21 count:int = messages.Messages;\nmessages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;\nmessages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats;\nmessages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull;\nmessages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory;\ninputMessagesFilterEmpty#57e2f66c = MessagesFilter;\ninputMessagesFilterPhotos#9609a51c = MessagesFilter;\ninputMessagesFilterVideo#9fc00e65 = MessagesFilter;\ninputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;\ninputMessagesFilterDocument#9eddf188 = MessagesFilter;\ninputMessagesFilterUrl#7ef0dd87 = MessagesFilter;\ninputMessagesFilterGif#ffc86587 = MessagesFilter;\ninputMessagesFilterVoice#50f5c392 = MessagesFilter;\ninputMessagesFilterMusic#3751b49e = MessagesFilter;\ninputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter;\ninputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter;\ninputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter;\ninputMessagesFilterRoundVideo#b549da53 = MessagesFilter;\ninputMessagesFilterMyMentions#c1f8e69a = MessagesFilter;\ninputMessagesFilterGeo#e7026d0d = MessagesFilter;\ninputMessagesFilterContacts#e062db83 = MessagesFilter;\ninputMessagesFilterPinned#1bb00451 = MessagesFilter;\nupdateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;\nupdateMessageID#4e90bfd6 id:int random_id:long = Update;\nupdateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update;\nupdateUserTyping#c01e857f user_id:long action:SendMessageAction = Update;\nupdateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update;\nupdateChatParticipants#7761198 participants:ChatParticipants = Update;\nupdateUserStatus#e5bdf8de user_id:long status:UserStatus = Update;\nupdateUserName#a7848924 user_id:long first_name:string last_name:string usernames:Vector<Username> = Update;\nupdateNewAuthorization#8951abef flags:# unconfirmed:flags.0?true hash:long date:flags.0?int device:flags.0?string location:flags.0?string = Update;\nupdateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;\nupdateEncryptedChatTyping#1710f156 chat_id:int = Update;\nupdateEncryption#b4a2e88d chat:EncryptedChat date:int = Update;\nupdateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update;\nupdateChatParticipantAdd#3dda5451 chat_id:long user_id:long inviter_id:long date:int version:int = Update;\nupdateChatParticipantDelete#e32f3d77 chat_id:long user_id:long version:int = Update;\nupdateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;\nupdateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;\nupdateServiceNotification#ebe46819 flags:# popup:flags.0?true invert_media:flags.2?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;\nupdatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;\nupdateUserPhone#5492a13 user_id:long phone:string = Update;\nupdateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update;\nupdateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update;\nupdateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update;\nupdateReadMessagesContents#f8227181 flags:# messages:Vector<int> pts:int pts_count:int date:flags.0?int = Update;\nupdateChannelTooLong#108d941f flags:# channel_id:long pts:flags.0?int = Update;\nupdateChannel#635b4c09 channel_id:long = Update;\nupdateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;\nupdateReadChannelInbox#922e6e10 flags:# folder_id:flags.0?int channel_id:long max_id:int still_unread_count:int pts:int = Update;\nupdateDeleteChannelMessages#c32d5b12 channel_id:long messages:Vector<int> pts:int pts_count:int = Update;\nupdateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update;\nupdateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update;\nupdateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;\nupdateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Update;\nupdateStickerSets#31c24808 flags:# masks:flags.0?true emojis:flags.1?true = Update;\nupdateSavedGifs#9375341e = Update;\nupdateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;\nupdateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;\nupdateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;\nupdateBotCallbackQuery#b9cfc48d flags:# query_id:long user_id:long peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;\nupdateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update;\nupdateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;\nupdateReadChannelOutbox#b75f99a9 channel_id:long max_id:int = Update;\nupdateDraftMessage#1b49ec6d flags:# peer:Peer top_msg_id:flags.0?int draft:DraftMessage = Update;\nupdateReadFeaturedStickers#571d2742 = Update;\nupdateRecentStickers#9a422c20 = Update;\nupdateConfig#a229dd06 = Update;\nupdatePtsChanged#3354678f = Update;\nupdateChannelWebPage#2f2ba99f channel_id:long webpage:WebPage pts:int pts_count:int = Update;\nupdateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update;\nupdatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector<DialogPeer> = Update;\nupdateBotWebhookJSON#8317c0c3 data:DataJSON = Update;\nupdateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update;\nupdateBotShippingQuery#b5aefd7d query_id:long user_id:long payload:bytes shipping_address:PostAddress = Update;\nupdateBotPrecheckoutQuery#8caa9a96 flags:# query_id:long user_id:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update;\nupdatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update;\nupdateLangPackTooLong#46560264 lang_code:string = Update;\nupdateLangPack#56022f4d difference:LangPackDifference = Update;\nupdateFavedStickers#e511996d = Update;\nupdateChannelReadMessagesContents#ea29055d flags:# channel_id:long top_msg_id:flags.0?int messages:Vector<int> = Update;\nupdateContactsReset#7084a7be = Update;\nupdateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = Update;\nupdateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update;\nupdateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;\nupdateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;\nupdateFolderPeers#19360dc0 folder_peers:Vector<FolderPeer> pts:int pts_count:int = Update;\nupdatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update;\nupdatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update;\nupdateNewScheduledMessage#39a51dfb message:Message = Update;\nupdateDeleteScheduledMessages#f2a71983 flags:# peer:Peer messages:Vector<int> sent_messages:flags.0?Vector<int> = Update;\nupdateTheme#8216fba3 theme:Theme = Update;\nupdateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;\nupdateLoginToken#564fe691 = Update;\nupdateMessagePollVote#24f40e77 poll_id:long peer:Peer options:Vector<bytes> qts:int = Update;\nupdateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;\nupdateDialogFilterOrder#a5d72105 order:Vector<int> = Update;\nupdateDialogFilters#3504914f = Update;\nupdatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update;\nupdateChannelMessageForwards#d29a27f4 channel_id:long id:int forwards:int = Update;\nupdateReadChannelDiscussionInbox#d6b19546 flags:# channel_id:long top_msg_id:int read_max_id:int broadcast_id:flags.0?long broadcast_post:flags.0?int = Update;\nupdateReadChannelDiscussionOutbox#695c9e7c channel_id:long top_msg_id:int read_max_id:int = Update;\nupdatePeerBlocked#ebe07752 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer = Update;\nupdateChannelUserTyping#8c88c923 flags:# channel_id:long top_msg_id:flags.0?int from_id:Peer action:SendMessageAction = Update;\nupdatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector<int> pts:int pts_count:int = Update;\nupdatePinnedChannelMessages#5bb98608 flags:# pinned:flags.0?true channel_id:long messages:Vector<int> pts:int pts_count:int = Update;\nupdateChat#f89a6a4e chat_id:long = Update;\nupdateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector<GroupCallParticipant> version:int = Update;\nupdateGroupCall#97d64341 flags:# chat_id:flags.0?long call:GroupCall = Update;\nupdatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update;\nupdateChatParticipant#d087663a flags:# chat_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update;\nupdateChannelParticipant#985d3abb flags:# via_chatlist:flags.3?true channel_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update;\nupdateBotStopped#c4870a49 user_id:long date:int stopped:Bool qts:int = Update;\nupdateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJSON = Update;\nupdateBotCommands#4d712f2e peer:Peer bot_id:long commands:Vector<BotCommand> = Update;\nupdatePendingJoinRequests#7063c3db peer:Peer requests_pending:int recent_requesters:Vector<long> = Update;\nupdateBotChatInviteRequester#11dfa986 peer:Peer date:int user_id:long about:string invite:ExportedChatInvite qts:int = Update;\nupdateMessageReactions#5e1b3cb8 flags:# peer:Peer msg_id:int top_msg_id:flags.0?int reactions:MessageReactions = Update;\nupdateAttachMenuBots#17b7a20b = Update;\nupdateWebViewResultSent#1592b79d query_id:long = Update;\nupdateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update;\nupdateSavedRingtones#74d8be99 = Update;\nupdateTranscribedAudio#84cd5a flags:# pending:flags.0?true peer:Peer msg_id:int transcription_id:long text:string = Update;\nupdateReadFeaturedEmojiStickers#fb4c496c = Update;\nupdateUserEmojiStatus#28373599 user_id:long emoji_status:EmojiStatus = Update;\nupdateRecentEmojiStatuses#30f443db = Update;\nupdateRecentReactions#6f7863f4 = Update;\nupdateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update;\nupdateMessageExtendedMedia#d5a41724 peer:Peer msg_id:int extended_media:Vector<MessageExtendedMedia> = Update;\nupdateChannelPinnedTopic#192efbe3 flags:# pinned:flags.0?true channel_id:long topic_id:int = Update;\nupdateChannelPinnedTopics#fe198602 flags:# channel_id:long order:flags.0?Vector<int> = Update;\nupdateUser#20529438 user_id:long = Update;\nupdateAutoSaveSettings#ec05b097 = Update;\nupdateStory#75b3b798 peer:Peer story:StoryItem = Update;\nupdateReadStories#f74e932b peer:Peer max_id:int = Update;\nupdateStoryID#1bf335b9 id:int random_id:long = Update;\nupdateStoriesStealthMode#2c084dc1 stealth_mode:StoriesStealthMode = Update;\nupdateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Update;\nupdateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update;\nupdateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update;\nupdatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update;\nupdateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector<Reaction> new_reactions:Vector<Reaction> qts:int = Update;\nupdateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector<ReactionCount> qts:int = Update;\nupdateSavedDialogPinned#aeaf9e74 flags:# pinned:flags.0?true peer:DialogPeer = Update;\nupdatePinnedSavedDialogs#686c85a6 flags:# order:flags.0?Vector<DialogPeer> = Update;\nupdateSavedReactionTags#39c67432 = Update;\nupdateSmsJob#f16269d4 job_id:string = Update;\nupdateQuickReplies#f9470ab2 quick_replies:Vector<QuickReply> = Update;\nupdateNewQuickReply#f53da717 quick_reply:QuickReply = Update;\nupdateDeleteQuickReply#53e6f1ec shortcut_id:int = Update;\nupdateQuickReplyMessage#3e050d0f message:Message = Update;\nupdateDeleteQuickReplyMessages#566fe7cd shortcut_id:int messages:Vector<int> = Update;\nupdateBotBusinessConnect#8ae5c97a connection:BotBusinessConnection qts:int = Update;\nupdateBotNewBusinessMessage#9ddb347c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update;\nupdateBotEditBusinessMessage#7df587c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update;\nupdateBotDeleteBusinessMessage#a02a982e connection_id:string peer:Peer messages:Vector<int> qts:int = Update;\nupdateNewStoryReaction#1824e40b story_id:int peer:Peer reaction:Reaction = Update;\nupdateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueBalances = Update;\nupdateStarsBalance#4e80a379 balance:StarsAmount = Update;\nupdateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long connection_id:string message:Message reply_to_message:flags.2?Message chat_instance:long data:flags.0?bytes = Update;\nupdateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update;\nupdateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update;\nupdatePaidReactionPrivacy#8b725fce private:PaidReactionPrivacy = Update;\nupdates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;\nupdates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference;\nupdates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference;\nupdates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;\nupdates.differenceTooLong#4afe8f6d pts:int = updates.Difference;\nupdatesTooLong#e317af7e = Updates;\nupdateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;\nupdateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;\nupdateShort#78d4dec1 update:Update date:int = Updates;\nupdatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;\nupdates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;\nupdateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;\nphotos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos;\nphotos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos;\nphotos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;\nupload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;\nupload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;\ndcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;\nconfig#cc1a241e flags:# default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int channels_read_media_period:int tmp_sessions:flags.0?int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction autologin_token:flags.16?string = Config;\nnearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;\nhelp.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate;\nhelp.noAppUpdate#c45a6536 = help.AppUpdate;\nhelp.inviteText#18cb9f78 message:string = help.InviteText;\nencryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat;\nencryptedChatWaiting#66b25953 id:int access_hash:long date:int admin_id:long participant_id:long = EncryptedChat;\nencryptedChatRequested#48f1d94c flags:# folder_id:flags.0?int id:int access_hash:long date:int admin_id:long participant_id:long g_a:bytes = EncryptedChat;\nencryptedChat#61f0d4c7 id:int access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long = EncryptedChat;\nencryptedChatDiscarded#1e1c7c45 flags:# history_deleted:flags.0?true id:int = EncryptedChat;\ninputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat;\nencryptedFileEmpty#c21f497e = EncryptedFile;\nencryptedFile#a8008cd8 id:long access_hash:long size:long dc_id:int key_fingerprint:int = EncryptedFile;\ninputEncryptedFileEmpty#1837c364 = InputEncryptedFile;\ninputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile;\ninputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile;\ninputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile;\nencryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage;\nencryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage;\nmessages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig;\nmessages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig;\nmessages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage;\nmessages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage;\ninputDocumentEmpty#72f0eaae = InputDocument;\ninputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;\ndocumentEmpty#36f8c871 id:long = Document;\ndocument#8fd4c4d8 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:long thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;\nhelp.support#17c6b5f6 phone_number:string user:User = help.Support;\nnotifyPeer#9fd40bd8 peer:Peer = NotifyPeer;\nnotifyUsers#b4c83b4c = NotifyPeer;\nnotifyChats#c007cec3 = NotifyPeer;\nnotifyBroadcasts#d612e8ef = NotifyPeer;\nnotifyForumTopic#226e6308 peer:Peer top_msg_id:int = NotifyPeer;\nsendMessageTypingAction#16bf744e = SendMessageAction;\nsendMessageCancelAction#fd5ec8f5 = SendMessageAction;\nsendMessageRecordVideoAction#a187d66f = SendMessageAction;\nsendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction;\nsendMessageRecordAudioAction#d52f73f7 = SendMessageAction;\nsendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction;\nsendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction;\nsendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;\nsendMessageGeoLocationAction#176f8ba1 = SendMessageAction;\nsendMessageChooseContactAction#628cbc6f = SendMessageAction;\nsendMessageGamePlayAction#dd6a8f48 = SendMessageAction;\nsendMessageRecordRoundAction#88f27fbc = SendMessageAction;\nsendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction;\nspeakingInGroupCallAction#d92c2285 = SendMessageAction;\nsendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction;\nsendMessageChooseStickerAction#b05ac6b1 = SendMessageAction;\nsendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction;\nsendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction;\ncontacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found;\ninputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;\ninputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey;\ninputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey;\ninputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey;\ninputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey;\ninputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey;\ninputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey;\ninputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey;\ninputPrivacyKeyVoiceMessages#aee69d68 = InputPrivacyKey;\ninputPrivacyKeyAbout#3823cc40 = InputPrivacyKey;\ninputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey;\ninputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey;\nprivacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;\nprivacyKeyChatInvite#500e6dfa = PrivacyKey;\nprivacyKeyPhoneCall#3d662b7b = PrivacyKey;\nprivacyKeyPhoneP2P#39491cc8 = PrivacyKey;\nprivacyKeyForwards#69ec56a3 = PrivacyKey;\nprivacyKeyProfilePhoto#96151fed = PrivacyKey;\nprivacyKeyPhoneNumber#d19ae46d = PrivacyKey;\nprivacyKeyAddedByPhone#42ffd42b = PrivacyKey;\nprivacyKeyVoiceMessages#697f414 = PrivacyKey;\nprivacyKeyAbout#a486b761 = PrivacyKey;\nprivacyKeyBirthday#2000a518 = PrivacyKey;\nprivacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey;\ninputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;\ninputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;\ninputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule;\ninputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule;\ninputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;\ninputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;\ninputPrivacyValueAllowChatParticipants#840649cf chats:Vector<long> = InputPrivacyRule;\ninputPrivacyValueDisallowChatParticipants#e94f0f86 chats:Vector<long> = InputPrivacyRule;\ninputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule;\ninputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule;\ninputPrivacyValueAllowBots#5a4fcce5 = InputPrivacyRule;\ninputPrivacyValueDisallowBots#c4e57915 = InputPrivacyRule;\nprivacyValueAllowContacts#fffe1bac = PrivacyRule;\nprivacyValueAllowAll#65427b82 = PrivacyRule;\nprivacyValueAllowUsers#b8905fb2 users:Vector<long> = PrivacyRule;\nprivacyValueDisallowContacts#f888fa1a = PrivacyRule;\nprivacyValueDisallowAll#8b73e763 = PrivacyRule;\nprivacyValueDisallowUsers#e4621141 users:Vector<long> = PrivacyRule;\nprivacyValueAllowChatParticipants#6b134e8e chats:Vector<long> = PrivacyRule;\nprivacyValueDisallowChatParticipants#41c87565 chats:Vector<long> = PrivacyRule;\nprivacyValueAllowCloseFriends#f7e8d89b = PrivacyRule;\nprivacyValueAllowPremium#ece9814b = PrivacyRule;\nprivacyValueAllowBots#21461b5d = PrivacyRule;\nprivacyValueDisallowBots#f6a5f82f = PrivacyRule;\naccount.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;\naccountDaysTTL#b8d0afdf days:int = AccountDaysTTL;\ndocumentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;\ndocumentAttributeAnimated#11b58939 = DocumentAttribute;\ndocumentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute;\ndocumentAttributeVideo#43c57c48 flags:# round_message:flags.0?true supports_streaming:flags.1?true nosound:flags.3?true duration:double w:int h:int preload_prefix_size:flags.2?int video_start_ts:flags.4?double video_codec:flags.5?string = DocumentAttribute;\ndocumentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute;\ndocumentAttributeFilename#15590068 file_name:string = DocumentAttribute;\ndocumentAttributeHasStickers#9801d2f7 = DocumentAttribute;\ndocumentAttributeCustomEmoji#fd149899 flags:# free:flags.0?true text_color:flags.1?true alt:string stickerset:InputStickerSet = DocumentAttribute;\nmessages.stickersNotModified#f1749a22 = messages.Stickers;\nmessages.stickers#30a6ec7e hash:long stickers:Vector<Document> = messages.Stickers;\nstickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;\nmessages.allStickersNotModified#e86602c3 = messages.AllStickers;\nmessages.allStickers#cdbbcebb hash:long sets:Vector<StickerSet> = messages.AllStickers;\nmessages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages;\nwebPageEmpty#211a1788 flags:# id:long url:flags.0?string = WebPage;\nwebPagePending#b0d13e47 flags:# id:long url:flags.0?string date:int = WebPage;\nwebPage#e89c45b2 flags:# has_large_media:flags.13?true video_cover_photo:flags.14?true id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage;\nwebPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage;\nauthorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true encrypted_requests_disabled:flags.3?true call_requests_disabled:flags.4?true unconfirmed:flags.5?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;\naccount.authorizations#4bff8ea0 authorization_ttl_days:int authorizations:Vector<Authorization> = account.Authorizations;\naccount.password#957b50fb flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int login_email_pattern:flags.6?string = account.Password;\naccount.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings;\naccount.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings;\nauth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery;\nreceivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage;\nchatInviteExported#a22cbd96 flags:# revoked:flags.0?true permanent:flags.5?true request_needed:flags.6?true link:string admin_id:long date:int start_date:flags.4?int expire_date:flags.1?int usage_limit:flags.2?int usage:flags.3?int requested:flags.7?int subscription_expired:flags.10?int title:flags.8?string subscription_pricing:flags.9?StarsSubscriptionPricing = ExportedChatInvite;\nchatInvitePublicJoinRequests#ed107ab7 = ExportedChatInvite;\nchatInviteAlready#5a686d7c chat:Chat = ChatInvite;\nchatInvite#5c9d3702 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true request_needed:flags.6?true verified:flags.7?true scam:flags.8?true fake:flags.9?true can_refulfill_subscription:flags.11?true title:string about:flags.5?string photo:Photo participants_count:int participants:flags.4?Vector<User> color:int subscription_pricing:flags.10?StarsSubscriptionPricing subscription_form_id:flags.12?long bot_verification:flags.13?BotVerification = ChatInvite;\nchatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite;\ninputStickerSetEmpty#ffb62b95 = InputStickerSet;\ninputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;\ninputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;\ninputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;\ninputStickerSetDice#e67f520e emoticon:string = InputStickerSet;\ninputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;\ninputStickerSetPremiumGifts#c88b3b02 = InputStickerSet;\ninputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet;\ninputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet;\ninputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet;\ninputStickerSetEmojiChannelDefaultStatuses#49748553 = InputStickerSet;\nstickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true emojis:flags.7?true text_color:flags.9?true channel_emoji_status:flags.10?true creator:flags.11?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet;\nmessages.stickerSet#6e153f16 set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = messages.StickerSet;\nmessages.stickerSetNotModified#d3f924eb = messages.StickerSet;\nbotCommand#c27ac8c7 command:string description:string = BotCommand;\nbotInfo#4d8a0299 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings verifier_settings:flags.9?BotVerifierSettings = BotInfo;\nkeyboardButton#a2fa4880 text:string = KeyboardButton;\nkeyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;\nkeyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;\nkeyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;\nkeyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;\nkeyboardButtonSwitchInline#93b9fbb5 flags:# same_peer:flags.0?true text:string query:string peer_types:flags.1?Vector<InlineQueryPeerType> = KeyboardButton;\nkeyboardButtonGame#50f41ccf text:string = KeyboardButton;\nkeyboardButtonBuy#afd93fbb text:string = KeyboardButton;\nkeyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton;\ninputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton;\nkeyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton;\ninputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = KeyboardButton;\nkeyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton;\nkeyboardButtonWebView#13767230 text:string url:string = KeyboardButton;\nkeyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton;\nkeyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton;\ninputKeyboardButtonRequestPeer#c9662d05 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton;\nkeyboardButtonCopy#75d2698e text:string copy_text:string = KeyboardButton;\nkeyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;\nreplyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup;\nreplyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup;\nreplyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true persistent:flags.4?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;\nreplyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup;\nmessageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity;\nmessageEntityMention#fa04579d offset:int length:int = MessageEntity;\nmessageEntityHashtag#6f635b0d offset:int length:int = MessageEntity;\nmessageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity;\nmessageEntityUrl#6ed02538 offset:int length:int = MessageEntity;\nmessageEntityEmail#64e475c2 offset:int length:int = MessageEntity;\nmessageEntityBold#bd610bc9 offset:int length:int = MessageEntity;\nmessageEntityItalic#826f8b60 offset:int length:int = MessageEntity;\nmessageEntityCode#28a20571 offset:int length:int = MessageEntity;\nmessageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;\nmessageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;\nmessageEntityMentionName#dc7b1140 offset:int length:int user_id:long = MessageEntity;\ninputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity;\nmessageEntityPhone#9b69e34b offset:int length:int = MessageEntity;\nmessageEntityCashtag#4c4e743f offset:int length:int = MessageEntity;\nmessageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity;\nmessageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;\nmessageEntityBankCard#761e6af4 offset:int length:int = MessageEntity;\nmessageEntitySpoiler#32ca960f offset:int length:int = MessageEntity;\nmessageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = MessageEntity;\nmessageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int length:int = MessageEntity;\ninputChannelEmpty#ee8c1e86 = InputChannel;\ninputChannel#f35aec28 channel_id:long access_hash:long = InputChannel;\ninputChannelFromMessage#5b934f9d peer:InputPeer msg_id:int channel_id:long = InputChannel;\ncontacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer;\nmessageRange#ae30253 min_id:int max_id:int = MessageRange;\nupdates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference;\nupdates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;\nupdates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;\nchannelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter;\nchannelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter;\nchannelParticipant#cb397619 flags:# user_id:long date:int subscription_until_date:flags.0?int = ChannelParticipant;\nchannelParticipantSelf#4f607bef flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int = ChannelParticipant;\nchannelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant;\nchannelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;\nchannelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant;\nchannelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant;\nchannelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;\nchannelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;\nchannelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter;\nchannelParticipantsBots#b0d1865b = ChannelParticipantsFilter;\nchannelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter;\nchannelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter;\nchannelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter;\nchannelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter;\nchannels.channelParticipants#9ab0feaf count:int participants:Vector<ChannelParticipant> chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipants;\nchannels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants;\nchannels.channelParticipant#dfb80317 participant:ChannelParticipant chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipant;\nhelp.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService;\nmessages.savedGifsNotModified#e8025ca2 = messages.SavedGifs;\nmessages.savedGifs#84a02a0d hash:long gifs:Vector<Document> = messages.SavedGifs;\ninputBotInlineMessageMediaAuto#3380c786 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaInvoice#d7e78225 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaWebPage#bddcc510 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true optional:flags.6?true message:string entities:flags.1?Vector<MessageEntity> url:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;\ninputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;\ninputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult;\ninputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult;\nbotInlineMessageMediaAuto#764cf810 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaWebPage#809ad9a6 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true manual:flags.7?true safe:flags.8?true message:string entities:flags.1?Vector<MessageEntity> url:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;\nbotInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;\nmessages.botResults#e021f2f6 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM switch_webview:flags.3?InlineBotWebView results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults;\nexportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;\nmessageFwdHeader#4e4df4bb flags:# imported:flags.7?true saved_out:flags.11?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int saved_from_id:flags.8?Peer saved_from_name:flags.9?string saved_date:flags.10?int psa_type:flags.6?string = MessageFwdHeader;\nauth.codeTypeSms#72a3158c = auth.CodeType;\nauth.codeTypeCall#741cd3e3 = auth.CodeType;\nauth.codeTypeFlashCall#226ccefb = auth.CodeType;\nauth.codeTypeMissedCall#d61ad6ee = auth.CodeType;\nauth.codeTypeFragmentSms#6ed998c = auth.CodeType;\nauth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;\nauth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;\nauth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;\nauth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;\nauth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType;\nauth.sentCodeTypeEmailCode#f450f59b flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int reset_available_period:flags.3?int reset_pending_date:flags.4?int = auth.SentCodeType;\nauth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType;\nauth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType;\nauth.sentCodeTypeFirebaseSms#9fd736 flags:# nonce:flags.0?bytes play_integrity_project_id:flags.2?long play_integrity_nonce:flags.2?bytes receipt:flags.1?string push_timeout:flags.1?int length:int = auth.SentCodeType;\nauth.sentCodeTypeSmsWord#a416ac81 flags:# beginning:flags.0?string = auth.SentCodeType;\nauth.sentCodeTypeSmsPhrase#b37794af flags:# beginning:flags.0?string = auth.SentCodeType;\nmessages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;\nmessages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData;\ninputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID;\ninputBotInlineMessageID64#b6d915d7 dc_id:int owner_id:long id:int access_hash:long = InputBotInlineMessageID;\ninlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM;\nmessages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs;\ntopPeer#edcdc05b peer:Peer rating:double = TopPeer;\ntopPeerCategoryBotsPM#ab661b5b = TopPeerCategory;\ntopPeerCategoryBotsInline#148677e2 = TopPeerCategory;\ntopPeerCategoryCorrespondents#637b7ed = TopPeerCategory;\ntopPeerCategoryGroups#bd17a14a = TopPeerCategory;\ntopPeerCategoryChannels#161d9628 = TopPeerCategory;\ntopPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory;\ntopPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory;\ntopPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory;\ntopPeerCategoryBotsApp#fd9e7bec = TopPeerCategory;\ntopPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers;\ncontacts.topPeersNotModified#de266ef5 = contacts.TopPeers;\ncontacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers;\ncontacts.topPeersDisabled#b52c939d = contacts.TopPeers;\ndraftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;\ndraftMessage#2d65321f flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo message:string entities:flags.3?Vector<MessageEntity> media:flags.5?InputMedia date:int effect:flags.7?long = DraftMessage;\nmessages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers;\nmessages.featuredStickers#be382906 flags:# premium:flags.0?true hash:long count:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;\nmessages.recentStickersNotModified#b17f890 = messages.RecentStickers;\nmessages.recentStickers#88d37c56 hash:long packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers;\nmessages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers;\nmessages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult;\nmessages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult;\nstickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered;\nstickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered;\nstickerSetFullCovered#40d13c0e set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = StickerSetCovered;\nstickerSetNoCovered#77b15d1c set:StickerSet = StickerSetCovered;\nmaskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords;\ninputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia;\ninputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia;\ngame#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game;\ninputGameID#32c3e77 id:long access_hash:long = InputGame;\ninputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame;\nhighScore#73a379eb pos:int user_id:long score:int = HighScore;\nmessages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores;\ntextEmpty#dc3d824f = RichText;\ntextPlain#744694e0 text:string = RichText;\ntextBold#6724abc4 text:RichText = RichText;\ntextItalic#d912a59c text:RichText = RichText;\ntextUnderline#c12622c4 text:RichText = RichText;\ntextStrike#9bf8bb95 text:RichText = RichText;\ntextFixed#6c3f19b9 text:RichText = RichText;\ntextUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText;\ntextEmail#de5a0dd6 text:RichText email:string = RichText;\ntextConcat#7e6260d7 texts:Vector<RichText> = RichText;\ntextSubscript#ed6a8504 text:RichText = RichText;\ntextSuperscript#c7fb5e01 text:RichText = RichText;\ntextMarked#34b8621 text:RichText = RichText;\ntextPhone#1ccb966a text:RichText phone:string = RichText;\ntextImage#81ccf4f document_id:long w:int h:int = RichText;\ntextAnchor#35553762 text:RichText name:string = RichText;\npageBlockUnsupported#13567e8a = PageBlock;\npageBlockTitle#70abc3fd text:RichText = PageBlock;\npageBlockSubtitle#8ffa9a1f text:RichText = PageBlock;\npageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock;\npageBlockHeader#bfd064ec text:RichText = PageBlock;\npageBlockSubheader#f12bb6e1 text:RichText = PageBlock;\npageBlockParagraph#467a0766 text:RichText = PageBlock;\npageBlockPreformatted#c070d93e text:RichText language:string = PageBlock;\npageBlockFooter#48870999 text:RichText = PageBlock;\npageBlockDivider#db20b188 = PageBlock;\npageBlockAnchor#ce0d37b0 name:string = PageBlock;\npageBlockList#e4e88011 items:Vector<PageListItem> = PageBlock;\npageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock;\npageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock;\npageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock;\npageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock;\npageBlockCover#39f23300 cover:PageBlock = PageBlock;\npageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock;\npageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:PageCaption = PageBlock;\npageBlockCollage#65a0fa4d items:Vector<PageBlock> caption:PageCaption = PageBlock;\npageBlockSlideshow#31f9590 items:Vector<PageBlock> caption:PageCaption = PageBlock;\npageBlockChannel#ef1751b5 channel:Chat = PageBlock;\npageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock;\npageBlockKicker#1e148390 text:RichText = PageBlock;\npageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector<PageTableRow> = PageBlock;\npageBlockOrderedList#9a8ae1e1 items:Vector<PageListOrderedItem> = PageBlock;\npageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector<PageBlock> title:RichText = PageBlock;\npageBlockRelatedArticles#16115a96 title:RichText articles:Vector<PageRelatedArticle> = PageBlock;\npageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock;\nphoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason;\nphoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason;\nphoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason;\nphoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason;\nphoneCallDiscardReasonAllowGroupCall#afe2b839 encrypted_key:bytes = PhoneCallDiscardReason;\ndataJSON#7d748d04 data:string = DataJSON;\nlabeledPrice#cb296bf8 label:string amount:long = LabeledPrice;\ninvoice#49ee584 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector<LabeledPrice> max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector<long> terms_url:flags.10?string subscription_period:flags.11?int = Invoice;\npaymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge;\npostAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress;\npaymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo;\npaymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials;\nwebDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;\nwebDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;\ninputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument;\ninputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation;\ninputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;\ninputWebFileAudioAlbumThumbLocation#f46fe924 flags:# small:flags.2?true document:flags.0?InputDocument title:flags.1?string performer:flags.1?string = InputWebFileLocation;\nupload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;\npayments.paymentForm#a0058751 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON additional_methods:flags.6?Vector<PaymentFormMethod> saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?Vector<PaymentSavedCredentials> users:Vector<User> = payments.PaymentForm;\npayments.paymentFormStars#7bf6b15c flags:# form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice users:Vector<User> = payments.PaymentForm;\npayments.paymentFormStarGift#b425cfe1 form_id:long invoice:Invoice = payments.PaymentForm;\npayments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;\npayments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult;\npayments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult;\npayments.paymentReceipt#70c4fe03 flags:# date:int bot_id:long provider_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;\npayments.paymentReceiptStars#dabbf83a flags:# date:int bot_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice currency:string total_amount:long transaction_id:string users:Vector<User> = payments.PaymentReceipt;\npayments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo;\ninputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials;\ninputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials;\ninputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials;\ninputPaymentCredentialsGooglePay#8ac32801 payment_token:DataJSON = InputPaymentCredentials;\naccount.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword;\nshippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption;\ninputStickerSetItem#32da9e9c flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords keywords:flags.1?string = InputStickerSetItem;\ninputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall;\nphoneCallEmpty#5366c915 id:long = PhoneCall;\nphoneCallWaiting#eed42858 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int conference_call:flags.8?InputGroupCall = PhoneCall;\nphoneCallRequested#45361c63 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall;\nphoneCallAccepted#22fd7181 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall;\nphoneCall#3ba5940c flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int custom_parameters:flags.7?DataJSON conference_call:flags.8?InputGroupCall = PhoneCall;\nphoneCallDiscarded#f9d25503 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int conference_call:flags.8?InputGroupCall = PhoneCall;\nphoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;\nphoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection;\nphoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol;\nphone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall;\nupload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile;\nupload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile;\ncdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey;\ncdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig;\nlangPackString#cad181f6 key:string value:string = LangPackString;\nlangPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString;\nlangPackStringDeleted#2979eeb2 key:string = LangPackString;\nlangPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference;\nlangPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage;\nchannelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction;\nchannelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction;\nchannelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeLinkedChat#50c7ac8 prev_value:long new_value:long = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;\nchannelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction;\nchannelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantJoinByInvite#fe9fc158 flags:# via_chatlist:flags.0?true invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatInvite approved_by:long = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeUsernames#f04fb3a9 prev_value:Vector<string> new_value:Vector<string> = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleForum#2cc6383 new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLogEventAction;\nchannelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic = ChannelAdminLogEventAction;\nchannelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction;\nchannelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleSignatureProfiles#60a79c79 new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent;\nchannels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults;\nchannelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter;\npopularContact#5ce14175 client_id:long importers:int = PopularContact;\nmessages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers;\nmessages.favedStickers#2cb51097 hash:long packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers;\nrecentMeUrlUnknown#46e1d13d url:string = RecentMeUrl;\nrecentMeUrlUser#b92c09e2 url:string user_id:long = RecentMeUrl;\nrecentMeUrlChat#b2da71d2 url:string chat_id:long = RecentMeUrl;\nrecentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl;\nrecentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl;\nhelp.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls;\ninputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia;\nwebAuthorization#a6f8f452 hash:long bot_id:long domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization;\naccount.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations;\ninputMessageID#a676a322 id:int = InputMessage;\ninputMessageReplyTo#bad88395 id:int = InputMessage;\ninputMessagePinned#86872538 = InputMessage;\ninputMessageCallbackQuery#acfa1a7e id:int query_id:long = InputMessage;\ninputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer;\ninputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer;\ndialogPeer#e56dbf05 peer:Peer = DialogPeer;\ndialogPeerFolder#514519e2 folder_id:int = DialogPeer;\nmessages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets;\nmessages.foundStickerSets#8af09dd2 hash:long sets:Vector<StickerSetCovered> = messages.FoundStickerSets;\nfileHash#f39b035c offset:long limit:int hash:bytes = FileHash;\ninputClientProxy#75588b3f address:string port:int = InputClientProxy;\nhelp.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;\nhelp.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;\ninputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile;\ninputSecureFile#5367e5be id:long access_hash:long = InputSecureFile;\nsecureFileEmpty#64199744 = SecureFile;\nsecureFile#7d09c27e id:long access_hash:long size:long dc_id:int date:int file_hash:bytes secret:bytes = SecureFile;\nsecureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData;\nsecurePlainPhone#7d6099dd phone:string = SecurePlainData;\nsecurePlainEmail#21ec5a5f email:string = SecurePlainData;\nsecureValueTypePersonalDetails#9d2a81e3 = SecureValueType;\nsecureValueTypePassport#3dac6a00 = SecureValueType;\nsecureValueTypeDriverLicense#6e425c4 = SecureValueType;\nsecureValueTypeIdentityCard#a0d0744b = SecureValueType;\nsecureValueTypeInternalPassport#99a48f23 = SecureValueType;\nsecureValueTypeAddress#cbe31e26 = SecureValueType;\nsecureValueTypeUtilityBill#fc36954e = SecureValueType;\nsecureValueTypeBankStatement#89137c0d = SecureValueType;\nsecureValueTypeRentalAgreement#8b883488 = SecureValueType;\nsecureValueTypePassportRegistration#99e3806a = SecureValueType;\nsecureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType;\nsecureValueTypePhone#b320aadb = SecureValueType;\nsecureValueTypeEmail#8e3ca7ee = SecureValueType;\nsecureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue;\ninputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector<InputSecureFile> files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue;\nsecureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash;\nsecureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError;\nsecureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;\nsecureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError;\nsecureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;\nsecureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;\naccount.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm;\naccount.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode;\nhelp.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo;\nhelp.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo;\nsavedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact;\naccount.takeout#4dba4501 id:long = account.Takeout;\npasswordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo;\npasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo;\nsecurePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo;\nsecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo;\nsecurePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo;\nsecureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings;\ninputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP;\ninputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP;\nsecureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType;\nsecureRequiredTypeOneOf#27477b4 types:Vector<SecureRequiredType> = SecureRequiredType;\nhelp.passportConfigNotModified#bfb9f457 = help.PassportConfig;\nhelp.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig;\ninputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent;\njsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue;\njsonNull#3f6d7b68 = JSONValue;\njsonBool#c7345e6a value:Bool = JSONValue;\njsonNumber#2be0dfa4 value:double = JSONValue;\njsonString#b71e767a value:string = JSONValue;\njsonArray#f7444763 value:Vector<JSONValue> = JSONValue;\njsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue;\npageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell;\npageTableRow#e0c0c5e5 cells:Vector<PageTableCell> = PageTableRow;\npageCaption#6f747657 text:RichText credit:RichText = PageCaption;\npageListItemText#b92fb6cd text:RichText = PageListItem;\npageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem;\npageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem;\npageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem;\npageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle;\npage#98657f0d flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> views:flags.3?int = Page;\nhelp.supportName#8c05f1c9 name:string = help.SupportName;\nhelp.userInfoEmpty#f3ae2eed = help.UserInfo;\nhelp.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;\npollAnswer#ff16e2ca text:TextWithEntities option:bytes = PollAnswer;\npoll#58747131 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;\npollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;\npollResults#7adf2420 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<Peer> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;\nchatOnlines#f041e250 onlines:int = ChatOnlines;\nstatsURL#47a971e0 url:string = StatsURL;\nchatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true = ChatAdminRights;\nchatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights;\ninputWallPaper#e630b979 id:long access_hash:long = InputWallPaper;\ninputWallPaperSlug#72091c80 slug:string = InputWallPaper;\ninputWallPaperNoFile#967a462e id:long = InputWallPaper;\naccount.wallPapersNotModified#1c199183 = account.WallPapers;\naccount.wallPapers#cdc3858c hash:long wallpapers:Vector<WallPaper> = account.WallPapers;\ncodeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true unknown_number:flags.9?true logout_tokens:flags.6?Vector<bytes> token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings;\nwallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings;\nautoDownloadSettings#baa57628 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true stories_preload:flags.4?true photo_size_max:int video_size_max:long file_size_max:long video_upload_maxbitrate:int small_queue_active_operations_max:int large_queue_active_operations_max:int = AutoDownloadSettings;\naccount.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings;\nemojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword;\nemojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword;\nemojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference;\nemojiURL#a575739d url:string = EmojiURL;\nemojiLanguage#b3fb5361 lang_code:string = EmojiLanguage;\nfolder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder;\ninputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer;\nfolderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer;\nmessages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter;\nurlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult;\nurlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult;\nurlAuthResultDefault#a9d6db1f = UrlAuthResult;\nchannelLocationEmpty#bfb5ad8b = ChannelLocation;\nchannelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation;\npeerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated;\npeerSelfLocated#f8ec284b expires:int = PeerLocated;\nrestrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason;\ninputTheme#3c5693e9 id:long access_hash:long = InputTheme;\ninputThemeSlug#f5890df1 slug:string = InputTheme;\ntheme#a00e67d6 flags:# creator:flags.0?true default:flags.1?true for_chat:flags.5?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?Vector<ThemeSettings> emoticon:flags.6?string installs_count:flags.4?int = Theme;\naccount.themesNotModified#f41eb622 = account.Themes;\naccount.themes#9a3d8c6d hash:long themes:Vector<Theme> = account.Themes;\nauth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken;\nauth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken;\nauth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken;\naccount.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings;\nmessages.inactiveChats#a927fec5 dates:Vector<int> chats:Vector<Chat> users:Vector<User> = messages.InactiveChats;\nbaseThemeClassic#c3a12462 = BaseTheme;\nbaseThemeDay#fbd81688 = BaseTheme;\nbaseThemeNight#b7b31ea8 = BaseTheme;\nbaseThemeTinted#6d5f77ee = BaseTheme;\nbaseThemeArctic#5b11125a = BaseTheme;\ninputThemeSettings#8fde504f flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings;\nthemeSettings#fa58b6d4 flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?WallPaper = ThemeSettings;\nwebPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector<Document> settings:flags.1?ThemeSettings = WebPageAttribute;\nwebPageAttributeStory#2e94c3e7 flags:# peer:Peer id:int story:flags.0?StoryItem = WebPageAttribute;\nwebPageAttributeStickerSet#50cc03d3 flags:# emojis:flags.0?true text_color:flags.1?true stickers:Vector<Document> = WebPageAttribute;\nwebPageAttributeUniqueStarGift#cf6f6db8 gift:StarGift = WebPageAttribute;\nmessages.votesList#4899484e flags:# count:int votes:Vector<MessagePeerVote> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.VotesList;\nbankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl;\npayments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData;\ndialogFilter#aa472651 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter;\ndialogFilterDefault#363293ae = DialogFilter;\ndialogFilterChatlist#96537bd7 flags:# has_my_invites:flags.26?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> = DialogFilter;\ndialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested;\nstatsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays;\nstatsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev;\nstatsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue;\nstatsGraphAsync#4a27eb2d token:string = StatsGraph;\nstatsGraphError#bedc9822 error:string = StatsGraph;\nstatsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph;\nstats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector<PostInteractionCounters> = stats.BroadcastStats;\nhelp.promoDataEmpty#98f6ac75 expires:int = help.PromoData;\nhelp.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData;\nvideoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize;\nvideoSizeEmojiMarkup#f85c413c emoji_id:long background_colors:Vector<int> = VideoSize;\nvideoSizeStickerMarkup#da082fe stickerset:InputStickerSet sticker_id:long background_colors:Vector<int> = VideoSize;\nstatsGroupTopPoster#9d04af9b user_id:long messages:int avg_chars:int = StatsGroupTopPoster;\nstatsGroupTopAdmin#d7584c87 user_id:long deleted:int kicked:int banned:int = StatsGroupTopAdmin;\nstatsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInviter;\nstats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats;\nglobalPrivacySettings#734c4ccb flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true = GlobalPrivacySettings;\nhelp.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode;\nhelp.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector<help.CountryCode> = help.Country;\nhelp.countriesListNotModified#93cc1f32 = help.CountriesList;\nhelp.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList;\nmessageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews;\nmessages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> users:Vector<User> = messages.MessageViews;\nmessages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;\nmessageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int = MessageReplyHeader;\nmessageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader;\nmessageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;\npeerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;\nstats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats;\ngroupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall;\ngroupCall#cdf8d3e3 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int conference_from_call:flags.14?long = GroupCall;\ninputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;\ngroupCallParticipant#eba636fe flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true video_joined:flags.15?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?GroupCallParticipantVideo presentation:flags.14?GroupCallParticipantVideo = GroupCallParticipant;\nphone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall;\nphone.groupParticipants#f47751b6 count:int participants:Vector<GroupCallParticipant> next_offset:string chats:Vector<Chat> users:Vector<User> version:int = phone.GroupParticipants;\ninlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType;\ninlineQueryPeerTypePM#833c0fac = InlineQueryPeerType;\ninlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType;\ninlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType;\ninlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType;\ninlineQueryPeerTypeBotPM#e3b2d0c = InlineQueryPeerType;\nmessages.historyImport#1662af0b id:long = messages.HistoryImport;\nmessages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed;\nmessages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector<int> = messages.AffectedFoundMessages;\nchatInviteImporter#8c5adfd9 flags:# requested:flags.0?true via_chatlist:flags.3?true user_id:long date:int about:flags.2?string approved_by:flags.1?long = ChatInviteImporter;\nmessages.exportedChatInvites#bdc62dcc count:int invites:Vector<ExportedChatInvite> users:Vector<User> = messages.ExportedChatInvites;\nmessages.exportedChatInvite#1871be50 invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;\nmessages.exportedChatInviteReplaced#222600ef invite:ExportedChatInvite new_invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;\nmessages.chatInviteImporters#81b6b00a count:int importers:Vector<ChatInviteImporter> users:Vector<User> = messages.ChatInviteImporters;\nchatAdminWithInvites#f2ecef23 admin_id:long invites_count:int revoked_invites_count:int = ChatAdminWithInvites;\nmessages.chatAdminsWithInvites#b69b72d7 admins:Vector<ChatAdminWithInvites> users:Vector<User> = messages.ChatAdminsWithInvites;\nmessages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer;\nphone.joinAsPeers#afe5623f peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = phone.JoinAsPeers;\nphone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvite;\ngroupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector<int> = GroupCallParticipantVideoSourceGroup;\ngroupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> audio_source:flags.1?int = GroupCallParticipantVideo;\nstickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName;\nbotCommandScopeDefault#2f6cb2ab = BotCommandScope;\nbotCommandScopeUsers#3c4f04d8 = BotCommandScope;\nbotCommandScopeChats#6fe1a881 = BotCommandScope;\nbotCommandScopeChatAdmins#b9aa606a = BotCommandScope;\nbotCommandScopePeer#db9d897d peer:InputPeer = BotCommandScope;\nbotCommandScopePeerAdmins#3fd863d1 peer:InputPeer = BotCommandScope;\nbotCommandScopePeerUser#a1321f3 peer:InputPeer user_id:InputUser = BotCommandScope;\naccount.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordResult;\naccount.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult;\naccount.resetPasswordOk#e926d63e = account.ResetPasswordResult;\nsponsoredMessage#4d93a990 flags:# recommended:flags.5?true can_report:flags.12?true random_id:bytes url:string title:string message:string entities:flags.1?Vector<MessageEntity> photo:flags.6?Photo media:flags.14?MessageMedia color:flags.13?PeerColor button_text:string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage;\nmessages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages;\nmessages.sponsoredMessagesEmpty#1839490f = messages.SponsoredMessages;\nsearchResultsCalendarPeriod#c9b0539f date:int min_msg_id:int max_msg_id:int count:int = SearchResultsCalendarPeriod;\nmessages.searchResultsCalendar#147ee23c flags:# inexact:flags.0?true count:int min_date:int min_msg_id:int offset_id_offset:flags.1?int periods:Vector<SearchResultsCalendarPeriod> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SearchResultsCalendar;\nsearchResultPosition#7f648b67 msg_id:int date:int offset:int = SearchResultsPosition;\nmessages.searchResultsPositions#53b22baf count:int positions:Vector<SearchResultsPosition> = messages.SearchResultsPositions;\nchannels.sendAsPeers#f496b0c6 peers:Vector<SendAsPeer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers;\nusers.userFull#3b6d152e full_user:UserFull chats:Vector<Chat> users:Vector<User> = users.UserFull;\nmessages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Vector<User> = messages.PeerSettings;\nauth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut;\nreactionCount#a3d1cb80 flags:# chosen_order:flags.0?int reaction:Reaction count:int = ReactionCount;\nmessageReactions#a339f0b flags:# min:flags.0?true can_see_list:flags.2?true reactions_as_tags:flags.3?true results:Vector<ReactionCount> recent_reactions:flags.1?Vector<MessagePeerReaction> top_reactors:flags.4?Vector<MessageReactor> = MessageReactions;\nmessages.messageReactionsList#31bd492d flags:# count:int reactions:Vector<MessagePeerReaction> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.MessageReactionsList;\navailableReaction#c077ec01 flags:# inactive:flags.0?true premium:flags.2?true reaction:string title:string static_icon:Document appear_animation:Document select_animation:Document activate_animation:Document effect_animation:Document around_animation:flags.1?Document center_icon:flags.1?Document = AvailableReaction;\nmessages.availableReactionsNotModified#9f071957 = messages.AvailableReactions;\nmessages.availableReactions#768e3aad hash:int reactions:Vector<AvailableReaction> = messages.AvailableReactions;\nmessagePeerReaction#8c79b63c flags:# big:flags.0?true unread:flags.1?true my:flags.2?true peer_id:Peer date:int reaction:Reaction = MessagePeerReaction;\ngroupCallStreamChannel#80eb48af channel:int scale:int last_timestamp_ms:long = GroupCallStreamChannel;\nphone.groupCallStreamChannels#d0e482b2 channels:Vector<GroupCallStreamChannel> = phone.GroupCallStreamChannels;\nphone.groupCallStreamRtmpUrl#2dbf3432 url:string key:string = phone.GroupCallStreamRtmpUrl;\nattachMenuBotIconColor#4576f3f0 name:string color:int = AttachMenuBotIconColor;\nattachMenuBotIcon#b2a7386b flags:# name:string icon:Document colors:flags.0?Vector<AttachMenuBotIconColor> = AttachMenuBotIcon;\nattachMenuBot#d90d8dfe flags:# inactive:flags.0?true has_settings:flags.1?true request_write_access:flags.2?true show_in_attach_menu:flags.3?true show_in_side_menu:flags.4?true side_menu_disclaimer_needed:flags.5?true bot_id:long short_name:string peer_types:flags.3?Vector<AttachMenuPeerType> icons:Vector<AttachMenuBotIcon> = AttachMenuBot;\nattachMenuBotsNotModified#f1d88a5c = AttachMenuBots;\nattachMenuBots#3c4301c0 hash:long bots:Vector<AttachMenuBot> users:Vector<User> = AttachMenuBots;\nattachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector<User> = AttachMenuBotsBot;\nwebViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true fullscreen:flags.2?true query_id:flags.0?long url:string = WebViewResult;\nwebViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent;\nbotMenuButtonDefault#7533a588 = BotMenuButton;\nbotMenuButtonCommands#4258c205 = BotMenuButton;\nbotMenuButton#c7b57ce6 text:string url:string = BotMenuButton;\naccount.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones;\naccount.savedRingtones#c1e92cc5 hash:long ringtones:Vector<Document> = account.SavedRingtones;\nnotificationSoundDefault#97e8bebe = NotificationSound;\nnotificationSoundNone#6f0c34df = NotificationSound;\nnotificationSoundLocal#830b9ae4 title:string data:string = NotificationSound;\nnotificationSoundRingtone#ff6c8049 id:long = NotificationSound;\naccount.savedRingtone#b7263f6d = account.SavedRingtone;\naccount.savedRingtoneConverted#1f307eb7 document:Document = account.SavedRingtone;\nattachMenuPeerTypeSameBotPM#7d6be90e = AttachMenuPeerType;\nattachMenuPeerTypeBotPM#c32bfa1a = AttachMenuPeerType;\nattachMenuPeerTypePM#f146d31f = AttachMenuPeerType;\nattachMenuPeerTypeChat#509113f = AttachMenuPeerType;\nattachMenuPeerTypeBroadcast#7bfbdefc = AttachMenuPeerType;\ninputInvoiceMessage#c5b56859 peer:InputPeer msg_id:int = InputInvoice;\ninputInvoiceSlug#c326caef slug:string = InputInvoice;\ninputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:PremiumGiftCodeOption = InputInvoice;\ninputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice;\ninputInvoiceChatInviteSubscription#34e793f1 hash:string = InputInvoice;\ninputInvoiceStarGift#e8625e92 flags:# hide_name:flags.0?true include_upgrade:flags.2?true peer:InputPeer gift_id:long message:flags.1?TextWithEntities = InputInvoice;\ninputInvoiceStarGiftUpgrade#4d818d5d flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = InputInvoice;\ninputInvoiceStarGiftTransfer#4a5f5bd9 stargift:InputSavedStarGift to_id:InputPeer = InputInvoice;\npayments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice;\nmessages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio;\nhelp.premiumPromo#5334759c status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> period_options:Vector<PremiumSubscriptionOption> users:Vector<User> = help.PremiumPromo;\ninputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgrade:flags.1?true = InputStorePaymentPurpose;\ninputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose;\ninputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector<InputUser> boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose;\ninputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose;\ninputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose;\ninputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose;\ninputStorePaymentStarsGiveaway#751f08fa flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true stars:long boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long users:int = InputStorePaymentPurpose;\npremiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption;\npaymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod;\nemojiStatusEmpty#2de11aae = EmojiStatus;\nemojiStatus#e7ff068a flags:# document_id:long until:flags.0?int = EmojiStatus;\nemojiStatusCollectible#7184603b flags:# collectible_id:long document_id:long title:string slug:string pattern_document_id:long center_color:int edge_color:int pattern_color:int text_color:int until:flags.0?int = EmojiStatus;\ninputEmojiStatusCollectible#7141dbf flags:# collectible_id:long until:flags.0?int = EmojiStatus;\naccount.emojiStatusesNotModified#d08ce645 = account.EmojiStatuses;\naccount.emojiStatuses#90c467d1 hash:long statuses:Vector<EmojiStatus> = account.EmojiStatuses;\nreactionEmpty#79f5d419 = Reaction;\nreactionEmoji#1b2286b8 emoticon:string = Reaction;\nreactionCustomEmoji#8935fc73 document_id:long = Reaction;\nreactionPaid#523da4eb = Reaction;\nchatReactionsNone#eafc32bc = ChatReactions;\nchatReactionsAll#52928bca flags:# allow_custom:flags.0?true = ChatReactions;\nchatReactionsSome#661d4037 reactions:Vector<Reaction> = ChatReactions;\nmessages.reactionsNotModified#b06fdbdf = messages.Reactions;\nmessages.reactions#eafdf716 hash:long reactions:Vector<Reaction> = messages.Reactions;\nemailVerifyPurposeLoginSetup#4345be73 phone_number:string phone_code_hash:string = EmailVerifyPurpose;\nemailVerifyPurposeLoginChange#527d22eb = EmailVerifyPurpose;\nemailVerifyPurposePassport#bbf51685 = EmailVerifyPurpose;\nemailVerificationCode#922e55a9 code:string = EmailVerification;\nemailVerificationGoogle#db909ec2 token:string = EmailVerification;\nemailVerificationApple#96d074fd token:string = EmailVerification;\naccount.emailVerified#2b96cd1b email:string = account.EmailVerified;\naccount.emailVerifiedLogin#e1bb0d61 email:string sent_code:auth.SentCode = account.EmailVerified;\npremiumSubscriptionOption#5f2d1df2 flags:# current:flags.1?true can_purchase_upgrade:flags.2?true transaction:flags.3?string months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumSubscriptionOption;\nsendAsPeer#b81c7034 flags:# premium_required:flags.0?true peer:Peer = SendAsPeer;\nmessageExtendedMediaPreview#ad628cc8 flags:# w:flags.0?int h:flags.0?int thumb:flags.1?PhotoSize video_duration:flags.2?int = MessageExtendedMedia;\nmessageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia;\nstickerKeyword#fcfeb29c document_id:long keyword:Vector<string> = StickerKeyword;\nusername#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username;\nforumTopicDeleted#23f109b id:int = ForumTopic;\nforumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;\nmessages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector<ForumTopic> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int = messages.ForumTopics;\ndefaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL;\nexportedContactToken#41bf109b url:string expires:int = ExportedContactToken;\nrequestPeerTypeUser#5f3b8a00 flags:# bot:flags.0?Bool premium:flags.1?Bool = RequestPeerType;\nrequestPeerTypeChat#c9f06e1b flags:# creator:flags.0?true bot_participant:flags.5?true has_username:flags.3?Bool forum:flags.4?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType;\nrequestPeerTypeBroadcast#339bef6c flags:# creator:flags.0?true has_username:flags.3?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType;\nemojiListNotModified#481eadfa = EmojiList;\nemojiList#7a1e11d1 hash:long document_id:Vector<long> = EmojiList;\nemojiGroup#7a9abda9 title:string icon_emoji_id:long emoticons:Vector<string> = EmojiGroup;\nemojiGroupGreeting#80d26cc7 title:string icon_emoji_id:long emoticons:Vector<string> = EmojiGroup;\nemojiGroupPremium#93bcf34 title:string icon_emoji_id:long = EmojiGroup;\nmessages.emojiGroupsNotModified#6fb4ad87 = messages.EmojiGroups;\nmessages.emojiGroups#881fb94b hash:int groups:Vector<EmojiGroup> = messages.EmojiGroups;\ntextWithEntities#751f3146 text:string entities:Vector<MessageEntity> = TextWithEntities;\nmessages.translateResult#33db32f8 result:Vector<TextWithEntities> = messages.TranslatedText;\nautoSaveSettings#c84834ce flags:# photos:flags.0?true videos:flags.1?true video_max_size:flags.2?long = AutoSaveSettings;\nautoSaveException#81602d47 peer:Peer settings:AutoSaveSettings = AutoSaveException;\naccount.autoSaveSettings#4c3e069d users_settings:AutoSaveSettings chats_settings:AutoSaveSettings broadcasts_settings:AutoSaveSettings exceptions:Vector<AutoSaveException> chats:Vector<Chat> users:Vector<User> = account.AutoSaveSettings;\nhelp.appConfigNotModified#7cde641d = help.AppConfig;\nhelp.appConfig#dd18782e hash:int config:JSONValue = help.AppConfig;\ninputBotAppID#a920bd7a id:long access_hash:long = InputBotApp;\ninputBotAppShortName#908c0407 bot_id:InputUser short_name:string = InputBotApp;\nbotAppNotModified#5da674b7 = BotApp;\nbotApp#95fcd1d6 flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document hash:long = BotApp;\nmessages.botApp#eb50adf5 flags:# inactive:flags.0?true request_write_access:flags.1?true has_settings:flags.2?true app:BotApp = messages.BotApp;\ninlineBotWebView#b57295d5 text:string url:string = InlineBotWebView;\nreadParticipantDate#4a4ff172 user_id:long date:int = ReadParticipantDate;\ninputChatlistDialogFilter#f3e0da33 filter_id:int = InputChatlist;\nexportedChatlistInvite#c5181ac flags:# title:string url:string peers:Vector<Peer> = ExportedChatlistInvite;\nchatlists.exportedChatlistInvite#10e6e3a6 filter:DialogFilter invite:ExportedChatlistInvite = chatlists.ExportedChatlistInvite;\nchatlists.exportedInvites#10ab6dc7 invites:Vector<ExportedChatlistInvite> chats:Vector<Chat> users:Vector<User> = chatlists.ExportedInvites;\nchatlists.chatlistInviteAlready#fa87f659 filter_id:int missing_peers:Vector<Peer> already_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite;\nchatlists.chatlistInvite#f10ece2f flags:# title_noanimate:flags.1?true title:TextWithEntities emoticon:flags.0?string peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite;\nchatlists.chatlistUpdates#93bd878d missing_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistUpdates;\nbots.botInfo#e8a775b0 name:string about:string description:string = bots.BotInfo;\nmessagePeerVote#b6cc2d5c peer:Peer option:bytes date:int = MessagePeerVote;\nmessagePeerVoteInputOption#74cda504 peer:Peer date:int = MessagePeerVote;\nmessagePeerVoteMultiple#4628f6e6 peer:Peer options:Vector<bytes> date:int = MessagePeerVote;\nstoryViews#8d595cd6 flags:# has_viewers:flags.1?true views_count:int forwards_count:flags.2?int reactions:flags.3?Vector<ReactionCount> reactions_count:flags.4?int recent_viewers:flags.0?Vector<long> = StoryViews;\nstoryItemDeleted#51e6ee4f id:int = StoryItem;\nstoryItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem;\nstoryItem#79b26a24 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia media_areas:flags.14?Vector<MediaArea> privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem;\nstories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories;\nstories.allStories#6efc5e81 flags:# has_more:flags.0?true count:int state:string peer_stories:Vector<PeerStories> chats:Vector<Chat> users:Vector<User> stealth_mode:StoriesStealthMode = stories.AllStories;\nstories.stories#63c3dd0a flags:# count:int stories:Vector<StoryItem> pinned_to_top:flags.0?Vector<int> chats:Vector<Chat> users:Vector<User> = stories.Stories;\nstoryView#b0bdeac5 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true user_id:long date:int reaction:flags.2?Reaction = StoryView;\nstoryViewPublicForward#9083670b flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true message:Message = StoryView;\nstoryViewPublicRepost#bd74cf49 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer story:StoryItem = StoryView;\nstories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count:int reactions_count:int views:Vector<StoryView> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = stories.StoryViewsList;\nstories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;\ninputReplyToMessage#22c0f6d5 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int = InputReplyTo;\ninputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo;\nexportedStoryLink#3fc9053b link:string = ExportedStoryLink;\nstoriesStealthMode#712e27fd flags:# active_until_date:flags.0?int cooldown_until_date:flags.1?int = StoriesStealthMode;\nmediaAreaCoordinates#cfc9e002 flags:# x:double y:double w:double h:double rotation:double radius:flags.0?double = MediaAreaCoordinates;\nmediaAreaVenue#be82db9c coordinates:MediaAreaCoordinates geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MediaArea;\ninputMediaAreaVenue#b282217f coordinates:MediaAreaCoordinates query_id:long result_id:string = MediaArea;\nmediaAreaGeoPoint#cad5452d flags:# coordinates:MediaAreaCoordinates geo:GeoPoint address:flags.0?GeoPointAddress = MediaArea;\nmediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea;\nmediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea;\ninputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea;\nmediaAreaUrl#37381085 coordinates:MediaAreaCoordinates url:string = MediaArea;\nmediaAreaWeather#49a6549c coordinates:MediaAreaCoordinates emoji:string temperature_c:double color:int = MediaArea;\nmediaAreaStarGift#5787686d coordinates:MediaAreaCoordinates slug:string = MediaArea;\npeerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector<StoryItem> = PeerStories;\nstories.peerStories#cae68768 stories:PeerStories chats:Vector<Chat> users:Vector<User> = stories.PeerStories;\nmessages.webPage#fd5e12bd webpage:WebPage chats:Vector<Chat> users:Vector<User> = messages.WebPage;\npremiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption;\npayments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector<Chat> users:Vector<User> = payments.CheckedGiftCode;\npayments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo;\npayments.giveawayInfoResults#e175e66f flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.3?string stars_prize:flags.4?long finish_date:int winners_count:int activated_count:flags.2?int = payments.GiveawayInfo;\nprepaidGiveaway#b2539d54 id:long months:int quantity:int date:int = PrepaidGiveaway;\nprepaidStarsGiveaway#9a9d77e0 id:long stars:long quantity:int boosts:int date:int = PrepaidGiveaway;\nboost#4b3e14d6 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int stars:flags.6?long = Boost;\npremium.boostsList#86f8613c flags:# count:int boosts:Vector<Boost> next_offset:flags.0?string users:Vector<User> = premium.BoostsList;\nmyBoost#c448415c flags:# slot:int peer:flags.0?Peer date:int expires:int cooldown_until_date:flags.1?int = MyBoost;\npremium.myBoosts#9ae228e2 my_boosts:Vector<MyBoost> chats:Vector<Chat> users:Vector<User> = premium.MyBoosts;\npremium.boostsStatus#4959427a flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int gift_boosts:flags.4?int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string prepaid_giveaways:flags.3?Vector<PrepaidGiveaway> my_boost_slots:flags.2?Vector<int> = premium.BoostsStatus;\nstoryFwdHeader#b826e150 flags:# modified:flags.3?true from:flags.0?Peer from_name:flags.1?string story_id:flags.2?int = StoryFwdHeader;\npostInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters;\npostInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters;\nstats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats;\npublicForwardMessage#1f2bf4a message:Message = PublicForward;\npublicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward;\nstats.publicForwards#93037e20 flags:# count:int forwards:Vector<PublicForward> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = stats.PublicForwards;\npeerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = PeerColor;\nhelp.peerColorSet#26219a58 colors:Vector<int> = help.PeerColorSet;\nhelp.peerColorProfileSet#767d61eb palette_colors:Vector<int> bg_colors:Vector<int> story_colors:Vector<int> = help.PeerColorSet;\nhelp.peerColorOption#adec6ebe flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet channel_min_level:flags.3?int group_min_level:flags.4?int = help.PeerColorOption;\nhelp.peerColorsNotModified#2ba1f5ce = help.PeerColors;\nhelp.peerColors#f8ed08 hash:int colors:Vector<help.PeerColorOption> = help.PeerColors;\nstoryReaction#6090d6d5 peer_id:Peer date:int reaction:Reaction = StoryReaction;\nstoryReactionPublicForward#bbab2643 message:Message = StoryReaction;\nstoryReactionPublicRepost#cfcd0f13 peer_id:Peer story:StoryItem = StoryReaction;\nstories.storyReactionsList#aa5f789c flags:# count:int reactions:Vector<StoryReaction> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = stories.StoryReactionsList;\nsavedDialog#bd87cb6c flags:# pinned:flags.2?true peer:Peer top_message:int = SavedDialog;\nmessages.savedDialogs#f83ae221 dialogs:Vector<SavedDialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SavedDialogs;\nmessages.savedDialogsSlice#44ba9dd9 count:int dialogs:Vector<SavedDialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SavedDialogs;\nmessages.savedDialogsNotModified#c01f6fe8 count:int = messages.SavedDialogs;\nsavedReactionTag#cb6ff828 flags:# reaction:Reaction title:flags.0?string count:int = SavedReactionTag;\nmessages.savedReactionTagsNotModified#889b59ef = messages.SavedReactionTags;\nmessages.savedReactionTags#3259950a tags:Vector<SavedReactionTag> hash:long = messages.SavedReactionTags;\noutboxReadDate#3bb842ac date:int = OutboxReadDate;\nsmsjobs.eligibleToJoin#dc8b44cf terms_url:string monthly_sent_sms:int = smsjobs.EligibilityToJoin;\nsmsjobs.status#2aee9191 flags:# allow_international:flags.0?true recent_sent:int recent_since:int recent_remains:int total_sent:int total_since:int last_gift_slug:flags.1?string terms_url:string = smsjobs.Status;\nsmsJob#e6a1eeb8 job_id:string phone_number:string text:string = SmsJob;\nbusinessWeeklyOpen#120b1ab9 start_minute:int end_minute:int = BusinessWeeklyOpen;\nbusinessWorkHours#8c92b098 flags:# open_now:flags.0?true timezone_id:string weekly_open:Vector<BusinessWeeklyOpen> = BusinessWorkHours;\nbusinessLocation#ac5c1af7 flags:# geo_point:flags.0?GeoPoint address:string = BusinessLocation;\ninputBusinessRecipients#6f8b32aa flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<InputUser> = InputBusinessRecipients;\nbusinessRecipients#21108ff7 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<long> = BusinessRecipients;\nbusinessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule;\nbusinessAwayMessageScheduleOutsideWorkHours#c3f2f501 = BusinessAwayMessageSchedule;\nbusinessAwayMessageScheduleCustom#cc4d9ecc start_date:int end_date:int = BusinessAwayMessageSchedule;\ninputBusinessGreetingMessage#194cb3b shortcut_id:int recipients:InputBusinessRecipients no_activity_days:int = InputBusinessGreetingMessage;\nbusinessGreetingMessage#e519abab shortcut_id:int recipients:BusinessRecipients no_activity_days:int = BusinessGreetingMessage;\ninputBusinessAwayMessage#832175e0 flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:InputBusinessRecipients = InputBusinessAwayMessage;\nbusinessAwayMessage#ef156a5c flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:BusinessRecipients = BusinessAwayMessage;\ntimezone#ff9289f5 id:string name:string utc_offset:int = Timezone;\nhelp.timezonesListNotModified#970708cc = help.TimezonesList;\nhelp.timezonesList#7b74ed71 timezones:Vector<Timezone> hash:int = help.TimezonesList;\nquickReply#697102b shortcut_id:int shortcut:string top_message:int count:int = QuickReply;\ninputQuickReplyShortcut#24596d41 shortcut:string = InputQuickReplyShortcut;\ninputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut;\nmessages.quickReplies#c68d6695 quick_replies:Vector<QuickReply> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.QuickReplies;\nmessages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies;\nconnectedBot#bd068601 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessBotRecipients = ConnectedBot;\naccount.connectedBots#17d7f87b connected_bots:Vector<ConnectedBot> users:Vector<User> = account.ConnectedBots;\nmessages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector<DialogFilter> = messages.DialogFilters;\nbirthday#6c8e1e06 flags:# day:int month:int year:flags.0?int = Birthday;\nbotBusinessConnection#896433b4 flags:# can_reply:flags.0?true disabled:flags.1?true connection_id:string user_id:long dc_id:int date:int = BotBusinessConnection;\ninputBusinessIntro#9c469cd flags:# title:string description:string sticker:flags.0?InputDocument = InputBusinessIntro;\nbusinessIntro#5a0a066d flags:# title:string description:string sticker:flags.0?Document = BusinessIntro;\nmessages.myStickers#faff629d count:int sets:Vector<StickerSetCovered> = messages.MyStickers;\ninputCollectibleUsername#e39460a9 username:string = InputCollectible;\ninputCollectiblePhone#a2e214a4 phone:string = InputCollectible;\nfragment.collectibleInfo#6ebdff91 purchase_date:int currency:string amount:long crypto_currency:string crypto_amount:long url:string = fragment.CollectibleInfo;\ninputBusinessBotRecipients#c4e5921e flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<InputUser> exclude_users:flags.6?Vector<InputUser> = InputBusinessBotRecipients;\nbusinessBotRecipients#b88cf373 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<long> exclude_users:flags.6?Vector<long> = BusinessBotRecipients;\ncontactBirthday#1d998733 contact_id:long birthday:Birthday = ContactBirthday;\ncontacts.contactBirthdays#114ff30d contacts:Vector<ContactBirthday> users:Vector<User> = contacts.ContactBirthdays;\nmissingInvitee#628c9224 flags:# premium_would_allow_invite:flags.0?true premium_required_for_pm:flags.1?true user_id:long = MissingInvitee;\nmessages.invitedUsers#7f5defa6 updates:Updates missing_invitees:Vector<MissingInvitee> = messages.InvitedUsers;\ninputBusinessChatLink#11679fa7 flags:# message:string entities:flags.0?Vector<MessageEntity> title:flags.1?string = InputBusinessChatLink;\nbusinessChatLink#b4ae666f flags:# link:string message:string entities:flags.0?Vector<MessageEntity> title:flags.1?string views:int = BusinessChatLink;\naccount.businessChatLinks#ec43a2d1 links:Vector<BusinessChatLink> chats:Vector<Chat> users:Vector<User> = account.BusinessChatLinks;\naccount.resolvedBusinessChatLinks#9a23af21 flags:# peer:Peer message:string entities:flags.0?Vector<MessageEntity> chats:Vector<Chat> users:Vector<User> = account.ResolvedBusinessChatLinks;\nrequestedPeerUser#d62ff46a flags:# user_id:long first_name:flags.0?string last_name:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer;\nrequestedPeerChat#7307544f flags:# chat_id:long title:flags.0?string photo:flags.2?Photo = RequestedPeer;\nrequestedPeerChannel#8ba403e4 flags:# channel_id:long title:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer;\nsponsoredMessageReportOption#430d3150 text:string option:bytes = SponsoredMessageReportOption;\nchannels.sponsoredMessageReportResultChooseOption#846f9e42 title:string options:Vector<SponsoredMessageReportOption> = channels.SponsoredMessageReportResult;\nchannels.sponsoredMessageReportResultAdsHidden#3e3bcf2f = channels.SponsoredMessageReportResult;\nchannels.sponsoredMessageReportResultReported#ad798849 = channels.SponsoredMessageReportResult;\nstats.broadcastRevenueStats#5407e297 top_hours_graph:StatsGraph revenue_graph:StatsGraph balances:BroadcastRevenueBalances usd_rate:double = stats.BroadcastRevenueStats;\nstats.broadcastRevenueWithdrawalUrl#ec659737 url:string = stats.BroadcastRevenueWithdrawalUrl;\nbroadcastRevenueTransactionProceeds#557e2cc4 amount:long from_date:int to_date:int = BroadcastRevenueTransaction;\nbroadcastRevenueTransactionWithdrawal#5a590978 flags:# pending:flags.0?true failed:flags.2?true amount:long date:int provider:string transaction_date:flags.1?int transaction_url:flags.1?string = BroadcastRevenueTransaction;\nbroadcastRevenueTransactionRefund#42d30d2e amount:long date:int provider:string = BroadcastRevenueTransaction;\nstats.broadcastRevenueTransactions#87158466 count:int transactions:Vector<BroadcastRevenueTransaction> = stats.BroadcastRevenueTransactions;\nreactionNotificationsFromContacts#bac3a61a = ReactionNotificationsFrom;\nreactionNotificationsFromAll#4b9e22a0 = ReactionNotificationsFrom;\nreactionsNotifySettings#56e34970 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings;\nbroadcastRevenueBalances#c3ff71e7 flags:# withdrawal_enabled:flags.0?true current_balance:long available_balance:long overall_revenue:long = BroadcastRevenueBalances;\navailableEffect#93c3e27e flags:# premium_required:flags.2?true id:long emoticon:string static_icon_id:flags.0?long effect_sticker_id:long effect_animation_id:flags.1?long = AvailableEffect;\nmessages.availableEffectsNotModified#d1ed9a5b = messages.AvailableEffects;\nmessages.availableEffects#bddb616e hash:int effects:Vector<AvailableEffect> documents:Vector<Document> = messages.AvailableEffects;\nfactCheck#b89bfccf flags:# need_check:flags.0?true country:flags.1?string text:flags.1?TextWithEntities hash:long = FactCheck;\nstarsTransactionPeerUnsupported#95f2bfe4 = StarsTransactionPeer;\nstarsTransactionPeerAppStore#b457b375 = StarsTransactionPeer;\nstarsTransactionPeerPlayMarket#7b560a0b = StarsTransactionPeer;\nstarsTransactionPeerPremiumBot#250dbaf8 = StarsTransactionPeer;\nstarsTransactionPeerFragment#e92fd902 = StarsTransactionPeer;\nstarsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer;\nstarsTransactionPeerAds#60682812 = StarsTransactionPeer;\nstarsTransactionPeerAPI#f9677aad = StarsTransactionPeer;\nstarsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption;\nstarsTransaction#64dfc926 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true id:string stars:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector<MessageMedia> subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount = StarsTransaction;\npayments.starsStatus#6c9ce8ed flags:# balance:StarsAmount subscriptions:flags.1?Vector<StarsSubscription> subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector<StarsTransaction> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.StarsStatus;\nfoundStory#e87acbc0 peer:Peer story:StoryItem = FoundStory;\nstories.foundStories#e2de7737 flags:# count:int stories:Vector<FoundStory> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = stories.FoundStories;\ngeoPointAddress#de4c5d93 flags:# country_iso2:string state:flags.0?string city:flags.1?string street:flags.2?string = GeoPointAddress;\nstarsRevenueStatus#febe5491 flags:# withdrawal_enabled:flags.0?true current_balance:StarsAmount available_balance:StarsAmount overall_revenue:StarsAmount next_withdrawal_at:flags.1?int = StarsRevenueStatus;\npayments.starsRevenueStats#c92bb73b revenue_graph:StatsGraph status:StarsRevenueStatus usd_rate:double = payments.StarsRevenueStats;\npayments.starsRevenueWithdrawalUrl#1dab80b7 url:string = payments.StarsRevenueWithdrawalUrl;\npayments.starsRevenueAdsAccountUrl#394e7f21 url:string = payments.StarsRevenueAdsAccountUrl;\ninputStarsTransaction#206ae6d1 flags:# refund:flags.0?true id:string = InputStarsTransaction;\nstarsGiftOption#5e0589f1 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsGiftOption;\nbots.popularAppBots#1991b13b flags:# next_offset:flags.0?string users:Vector<User> = bots.PopularAppBots;\nbotPreviewMedia#23e91ba3 date:int media:MessageMedia = BotPreviewMedia;\nbots.previewInfo#ca71d64 media:Vector<BotPreviewMedia> lang_codes:Vector<string> = bots.PreviewInfo;\nstarsSubscriptionPricing#5416d58 period:int amount:long = StarsSubscriptionPricing;\nstarsSubscription#2e6eab1a flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true bot_canceled:flags.7?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string title:flags.4?string photo:flags.5?WebDocument invoice_slug:flags.6?string = StarsSubscription;\nmessageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor;\nstarsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true stars:long yearly_boosts:int store_product:flags.2?string currency:string amount:long winners:Vector<StarsGiveawayWinnersOption> = StarsGiveawayOption;\nstarsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption;\nstarGift#2cc73c8 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long = StarGift;\nstarGiftUnique#5c62d151 flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int gift_address:flags.3?string = StarGift;\npayments.starGiftsNotModified#a388a368 = payments.StarGifts;\npayments.starGifts#901689ea hash:int gifts:Vector<StarGift> = payments.StarGifts;\nmessageReportOption#7903e3d9 text:string option:bytes = MessageReportOption;\nreportResultChooseOption#f0e4e0b6 title:string options:Vector<MessageReportOption> = ReportResult;\nreportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = ReportResult;\nreportResultReported#8db33c4b = ReportResult;\nmessages.botPreparedInlineMessage#8ecf0511 id:string expire_date:int = messages.BotPreparedInlineMessage;\nmessages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult peer_types:Vector<InlineQueryPeerType> cache_time:int users:Vector<User> = messages.PreparedInlineMessage;\nbotAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings;\nstarRefProgram#dd0c66f2 flags:# bot_id:long commission_permille:int duration_months:flags.0?int end_date:flags.1?int daily_revenue_per_user:flags.2?StarsAmount = StarRefProgram;\nconnectedBotStarRef#19a13f71 flags:# revoked:flags.1?true url:string date:int bot_id:long commission_permille:int duration_months:flags.0?int participants:long revenue:long = ConnectedBotStarRef;\npayments.connectedStarRefBots#98d5ea1d count:int connected_bots:Vector<ConnectedBotStarRef> users:Vector<User> = payments.ConnectedStarRefBots;\npayments.suggestedStarRefBots#b4d5d859 flags:# count:int suggested_bots:Vector<StarRefProgram> users:Vector<User> next_offset:flags.0?string = payments.SuggestedStarRefBots;\nstarsAmount#bbb6b4a3 amount:long nanos:int = StarsAmount;\nmessages.foundStickersNotModified#6010c534 flags:# next_offset:flags.0?int = messages.FoundStickers;\nmessages.foundStickers#82c9e290 flags:# next_offset:flags.0?int hash:long stickers:Vector<Document> = messages.FoundStickers;\nbotVerifierSettings#b0cd6617 flags:# can_modify_custom_description:flags.1?true icon:long company:string custom_description:flags.0?string = BotVerifierSettings;\nbotVerification#f93cd45c bot_id:long icon:long description:string = BotVerification;\nstarGiftAttributeModel#39d99013 name:string document:Document rarity_permille:int = StarGiftAttribute;\nstarGiftAttributePattern#13acff19 name:string document:Document rarity_permille:int = StarGiftAttribute;\nstarGiftAttributeBackdrop#94271762 name:string center_color:int edge_color:int pattern_color:int text_color:int rarity_permille:int = StarGiftAttribute;\nstarGiftAttributeOriginalDetails#e0bff26c flags:# sender_id:flags.0?Peer recipient_id:Peer date:int message:flags.1?TextWithEntities = StarGiftAttribute;\npayments.starGiftUpgradePreview#167bd90b sample_attributes:Vector<StarGiftAttribute> = payments.StarGiftUpgradePreview;\nusers.users#62d706b8 users:Vector<User> = users.Users;\nusers.usersSlice#315a4974 count:int users:Vector<User> = users.Users;\npayments.uniqueStarGift#caa2f60b gift:StarGift users:Vector<User> = payments.UniqueStarGift;\nmessages.webPagePreview#b53e8b21 media:MessageMedia users:Vector<User> = messages.WebPagePreview;\nsavedStarGift#6056dba5 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long = SavedStarGift;\npayments.savedStarGifts#95f389b1 flags:# count:int chat_notifications_enabled:flags.1?Bool gifts:Vector<SavedStarGift> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.SavedStarGifts;\ninputSavedStarGiftUser#69279795 msg_id:int = InputSavedStarGift;\ninputSavedStarGiftChat#f101aa7f peer:InputPeer saved_id:long = InputSavedStarGift;\npayments.starGiftWithdrawalUrl#84aa3a9c url:string = payments.StarGiftWithdrawalUrl;\npaidReactionPrivacyDefault#206ad49e = PaidReactionPrivacy;\npaidReactionPrivacyAnonymous#1f0c1ad9 = PaidReactionPrivacy;\npaidReactionPrivacyPeer#dc6cfcf0 peer:InputPeer = PaidReactionPrivacy;\n---functions---\ninvokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;\ninitConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;\ninvokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;\nauth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;\nauth.signUp#aac7b717 flags:# no_joined_notifications:flags.0?true phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;\nauth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization;\nauth.logOut#3e72ba19 = auth.LoggedOut;\nauth.resetAuthorizations#9fab0d1a = Bool;\nauth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;\nauth.importAuthorization#a57a7dad id:long bytes:bytes = auth.Authorization;\nauth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool;\nauth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization;\nauth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery;\nauth.resendCode#cae47523 flags:# phone_number:string phone_code_hash:string reason:flags.0?string = auth.SentCode;\nauth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool;\nauth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool;\nauth.exportLoginToken#b7e085fe api_id:int api_hash:string except_ids:Vector<long> = auth.LoginToken;\nauth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;\nauth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization;\naccount.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<long> = Bool;\naccount.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector<long> = Bool;\naccount.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool;\naccount.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings;\naccount.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User;\naccount.updateStatus#6628562c offline:Bool = Bool;\naccount.getWallPapers#7967d36 hash:long = account.WallPapers;\naccount.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool;\naccount.checkUsername#2714d86c username:string = Bool;\naccount.updateUsername#3e0bdd7c username:string = User;\naccount.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;\naccount.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;\naccount.getAuthorizations#e320c158 = account.Authorizations;\naccount.resetAuthorization#df77f3bc hash:long = Bool;\naccount.getPassword#548a30f5 = account.Password;\naccount.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings;\naccount.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool;\naccount.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode;\naccount.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool;\naccount.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword;\naccount.getWebAuthorizations#182e6d6f = account.WebAuthorizations;\naccount.resetWebAuthorization#2d01b9ef hash:long = Bool;\naccount.resetWebAuthorizations#682d2594 = Bool;\naccount.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;\naccount.confirmPasswordEmail#8fdf1920 code:string = Bool;\naccount.getContactSignUpNotification#9f07c728 = Bool;\naccount.setContactSignUpNotification#cff43f61 silent:Bool = Bool;\naccount.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true compare_stories:flags.2?true peer:flags.0?InputNotifyPeer = Updates;\naccount.uploadWallPaper#e39a8f03 flags:# for_chat:flags.0?true file:InputFile mime_type:string settings:WallPaperSettings = WallPaper;\naccount.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool;\naccount.getContentSettings#8b9b4dae = account.ContentSettings;\naccount.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings;\naccount.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings;\naccount.reportProfilePhoto#fa8cc6f5 peer:InputPeer photo_id:InputPhoto reason:ReportReason message:string = Bool;\naccount.setAuthorizationTTL#bf899aa0 authorization_ttl_days:int = Bool;\naccount.changeAuthorizationSettings#40f48462 flags:# confirmed:flags.3?true hash:long encrypted_requests_disabled:flags.0?Bool call_requests_disabled:flags.1?Bool = Bool;\naccount.updateEmojiStatus#fbd3de6b emoji_status:EmojiStatus = Bool;\naccount.getRecentEmojiStatuses#f578105 hash:long = account.EmojiStatuses;\naccount.reorderUsernames#ef500eab order:Vector<string> = Bool;\naccount.toggleUsername#58d6b376 username:string active:Bool = Bool;\naccount.resolveBusinessChatLink#5492e5ee slug:string = account.ResolvedBusinessChatLinks;\naccount.toggleSponsoredMessages#b9d9a38d enabled:Bool = Bool;\naccount.getCollectibleEmojiStatuses#2e7b4543 hash:long = account.EmojiStatuses;\nusers.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;\nusers.getFullUser#b60f5918 id:InputUser = users.UserFull;\ncontacts.getContacts#5dd69e12 hash:long = contacts.Contacts;\ncontacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts;\ncontacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates;\ncontacts.block#2e2e8734 flags:# my_stories_from:flags.0?true id:InputPeer = Bool;\ncontacts.unblock#b550d328 flags:# my_stories_from:flags.0?true id:InputPeer = Bool;\ncontacts.getBlocked#9a868f80 flags:# my_stories_from:flags.0?true offset:int limit:int = contacts.Blocked;\ncontacts.search#11f812d8 q:string limit:int = contacts.Found;\ncontacts.resolveUsername#725afbbc flags:# username:string referer:flags.0?string = contacts.ResolvedPeer;\ncontacts.getTopPeers#973478b6 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true bots_app:flags.16?true offset:int limit:int hash:long = contacts.TopPeers;\ncontacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;\ncontacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer;\ncontacts.editCloseFriends#ba6705f0 id:Vector<long> = Bool;\nmessages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;\nmessages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs;\nmessages.getHistory#4423e6c5 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;\nmessages.search#29ee847a flags:# peer:InputPeer q:string from_id:flags.0?InputPeer saved_peer_id:flags.2?InputPeer saved_reaction:flags.3?Vector<Reaction> top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;\nmessages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;\nmessages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory;\nmessages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;\nmessages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;\nmessages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;\nmessages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates;\nmessages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates;\nmessages.forwardMessages#6d74da08 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int = Updates;\nmessages.reportSpam#cf1592db peer:InputPeer = Bool;\nmessages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;\nmessages.report#fc78af9b peer:InputPeer id:Vector<int> option:bytes message:string = ReportResult;\nmessages.getChats#49e9528f id:Vector<long> = messages.Chats;\nmessages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull;\nmessages.editChatTitle#73783ffd chat_id:long title:string = Updates;\nmessages.editChatPhoto#35ddd674 chat_id:long photo:InputChatPhoto = Updates;\nmessages.addChatUser#cbc6d107 chat_id:long user_id:InputUser fwd_limit:int = messages.InvitedUsers;\nmessages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates;\nmessages.createChat#92ceddd4 flags:# users:Vector<InputUser> title:string ttl_period:flags.0?int = messages.InvitedUsers;\nmessages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig;\nmessages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages;\nmessages.getStickers#d5a5d3a1 emoticon:string hash:long = messages.Stickers;\nmessages.getAllStickers#b8a0a1a8 hash:long = messages.AllStickers;\nmessages.getWebPagePreview#570d6f6f flags:# message:string entities:flags.3?Vector<MessageEntity> = messages.WebPagePreview;\nmessages.exportChatInvite#a455de90 flags:# legacy_revoke_permanent:flags.2?true request_needed:flags.3?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int title:flags.4?string subscription_pricing:flags.5?StarsSubscriptionPricing = ExportedChatInvite;\nmessages.checkChatInvite#3eadb1bb hash:string = ChatInvite;\nmessages.importChatInvite#6c50051c hash:string = Updates;\nmessages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet;\nmessages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult;\nmessages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;\nmessages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;\nmessages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector<int> increment:Bool = messages.MessageViews;\nmessages.migrateChat#a2875319 chat_id:long = Updates;\nmessages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true groups_only:flags.2?true users_only:flags.3?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;\nmessages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Document;\nmessages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs;\nmessages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool;\nmessages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;\nmessages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates;\nmessages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates;\nmessages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer;\nmessages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs;\nmessages.saveDraft#d372c5ce flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> media:flags.5?InputMedia effect:flags.7?long = Bool;\nmessages.getFeaturedStickers#64780b14 hash:long = messages.FeaturedStickers;\nmessages.readFeaturedStickers#5b118126 id:Vector<long> = Bool;\nmessages.getRecentStickers#9da9403b flags:# attached:flags.0?true hash:long = messages.RecentStickers;\nmessages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool;\nmessages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool;\nmessages.getCommonChats#e40ca104 user_id:InputUser max_id:long limit:int = messages.Chats;\nmessages.getWebPage#8d9692a3 url:string hash:int = messages.WebPage;\nmessages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;\nmessages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs;\nmessages.uploadMedia#14967978 flags:# business_connection_id:flags.0?string peer:InputPeer media:InputMedia = MessageMedia;\nmessages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers;\nmessages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;\nmessages.getUnreadMentions#f107e790 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;\nmessages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory;\nmessages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates;\nmessages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets;\nmessages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool;\nmessages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates;\nmessages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;\nmessages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;\nmessages.editChatAbout#def60797 peer:InputPeer about:string = Bool;\nmessages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;\nmessages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference;\nmessages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult;\nmessages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult;\nmessages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool;\nmessages.getScheduledHistory#f516760b peer:InputPeer hash:long = messages.Messages;\nmessages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector<int> = Updates;\nmessages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector<int> = Updates;\nmessages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList;\nmessages.getDialogFilters#efd48c89 = messages.DialogFilters;\nmessages.getSuggestedDialogFilters#a29cd42c = Vector<DialogFilterSuggested>;\nmessages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool;\nmessages.updateDialogFiltersOrder#c563c1e4 order:Vector<int> = Bool;\nmessages.getReplies#22ddd30c peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;\nmessages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage;\nmessages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;\nmessages.unpinAllMessages#ee22b9a8 flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory;\nmessages.deleteChat#5bd0ee50 chat_id:long = Bool;\nmessages.getExportedChatInvites#a2b5a3f6 flags:# revoked:flags.3?true peer:InputPeer admin_id:InputUser offset_date:flags.2?int offset_link:flags.2?string limit:int = messages.ExportedChatInvites;\nmessages.editExportedChatInvite#bdca2f75 flags:# revoked:flags.2?true peer:InputPeer link:string expire_date:flags.0?int usage_limit:flags.1?int request_needed:flags.3?Bool title:flags.4?string = messages.ExportedChatInvite;\nmessages.deleteRevokedExportedChatInvites#56987bd5 peer:InputPeer admin_id:InputUser = Bool;\nmessages.deleteExportedChatInvite#d464a42b peer:InputPeer link:string = Bool;\nmessages.getChatInviteImporters#df04dd4e flags:# requested:flags.0?true subscription_expired:flags.3?true peer:InputPeer link:flags.1?string q:flags.2?string offset_date:int offset_user:InputUser limit:int = messages.ChatInviteImporters;\nmessages.getMessageReadParticipants#31c1c44f peer:InputPeer msg_id:int = Vector<ReadParticipantDate>;\nmessages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPeer user_id:InputUser = Updates;\nmessages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates;\nmessages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates;\nmessages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool;\nmessages.sendReaction#d30d78d4 flags:# big:flags.1?true add_to_recent:flags.2?true peer:InputPeer msg_id:int reaction:flags.0?Vector<Reaction> = Updates;\nmessages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates;\nmessages.getMessageReactionsList#461b3f48 flags:# peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = messages.MessageReactionsList;\nmessages.setChatAvailableReactions#864b2581 flags:# peer:InputPeer available_reactions:ChatReactions reactions_limit:flags.0?int paid_enabled:flags.1?Bool = Updates;\nmessages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions;\nmessages.setDefaultReaction#4f47a016 reaction:Reaction = Bool;\nmessages.translateText#63183030 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<TextWithEntities> to_lang:string = messages.TranslatedText;\nmessages.getUnreadReactions#3223495b flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;\nmessages.readReactions#54aa7f8e flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory;\nmessages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots;\nmessages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot;\nmessages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool;\nmessages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult;\nmessages.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool;\nmessages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true fullscreen:flags.8?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult;\nmessages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent;\nmessages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates;\nmessages.transcribeAudio#269e9a49 peer:InputPeer msg_id:int = messages.TranscribedAudio;\nmessages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector<long> = Vector<Document>;\nmessages.getEmojiStickers#fbfca18f hash:long = messages.AllStickers;\nmessages.getFeaturedEmojiStickers#ecf6736 hash:long = messages.FeaturedStickers;\nmessages.getTopReactions#bb8125ba limit:int hash:long = messages.Reactions;\nmessages.getRecentReactions#39461db2 limit:int hash:long = messages.Reactions;\nmessages.clearRecentReactions#9dfeefb4 = Bool;\nmessages.getExtendedMedia#84f80814 peer:InputPeer id:Vector<int> = Updates;\nmessages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:InputPeer = Bool;\nmessages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp;\nmessages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult;\nmessages.getSavedDialogs#5381d21a flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.SavedDialogs;\nmessages.getSavedHistory#3d9a414d peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;\nmessages.deleteSavedHistory#6e98102b flags:# peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory;\nmessages.getPinnedSavedDialogs#d63d94e0 = messages.SavedDialogs;\nmessages.toggleSavedDialogPin#ac81bbde flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;\nmessages.getSavedReactionTags#3637e05b flags:# peer:flags.0?InputPeer hash:long = messages.SavedReactionTags;\nmessages.updateSavedReactionTag#60297dec flags:# reaction:Reaction title:flags.0?string = Bool;\nmessages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions;\nmessages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate;\nmessages.getQuickReplies#d483f2a8 hash:long = messages.QuickReplies;\nmessages.getQuickReplyMessages#94a495c3 flags:# shortcut_id:int id:flags.0?Vector<int> hash:long = messages.Messages;\nmessages.sendQuickReplyMessages#6c750de1 peer:InputPeer shortcut_id:int id:Vector<int> random_id:Vector<long> = Updates;\nmessages.getAvailableEffects#dea20a39 hash:int = messages.AvailableEffects;\nmessages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector<int> = Vector<FactCheck>;\nmessages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult;\nmessages.sendPaidReaction#58bbcb50 flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?PaidReactionPrivacy = Updates;\nmessages.getPaidReactionPrivacy#472455aa = Updates;\nmessages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool;\nmessages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool;\nmessages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult;\nmessages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages;\nmessages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage;\nmessages.reportMessagesDelivery#5a6d7395 flags:# push:flags.0?true peer:InputPeer id:Vector<int> = Bool;\nupdates.getState#edd4882a = updates.State;\nupdates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference;\nupdates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;\nphotos.updateProfilePhoto#9e82039 flags:# fallback:flags.0?true bot:flags.1?InputUser id:InputPhoto = photos.Photo;\nphotos.uploadProfilePhoto#388a3b5 flags:# fallback:flags.3?true bot:flags.5?InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.4?VideoSize = photos.Photo;\nphotos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>;\nphotos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;\nphotos.uploadContactProfilePhoto#e14c4a71 flags:# suggest:flags.3?true save:flags.4?true user_id:InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.5?VideoSize = photos.Photo;\nupload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;\nupload.getFile#be5335be flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:long limit:int = upload.File;\nupload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;\nupload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;\nhelp.getConfig#c4f9186b = Config;\nhelp.getNearestDc#1fb33026 = NearestDc;\nhelp.getSupport#9cdf08cd = help.Support;\nhelp.acceptTermsOfService#ee72f79a id:DataJSON = Bool;\nhelp.getAppConfig#61e3f854 hash:int = help.AppConfig;\nhelp.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList;\nhelp.getPremiumPromo#b81b93d4 = help.PremiumPromo;\nhelp.getPeerColors#da80f42f hash:int = help.PeerColors;\nhelp.getTimezonesList#49b30240 hash:int = help.TimezonesList;\nchannels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;\nchannels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;\nchannels.reportSpam#f44a8315 channel:InputChannel participant:InputPeer id:Vector<int> = Bool;\nchannels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages;\nchannels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:long = channels.ChannelParticipants;\nchannels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant;\nchannels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;\nchannels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;\nchannels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates;\nchannels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates;\nchannels.editTitle#566decd0 channel:InputChannel title:string = Updates;\nchannels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;\nchannels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;\nchannels.updateUsername#3514b3de channel:InputChannel username:string = Bool;\nchannels.joinChannel#24b524c5 channel:InputChannel = Updates;\nchannels.leaveChannel#f836aa95 channel:InputChannel = Updates;\nchannels.inviteToChannel#c9e33d54 channel:InputChannel users:Vector<InputUser> = messages.InvitedUsers;\nchannels.deleteChannel#c0111fe3 channel:InputChannel = Updates;\nchannels.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink;\nchannels.toggleSignatures#418d549c flags:# signatures_enabled:flags.0?true profiles_enabled:flags.1?true channel:InputChannel = Updates;\nchannels.editBanned#96e6cd81 channel:InputChannel participant:InputPeer banned_rights:ChatBannedRights = Updates;\nchannels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;\nchannels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;\nchannels.getGroupsForDiscussion#f5dad378 = messages.Chats;\nchannels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;\nchannels.getSendAs#e785a43f flags:# for_paid_reactions:flags.0?true peer:InputPeer = channels.SendAsPeers;\nchannels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory;\nchannels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates;\nchannels.toggleJoinRequest#4c2985b6 channel:InputChannel enabled:Bool = Updates;\nchannels.reorderUsernames#b45ced1d channel:InputChannel order:Vector<string> = Bool;\nchannels.toggleUsername#50f24105 channel:InputChannel username:string active:Bool = Bool;\nchannels.deactivateAllUsernames#a245dd3 channel:InputChannel = Bool;\nchannels.toggleForum#a4298b29 channel:InputChannel enabled:Bool = Updates;\nchannels.createForumTopic#f40c0224 flags:# channel:InputChannel title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates;\nchannels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics;\nchannels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector<int> = messages.ForumTopics;\nchannels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates;\nchannels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates;\nchannels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory;\nchannels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates;\nchannels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates;\nchannels.getChannelRecommendations#25a71742 flags:# channel:flags.0?InputChannel = messages.Chats;\nchannels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;\nbots.setBotInfo#10cf3123 flags:# bot:flags.2?InputUser lang_code:string name:flags.3?string about:flags.0?string description:flags.1?string = Bool;\nbots.canSendMessage#1359f4e6 bot:InputUser = Bool;\nbots.allowSendMessage#f132e3ef bot:InputUser = Updates;\nbots.invokeWebViewCustomMethod#87fc5e7 bot:InputUser custom_method:string params:DataJSON = DataJSON;\nbots.getPopularAppBots#c2510192 offset:string limit:int = bots.PopularAppBots;\nbots.getPreviewMedias#a2a5594d bot:InputUser = Vector<BotPreviewMedia>;\nbots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool;\nbots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool;\nbots.getBotRecommendations#a1b70815 bot:InputUser = users.Users;\npayments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm;\npayments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;\npayments.validateRequestedInfo#b6c8f12b flags:# save:flags.0?true invoice:InputInvoice info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;\npayments.sendPaymentForm#2d03522f flags:# form_id:long invoice:InputInvoice requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult;\npayments.getSavedInfo#227d824b = payments.SavedInfo;\npayments.getPremiumGiftCodeOptions#2757ba54 flags:# boost_peer:flags.0?InputPeer = Vector<PremiumGiftCodeOption>;\npayments.checkGiftCode#8e51b4c1 slug:string = payments.CheckedGiftCode;\npayments.applyGiftCode#f6e26854 slug:string = Updates;\npayments.getGiveawayInfo#f4239425 peer:InputPeer msg_id:int = payments.GiveawayInfo;\npayments.launchPrepaidGiveaway#5ff58f20 peer:InputPeer giveaway_id:long purpose:InputStorePaymentPurpose = Updates;\npayments.getStarsTopupOptions#c00ec7d3 = Vector<StarsTopupOption>;\npayments.getStarsStatus#104fcfa7 peer:InputPeer = payments.StarsStatus;\npayments.getStarsTransactions#69da4557 flags:# inbound:flags.0?true outbound:flags.1?true ascending:flags.2?true subscription_id:flags.3?string peer:InputPeer offset:string limit:int = payments.StarsStatus;\npayments.sendStarsForm#7998c914 form_id:long invoice:InputInvoice = payments.PaymentResult;\npayments.refundStarsCharge#25ae8f4a user_id:InputUser charge_id:string = Updates;\npayments.getStarsTransactionsByID#27842d2e peer:InputPeer id:Vector<InputStarsTransaction> = payments.StarsStatus;\npayments.getStarsGiftOptions#d3c96bc8 flags:# user_id:flags.0?InputUser = Vector<StarsGiftOption>;\npayments.getStarsSubscriptions#32512c5 flags:# missing_balance:flags.0?true peer:InputPeer offset:string = payments.StarsStatus;\npayments.changeStarsSubscription#c7770878 flags:# peer:InputPeer subscription_id:string canceled:flags.0?Bool = Bool;\npayments.fulfillStarsSubscription#cc5bebb3 peer:InputPeer subscription_id:string = Bool;\npayments.getStarsGiveawayOptions#bd1efd3e = Vector<StarsGiveawayOption>;\npayments.getStarGifts#c4563590 hash:int = payments.StarGifts;\npayments.saveStarGift#2a2a697c flags:# unsave:flags.0?true stargift:InputSavedStarGift = Bool;\npayments.convertStarGift#74bf076b stargift:InputSavedStarGift = Bool;\npayments.getStarGiftUpgradePreview#9c9abcb1 gift_id:long = payments.StarGiftUpgradePreview;\npayments.upgradeStarGift#aed6e4f5 flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = Updates;\npayments.transferStarGift#7f18176a stargift:InputSavedStarGift to_id:InputPeer = Updates;\npayments.getUniqueStarGift#a1974d72 slug:string = payments.UniqueStarGift;\npayments.getSavedStarGifts#23830de9 flags:# exclude_unsaved:flags.0?true exclude_saved:flags.1?true exclude_unlimited:flags.2?true exclude_limited:flags.3?true exclude_unique:flags.4?true sort_by_value:flags.5?true peer:InputPeer offset:string limit:int = payments.SavedStarGifts;\npayments.getStarGiftWithdrawalUrl#d06e93a8 stargift:InputSavedStarGift password:InputCheckPasswordSRP = payments.StarGiftWithdrawalUrl;\npayments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector<InputSavedStarGift> = Bool;\nphone.requestCall#a6c4600c flags:# video:flags.0?true user_id:InputUser conference_call:flags.1?InputGroupCall random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;\nphone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall;\nphone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;\nphone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;\nphone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates;\nphone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates;\nphone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;\nphone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool;\nphone.createGroupCall#48cdc6d8 flags:# rtmp_stream:flags.2?true peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates;\nphone.joinGroupCall#d61e1df3 flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string key_fingerprint:flags.3?long params:DataJSON = Updates;\nphone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates;\nphone.discardGroupCall#7a777135 call:InputGroupCall = Updates;\nphone.getGroupCall#41845db call:InputGroupCall limit:int = phone.GroupCall;\nphone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector<InputPeer> sources:Vector<int> offset:string limit:int = phone.GroupParticipants;\nphone.editGroupCallParticipant#a5273abf flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_stopped:flags.3?Bool video_paused:flags.4?Bool presentation_paused:flags.5?Bool = Updates;\nphone.exportGroupCallInvite#e6aa647f flags:# can_self_unmute:flags.0?true call:InputGroupCall = phone.ExportedGroupCallInvite;\nphone.toggleGroupCallStartSubscription#219c34e6 call:InputGroupCall subscribed:Bool = Updates;\nphone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = Updates;\nphone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates;\nlangpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;\nlangpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;\nlangpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference;\nlangpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;\nlangpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage;\nfolders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;\nstats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;\nstats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;\nstats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats;\nstats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards;\nstats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;\nstats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats;\nstats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards;\nstats.getBroadcastRevenueStats#f788ee19 flags:# dark:flags.0?true peer:InputPeer = stats.BroadcastRevenueStats;\nstats.getBroadcastRevenueWithdrawalUrl#9df4faad peer:InputPeer password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl;\nchatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector<InputPeer> = chatlists.ExportedChatlistInvite;\nchatlists.deleteExportedInvite#719c5c5e chatlist:InputChatlist slug:string = Bool;\nchatlists.editExportedInvite#653db63d flags:# chatlist:InputChatlist slug:string title:flags.1?string peers:flags.2?Vector<InputPeer> = ExportedChatlistInvite;\nchatlists.getExportedInvites#ce03da83 chatlist:InputChatlist = chatlists.ExportedInvites;\nchatlists.checkChatlistInvite#41c10fff slug:string = chatlists.ChatlistInvite;\nchatlists.joinChatlistInvite#a6b1e39a slug:string peers:Vector<InputPeer> = Updates;\nchatlists.getLeaveChatlistSuggestions#fdbcd714 chatlist:InputChatlist = Vector<Peer>;\nchatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer> = Updates;\nstories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector<MediaArea> caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> = Updates;\nstories.deleteStories#ae59db5f peer:InputPeer id:Vector<int> = Vector<int>;\nstories.togglePinned#9a75a1ef peer:InputPeer id:Vector<int> pinned:Bool = Vector<int>;\nstories.getAllStories#eeb0d625 flags:# next:flags.1?true hidden:flags.2?true state:flags.0?string = stories.AllStories;\nstories.getPinnedStories#5821a5dc peer:InputPeer offset_id:int limit:int = stories.Stories;\nstories.getStoriesArchive#b4352016 peer:InputPeer offset_id:int limit:int = stories.Stories;\nstories.getStoriesByID#5774ca74 peer:InputPeer id:Vector<int> = stories.Stories;\nstories.readStories#a556dac8 peer:InputPeer max_id:int = Vector<int>;\nstories.incrementStoryViews#b2028afb peer:InputPeer id:Vector<int> = Bool;\nstories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList;\nstories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector<int> = stories.StoryViews;\nstories.exportStoryLink#7b8def20 peer:InputPeer id:int = ExportedStoryLink;\nstories.report#19d8eb45 peer:InputPeer id:Vector<int> option:bytes message:string = ReportResult;\nstories.activateStealthMode#57bbd166 flags:# past:flags.0?true future:flags.1?true = Updates;\nstories.sendReaction#7fd736b2 flags:# add_to_recent:flags.0?true peer:InputPeer story_id:int reaction:Reaction = Updates;\nstories.getPeerStories#2c4ada50 peer:InputPeer = stories.PeerStories;\nstories.getPeerMaxIDs#535983c3 id:Vector<InputPeer> = Vector<int>;\nstories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool;\nstories.togglePinnedToTop#b297e9b peer:InputPeer id:Vector<int> = Bool;\npremium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList;\npremium.getMyBoosts#be77b4a = premium.MyBoosts;\npremium.applyBoost#6b7da746 flags:# slots:flags.0?Vector<int> peer:InputPeer = premium.MyBoosts;\npremium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus;\nfragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;"),[n,s]=Je("resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ;\np_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data;\np_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;\np_q_inner_data_temp#3c6a84d4 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data;\np_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;\nserver_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;\nserver_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;\nserver_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;\nclient_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;\ndh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;\ndh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;\ndh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;\ndestroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes;\ndestroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes;\ndestroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes;\n---functions---\nreq_pq#60469778 nonce:int128 = ResPQ;\nreq_pq_multi#be7e8ef1 nonce:int128 = ResPQ;\nreq_pq_multi_new#51b410fd nonce:int128 = ResPQ;\nreq_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;\nset_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;\ndestroy_auth_key#d1435160 = DestroyAuthKeyRes;\n---types---\nmsgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck;\nbad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification;\nbad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification;\nmsgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq;\nmsgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo;\nmsgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo;\nmsg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo;\nmsg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo;\nmsg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq;\nrpc_error#2144ca19 error_code:int error_message:string = RpcError;\nrpc_answer_unknown#5e2ad36e = RpcDropAnswer;\nrpc_answer_dropped_running#cd78e586 = RpcDropAnswer;\nrpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer;\nfuture_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;\nfuture_salts#ae500895 req_msg_id:long now:int salts:vector<FutureSalt> = FutureSalts;\npong#347773c5 msg_id:long ping_id:long = Pong;\ndestroy_session_ok#e22045fc session_id:long = DestroySessionRes;\ndestroy_session_none#62d350c9 session_id:long = DestroySessionRes;\nnew_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession;\nhttp_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait;\nipPort#d433ad73 ipv4:int port:int = IpPort;\nipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort;\naccessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector<IpPort> = AccessPointRule;\nhelp.configSimple#5a592a6c date:int expires:int rules:vector<AccessPointRule> = help.ConfigSimple;\ntlsClientHello blocks:vector<TlsBlock> = TlsClientHello;\ntlsBlockString data:string = TlsBlock;\ntlsBlockRandom length:int = TlsBlock;\ntlsBlockZero length:int = TlsBlock;\ntlsBlockDomain = TlsBlock;\ntlsBlockGrease seed:int = TlsBlock;\ntlsBlockScope entries:Vector<TlsBlock> = TlsBlock;\n---functions---\nping#7abe77ec ping_id:long = Pong;\nping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong;");return{constructors:[].concat(e,n),requests:[].concat(t,s)}}(),Ke&&localStorage.setItem($e,JSON.stringify(e))),function(e,t){const n={...e};return Object.keys(t).forEach((e=>{"function"!=typeof t[e]&&n[e]?Object.assign(n[e],t[e]):n[e]=t[e]})),n}(Ze("constructor",e.constructors),Ze("request",e.requests))}();function et(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class tt extends Error{constructor(e,t,n){super("RPCError {0}: {1}{2}".replace("{0}",n?.toString()||"").replace("{1}",e).replace("{2}",tt._fmtRequest(t))),et(this,"code",void 0),et(this,"errorMessage",void 0),this.code=n,this.errorMessage=e}static _fmtRequest(e){return e?` (caused by ${e.className})`:""}}class nt extends tt{constructor(e,t,n){super(e,t,n),this.code=n||303,this.errorMessage=e||"ERROR_SEE_OTHER"}}class st extends tt{constructor(...e){super(...e),et(this,"code",400),et(this,"errorMessage","BAD_REQUEST")}}class at extends tt{constructor(...e){super(...e),et(this,"code",420),et(this,"errorMessage","FLOOD")}}class it extends tt{constructor(...e){super(...e),et(this,"code",500),et(this,"errorMessage","INTERNAL")}}class ot extends tt{constructor(...e){super(...e),et(this,"code",503),et(this,"errorMessage","Timeout")}}function rt(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ct extends nt{constructor(e){const t=Number(e.capture||0);super(`The user whose identity is being used to execute queries is associated with DC ${t}${tt._fmtRequest(e.request)}`,e.request),rt(this,"newDc",void 0),this.message=`The user whose identity is being used to execute queries is associated with DC ${t}${tt._fmtRequest(e.request)}`,this.newDc=t}}class dt extends nt{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}${tt._fmtRequest(e.request)}`,e.request),rt(this,"newDc",void 0),this.message=`The phone number a user is trying to use for authorization is associated with DC ${t}${tt._fmtRequest(e.request)}`,this.newDc=t}}class ut extends at{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required${tt._fmtRequest(e.request)}`,e.request),rt(this,"seconds",void 0),this.message=`A wait of ${t} seconds is required${tt._fmtRequest(e.request)}`,this.seconds=t}}class lt extends ut{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required${tt._fmtRequest(e.request)}`),this.message=`A wait of ${t} seconds is required${tt._fmtRequest(e.request)}`,this.seconds=t}}class ft extends at{constructor(e){super(`Message failed to be sent.${tt._fmtRequest(e.request)}`,e.request),this.message=`Message failed to be sent.${tt._fmtRequest(e.request)}`}}class gt extends at{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required in the test servers${tt._fmtRequest(e.request)}`,e.request),rt(this,"seconds",void 0),this.message=`A wait of ${t} seconds is required in the test servers${tt._fmtRequest(e.request)}`,this.seconds=t}}class pt extends nt{constructor(e){const t=Number(e.capture||0);super(`The source IP address is associated with DC ${t}${tt._fmtRequest(e.request)}`,e.request),rt(this,"newDc",void 0),this.message=`The source IP address is associated with DC ${t}${tt._fmtRequest(e.request)}`,this.newDc=t}}class ht extends st{constructor(e){const t=Number(e.capture||0);super(`Email unconfirmed, the length of the code must be ${t}${tt._fmtRequest(e.request)}`,e.request,400),rt(this,"codeLength",void 0),this.message=`Email unconfirmed, the length of the code must be ${t}${tt._fmtRequest(e.request)}`,this.codeLength=t}}class mt extends st{constructor(e){const t=Number(e.capture||0);super(`The password was modified less than 24 hours ago, try again in ${t} seconds.`,e.request),rt(this,"seconds",void 0),this.message=`The password was modified less than 24 hours ago, try again in ${t} seconds.`,this.seconds=t}}const yt=new Map([[/FILE_MIGRATE_(\d+)/,class extends nt{constructor(e){const t=Number(e.capture||0);super(`The file to be accessed is currently stored in DC ${t}${tt._fmtRequest(e.request)}`,e.request),rt(this,"newDc",void 0),this.message=`The file to be accessed is currently stored in DC ${t}${tt._fmtRequest(e.request)}`,this.newDc=t}}],[/FLOOD_TEST_PHONE_WAIT_(\d+)/,gt],[/FLOOD_WAIT_(\d+)/,ut],[/FLOOD_PREMIUM_WAIT_(\d+)/,lt],[/MSG_WAIT_(.*)/,ft],[/PHONE_MIGRATE_(\d+)/,dt],[/SLOWMODE_WAIT_(\d+)/,class extends at{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required before sending another message in this chat ${tt._fmtRequest(e.request)}`,e.request),rt(this,"seconds",void 0),this.message=`A wait of ${t} seconds is required before sending another message in this chat${tt._fmtRequest(e.request)}`,this.seconds=t}}],[/USER_MIGRATE_(\d+)/,ct],[/NETWORK_MIGRATE_(\d+)/,pt],[/EMAIL_UNCONFIRMED_(\d+)/,ht],[/PASSWORD_TOO_FRESH_(\d+)/,mt],[/^Timeout$/,ot]]);function _t(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Error;class bt 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}`),_t(this,"invalidConstructorId",void 0),_t(this,"remaining",void 0),"undefined"!=typeof alert&&alert(`Missing MTProto Entity: Please, make sure to add TL definition for ID ${e}`),this.invalidConstructorId=e,this.remaining=t}}Error;class vt extends Error{constructor(e){let t;4===e.length?(t=-e.readInt32LE(0),super(`Invalid response buffer (HTTP code ${t})`),_t(this,"code",void 0),_t(this,"payload",void 0)):(super(`Invalid response buffer (too short ${e})`),_t(this,"code",void 0),_t(this,"payload",void 0)),this.code=t,this.payload=e}}class wt extends Error{constructor(...e){e.length||(e=["A security check failed."]),super(...e)}}class St extends Error{constructor(e,t){let n=St.ErrorMessages[t]||`Unknown error code (this should not happen): ${t}.`;n+=` Caused by ${e.className}`,super(n),_t(this,"code",void 0),_t(this,"errorMessage",void 0),this.errorMessage=n,this.code=t}}function It(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}_t(St,"ErrorMessages",{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."});class Pt{constructor(){It(this,"_queue",void 0),It(this,"canGet",void 0),It(this,"resolveGet",void 0),It(this,"canPush",void 0),It(this,"resolvePush",void 0),this._queue=[],this.resolvePush=()=>{},this.resolveGet=()=>{},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}}var Ct=n(87784),Mt=n(48287).hp;function Rt(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class kt{constructor(e){Rt(this,"data",void 0),Rt(this,"CONSTRUCTOR_ID",void 0),Rt(this,"classType",void 0),this.data=e,this.CONSTRUCTOR_ID=812830625,this.classType="constructor"}static async gzipIfSmaller(e,t){if(e&&t.length>512){const e=await new kt(t).toBytes();if(e.length<t.length)return e}return t}static gzip(e){return Mt.from(e)}static ungzip(e){return Mt.from((0,Ct.inflate)(e))}async toBytes(){const e=Mt.alloc(4);return e.writeUInt32LE(kt.CONSTRUCTOR_ID,0),Mt.concat([e,je(await kt.gzip(this.data))])}static read(e){if(e.readInt(!1)!==kt.CONSTRUCTOR_ID)throw new Error("not equal");return kt.gzip(e.tgReadBytes())}static async fromReader(e){const t=e.tgReadBytes();return new kt(await kt.ungzip(t))}}function At(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Rt(kt,"CONSTRUCTOR_ID",812830625),Rt(kt,"classType","constructor");class Tt{constructor(e,t,n){At(this,"msgId",void 0),At(this,"seqNo",void 0),At(this,"obj",void 0),this.msgId=e,this.seqNo=t,this.obj=n}}function Et(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}At(Tt,"SIZE_OVERHEAD",12),At(Tt,"classType","constructor");class Ut{constructor(e){Et(this,"CONSTRUCTOR_ID",void 0),Et(this,"messages",void 0),Et(this,"classType",void 0),this.CONSTRUCTOR_ID=1945237724,this.messages=e,this.classType="constructor"}static fromReader(e){const t=[],n=e.readInt();for(let s=0;s<n;s++){const n=e.readLong(),s=e.readInt(),a=e.readInt(),i=e.tellPosition(),o=e.tgReadObject();e.setPosition(i+a);const r=new Tt(n,s,o);t.push(r)}return new Ut(t)}}function Dt(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Et(Ut,"CONSTRUCTOR_ID",1945237724),Et(Ut,"classType","constructor"),Et(Ut,"MAXIMUM_SIZE",1044448),Et(Ut,"MAXIMUM_LENGTH",100);class Bt{constructor(e,t,n){Dt(this,"CONSTRUCTOR_ID",void 0),Dt(this,"reqMsgId",void 0),Dt(this,"body",void 0),Dt(this,"error",void 0),Dt(this,"classType",void 0),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===Ye.RpcError.CONSTRUCTOR_ID?new Bt(t,void 0,Ye.RpcError.fromReader(e)):n===kt.CONSTRUCTOR_ID?new Bt(t,(await kt.fromReader(e)).data):(e.seek(-4),new Bt(t,e.read(),void 0))}}Dt(Bt,"CONSTRUCTOR_ID",4082920705),Dt(Bt,"classType","constructor");const xt=new Map([[Bt.CONSTRUCTOR_ID,Bt],[kt.CONSTRUCTOR_ID,kt],[Ut.CONSTRUCTOR_ID,Ut]]),Vt={};for(const e of Object.values(Ye))if("CONSTRUCTOR_ID"in e)Vt[e.CONSTRUCTOR_ID]=e;else for(const t of Object.values(e))Vt[t.CONSTRUCTOR_ID]=t;function Nt(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ft{constructor(e){Nt(this,"stream",void 0),Nt(this,"_last",void 0),Nt(this,"offset",void 0),this.stream=e,this._last=void 0,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){return Pe(this.read(Math.floor(e/8)),!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=Vt[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;n<t;n++)e.push(this.tgReadObject());return e}if(t=xt.get(e),void 0===t){this.seek(-4);const t=this.tellPosition(),n=new bt(e,this.read());throw this.setPosition(t),n}}return t.fromReader(this)}tgReadVector(){if(481674261!==this.readInt(!1))throw new Error("Invalid constructor code, vector was expected");const e=this.readInt(),t=[];for(let n=0;n<e;n++)t.push(this.tgReadObject());return t}tellPosition(){return this.offset}setPosition(e){this.offset=e}seek(e){this.offset+=e}}var Gt=n(48287).hp;class qt{constructor(e){var t,n,s,a;t=this,s=void 0,(n="symbol"==typeof(a=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n="_buffers"))?a:a+"")in t?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,this._buffers=[e]}write(e){this._buffers.push(e)}getValue(){return Gt.concat(this._buffers)}}var Ht,Ot=n(48287).hp;function Lt(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const jt=new Error("HttpStream was closed");(Ht=AbortSignal).timeout??(Ht.timeout=function(e){const t=new AbortController;return setTimeout((()=>t.abort()),e),t.signal});class Wt{constructor(e){Lt(this,"url",void 0),Lt(this,"isClosed",void 0),Lt(this,"stream",[]),Lt(this,"canRead",Promise.resolve()),Lt(this,"resolveRead",void 0),Lt(this,"rejectRead",void 0),Lt(this,"disconnectedCallback",void 0),this.isClosed=!0,this.disconnectedCallback=e}async readExactly(e){let t=Ot.alloc(0);for(;;){const n=await this.read();if(t=Ot.concat([t,n]),(e-=n.length)<=0)return t}}async read(){await this.canRead;const e=this.stream.shift();return 0===this.stream.length&&(this.canRead=new Promise(((e,t)=>{this.resolveRead=e,this.rejectRead=t}))),e}static getURL(e,t,n,s){return 443===t?`https://${e}:${t}/apiw1${n?"_test":""}${s?"_premium":""}`:`http://${e}:${t}/apiw1${n?"_test":""}${s?"_premium":""}`}async connect(e,t,n=!1,s=!1){this.stream=[],this.canRead=new Promise(((e,t)=>{this.resolveRead=e,this.rejectRead=t})),this.url=Wt.getURL(t,e,n,s),await fetch(this.url,{method:"POST",body:Ot.from([]),mode:"cors",signal:AbortSignal.timeout(1e4)}),this.isClosed=!1}write(e){if(this.isClosed||!this.url)throw this.handleDisconnect(),jt;return fetch(this.url,{method:"POST",body:e,mode:"cors",signal:AbortSignal.timeout(1e4)}).then((async e=>{if(this.isClosed)return void this.handleDisconnect();if(200!==e.status)throw jt;const t=await e.arrayBuffer();this.stream=this.stream.concat(Ot.from(t)),this.resolveRead&&!this.isClosed&&this.resolveRead()})).catch((e=>{throw this.handleDisconnect(),e}))}handleDisconnect(){this.disconnectedCallback?.(),this.rejectRead&&this.rejectRead()}close(){this.isClosed=!0,this.handleDisconnect(),this.disconnectedCallback=void 0}}function zt(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Kt;class $t{constructor(e){zt(this,"colors",void 0),zt(this,"messageFormat",void 0),Kt||(Kt=e||"debug"),this.colors={start:"%c",warn:"color : #ff00ff",info:"color : #ffff00",debug:"color : #00ffff",error:"color : #ff0000",end:""},this.messageFormat="[%t] [%l] - [%m]"}static setLevel(e){Kt=e}canSend(e){return!!Kt&&$t.LEVEL_MAP.get(Kt).has(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,n){Kt&&this.canSend(e)&&console.log(this.colors.start+this.format(t,e),n)}}zt($t,"LEVEL_MAP",new Map([["error",new Set(["error"])],["warn",new Set(["error","warn"])],["info",new Set(["error","warn","info"])],["debug",new Set(["error","warn","info","debug"])]]));var Jt=n(48287).hp;function Qt(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Xt=new Set(["messages.SendMessage","messages.SendMedia","messages.SendMultiMedia","messages.ForwardMessages","messages.SendInlineBotResult"]);class Zt{constructor(e,t){Qt(this,"_state",void 0),Qt(this,"_pendingStates",void 0),Qt(this,"_queue",void 0),Qt(this,"_ready",void 0),Qt(this,"setReady",void 0),Qt(this,"_log",void 0),this._state=e,this._queue=[],this._pendingStates=[],this._ready=new Promise((e=>{this.setReady=e})),this._log=t}values(){return this._queue}clear(){this._queue=[],this.append(void 0)}append(e,t=!0,n=!1){if(e&&Xt.has(e.request.className))if(n){for(let t=0;t<this._queue.length;t++)if(Xt.has(this._queue[t]?.request.className)){this._queue[t].after=e;break}}else for(let t=this._queue.length-1;t>=0;t--)if(Xt.has(this._queue[t]?.request.className)){e.after=this._queue[t];break}n?this._queue.unshift(e):this._queue.push(e),t&&this.setReady?.(!0),e&&1658238041!==e.request.CONSTRUCTOR_ID&&(this._pendingStates.push(e),e.promise?.catch((()=>{})).finally((()=>{this._pendingStates=this._pendingStates.filter((t=>t!==e))})))}prepend(e){e.reverse().forEach((e=>{this.append(e,!1,!0)})),this.setReady?.(!0)}extend(e){e.forEach((e=>{this.append(e,!1)})),this.setReady?.(!0)}async getBeacon(e){const t=new qt(Jt.alloc(0));if(e.data.length+Tt.SIZE_OVERHEAD<=Ut.MAXIMUM_SIZE){let n;return e.after&&(n=e.after.msgId),e.msgId=await this._state.writeDataAsMessage(t,e.data,"request"===e.request.classType,n),this._log.debug(`Assigned msgId = ${e.msgId} to ${e.request.className||e.request.constructor.name}`),t.getValue()}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?.(new Error("Request Payload is too big"))}async wait(){this._queue.length||(this._ready=new Promise((e=>{this.setReady=e})),await this._ready)}async get(){if(!this._queue[this._queue.length-1])return void(this._queue=this._queue.filter(Boolean));let e,t=new qt(Jt.alloc(0));const n=[];let s=0;for(;this._queue.length&&n.length<=Ut.MAXIMUM_LENGTH;){const e=this._queue.shift();if(e)if(e.abortSignal?.aborted)e.reject?.(new Error("Request aborted"));else if(s+=e.data.length+Tt.SIZE_OVERHEAD,s<=Ut.MAXIMUM_SIZE){let s;e.after&&(s=e.after.msgId),e.msgId=await this._state.writeDataAsMessage(t,e.data,"request"===e.request.classType,s),this._log.debug(`Assigned msgId = ${e.msgId} to ${e.request.className||e.request.constructor.name}`),n.push(e)}else{if(n.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?.(new Error("Request Payload is too big")),s=0}}if(n.length){if(n.length>1){const s=Jt.alloc(8);s.writeUInt32LE(Ut.CONSTRUCTOR_ID,0),s.writeInt32LE(n.length,4),e=Jt.concat([s,t.getValue()]),t=new qt(Jt.alloc(0));const a=await this._state.writeDataAsMessage(t,e,!1);for(const e of n)e.containerId=a}return e=t.getValue(),{batch:n,data:e}}}}var Yt=n(80129),en=n(48287).hp;function tn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const nn=new Yt.eu,sn=new Error("WebSocket was closed");class an{constructor(e){tn(this,"closed",void 0),tn(this,"timeout",void 0),tn(this,"stream",void 0),tn(this,"canRead",void 0),tn(this,"resolveRead",void 0),tn(this,"client",void 0),tn(this,"website",void 0),tn(this,"disconnectedCallback",void 0),this.client=void 0,this.closed=!0,this.stream=en.alloc(0),this.disconnectedCallback=e,this.timeout=3e3}async readExactly(e){let t=en.alloc(0);for(;;){const n=await this.read(e);if(t=en.concat([t,n]),!(e-=n.length))return t}}async read(e){if(this.closed)throw sn;if(await this.canRead,this.closed)throw sn;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 sn;const e=this.stream;return this.stream=en.alloc(0),this.canRead=new Promise((e=>{this.resolveRead=e})),e}getWebSocketLink(e,t,n,s){return 443===t?`wss://${e}:${t}/apiws${n?"_test":""}${s?"_premium":""}`:`ws://${e}:${t}/apiws${n?"_test":""}${s?"_premium":""}`}connect(e,t,n=!1,s=!1){return this.stream=en.alloc(0),this.canRead=new Promise((e=>{this.resolveRead=e})),this.closed=!1,this.website=this.getWebSocketLink(t,e,n,s),this.client=new WebSocket(this.website,"binary"),new Promise(((e,n)=>{if(!this.client)return;let s,a=!1;this.client.onopen=()=>{this.receive(),e(this),a=!0,s&&clearTimeout(s)},this.client.onerror=e=>{console.error("WebSocket error",e),n(e),a=!0,s&&clearTimeout(s)},this.client.onclose=e=>{const{code:n,reason:i,wasClean:o}=e;1e3!==n&&console.error(`Socket ${t} closed. Code: ${n}, reason: ${i}, was clean: ${o}`),this.resolveRead?.(!1),this.closed=!0,this.disconnectedCallback&&this.disconnectedCallback(),a=!0,s&&clearTimeout(s)},s=setTimeout((()=>{a||(n(new Error("WebSocket connection timeout")),this.resolveRead?.(!1),this.closed=!0,this.disconnectedCallback&&this.disconnectedCallback(),this.client?.close(),this.timeout*=2,this.timeout=Math.min(this.timeout,3e4),s=void 0)}),this.timeout),self.addEventListener("offline",(async()=>{await this.close(),this.resolveRead?.(!1)}))}))}write(e){if(this.closed)throw sn;this.client?.send(e)}async close(){await(this.client?.close()),this.closed=!0}receive(){this.client&&(this.client.onmessage=async e=>{await nn.runExclusive((async()=>{const t=e.data instanceof ArrayBuffer?en.from(e.data):en.from(await new Response(e.data).arrayBuffer());this.stream=en.concat([this.stream,t]),this.resolveRead?.(!0)}))})}}function on(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class rn{constructor({ip:e,port:t,dcId:n,loggers:s,isPremium:a,isTestServer:i}){on(this,"PacketCodecClass",void 0),on(this,"_ip",void 0),on(this,"_port",void 0),on(this,"_dcId",void 0),on(this,"_log",void 0),on(this,"_connected",void 0),on(this,"_isPremium",void 0),on(this,"shouldLongPoll",void 0),on(this,"_sendTask",void 0),on(this,"_recvTask",void 0),on(this,"_codec",void 0),on(this,"_obfuscation",void 0),on(this,"_sendArray",void 0),on(this,"_recvArray",void 0),on(this,"socket",void 0),on(this,"_isTestServer",void 0),this._ip=e,this._port=t,this._dcId=n,this._log=s,this._isTestServer=i,this._isPremium=a,this._connected=!1,this._sendTask=void 0,this._recvTask=void 0,this._codec=void 0,this._obfuscation=void 0,this._sendArray=new Pt,this._recvArray=new Pt,this.shouldLongPoll=!1,this.socket=new an(this.disconnectCallback.bind(this))}isConnected(){return this._connected}async disconnectCallback(){await this.disconnect(!0)}async _connect(){this._log.debug("Connecting"),this._codec=new this.PacketCodecClass(this),await this.socket.connect(this._port,this._ip,this._isTestServer,this._isPremium),this._log.debug("Finished connecting"),await this._initConn()}async connect(){await this._connect(),this._connected=!0,this._sendTask||(this._sendTask=this._sendLoop()),this._recvTask=this._recvLoop()}async disconnect(e=!1){this._connected&&(this._connected=!1,this._recvArray.push(void 0),e||await this.socket.close())}async send(e){if(!this._connected)throw new Error("Not connected");await this._sendArray.push(e)}async recv(){for(;this._connected;){const e=await this._recvArray.pop();if(e)return e}throw new Error("Not connected")}async _sendLoop(){try{for(;this._connected;){const e=await this._sendArray.pop();if(!e)return void(this._sendTask=void 0);await this._send(e)}}catch(e){this._log.info("The server closed the connection while sending")}}async _recvLoop(){let e;for(;this._connected;){try{if(e=await this._recv(),!e)throw new Error("no data received")}catch(e){return this._log.info("connection closed"),void this.disconnect()}await this._recvArray.push(e)}}async _initConn(){this._codec.tag&&await this.socket.write(this._codec.tag)}_send(e){const t=this._codec.encodePacket(e);this.socket.write(t)}_recv(){return this._codec.readPacket(this.socket)}toString(){return`${this._ip}:${this._port}/${this.constructor.name.replace("Connection","")}`}}class cn extends rn{constructor(...e){super(...e),on(this,"ObfuscatedIO",void 0)}async _initConn(){this._obfuscation=new this.ObfuscatedIO(this),this.socket.write(this._obfuscation.header)}_send(e){this._obfuscation.write(this._codec.encodePacket(e))}_recv(){return this._codec.readPacket(this._obfuscation)}}class dn{constructor(e){on(this,"_conn",void 0),this._conn=e}encodePacket(e){throw new Error("Not Implemented")}readPacket(e){throw new Error("Not Implemented")}}class un extends rn{constructor(e){super(e),on(this,"socket",void 0),on(this,"href",void 0),this.shouldLongPoll=!0,this.socket=new Wt(this.disconnectCallback.bind(this)),this.href=Wt.getURL(this._ip,this._port,this._isTestServer,this._isPremium)}send(e){return this.socket.write(e)}recv(){return this.socket.read()}async _connect(){this._log.debug("Connecting"),await this.socket.connect(this._port,this._ip,this._isTestServer,this._isPremium),this._log.debug("Finished connecting")}async connect(){await this._connect(),this._connected=!0}}var ln=n(48287).hp;function fn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class gn extends dn{constructor(e){super(e),fn(this,"tag",void 0),fn(this,"obfuscateTag",void 0),this.tag=gn.tag,this.obfuscateTag=gn.obfuscateTag}encodePacket(e){const t=e.length>>2;let n;if(t<127){const e=ln.alloc(1);e.writeUInt8(t,0),n=e}else n=ln.concat([ln.from("7f","hex"),Me(fe()(t),3)]);return ln.concat([n,e])}async readPacket(e){let t=(await e.read(1))[0];return t>=127&&(t=ln.concat([await e.read(3),ln.alloc(1)]).readInt32LE(0)),e.read(t<<2)}}fn(gn,"tag",ln.from("ef","hex")),fn(gn,"obfuscateTag",ln.from("efefefef","hex"));var pn=n(48287).hp;function hn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class mn{constructor(e,t){if(hn(this,"cipher",void 0),hn(this,"decipher",void 0),!pn.isBuffer(e)||!pn.isBuffer(t)||16!==t.length)throw new Error("Key and iv need to be a buffer");this.cipher=function(e,t,n){if("AES-256-CTR".includes("ECB"))throw new Error("Not supported");return new ve(t,n)}(0,e,t),this.decipher=function(e,t,n){if("AES-256-CTR".includes("ECB"))throw new Error("Not supported");return new ve(t,n)}(0,e,t)}encrypt(e){return pn.from(this.cipher.update(e))}decrypt(e){return pn.from(this.decipher.update(e))}}var yn=n(48287).hp;function _n(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class bn{constructor(e){_n(this,"header",void 0),_n(this,"connection",void 0),_n(this,"_encrypt",void 0),_n(this,"_decrypt",void 0),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 t=[yn.from("50567247","hex"),yn.from("474554","hex"),yn.from("504f5354","hex"),yn.from("eeeeeeee","hex")];let n;for(;;)if(n=ke(64),239!==n[0]&&!n.slice(4,8).equals(yn.alloc(4))){let e=!0;for(const s of t)if(s.equals(n.slice(0,4))){e=!1;break}if(e)break}n=n.toJSON().data;const s=yn.from(n.slice(8,56)).reverse(),a=yn.from(n.slice(8,40)),i=yn.from(n.slice(40,56)),o=yn.from(s.slice(0,32)),r=yn.from(s.slice(32,48)),c=new mn(a,i),d=new mn(o,r);return n=yn.concat([yn.from(n.slice(0,56)),e.obfuscateTag,yn.from(n.slice(60))]),n=yn.concat([yn.from(n.slice(0,56)),yn.from(c.encrypt(n).slice(56,64)),yn.from(n.slice(64))]),{random:n,encryptor:c,decryptor:d}}async read(e){const t=await this.connection.readExactly(e);return this._decrypt.encrypt(t)}write(e){this.connection.write(this._encrypt.encrypt(e))}}function vn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class wn{constructor(e){vn(this,"state",void 0),this.state=e}}vn(wn,"disconnected",-1),vn(wn,"connected",1),vn(wn,"broken",0);class Sn{constructor(e){vn(this,"timeOffset",void 0),this.timeOffset=e}}var In=n(48287).hp;class Pn{constructor(e,t){(function(e,t,n){var s;(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})(this,"ige",void 0),this.ige=new ge.gj(e,t)}decryptIge(e){return Ae(this.ige.decrypt(e))}encryptIge(e){const t=e.length%16;return t&&(e=In.concat([e,ke(16-t)])),Ae(this.ige.encrypt(e))}}var Cn=n(48287).hp;function Mn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Rn{constructor(e,t,n=!1,s=!1){Mn(this,"authKey",void 0),Mn(this,"_log",void 0),Mn(this,"timeOffset",void 0),Mn(this,"salt",void 0),Mn(this,"id",void 0),Mn(this,"_sequence",void 0),Mn(this,"_isCall",void 0),Mn(this,"_isOutgoing",void 0),Mn(this,"_lastMsgId",void 0),Mn(this,"msgIds",void 0),this.authKey=e,this._log=t,this._isCall=n,this._isOutgoing=s,this.timeOffset=0,this.salt=fe().zero,this.id=fe().zero,this._sequence=0,this._lastMsgId=fe().zero,this.msgIds=[],this.reset()}reset(){this.id=function(e=!0){return Pe(ke(8),!0,e)}(!0),this._sequence=0,this._lastMsgId=fe()(0),this.msgIds=[]}updateMessageId(e){e.msgId=this._getNewMsgId()}async _calcKey(e,t,n){const s=this._isCall?128+(this._isOutgoing!==n?8:0):n?0:8,[a,i]=await Promise.all([Ee(Cn.concat([t,e.slice(s,s+36)])),Ee(Cn.concat([e.slice(s+40,s+76),t]))]),o=Cn.concat([a.slice(0,8),i.slice(8,24),a.slice(24,32)]);return this._isCall?{key:o,iv:Cn.concat([i.slice(0,4),a.slice(8,16),i.slice(24,28)])}:{key:o,iv:Cn.concat([i.slice(0,8),a.slice(8,24),i.slice(24,32)])}}async writeDataAsMessage(e,t,n,s){const a=this._getNewMsgId(),i=this._getSeqNo(n);let o;o=s?await kt.gzipIfSmaller(n,new Ye.InvokeAfterMsg({msgId:s,query:{getBytes:()=>t}}).getBytes()):await kt.gzipIfSmaller(n,t);const r=Cn.alloc(4);r.writeInt32LE(i,0);const c=Cn.alloc(4);c.writeInt32LE(o.length,0);const d=Ce(a,8);return e.write(Cn.concat([d,r,c])),e.write(o),a}async encryptMessageData(e){if(!this.authKey)throw new Error("Auth key unset");await this.authKey.waitForKey();const t=this.authKey.getKey();if(!t)throw new Error("Auth key unset");if(!(this.salt&&this.id&&t&&this.authKey.keyId))throw new Error("Unset params");if(this._isCall){const n=128+(this._isOutgoing?0:8),s=e.length;e=Cn.from(e),s%4!=0&&(e=Cn.concat([e,Cn.from(new Array(4-s%4).fill(32))]));const a=(await Ee(Cn.concat([t.slice(88+n,88+n+32),Cn.from(e)]))).slice(8,24),{iv:i,key:o}=await this._calcKey(t,a,!0);return e=new mn(o,i).encrypt(e),Cn.concat([a,e])}{const n=Ce(this.salt,8),s=Ce(this.id,8),a=ke((-((e=Cn.concat([Cn.concat([n,s]),e])).length+12)%16+16)%16+12),i=(await Ee(Cn.concat([t.slice(88,120),e,a]))).slice(8,24),{iv:o,key:r}=await this._calcKey(t,i,!0),c=Me(this.authKey.keyId,8);return Cn.concat([c,i,new Pn(r,o).encryptIge(Cn.concat([e,a]))])}}async decryptMessageData(e){if(!this.authKey)throw new Error("Auth key unset");if(e.length<8)throw new vt(e);if(e.length<0)throw new wt("Server replied with negative length");if(e.length%4!=0&&!this._isCall)throw new wt("Server replied with length not divisible by 4");if(!this._isCall){const t=Pe(e.slice(0,8));if(!this.authKey.keyId||t.neq(this.authKey.keyId))throw new wt("Server replied with an invalid auth key")}const t=this.authKey.getKey();if(!t)throw new wt("Unset AuthKey");const n=this._isCall?e.slice(0,16):e.slice(8,24),s=this._isCall?128+(this._isOutgoing?8:0):0,{iv:a,key:i}=await this._calcKey(t,n,!1);if(this._isCall){const t=(e=e.slice(16)).length;e=Cn.concat([e,Cn.from(new Array(4-t%4).fill(0))]),e=(e=new mn(i,a).decrypt(e)).slice(0,t)}else e=new Pn(i,a).decryptIge(this._isCall?e.slice(16):e.slice(24));const o=this._isCall?await Ee(Cn.concat([t.slice(88+s,88+s+32),e])):await Ee(Cn.concat([t.slice(96,128),e]));if(!this._isCall&&!n.equals(o.slice(8,24)))throw new wt("Received msg_key doesn't match with expected one");const r=new Ft(e);if(this._isCall)return r.readInt(!1),r.read(e.length-4);{if(r.readLong(),!r.readLong().eq(this.id))throw new wt("Server replied with a wrong session ID");const t=r.readLong();if(this.msgIds.includes(t.toString()))throw new wt("Duplicate msgIds");this.msgIds.length>500&&this.msgIds.shift();const n=r.readInt(),s=r.readInt(),a=e.length-s;if(a<12||a>1024)throw new wt("Server replied with the wrong message padding");const i=await r.tgReadObject();if(i?.className?.startsWith("Update")){const e=Math.floor(Date.now()/1e3),n=this.getMsgIdTimeLocal(t);if(n&&(n-e>30||e-n>300))throw new wt("The message time is incorrect.")}return i&&!("errorCode"in i)&&this.msgIds.push(t.toString()),new Tt(t,n,i)}}_getNewMsgId(){const e=Date.now()/1e3+this.timeOffset,t=Math.floor(1e9*(e-Math.floor(e)));let n=fe()(Math.floor(e)).shiftLeft(fe()(32)).or(fe()(t).shiftLeft(fe()(2)));return this._lastMsgId.greaterOrEquals(n)&&(n=this._lastMsgId.add(fe()(4))),this._lastMsgId=n,n}getMsgIdTimeLocal(e){return!this._lastMsgId.eq(0)&&e.shiftRight(fe()(32)).toJSNumber()-this.timeOffset}updateTimeOffset(e){const t=this._getNewMsgId(),n=this.timeOffset,s=Math.floor(Date.now()/1e3),a=e.shiftRight(fe()(32)).toJSNumber();return this.timeOffset=a-s,this.timeOffset!==n&&(this._lastMsgId=fe()(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}}var kn=n(48287).hp;function An(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Tn{constructor(e,t){An(this,"_state",void 0),An(this,"_connection",void 0),this._state=new Rn(void 0,t),this._connection=e}async send(e){let t=e.getBytes(),n=this._state._getNewMsgId();const s=Ce(n,8),a=kn.alloc(4);a.writeInt32LE(t.length,0);const i=kn.concat([kn.concat([kn.alloc(8),s,a]),t]);if(await this._connection.send(i),t=await this._connection.recv(),t.length<8)throw new vt(t);const o=new Ft(t);if(o.readLong().neq(fe()(0)))throw new Error("Bad authKeyId");if(n=o.readLong(),n.eq(fe()(0)))throw new Error("Bad msgId");if(o.readInt()<=0)throw new Error("Bad length");return o.tgReadObject()}}var En=n(48287).hp;function Un(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Dn{constructor(e,t){if(Un(this,"_key",void 0),Un(this,"_hash",void 0),Un(this,"auxHash",void 0),Un(this,"keyId",void 0),!t||!e)return;this._key=e,this._hash=t;const n=new Ft(t);this.auxHash=n.readLong(!1),n.read(4),this.keyId=n.readLong(!1)}async setKey(e){if(!e)return this._key=void 0,this.auxHash=void 0,this.keyId=void 0,void(this._hash=void 0);if(e instanceof Dn)return this._key=e._key,this.auxHash=e.auxHash,this.keyId=e.keyId,void(this._hash=e._hash);this._key=e,this._hash=await Te(this._key);const t=new Ft(this._hash);this.auxHash=t.readLong(!1),t.read(4),this.keyId=t.readLong(!1)}async waitForKey(){for(;!this.keyId;)await Be(20)}getKey(){return this._key}async calcNewNonceHash(e,t){if(!this.auxHash)throw new Error("Auth key not set");const n=Ce(e,32),s=En.alloc(1);s.writeUInt8(t,0);const a=En.concat([n,En.concat([s,Me(this.auxHash,8,!0)])]);return Pe((await Te(a)).slice(4,20),!0,!0)}equals(e){return e instanceof this.constructor&&this._key&&En.isBuffer(e.getKey())&&e.getKey()?.equals(this._key)}}class Bn{constructor(){var e,t,n,s;e=this,n=void 0,(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t="_pending"))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,this._pending=new Map}set(e,t){this._pending.set(e.toString(),t)}get(e){return this._pending.get(e.toString())}getAndDelete(e){const t=this.get(e);return this.delete(e),t}values(){return Array.from(this._pending.values())}delete(e){this._pending.delete(e.toString())}clear(){this._pending.clear()}}n(48287).hp;const xn=[{fingerprint:fe()("-3414540481677951611"),n:fe()("29379598170669337022986177149456128565388431120058863768162556424047512191330847455146576344487764408661701890505066208632169112269581063774293102577308490531282748465986139880977280302242772832972539403531316010870401287642763009136156734339538042419388722777357134487746169093539093850251243897188928735903389451772730245253062963384108812842079887538976360465290946139638691491496062099570836476454855996319192747663615955633778034897140982517446405334423701359108810182097749467210509584293428076654573384828809574217079944388301239431309115013843331317877374435868468779972014486325557807783825502498215169806323"),e:65537},{fingerprint:fe()("-5595554452916591101"),n:fe()("25342889448840415564971689590713473206898847759084779052582026594546022463853940585885215951168491965708222649399180603818074200620463776135424884632162512403163793083921641631564740959529419359595852941166848940585952337613333022396096584117954892216031229237302943701877588456738335398602461675225081791820393153757504952636234951323237820036543581047826906120927972487366805292115792231423684261262330394324750785450942589751755390156647751460719351439969059949569615302809050721500330239005077889855323917509948255722081644689442127297605422579707142646660768825302832201908302295573257427896031830742328565032949"),e:65537}].reduce(((e,{fingerprint:t,...n})=>(e.set(t.toString(),n),e)),new Map);class Vn{static gcd(e,t){for(;t.neq(fe().zero);){const n=t;t=e.remainder(t),e=n}return e}static factorize(e){if(e.remainder(2).equals(fe().zero))return{p:fe()(2),q:e.divide(fe()(2))};let t=fe().randBetween(fe()(1),e.minus(1));const n=fe().randBetween(fe()(1),e.minus(1)),s=fe().randBetween(fe()(1),e.minus(1));let a,i=fe().one,o=fe().one,r=fe().one,c=fe().zero,d=fe().zero;for(;i.eq(fe().one);){c=t;for(let s=0;fe()(s).lesser(o);s++)t=Ue(t,fe()(2),e).add(n).remainder(e);for(a=fe().zero;a.lesser(o)&&i.eq(fe().one);){d=t;const u=fe().min(s,o.minus(a));for(let s=0;fe()(s).lesser(u);s++)t=Ue(t,fe()(2),e).add(n).remainder(e),r=r.multiply(c.minus(t).abs()).remainder(e);i=Vn.gcd(r,e),a=a.add(s)}o=o.multiply(2)}if(i.eq(e))for(;d=Ue(d,fe()(2),e).add(n).remainder(e),i=Vn.gcd(c.minus(d).abs(),e),!i.greater(1););const u=i;return r=e.divide(i),u<r?{p:u,q:r}:{p:r,q:u}}}var Nn=n(48287).hp;function Fn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Gn{constructor(){Fn(this,"promise",void 0),Fn(this,"reject",void 0),Fn(this,"resolve",void 0),this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}static resolved(e){const t=new Gn;return t.resolve(e),t}}function qn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Hn{constructor(e,t){qn(this,"containerId",void 0),qn(this,"msgId",void 0),qn(this,"request",void 0),qn(this,"data",void 0),qn(this,"after",void 0),qn(this,"result",void 0),qn(this,"finished",void 0),qn(this,"promise",void 0),qn(this,"abortSignal",void 0),qn(this,"resolve",void 0),qn(this,"reject",void 0),this.containerId=void 0,this.msgId=void 0,this.request=e,this.data=e.getBytes(),this.after=void 0,this.result=void 0,this.abortSignal=t,this.finished=new Gn,this.resetPromise()}isReady(){return!this.after||this.after.finished.promise}resetPromise(){this.reject?.(),this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}var On=n(48287).hp;function Ln(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class jn{constructor(e,t){Ln(this,"_connection",void 0),Ln(this,"_fallbackConnection",void 0),Ln(this,"_shouldForceHttpTransport",void 0),Ln(this,"_shouldAllowHttpTransport",void 0),Ln(this,"_retriesToFallback",void 0),Ln(this,"_log",void 0),Ln(this,"_dcId",void 0),Ln(this,"_senderIndex",void 0),Ln(this,"_retries",void 0),Ln(this,"_delay",void 0),Ln(this,"_retryMainConnectionDelay",void 0),Ln(this,"_isFallback",void 0),Ln(this,"_authKeyCallback",void 0),Ln(this,"_updateCallback",void 0),Ln(this,"_autoReconnectCallback",void 0),Ln(this,"_isMainSender",void 0),Ln(this,"_isExported",void 0),Ln(this,"_sendQueue",void 0),Ln(this,"_sendQueueLongPoll",void 0),Ln(this,"isSendingLongPoll",void 0),Ln(this,"_pendingAck",void 0),Ln(this,"_lastAcks",void 0),Ln(this,"_pendingState",void 0),Ln(this,"_userConnected",void 0),Ln(this,"isReconnecting",void 0),Ln(this,"_disconnected",void 0),Ln(this,"_sendLoopHandle",void 0),Ln(this,"_recvLoopHandle",void 0),Ln(this,"_longPollLoopHandle",void 0),Ln(this,"_isReconnectingToMain",!1),Ln(this,"authKey",void 0),Ln(this,"_state",void 0),Ln(this,"_getShouldDebugExportedSenders",void 0),Ln(this,"_handlers",void 0),Ln(this,"_onConnectionBreak",void 0),Ln(this,"userDisconnected",void 0),Ln(this,"isConnecting",!1),Ln(this,"_authenticated",!1),Ln(this,"logWithIndex",{debug:this.logWithIndexCallback("debug"),log:this.logWithIndexCallback("log"),warn:this.logWithIndexCallback("warn"),error:this.logWithIndexCallback("error")});const n={...jn.DEFAULT_OPTIONS,...t};this._connection=void 0,this._fallbackConnection=void 0,this._shouldForceHttpTransport=n.shouldForceHttpTransport,this._shouldAllowHttpTransport=n.shouldAllowHttpTransport,this._log=n.logger,this._dcId=n.dcId,this._senderIndex=n.senderIndex||0,this._retries=n.retries,this._retriesToFallback=n.retriesToFallback,this._delay=n.delay,this._retryMainConnectionDelay=n.retryMainConnectionDelay,this._authKeyCallback=n.authKeyCallback,this._updateCallback=n.updateCallback,this._autoReconnectCallback=n.autoReconnectCallback,this._isMainSender=Boolean(n.isMainSender),this._isExported=Boolean(n.isExported),this._onConnectionBreak=n.onConnectionBreak,this._isFallback=!1,this._getShouldDebugExportedSenders=n.getShouldDebugExportedSenders,this.userDisconnected=!1,this._userConnected=!1,this.isReconnecting=!1,this._disconnected=!0,this._sendLoopHandle=void 0,this._longPollLoopHandle=void 0,this._recvLoopHandle=void 0,this.authKey=e||new Dn,this._state=new Rn(this.authKey,this._log),this._sendQueue=new Zt(this._state,this._log),this._sendQueueLongPoll=new Zt(this._state,this._log),this._pendingState=new Bn,this._pendingAck=new Set,this._lastAcks=[],this._handlers={[Bt.CONSTRUCTOR_ID]:this._handleRPCResult.bind(this),[Ut.CONSTRUCTOR_ID]:this._handleContainer.bind(this),[kt.CONSTRUCTOR_ID]:this._handleGzipPacked.bind(this),[Ye.Pong.CONSTRUCTOR_ID]:this._handlePong.bind(this),[Ye.BadServerSalt.CONSTRUCTOR_ID]:this._handleBadServerSalt.bind(this),[Ye.BadMsgNotification.CONSTRUCTOR_ID]:this._handleBadNotification.bind(this),[Ye.MsgDetailedInfo.CONSTRUCTOR_ID]:this._handleDetailedInfo.bind(this),[Ye.MsgNewDetailedInfo.CONSTRUCTOR_ID]:this._handleNewDetailedInfo.bind(this),[Ye.NewSessionCreated.CONSTRUCTOR_ID]:this._handleNewSessionCreated.bind(this),[Ye.MsgsAck.CONSTRUCTOR_ID]:this._handleAck.bind(this),[Ye.FutureSalts.CONSTRUCTOR_ID]:this._handleFutureSalts.bind(this),[Ye.MsgsStateReq.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[Ye.MsgResendReq.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[Ye.MsgsAllInfo.CONSTRUCTOR_ID]:this._handleMsgAll.bind(this)}}logWithIndexCallback(e){return(...t)=>{this._getShouldDebugExportedSenders&&this._getShouldDebugExportedSenders()&&console[e](`[${this._isExported?`idx=${this._senderIndex} `:"M "}dcId=${this._dcId}]`,...t)}}getConnection(){return this._isFallback?this._fallbackConnection:this._connection}async connect(e,t,n){if(this.userDisconnected=!1,this._userConnected&&!t)return this._log.info("User is already connected!"),!1;this.isConnecting=!0,this._isFallback=this._shouldForceHttpTransport&&this._shouldAllowHttpTransport,this._connection=e,this._fallbackConnection=n;for(let e=0;e<this._retries+this._retriesToFallback;e++)try{e>=this._retriesToFallback&&this._shouldAllowHttpTransport&&(this._isFallback=!0,this.logWithIndex.warn("Using fallback connection"),this._log.warn("Using fallback connection")),this.logWithIndex.warn("Connecting..."),await this._connect(this.getConnection()),this.logWithIndex.warn("Connected!"),this._isExported||this._updateCallback?.(new wn(wn.connected));break}catch(t){this._isExported||0!==e||this._updateCallback?.(new wn(wn.disconnected)),this._log.error(`${this._isFallback?"HTTP":"WebSocket"} connection failed attempt: ${e+1}`),console.error(t),await Be(this._delay)}return this.isConnecting=!1,this._isFallback&&!this._shouldForceHttpTransport&&this.tryReconnectToMain(),!0}async tryReconnectToMain(){if(this.isConnecting||!this._isFallback||this._isReconnectingToMain||this.isReconnecting||this._shouldForceHttpTransport||this._isExported)await Be(this._retryMainConnectionDelay);else{this._log.debug("Trying to reconnect to main connection"),this._isReconnectingToMain=!0;try{await this._connection.connect(),this._log.info("Reconnected to main connection"),this.logWithIndex.warn("Reconnected to main connection"),this.isReconnecting=!0,this._fallbackConnection&&await this._disconnect(this._fallbackConnection),await this.connect(this._connection,!0,this._fallbackConnection),this.isReconnecting=!1,this._isReconnectingToMain=!1}catch(e){this.isReconnecting=!1,this._isReconnectingToMain=!1,this._log.error(`Failed to reconnect to main connection, retrying in ${this._retryMainConnectionDelay}ms`),await Be(this._retryMainConnectionDelay),this.tryReconnectToMain()}}}isConnected(){return this._userConnected}async disconnect(){this.userDisconnected=!0,this.logWithIndex.warn("Disconnecting...");const e=this.getConnection();e&&await this._disconnect(e)}destroy(){this._sendQueue.clear()}send(e,t,n=!1){const s=new Hn(e,t);return n?this._sendQueueLongPoll.append(s):(this.logWithIndex.debug(`Send ${e.className}`),this._sendQueue.append(s)),s.promise}addStateToQueue(e){this._sendQueue.append(e)}async sendBeacon(e){if(!(this._userConnected&&this._fallbackConnection instanceof un))throw new Error("Cannot send requests while disconnected");const t=new Hn(e,void 0),n=await this._sendQueue.getBeacon(t);if(!n)return;const s=await this._state.encryptMessageData(n);postMessage({type:"sendBeacon",data:s,url:this._fallbackConnection.href})}async _connect(e){if(e.isConnected()||(this._log.info("Connecting to {0}...".replace("{0}",e._ip)),await e.connect(),this._log.debug("Connection success!")),this.authKey.getKey())this._authenticated=!0,this._log.debug("Already have an auth key ...");else{const t=new Tn(e,this._log);this._log.debug("New auth_key attempt ...");const n=await async function(e,t){let n=ke(16);const s=Pe(n,!1,!0),a=await e.send(new Ye.ReqPqMulti({nonce:s}));if(t.debug("Starting authKey generation step 1"),!(a instanceof Ye.ResPQ))throw new wt(`Step 1 answer was ${a}`);if(a.nonce.neq(s))throw new wt("Step 1 invalid nonce from server");const i=Pe(a.pq,!1,!0);t.debug("Finished authKey generation step 1");const{p:o,q:r}=Vn.factorize(i),c=De(o),d=De(r);n=ke(32);const u=Pe(n,!0,!0),l=new Ye.PQInnerData({pq:De(i),p:c,q:d,nonce:a.nonce,serverNonce:a.serverNonce,newNonce:u}).getBytes();if(l.length>144)throw new wt("Step 1 invalid nonce from server");let f,g;for(const e of a.serverPublicKeyFingerprints)if(g=xn.get(e.toString()),void 0!==g){f=e;break}if(void 0===f||void 0===g)throw new wt("Step 2 could not find a valid key for fingerprints");const p=ke(192-l.length),h=Nn.concat([l,p]),m=Nn.from(h).reverse();let y;for(let e=0;e<20;e++){const e=ke(32),n=await Ee(Nn.concat([e,h])),s=Nn.concat([m,n]),a=new Pn(e,Nn.alloc(32)).encryptIge(s),i=xe(e,await Ee(a)),o=Pe(Nn.concat([i,a]),!1,!1);if(!o.greaterOrEquals(g.n)){y=Me(Ue(o,fe()(g.e),g.n),256,!1,!1);break}t.debug("Aes key greater than RSA. retrying")}if(void 0===y)throw new wt("Step 2 could create a secure encrypted key");t.debug("Step 2 : Generated a secure aes encrypted data");const _=await e.send(new Ye.ReqDHParams({nonce:a.nonce,serverNonce:a.serverNonce,p:c,q:d,publicKeyFingerprint:f,encryptedData:y}));if(!(_ instanceof Ye.ServerDHParamsOk||_ instanceof Ye.ServerDHParamsFail))throw new Error(`Step 2.1 answer was ${_}`);if(_.nonce.neq(a.nonce))throw new wt("Step 2 invalid nonce from server");if(_.serverNonce.neq(a.serverNonce))throw new wt("Step 2 invalid server nonce from server");if(_ instanceof Ye.ServerDHParamsFail){const e=Pe(await Te(Ce(u,32).slice(4,20)),!0,!0);if(_.newNonceHash.neq(e))throw new wt("Step 2 invalid DH fail nonce from server")}if(!(_ instanceof Ye.ServerDHParamsOk))throw new Error(`Step 2.2 answer was ${_}`);t.debug("Finished authKey generation step 2"),t.debug("Starting authKey generation step 3");const{key:b,iv:v}=await async function(e,t){const n=Ce(e,16),s=Ce(t,32),[a,i,o]=await Promise.all([Te(Ie.concat([s,n])),Te(Ie.concat([n,s])),Te(Ie.concat([s,s]))]);return{key:Ie.concat([a,i.slice(0,12)]),iv:Ie.concat([i.slice(12,20),o,s.slice(0,4)])}}(a.serverNonce,u);if(_.encryptedAnswer.length%16!=0)throw new wt("Step 3 AES block size mismatch");const w=new Pn(b,v),S=w.decryptIge(_.encryptedAnswer),I=new Ft(S),P=I.read(20),C=I.tgReadObject();if(!(C instanceof Ye.ServerDHInnerData))throw new Error(`Step 3 answer was ${C}`);const M=await Te(C.getBytes());if(!P.equals(M))throw new wt("Step 3 Invalid hash answer");if(C.nonce.neq(a.nonce))throw new wt("Step 3 Invalid nonce in encrypted answer");if(C.serverNonce.neq(a.serverNonce))throw new wt("Step 3 Invalid server nonce in encrypted answer");if(3!==C.g||"c71caeb9c6b1c9048e6c522f70f13f73980d40238e3e21c14934d037563d930f48198a0aa7c14058229493d22530f4dbfa336f6e0ac925139543aed44cce7c3720fd51f69458705ac68cd4fe6b6b13abdc9746512969328454f18faf8c595f642477fe96bb2a941d5bcd1d4ac8cc49880708fa9b378e3c4f3a9060bee67cf9a4a4a695811051907e162753b56b0f6b410dba74d8a84b2a14b3144e0ef1284754fd17ed950d5965b4b9dd46582db1178d169c6bc465b0d6ff9ca3928fef5b9ae4e418fc15e83ebea0f87fa9ff5eed70050ded2849f47bf959d956850ce929851f0d8115f635b105ee2e4e15d04b2454bf6f4fadf034b10403119cd8e3b92fcc5b"!==C.dhPrime.toString("hex"))throw new wt("Step 3 invalid dhPrime or g");const R=Pe(C.dhPrime,!1,!1),k=Pe(C.gA,!1,!1),A=C.serverTime-Math.floor(Date.now()/1e3),T=Pe(ke(256),!1,!1),E=Ue(fe()(C.g),T,R),U=Ue(k,T,R);if(k.lesserOrEquals(1))throw new wt("Step 3 failed ga > 1 check");if(E.lesserOrEquals(1))throw new wt("Step 3 failed gb > 1 check");if(k.greater(R.minus(1)))throw new wt("Step 3 failed ga > dh_prime - 1 check");const D=fe()(2).pow(1984);if(!k.greaterOrEquals(D)||!k.lesserOrEquals(R.minus(D)))throw new wt("Step 3 failed dh_prime - 2^{2048-64} < ga < 2^{2048-64} check");if(!E.greaterOrEquals(D)||!E.lesserOrEquals(R.minus(D)))throw new wt("Step 3 failed dh_prime - 2^{2048-64} < gb < 2^{2048-64} check");const B=new Ye.ClientDHInnerData({nonce:a.nonce,serverNonce:a.serverNonce,retryId:fe().zero,gB:De(E,!1)}).getBytes(),x=Nn.concat([await Te(B),B]),V=w.encryptIge(x),N=await e.send(new Ye.SetClientDHParams({nonce:a.nonce,serverNonce:a.serverNonce,encryptedData:V})),F=[Ye.DhGenOk,Ye.DhGenRetry,Ye.DhGenFail];if(!(N instanceof F[0]||N instanceof F[1]||N instanceof F[2]))throw new Error(`Step 3.1 answer was ${N}`);const{name:G}=N.constructor;if(N.nonce.neq(a.nonce))throw new wt(`Step 3 invalid ${G} nonce from server`);if(N.serverNonce.neq(a.serverNonce))throw new wt(`Step 3 invalid ${G} server nonce from server`);const q=new Dn;await q.setKey(De(U));const H=1+["DhGenOk","DhGenRetry","DhGenFail"].indexOf(N.className),O=await q.calcNewNonceHash(u,H);if(N[`newNonceHash${H}`].neq(O))throw new wt("Step 3 invalid new nonce hash");if(!(N instanceof Ye.DhGenOk))throw new Error(`Step 3.2 answer was ${N}`);return t.debug("Finished authKey generation step 3"),{authKey:q,timeOffset:A}}(t,this._log);this._log.debug("Generated new auth_key successfully"),await this.authKey.setKey(n.authKey),this._state.timeOffset=n.timeOffset,this._isExported||this._updateCallback?.(new Sn(this._state.timeOffset)),this._authKeyCallback&&await this._authKeyCallback(this.authKey,this._dcId)}this._userConnected=!0,this.isReconnecting=!1,this._sendLoopHandle||(this._log.debug("Starting send loop"),this._sendLoopHandle=this._sendLoop()),this._recvLoopHandle||(this._log.debug("Starting receive loop"),this._recvLoopHandle=this._recvLoop()),!this._longPollLoopHandle&&e.shouldLongPoll&&(this._log.debug("Starting long-poll loop"),this._longPollLoopHandle=this._longPollLoop()),this._log.info("Connection to %s complete!".replace("%s",e.toString()))}async _disconnect(e){this._isExported||this._updateCallback?.(new wn(wn.disconnected)),void 0!==e?(this._log.info("Disconnecting from %s...".replace("%s",e.toString())),this._userConnected=!1,this._log.debug("Closing current connection..."),this.logWithIndex.warn("Disconnecting"),await e.disconnect()):this._log.info("Not disconnecting (already have no connection)")}async _longPollLoop(){for(;this._userConnected&&!this.isReconnecting&&this._isFallback&&this.getConnection().shouldLongPoll;){await this._sendQueueLongPoll.wait();const e=await this._sendQueueLongPoll.get();if(this.isReconnecting||!this._isFallback)return void(this._longPollLoopHandle=void 0);if(!e)continue;let{data:t}=e;const{batch:n}=e;this._log.debug(`Encrypting ${n.length} message(s) in ${t.length} bytes for sending`),t=await this._state.encryptMessageData(t);try{await(this._fallbackConnection?.send(t))}catch(e){return this._log.error(e),this._log.info("Connection closed while sending data"),this._longPollLoopHandle=void 0,this.isSendingLongPoll=!1,void(this.userDisconnected||this.reconnect())}this.isSendingLongPoll=!1,this.checkLongPoll()}this._longPollLoopHandle=void 0}async _sendLoop(){for(this._sendQueue.prepend(this._pendingState.values()),this._pendingState.clear();this._userConnected&&!this.isReconnecting;){const e=()=>{if(this._pendingAck.size){const e=new Hn(new Ye.MsgsAck({msgIds:Array(...this._pendingAck)}));this._sendQueue.append(e),this._lastAcks.push(e),this._lastAcks.length>=10&&this._lastAcks.shift(),this._pendingAck.clear()}};e(),this.logWithIndex.debug(`Waiting for messages to send... ${this.isReconnecting}`),this._log.debug(`Waiting for messages to send... ${this.isReconnecting}`),await this._sendQueue.wait(),this._isFallback&&this.send(new Ye.HttpWait({maxDelay:0,waitAfter:0,maxWait:0})),e();const t=await this._sendQueue.get();if(this.logWithIndex.debug(`Got ${t?.batch.length} message(s) to send`),!t)continue;let{data:n}=t;const{batch:s}=t;for(const e of s)if(Array.isArray(e))for(const t of e)"request"===t.request.classType&&"HttpWait"!==t.request.className&&this._pendingState.set(t.msgId,t);else"request"===e.request.classType&&"HttpWait"!==e.request.className&&this._pendingState.set(e.msgId,e);if(this.isReconnecting)return this.logWithIndex.debug("Reconnecting :("),void(this._sendLoopHandle=void 0);this._log.debug(`Encrypting ${s.length} message(s) in ${n.length} bytes for sending`),this.logWithIndex.debug("Sending",s.map((e=>e.request.className))),n=await this._state.encryptMessageData(n);try{await this.getConnection().send(n)}catch(e){return this.logWithIndex.debug(`Connection closed while sending data ${e}`),this._log.error(e),this._log.info("Connection closed while sending data"),this._sendLoopHandle=void 0,void(this.userDisconnected||this.reconnect())}finally{for(const e of s)if(Array.isArray(e))for(const t of e)"HttpWait"===t.request.className&&e.resolve?.();else"HttpWait"===e.request.className&&e.resolve?.();this.logWithIndex.debug("Encrypted messages put in a queue to be sent"),this._log.debug("Encrypted messages put in a queue to be sent")}}this._sendLoopHandle=void 0}async _recvLoop(){let e,t;for(;this._userConnected&&!this.isReconnecting;){this._log.debug("Receiving items from the network..."),this.logWithIndex.debug("Receiving items from the network...");try{e=await this.getConnection().recv()}catch(e){return this.userDisconnected||(this._log.error(e),this._log.warn("Connection closed while receiving data"),this.reconnect()),void(this._recvLoopHandle=void 0)}try{t=await this._state.decryptMessageData(e)}catch(e){if(this.logWithIndex.debug(`Error while receiving items from the network ${e.toString()}`),e instanceof bt){this._log.info(`Type ${e.invalidConstructorId} not found, remaining data ${e.remaining}`);continue}if(e instanceof wt){this._log.warn(`Security error while unpacking a received message: ${e}`);continue}return e instanceof vt?(404===e.code?this._handleBadAuthKey():(this._log.warn(`Invalid buffer ${e.code} for dc ${this._dcId}`),this.reconnect()),void(this._recvLoopHandle=void 0)):(this._log.error("Unhandled error while receiving data"),this._log.error(e),this.reconnect(),void(this._recvLoopHandle=void 0))}try{await this._processMessage(t)}catch(e){e instanceof tt?"AUTH_KEY_UNREGISTERED"!==e.errorMessage&&"SESSION_REVOKED"!==e.errorMessage||this._handleBadAuthKey(!0):(this._log.error("Unhandled error while receiving data"),this._log.error(e))}this.checkLongPoll()}this._recvLoopHandle=void 0}checkLongPoll(){!this.isSendingLongPoll&&this._isFallback&&(this.isSendingLongPoll=!0,this.send(new Ye.HttpWait({maxDelay:500,waitAfter:150,maxWait:3e3}),void 0,!0))}_handleBadAuthKey(e){e&&this._isMainSender||(this._log.warn(`Broken authorization key for dc ${this._dcId}, resetting...`),this._isMainSender&&!this._isExported?this._updateCallback?.(new wn(wn.broken)):!this._isMainSender&&this._onConnectionBreak&&this._onConnectionBreak(this._dcId))}async _processMessage(e){if("MsgsAck"===e.obj.className)return;this.logWithIndex.debug(`Process message ${e.obj.className}`),this._pendingAck.add(e.msgId),this.getConnection().shouldLongPoll&&this._sendQueue.setReady?.(!0),e.obj=await e.obj;let t=this._handlers[e.obj.CONSTRUCTOR_ID];t||(t=this._handleUpdate.bind(this)),await t(e)}_popStates(e){const t=this._pendingState.getAndDelete(e);if(t)return[t];const n=[];for(const t of this._pendingState.values())t.containerId?.equals(e)&&n.push(t.msgId);if(n.length){const e=[];for(const t of n)e.push(this._pendingState.getAndDelete(t));return e}for(const t of this._lastAcks)if(t.msgId===e)return[t];return[]}_handleRPCResult(e){const t=e.obj,n=this._pendingState.getAndDelete(t.reqMsgId);if(this._log.debug(`Handling RPC result for message ${t.reqMsgId}`),n){if(t.error){const e=function(e,t){for(const[n,s]of yt){const a=e.errorMessage.match(n);if(a)return new s({request:t,capture:2===a.length?parseInt(a[1],10):void 0})}return new tt(e.errorMessage,t,e.errorCode)}(t.error,n.request);throw this._sendQueue.append(new Hn(new Ye.MsgsAck({msgIds:[n.msgId]}))),n.reject?.(e),e}try{const e=new Ft(t.body),s=n.request.readResult(e);this.logWithIndex.debug("Handling RPC result",s),n.resolve?.(s)}catch(e){throw n.reject?.(e),e}}else try{if(!(new Ft(t.body).tgReadObject()instanceof Ye.upload.File))throw new bt(0,On.alloc(0))}catch(e){if(e instanceof bt)return void this._log.info(`Received response without parent request: ${t.body}`);if(this._isFallback)return;throw e}}async _handleContainer(e){this._log.debug("Handling container");for(const t of e.obj.messages)await this._processMessage(t)}async _handleGzipPacked(e){this._log.debug("Handling gzipped data");const t=new Ft(e.obj.data);e.obj=t.tgReadObject(),await this._processMessage(e)}_handleUpdate(e){2331323052===e.obj.SUBCLASS_OF_ID?(this._log.debug(`Handling update ${e.obj.className}`),this._isExported||this._updateCallback?.(e.obj)):this._log.warn(`Note: ${e.obj.className} is not an update, not dispatching it`)}_handlePong(e){const t=e.obj,n=this._state.updateTimeOffset(e.msgId);this._isExported||this._updateCallback?.(new Sn(n)),this._log.debug(`Handling pong for message ${t.msgId}`);const s=this._pendingState.getAndDelete(t.msgId);s&&s.resolve?.(t)}_handleBadServerSalt(e){const t=e.obj;this._log.debug(`Handling bad salt for message ${t.badMsgId}`),this._state.salt=t.newServerSalt;const n=this._popStates(t.badMsgId);this._sendQueue.extend(n),this._log.debug(`${n.length} message(s) will be resent`)}_handleBadNotification(e){const t=e.obj,n=this._popStates(t.badMsgId);if(this._log.debug(`Handling bad msg ${JSON.stringify(t)}`),[16,17].includes(t.errorCode)){const t=this._state.updateTimeOffset(e.msgId);this._isExported||this._updateCallback?.(new Sn(t)),this._log.info(`System clock is wrong, set time offset to ${t}s`)}else if(32===t.errorCode)this._state._sequence+=64;else{if(33!==t.errorCode){for(const e of n)e.reject(new St(e.request,t.errorCode));return}this._state._sequence-=16}this._sendQueue.extend(n),this._log.debug(`${n.length} messages will be resent due to bad msg`)}_handleDetailedInfo(e){const t=e.obj.answerMsgId;this._log.debug(`Handling detailed info for message ${t}`),this._pendingAck.add(t)}_handleNewDetailedInfo(e){const t=e.obj.answerMsgId;this._log.debug(`Handling new detailed info for message ${t}`),this._pendingAck.add(t)}_handleNewSessionCreated(e){this._log.debug("Handling new session created"),this._state.salt=e.obj.serverSalt}_handleAck(){}_handleFutureSalts(e){this._log.debug(`Handling future salts for message ${e.msgId}`);const t=this._pendingState.getAndDelete(e.msgId);t&&t.resolve?.(e.obj)}_handleStateForgotten(e){this._sendQueue.append(new Hn(new Ye.MsgsStateInfo({reqMsgId:e.msgId,info:String.fromCharCode(1).repeat(e.obj.msgIds)})))}_handleMsgAll(e){}reconnect(){this._userConnected&&!this.isReconnecting&&(this.isReconnecting=!0,Be(1e3).then((()=>{this.logWithIndex.log("Reconnecting..."),this._log.info("Started reconnecting"),this._reconnect()})))}async _reconnect(){const e=this._connection,t=this._fallbackConnection;this._log.debug("Closing current connection...");try{this.logWithIndex.warn("[Reconnect] Closing current connection..."),e&&await this._disconnect(e),t&&await this._disconnect(t)}catch(e){this._log.warn(e)}this._sendQueue.append(void 0),this._state.reset();const n=new e.constructor({ip:e._ip,port:e._port,dcId:e._dcId,loggers:e._log,isTestServer:e._isTestServer,isPremium:e._isPremium}),s=new this._fallbackConnection.constructor({ip:e._ip,port:e._port,dcId:e._dcId,loggers:e._log,isTestServer:e._isTestServer,isPremium:e._isPremium});await this.connect(n,!0,s),this.isReconnecting=!1,this._sendQueue.prepend(this._pendingState.values()),this._pendingState.clear(),this._autoReconnectCallback&&await this._autoReconnectCallback()}}Ln(jn,"DEFAULT_OPTIONS",{logger:void 0,retries:1/0,retriesToFallback:1,delay:2e3,retryMainConnectionDelay:1e4,shouldForceHttpTransport:!1,shouldAllowHttpTransport:!1,autoReconnect:!0,connectTimeout:void 0,authKeyCallback:void 0,updateCallback:void 0,autoReconnectCallback:void 0,isMainSender:void 0,onConnectionBreak:void 0,isExported:void 0,getShouldDebugExportedSenders:void 0});var Wn=n(48287).hp;const zn=Wn.from("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00","hex"),Kn=Wn.from("ffd9","hex");function $n(e,t=!0,n=!0){if(3374092470===e.SUBCLASS_OF_ID)return e;if(e instanceof Ye.User){if(e.self&&t)return new Ye.InputPeerSelf;if(void 0===e.accessHash&&n)throw new Error("User without accessHash or min info cannot be input");return new Ye.InputPeerUser({userId:e.id,accessHash:e.accessHash})}if(e instanceof Ye.Chat||e instanceof Ye.ChatEmpty||e instanceof Ye.ChatForbidden)return new Ye.InputPeerChat({chatId:e.id});if(e instanceof Ye.Channel){if(void 0===e.accessHash&&n)throw new TypeError("Channel without accessHash or min info cannot be input");return new Ye.InputPeerChannel({channelId:e.id,accessHash:e.accessHash})}return e instanceof Ye.ChannelForbidden?new Ye.InputPeerChannel({channelId:e.id,accessHash:e.accessHash}):e instanceof Ye.InputUser?new Ye.InputPeerUser({userId:e.userId,accessHash:e.accessHash}):e instanceof Ye.InputChannel?new Ye.InputPeerChannel({channelId:e.channelId,accessHash:e.accessHash}):(e instanceof Ye.UserEmpty||function(e,t){throw new Error(`Cannot cast ${e.className} to any kind of InputPeer`)}(e),new Ye.InputPeerEmpty)}function Jn(e){if(e.length<3||1!==e[0])return e;const t=Wn.from(zn);return t[164]=e[1],t[166]=e[2],Wn.concat([t,e.slice(3),Kn])}function Qn(e,t=!1){switch(e){case 1:return{id:1,ipAddress:`zws1${t?"-1":""}.web.telegram.org`,port:443};case 2:return{id:2,ipAddress:`zws2${t?"-1":""}.web.telegram.org`,port:443};case 3:return{id:3,ipAddress:`zws3${t?"-1":""}.web.telegram.org`,port:443};case 4:return{id:4,ipAddress:`zws4${t?"-1":""}.web.telegram.org`,port:443};case 5:return{id:5,ipAddress:`zws5${t?"-1":""}.web.telegram.org`,port:443};default:throw new Error(`Cannot find the DC with the ID of ${e}`)}}class Xn{}function Zn(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Yn extends Xn{constructor(){super(),Zn(this,"_serverAddress",void 0),Zn(this,"_dcId",void 0),Zn(this,"_port",void 0),Zn(this,"_takeoutId",void 0),Zn(this,"_entities",void 0),Zn(this,"_updateStates",void 0),Zn(this,"_isTestServer",void 0),this._serverAddress=void 0,this._dcId=0,this._port=void 0,this._takeoutId=void 0,this._isTestServer=!1,this._entities=new Set,this._updateStates={}}get dcId(){return this._dcId}get serverAddress(){return this._serverAddress}get port(){return this._port}get isTestServer(){return this._isTestServer}setDC(e,t,n,s){this._dcId=0|e,this._serverAddress=t,this._port=n,this._isTestServer=s}getAuthKey(e){return new Dn}setAuthKey(e,t){}async load(){}save(){}delete(){}}var es=n(48287).hp;function ts(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ns extends Yn{constructor(e,t){super(),ts(this,"_sessionData",void 0),ts(this,"_callback",void 0),ts(this,"_authKeys",void 0),this._sessionData=e,this._callback=t,this._authKeys={}}async load(){if(!this._sessionData)return;const{mainDcId:e,keys:t,hashes:n,isTest:s}=this._sessionData,{ipAddress:a,port:i}=Qn(e);this.setDC(e,a,i,s,!0),await Promise.all(Object.keys(t).map((async e=>{const s=Number(e),a="string"==typeof t[s]?es.from(t[s],"hex"):es.from(t[s]);if(n[s]){const e="string"==typeof n[s]?es.from(n[s],"hex"):es.from(n[s]);this._authKeys[s]=new Dn(a,e)}else this._authKeys[s]=new Dn,await this._authKeys[s].setKey(a)})))}setDC(e,t,n,s,a=!1){this._dcId=e,this._serverAddress=t,this._port=n,this._isTestServer=s,delete this._authKeys[e],a||this._onUpdate()}getAuthKey(e=this._dcId){return this._authKeys[e]}setAuthKey(e,t=this._dcId){this._authKeys[t]=e,this._onUpdate()}getSessionData(){const e={mainDcId:this._dcId,keys:{},hashes:{},isTest:this._isTestServer||void 0};return Object.keys(this._authKeys).forEach((t=>{const n=Number(t),s=this._authKeys[n];s?._key&&(e.keys[n]=s._key.toString("hex"),e.hashes[n]=s._hash.toString("hex"))})),e}_onUpdate(){this._callback(this.getSessionData())}delete(){this._callback(void 0)}}var ss=n(51072),as=n(48287).hp;const is=256;function os(e,t){if(!as.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(t))throw new Error("Changing passwords unsupported")}function rs(e){return as.concat([as.alloc(is-e.length),e])}function cs(e){return Me(e,is,!1)}function ds(e,t){const n=t.subtract(e);return!(n.lesser(fe()(0))||n.bitLength().toJSNumber()<1984||e.bitLength().toJSNumber()<1984||Math.floor((e.bitLength().toJSNumber()+7)/8)>256)}function us(e,t){const n=Math.min(e.length,t.length);for(let s=0;s<n;s++)e[s]^=t[s];return e}async function ls(e,t){const n=await Ee(as.concat([e.salt1,as.from(t,"utf-8"),e.salt1])),s=await Ee(as.concat([e.salt2,n,e.salt2])),a=await function(e,t,n){return async function(e,t,n){const s=await crypto.subtle.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]);return ye.from(await crypto.subtle.deriveBits({name:"PBKDF2",hash:"SHA-512",salt:t,iterations:n},s,512))}(e,t,n)}(s,e.salt1,1e5);return Ee(as.concat([e.salt2,a,e.salt2]))}async function fs(e,t){try{os(e.p,e.g)}catch(e){throw new Error("bad p/g in password")}return cs(Ue(fe()(e.g),Pe(await ls(e,t),!1),Pe(e.p,!1)))}async function gs(e,t){const n=e.currentAlgo;if(!(n instanceof Ye.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow))throw new Error(`Unsupported password algorithm ${n?.className}`);const s=e.srp_B,a=e.srpId;if(!s||!a)throw new Error(`Undefined srp_b ${e}`);const i=await ls(n,t),o=Pe(n.p,!1),{g:r}=n,c=Pe(s,!1);try{os(n.p,r)}catch(e){throw new Error("bad /g in password")}if(!function(e,t){return e.greater(fe()(0))&&t.subtract(e).greater(fe()(0))}(c,o))throw new Error("bad b in check");const d=Pe(i,!1),u=rs(n.p),l=cs(fe()(r)),f=rs(s),g=Ue(fe()(r),d,o),p=Re(Pe(await Ee(as.concat([u,l])),!1).multiply(g),o),{a:h,aForHash:m,u:y}=await(async()=>{for(;;){const e=Pe(ke(256),!1),t=Ue(fe()(r),e,o);if(ds(t,o)){const n=cs(t),s=Pe(await Ee(as.concat([n,f])),!1);if(s.greater(fe()(0)))return{a:e,aForHash:n,u:s}}}})(),_=Re(c.subtract(p),o);if(!ds(_,o))throw new Error("bad gB");const b=y.multiply(d),v=Ue(_,h.add(b),o),[w,S,I,P,C]=await Promise.all([Ee(cs(v)),Ee(u),Ee(l),Ee(n.salt1),Ee(n.salt2)]),M=await Ee(as.concat([us(S,I),P,C,m,f,w]));return new Ye.InputCheckPasswordSRP({srpId:a,A:as.from(m),M1:M})}let ps=0;function hs(){return ps}function ms(){return Math.floor(Date.now()/1e3)+ps}const ys="phoneNumber";function _s(e,t,n){const{initialMethod:s=ys}=n;return"phoneNumber"===s?vs(e,t,n):ws(e,t,n)}async function bs(e,t=!1){try{return await e.invoke(new Ye.updates.GetState),!0}catch(e){if(e instanceof Error&&"Disconnect"===e.message||t)throw e;return!1}}async function vs(e,t,n){let s,a,i,o=!1;for(;;)try{if("function"==typeof n.phoneNumber)try{s=await n.phoneNumber()}catch(s){if(s instanceof Error&&"RESTART_AUTH_WITH_QR"===s.message)return ws(e,t,n);throw s}else s=n.phoneNumber;const i=await Ss(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 r,c=!1;for(;;)try{try{i=await n.phoneCode(o)}catch(s){if(s instanceof Error&&"RESTART_AUTH"===s.message)return vs(e,t,n)}if(!i)throw new Error("Code is empty");const d=await e.invoke(new Ye.auth.SignIn({phoneNumber:s,phoneCodeHash:a,phoneCode:i}));if(d instanceof Ye.auth.AuthorizationSignUpRequired){c=!0,r=d.termsOfService;break}return d.user}catch(t){if(t instanceof tt&&"SESSION_PASSWORD_NEEDED"===t.errorMessage)return Is(e,0,n);t instanceof Error?n.onError(t):console.warn("Unexpected error:",t)}if(c)for(;;)try{const[t,i]=await n.firstAndLastNames();if(!t)throw new Error("First name is required");const{user:o}=await e.invoke(new Ye.auth.SignUp({phoneNumber:s,phoneCodeHash:a,firstName:t,lastName:i}));return r&&await e.invoke(new Ye.help.AcceptTermsOfService({id:r.id})),o}catch(e){n.onError(e)}return n.onError(new Error("Auth failed")),vs(e,t,n)}async function ws(e,t,n){let s=!1;const a=(async()=>{for(;!s;){const t=await e.invoke(new Ye.auth.ExportLoginToken({apiId:Number("2496"),apiHash:"8da85b0d5bfe62527e5b244c209159c3",exceptIds:[]}));if(!(t instanceof Ye.auth.LoginToken))throw new Error("Unexpected");const{token:s,expires:a}=t;await Promise.race([n.qrCode({token:s,expires:a}),Be(1e3*(a-ms()))])}})(),i=new Promise((t=>{e.addEventHandler((e=>{e instanceof Ye.UpdateLoginToken&&t()}),{build:e=>e})}));try{await Promise.race([i,a])}catch(s){if(s instanceof Error&&"RESTART_AUTH"===s.message)return await vs(e,t,n);throw s}finally{s=!0}try{const t=await e.invoke(new Ye.auth.ExportLoginToken({apiId:Number("2496"),apiHash:"8da85b0d5bfe62527e5b244c209159c3",exceptIds:[]}));if(t instanceof Ye.auth.LoginTokenSuccess&&t.authorization instanceof Ye.auth.Authorization)return t.authorization.user;if(t instanceof Ye.auth.LoginTokenMigrateTo){await e._switchDC(t.dcId);const n=await e.invoke(new Ye.auth.ImportLoginToken({token:t.token}));if(n instanceof Ye.auth.LoginTokenSuccess&&n.authorization instanceof Ye.auth.Authorization)return n.authorization.user}}catch(t){if(t instanceof tt&&"SESSION_PASSWORD_NEEDED"===t.errorMessage)return Is(e,0,n);throw t}throw void 0}async function Ss(e,t,n,s=!1){try{const{apiId:a,apiHash:i}=t,o=await e.invoke(new Ye.auth.SendCode({phoneNumber:n,apiId:a,apiHash:i,settings:new Ye.CodeSettings}));if(!(o instanceof Ye.auth.SentCode))throw Error("Unexpected SentCodeSuccess");if(!s||o.type instanceof Ye.auth.SentCodeTypeSms)return{phoneCodeHash:o.phoneCodeHash,isCodeViaApp:o.type instanceof Ye.auth.SentCodeTypeApp};const r=await e.invoke(new Ye.auth.ResendCode({phoneNumber:n,phoneCodeHash:o.phoneCodeHash}));if(!(r instanceof Ye.auth.SentCode))throw Error("Unexpected SentCodeSuccess");return{phoneCodeHash:r.phoneCodeHash,isCodeViaApp:r.type instanceof Ye.auth.SentCodeTypeApp}}catch(a){if(a instanceof tt&&"AUTH_RESTART"===a.errorMessage)return Ss(e,t,n,s);throw a}}async function Is(e,t,n,s=!1){for(;;)try{const t=await e.invoke(new Ye.account.GetPassword),a=await n.password(t.hint,s);if(!a)throw new Error("Password is empty");const i=await gs(t,a),{user:o}=await e.invoke(new Ye.auth.CheckPassword({password:i}));return o}catch(e){n.onError(e)}}function Ps(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Cs{constructor(e){this.maxWorkers=e,Ps(this,"deferreds",[]),Ps(this,"priorityDeferreds",[]),Ps(this,"activeWorkers",0)}requestWorker(e){if(this.activeWorkers===this.maxWorkers){const t=new Gn;return e?this.priorityDeferreds.push(t):this.deferreds.push(t),t.promise}return this.activeWorkers++,Promise.resolve()}releaseWorker(){this.queueLength?(this.priorityDeferreds.shift()||this.deferreds.shift()).resolve():this.activeWorkers--}get queueLength(){return this.deferreds.length+this.priorityDeferreds.length}}class Ms{constructor(e){this.isUpload=e}}var Rs=n(48287).hp;function ks(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const As=4096,Ts=1048576,Es=5;class Us{constructor(e){ks(this,"type",void 0),ks(this,"size",void 0),ks(this,"buffer",void 0),ks(this,"largeFile",void 0),ks(this,"largeFileAccessHandle",void 0),this.size=e,this.type=e&&e>self.maxBufferSize?"opfs":"memory"}async init(){if("opfs"===this.type){if(!FileSystemFileHandle?.prototype.createSyncAccessHandle)throw new Error("`createSyncAccessHandle` is not available. Cannot download files larger than 2GB.");const e=await navigator.storage.getDirectory(),t=await e.getDirectoryHandle("downloads",{create:!0});this.largeFile=await t.getFileHandle(Math.random().toString(),{create:!0}),this.largeFileAccessHandle=await this.largeFile.createSyncAccessHandle()}else this.buffer=this.size?Rs.alloc(this.size):Rs.alloc(0)}write(e,t){if("opfs"===this.type)this.largeFileAccessHandle.write(e,{at:t});else if(this.size)for(let n=0;n<e.length;n++){if(t+n>=this.buffer.length)return;this.buffer.writeUInt8(e[n],t+n)}else this.buffer=Rs.concat([this.buffer,e])}async getData(){return"opfs"===this.type?this.largeFile.getFile():Promise.resolve(this.buffer)}}const Ds=3,Bs=6,xs=Array(Bs).fill(void 0).map((()=>new Cs(10)));async function Vs(e,t,n,s){let{partSizeKb:a,end:i=0}=n;const{fileSize:o,dcId:r,progressCallback:c,isPriority:d,start:u=0}=n,l="id"in t?t.id:void 0,f=(...e)=>{s&&console.log(`⬇️ [${l}/${n.dcId}]`,...e)};f("Downloading file...");const g=Boolean(e.isPremium);o&&(i=i&&i<o?i:o-1);const p=i?i-u+1:void 0;a||(a=o?function(e){if(e<=65536)return 64;if(e<=104857600)return 128;if(e<=786432e3)return 256;if(e<=2097152e3)return 512;if(e<=4194304e3)return 1024;throw new Error("File size too large")}(p||o):64);const h=1024*a,m=p?Math.ceil(p/h):1,y=!i,_=Boolean(o)&&o>=10485760&&!y;let b;if(h%As!=0)throw new Error("The part size must be evenly divisible by 4096");e._log.info(`Downloading file in chunks of ${h} bytes`);const v=new Us(p),w=[];let S=u,I=!1,P=0;c&&c(P);let C=!1;for(await v.init();;){let n=h,a=!1;Math.floor(S/Ts)!==Math.floor((S+n-1)/Ts)&&(n=Ts-S%Ts,a=!0),S%As==0&&n%As==0||(a=!0);const o=Ns(g,_);if(await xs[o].requestWorker(d),b&&await b.promise,y&&(b=new Gn),I){xs[o].releaseWorker();break}const l=(...e)=>{f(`[${o}/${r}]`,...e)};if(w.push((async d=>{for(;;){let f;try{let p=!1;s&&setTimeout((()=>{p||l(`❗️️ getSender took too long ${d}`)}),8e3),f=await e.getSender(r,o,g),p=!0;let h=!1;s&&setTimeout((()=>{h||l(`❗️️ sender.send took too long ${d}`)}),6e3);const y=await Promise.race([f.send(new Ye.upload.GetFile({location:t,offset:fe()(d),limit:n,precise:a||void 0})),Be(6e4).then((()=>r===e.session.dcId?(l(`Download timed out ${d}`),Promise.reject(new Error("USER_CANCELED"))):(l(`Download timed out [not main] ${d}`),Promise.reject(new Error("SESSION_REVOKED")))))]);if(e.releaseExportedSender(f),y instanceof Ye.upload.FileCdnRedirect)throw new Error("CDN download not supported");if(h=!0,c){if(c.isCanceled)throw new Error("USER_CANCELED");P+=1/m,l(`⬇️️ ${100*P}%`),c(P)}return!i&&y.bytes.length<n&&(I=!0),xs[o].releaseWorker(),b&&b.resolve(),void v.write(y.bytes,d-u)}catch(t){if(f&&!f.isConnected()){await Be(1e3);continue}if(t instanceof ut){t instanceof lt&&!C&&(f?._updateCallback(new Ms(!1)),C=!0),await Be(1e3*t.seconds);continue}throw l(`Ended not gracefully ${d}`),xs[o].releaseWorker(),b&&b.resolve(),I=!0,f&&e.releaseExportedSender(f),t}}})(S)),S+=n,i&&S>i)break}return await Promise.all(w),v.getData()}function Ns(e,t){const n=e?Bs:Ds;let s=0,a=1/0;for(let e=0;e<n;e++){const n=xs[e];if(!n.queueLength)return e;if(!t&&n.queueLength<=Es)return e;n.queueLength<=a&&(s=e,a=n.activeWorkers)}return s}var Fs=n(48287).hp;const Gs=Array(6).fill(void 0).map((()=>new Cs(10)));var qs=n(48287).hp,Hs=n(48287).hp;function Os(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ls=131072,js=["u","v","w","y","d","x","c","m","b","a","s","f","i","j"];class Ws{constructor(e,t,n,s=Ws.DEFAULT_OPTIONS){if(Os(this,"_args",void 0),Os(this,"session",void 0),Os(this,"apiHash",void 0),Os(this,"apiId",void 0),Os(this,"defaultDcId",void 0),Os(this,"_useIPV6",void 0),Os(this,"_shouldForceHttpTransport",void 0),Os(this,"_shouldAllowHttpTransport",void 0),Os(this,"_shouldDebugExportedSenders",void 0),Os(this,"_log",void 0),Os(this,"floodSleepLimit",void 0),Os(this,"_connection",void 0),Os(this,"_fallbackConnection",void 0),Os(this,"_sender",void 0),Os(this,"_eventBuilders",void 0),Os(this,"_requestRetries",void 0),Os(this,"_connectionRetries",void 0),Os(this,"_connectionRetriesToFallback",void 0),Os(this,"_retryDelay",void 0),Os(this,"_retryMainConnectionDelay",void 0),Os(this,"_timeout",void 0),Os(this,"_autoReconnect",void 0),Os(this,"_config",void 0),Os(this,"_exportedSenderPromises",{}),Os(this,"_exportedSenderRefCounter",{}),Os(this,"_waitingForAuthKey",{}),Os(this,"_exportedSenderReleaseTimeouts",{}),Os(this,"_loopStarted",!1),Os(this,"_isSwitchingDc",!1),Os(this,"_destroyed",!1),Os(this,"_connectedDeferred",new Gn),Os(this,"pingCallback",void 0),Os(this,"_initWith",void 0),Os(this,"isPremium",!1),Os(this,"_lastRequest",Date.now()),!t||!n||!Number.isFinite(t))throw Error('Your API ID or Hash are invalid. Please read "Requirements" on README.md');const a={...Ws.DEFAULT_OPTIONS,...s};if(this.apiId=t,this.apiHash=n,this.defaultDcId=a.dcId||2,this._useIPV6=a.useIPV6,this._shouldForceHttpTransport=a.shouldForceHttpTransport,this._shouldAllowHttpTransport=a.shouldAllowHttpTransport,this._shouldDebugExportedSenders=a.shouldDebugExportedSenders,"string"==typeof a.baseLogger?this._log=new $t:this._log=a.baseLogger,"string"!=typeof e&&e){if(!(e instanceof Xn))throw new Error("The given session must be str or a session instance")}else try{throw new Error("not implemented")}catch(t){e=new Yn}this.session=e,this.floodSleepLimit=a.floodSleepLimit,this._eventBuilders=[],this._requestRetries=a.requestRetries,this._connectionRetries=a.connectionRetries,this._connectionRetriesToFallback=a.connectionRetriesToFallback,this._retryDelay=a.retryDelay||0,this._retryMainConnectionDelay=a.retryMainConnectionDelay||0,this._timeout=a.timeout,this._autoReconnect=a.autoReconnect,this._connection=a.connection,this._fallbackConnection=a.fallbackConnection,this._initWith=e=>new Ye.InvokeWithLayer({layer:199,query:new Ye.InitConnection({apiId:this.apiId,deviceModel:a.deviceModel||ss.type().toString()||"Unknown",systemVersion:a.systemVersion||ss.release().toString()||"1.0",appVersion:a.appVersion||"1.0",langCode:a.langCode,langPack:a.langPack,systemLangCode:a.systemLangCode,query:e,proxy:void 0})}),this._args=a}async connect(){await this._initSession(),void 0===this._sender&&(this._sender=new jn(this.session.getAuthKey(),{logger:this._log,dcId:this.session.dcId,retries:this._connectionRetries,retriesToFallback:this._connectionRetriesToFallback,shouldForceHttpTransport:this._shouldForceHttpTransport,shouldAllowHttpTransport:this._shouldAllowHttpTransport,delay:this._retryDelay,retryMainConnectionDelay:this._retryMainConnectionDelay,autoReconnect:this._autoReconnect,connectTimeout:this._timeout,authKeyCallback:this._authKeyCallback.bind(this),updateCallback:this._handleUpdate.bind(this),getShouldDebugExportedSenders:this.getShouldDebugExportedSenders.bind(this),isMainSender:!0}));const e=new this._connection({ip:this.session.serverAddress,port:this.session.port,dcId:this.session.dcId,loggers:this._log,isTestServer:this.session.isTestServer}),t=new this._fallbackConnection({ip:this.session.serverAddress,port:this.session.port,dcId:this.session.dcId,loggers:this._log,isTestServer:this.session.isTestServer});if(!await this._sender.connect(e,!1,t))return void(this._loopStarted||(this._updateLoop(),this._loopStarted=!0));this.session.setAuthKey(this._sender.authKey),await this._sender.send(this._initWith(new Ye.help.GetConfig)),this._loopStarted||(this._updateLoop(),this._loopStarted=!0),this._connectedDeferred.resolve(),this._isSwitchingDc=!1;const n=await this._borrowExportedSender(this.session.dcId,!1,void 0,0,this.isPremium);n&&this.releaseExportedSender(n)}async _initSession(){if(await this.session.load(),!this.session.serverAddress||this.session.serverAddress.includes(":")!==this._useIPV6){const e=Qn(this.defaultDcId);this.session.setDC(this.defaultDcId,e.ipAddress,this._args.useWSS?443:80,this._args.isTestServerRequested)}}setPingCallback(e){this.pingCallback=e}async setForceHttpTransport(e){this._shouldForceHttpTransport=e,await this.disconnect(),this._sender=void 0,await this.connect()}async setAllowHttpTransport(e){this._shouldAllowHttpTransport=e,await this.disconnect(),this._sender=void 0,await this.connect()}setShouldDebugExportedSenders(e){this._shouldDebugExportedSenders=e}getShouldDebugExportedSenders(){return this._shouldDebugExportedSenders}async _updateLoop(){let e;const t=this._sender;if(!t)throw new Error("Sender is not initialized");for(;!this._destroyed;)if(await Be(3e3),t.isReconnecting||this._isSwitchingDc)e=void 0;else{try{const n=()=>{var e,n;if(!this._destroyed)return t.send(new Ye.PingDelayDisconnect({pingId:fe()((e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER,e=Math.ceil(e),n=Math.floor(n),Math.floor(Math.random()*(n-e+1))+e)),disconnectDelay:6e4}))},s=Date.now(),a=e?s-e:void 0;if(!a||a<5e3)await Ks((()=>zs(n,5e3)),3,100);else{let e=setTimeout((()=>{this._handleUpdate(new wn(wn.disconnected)),e=void 0}),1e3);await zs(n,3e3),e&&(clearTimeout(e),e=void 0),this._handleUpdate(new wn(wn.connected))}e=Date.now()}catch(n){if(console.warn(n),e=void 0,t.isReconnecting||this._isSwitchingDc)continue;if(this._destroyed)break;t.reconnect()}if(Date.now()-this._lastRequest>18e5){try{await(this.pingCallback?.())}catch(e){}e=void 0}}await this.disconnect()}async disconnect(){await(this._sender?.disconnect()),await Promise.all(Object.values(this._exportedSenderPromises).map((e=>Object.values(e).map((e=>e?.then((e=>e?.disconnect())))))).flat()),Object.values(this._exportedSenderReleaseTimeouts).forEach((e=>{Object.values(e).forEach((e=>{clearTimeout(e)}))})),this._exportedSenderRefCounter={},this._exportedSenderPromises={},this._waitingForAuthKey={}}async destroy(){this._destroyed=!0;try{await this.disconnect(),this._sender?.destroy()}catch(e){}this.session.delete(),this._eventBuilders=[]}async _switchDC(e){if(!this._sender)throw new Error("Sender is not initialized");this._log.info(`Reconnecting to new data center ${e}`);const t=Qn(e),n=this.session.isTestServer||this._args.isTestServerRequested;return this.session.setDC(e,t.ipAddress,t.port,n),await this._sender.authKey.setKey(void 0),this.session.setAuthKey(void 0),this._isSwitchingDc=!0,await this.disconnect(),this._sender=void 0,this.connect()}_authKeyCallback(e,t){this.session.setAuthKey(e,t)}async _cleanupExportedSender(e,t){this.session.dcId!==e&&this.session.setAuthKey(void 0,e),this._shouldDebugExportedSenders&&console.log(`🧹 Cleanup idx=${t} dcId=${e}`);const n=await this._exportedSenderPromises[e][t];delete this._exportedSenderPromises[e][t],delete this._exportedSenderRefCounter[e][t],await(n?.disconnect())}async _cleanupExportedSenders(e){const t=Object.values(this._exportedSenderPromises[e]);t.length&&(this.session.dcId!==e&&this.session.setAuthKey(void 0,e),this._exportedSenderPromises[e]={},this._exportedSenderRefCounter[e]={},await Promise.all(t.map((async e=>{const t=await e;await(t?.disconnect())}))))}async _connectSender(e,t,n,s=!1){let a,i=Boolean(e.authKey.getKey());if(!i)if(this._waitingForAuthKey[t]){await this._waitingForAuthKey[t];const n=this.session.getAuthKey(t);i=Boolean(e.authKey?.getKey()),i&&await e.authKey.setKey(n.getKey())}else this._waitingForAuthKey[t]=new Promise((e=>{a=e}));const o=Qn(t,i);for(;;)try{return await e.connect(new this._connection({ip:o.ipAddress,port:o.port,dcId:t,loggers:this._log,isTestServer:this.session.isTestServer,isPremium:!!i&&s}),!1,new this._fallbackConnection({ip:o.ipAddress,port:o.port,dcId:t,loggers:this._log,isTestServer:this.session.isTestServer,isPremium:!!i&&s})),this.session.dcId===t||e._authenticated||await navigator.locks.request("GRAMJS_AUTH_EXPORT",(async()=>{this._log.info(`Exporting authorization for data center ${o.ipAddress}`);const n=await this.invoke(new Ye.auth.ExportAuthorization({dcId:t})),s=this._initWith(new Ye.auth.ImportAuthorization({id:n.id,bytes:n.bytes}));await e.send(s),e._authenticated=!0})),e._dcId=t,e.userDisconnected=!1,a&&(a(),delete this._waitingForAuthKey[t]),this._shouldDebugExportedSenders&&console.warn(`✅ Connected to exported sender idx=${n} dc=${t}`),e}catch(s){this._shouldDebugExportedSenders&&console.error(`☠️ ERROR! idx=${n} dcId=${t} ${s.message}`),console.error(s),await Be(1e3),await e.disconnect()}}releaseExportedSender(e){const t=e._dcId,n=e._senderIndex;this._exportedSenderRefCounter[t]&&this._exportedSenderRefCounter[t][n]&&(this._exportedSenderRefCounter[t][n]-=1,this._exportedSenderRefCounter[t][n]<=0&&(this._exportedSenderReleaseTimeouts[t]||(this._exportedSenderReleaseTimeouts[t]={}),this._exportedSenderReleaseTimeouts[t][n]=setTimeout((()=>{this._shouldDebugExportedSenders&&console.log(`[CC] [idx=${n} dcId=${t}] 🚪 Release`),e.disconnect(),this._exportedSenderReleaseTimeouts[t][n]=void 0,this._exportedSenderPromises[t][n]=void 0}),3e4)))}async _borrowExportedSender(e,t,n,s,a){const i=s||0;let o;this._exportedSenderPromises[e]||(this._exportedSenderPromises[e]={}),this._exportedSenderRefCounter[e]||(this._exportedSenderRefCounter[e]={}),this._exportedSenderPromises[e][i]&&!t||(this._shouldDebugExportedSenders&&console.warn(`🕒 Connecting to exported sender idx=${i} dc=${e} `+(t?"(reconnect)":"")),this._exportedSenderRefCounter[e][i]=0,this._exportedSenderPromises[e][i]=this._connectSender(n||this._createExportedSender(e,i),e,s,a));try{if(o=await this._exportedSenderPromises[e][i],!o?.isConnected())return o?.isConnecting?(await Be(1e3),this._borrowExportedSender(e,!1,o,i,a)):this._borrowExportedSender(e,!0,o,i,a)}catch(t){return console.error(t),this._borrowExportedSender(e,!0,void 0,i,a)}return this._exportedSenderRefCounter[e][i]+=1,this._exportedSenderReleaseTimeouts[e]||(this._exportedSenderReleaseTimeouts[e]={}),this._exportedSenderReleaseTimeouts[e][i]&&(clearTimeout(this._exportedSenderReleaseTimeouts[e][i]),this._exportedSenderReleaseTimeouts[e][i]=void 0),o}_createExportedSender(e,t){return new jn(this.session.getAuthKey(e),{logger:this._log,dcId:e,senderIndex:t,retries:this._connectionRetries,retriesToFallback:this._connectionRetriesToFallback,delay:this._retryDelay,retryMainConnectionDelay:this._retryMainConnectionDelay,shouldForceHttpTransport:this._shouldForceHttpTransport,shouldAllowHttpTransport:this._shouldAllowHttpTransport,autoReconnect:this._autoReconnect,connectTimeout:this._timeout,authKeyCallback:this._authKeyCallback.bind(this),isMainSender:e===this.session.dcId,isExported:!0,updateCallback:this._handleUpdate.bind(this),getShouldDebugExportedSenders:this.getShouldDebugExportedSenders.bind(this),onConnectionBreak:()=>this._cleanupExportedSender(e,t)})}getSender(e,t,n){return e?this._borrowExportedSender(e,void 0,void 0,t,n):Promise.resolve(this._sender)}downloadFile(e,t){return async function(e,t,n,s){const{dcId:a}=n;for(let i=0;i<5;i++)try{return await Vs(e,t,n,s)}catch(t){if(!(t instanceof tt&&(t.errorMessage.startsWith("SESSION_REVOKED")||t.errorMessage.startsWith("CONNECTION_NOT_INITED"))&&i<4))throw t;await e._cleanupExportedSenders(a)}}(this,e,t,this._shouldDebugExportedSenders)}downloadMedia(e,t){let n;if(e instanceof Ye.Message||e instanceof Ye.StoryItem)n=e.media;else if(e instanceof Ye.MessageService){const t=e.action;"photo"in t&&(n=t.photo)}else n=e;return n instanceof Ye.MessageMediaWebPage&&n.webpage instanceof Ye.WebPage&&(n=n.webpage.document||n.webpage.photo),n instanceof Ye.MessageMediaPhoto||n instanceof Ye.Photo?this._downloadPhoto(n,t):n instanceof Ye.MessageMediaDocument||n instanceof Ye.Document?this._downloadDocument(n,t):n instanceof Ye.WebDocument||n instanceof Ye.WebDocumentNoProxy?this._downloadWebDocument(n):void 0}downloadProfilePhoto(e,t=!1){const n=e.photo;if(!(n instanceof Ye.UserProfilePhoto||n instanceof Ye.ChatPhoto))return;const s=n.dcId,a=new Ye.InputPeerPhotoFileLocation({peer:$n(e),photoId:n.photoId,big:t||void 0});return this.downloadFile(a,{dcId:s,isPriority:!0})}downloadStickerSetThumb(e){if(!e.thumbs?.length&&!e.thumbDocumentId)return;const t=e.thumbVersion;return e.thumbDocumentId?this.invoke(new Ye.messages.GetCustomEmojiDocuments({documentId:[e.thumbDocumentId]})).then((e=>{const t=e[0];if(t&&!(t instanceof Ye.DocumentEmpty))return this.downloadFile(new Ye.InputDocumentFileLocation({id:t.id,accessHash:t.accessHash,fileReference:t.fileReference,thumbSize:""}),{fileSize:t.size.toJSNumber(),dcId:t.dcId})})):this.downloadFile(new Ye.InputStickerSetThumb({stickerset:new Ye.InputStickerSetID({id:e.id,accessHash:e.accessHash}),thumbVersion:t}),{dcId:e.thumbDcId})}pickFileSize(e,t){if(!e?.length)return;if(!t)return e.reduce(((e,t)=>"w"in t?e&&"w"in e&&e.w>t.w?e:t:e),void 0);let n;for(let s=js.indexOf(t);s<js.length;s++)if(n=e.find((e=>"type"in e&&e.type===js[s])),n)return n}_downloadCachedPhotoSize(e){let t;return t=e instanceof Ye.PhotoStrippedSize?Jn(e.bytes):e.bytes,t}_downloadPhoto(e,t){let n=e;if(e instanceof Ye.MessageMediaPhoto&&e.photo instanceof Ye.Photo&&(n=e.photo),!(n instanceof Ye.Photo))return;const s="u"===t.sizeType||"v"===t.sizeType?n.videoSizes:[],a=this.pickFileSize([...s,...n.sizes],t.sizeType);if(!a||a instanceof Ye.PhotoSizeEmpty||a instanceof Ye.VideoSizeEmojiMarkup||a instanceof Ye.VideoSizeStickerMarkup)return;if(a instanceof Ye.PhotoCachedSize||a instanceof Ye.PhotoStrippedSize)return this._downloadCachedPhotoSize(a);let i;return i=a instanceof Ye.PhotoSizeProgressive?Math.max(...a.sizes):"size"in a?a.size:512,this.downloadFile(new Ye.InputPhotoFileLocation({id:n.id,accessHash:n.accessHash,fileReference:n.fileReference,thumbSize:a.type}),{dcId:n.dcId,fileSize:i,progressCallback:t.progressCallback})}_downloadDocument(e,t){let n,s=e;if(s instanceof Ye.MessageMediaDocument&&s.document instanceof Ye.Document&&(s=s.document),s instanceof Ye.Document){if(t.sizeType){if(n=this.pickFileSize([...s.thumbs||[],...s.videoThumbs||[]],t.sizeType),!n&&s.mimeType.startsWith("video/"))return;if(n&&(n instanceof Ye.PhotoCachedSize||n instanceof Ye.PhotoStrippedSize))return this._downloadCachedPhotoSize(n)}return this.downloadFile(new Ye.InputDocumentFileLocation({id:s.id,accessHash:s.accessHash,fileReference:s.fileReference,thumbSize:n&&"type"in n?n.type:""}),{fileSize:n&&"size"in n?n.size:s.size.toJSNumber(),progressCallback:t.progressCallback,start:t.start,end:t.end,dcId:s.dcId,workers:t.workers})}}async _downloadWebDocument(e){if(e instanceof Ye.WebDocumentNoProxy){const t=await fetch(e.url).then((e=>e.arrayBuffer()));return Hs.from(t)}try{const t=[];let n=0;for(;;){const s=new Ye.upload.GetWebFile({location:new Ye.InputWebFileLocation({url:e.url,accessHash:e.accessHash}),offset:n,limit:Ls}),a=await this._borrowExportedSender(this._config?.webfileDcId||4);if(!a)throw new Error("Failed to obtain sender");const i=await a.send(s);if(this.releaseExportedSender(a),n+=Ls,!i.bytes.length)break;if(t.push(i.bytes),i.bytes.length<Ls)break}return Hs.concat(t)}catch(e){if(e instanceof tt&&"WEBFILE_NOT_AVAILABLE"===e.errorMessage)return Hs.alloc(0);throw e}}async downloadStaticMap(e,t,n,s,a,i,o,r){try{const c=[];let d=0;for(;;)try{const u=new Ye.upload.GetWebFile({location:new Ye.InputWebFileGeoPointLocation({geoPoint:new Ye.InputGeoPoint({lat:n,long:t,accuracyRadius:r}),accessHash:e,w:s,h:a,zoom:i,scale:o}),offset:d,limit:Ls}),l=await this._borrowExportedSender(4);if(!l)throw new Error("Failed to obtain sender");const f=await l.send(u);if(this.releaseExportedSender(l),d+=Ls,!f.bytes.length)break;if(c.push(f.bytes),f.bytes.length<Ls)break}catch(e){if(e instanceof ut){console.warn(`getWebFile: sleeping for ${e.seconds}s on flood wait`),await Be(1e3*e.seconds);continue}}return Hs.concat(c)}catch(e){if(e instanceof tt&&"WEBFILE_NOT_AVAILABLE"===e.errorMessage)return Hs.alloc(0);throw e}}async invoke(e,t,n,s){if("request"!==e.classType)throw new Error("You can only invoke MTProtoRequests");const a=void 0!==t;let i=a?await this.getSender(t):this._sender;this._lastRequest=Date.now(),await this._connectedDeferred.promise;const o=new Hn(e,n);let r=0;for(r=0;r<this._requestRetries;r++){i.addStateToQueue(o);try{const e=await o.promise;return o.finished.resolve(),a&&this.releaseExportedSender(i),e}catch(e){if(e instanceof it||e instanceof tt&&("RPC_CALL_FAIL"===e.errorMessage||"RPC_MCGET_FAIL"===e.errorMessage||e.errorMessage.match(/INTERDC_\d_CALL(_RICH)?_ERROR/)))this._log.warn(`Telegram is having internal issues ${e.constructor.name}`),await Be(2e3);else if(e instanceof ut||e instanceof gt){if(!(e.seconds<=this.floodSleepLimit))throw o.finished.resolve(),a&&this.releaseExportedSender(i),e;this._log.info(`Sleeping for ${e.seconds}s on flood wait`),await Be(1e3*e.seconds)}else if(e instanceof dt||e instanceof pt||e instanceof ct){if(this._log.info(`Phone migrated to ${e.newDc}`),(e instanceof dt||e instanceof pt)&&await bs(this))throw o.finished.resolve(),a&&this.releaseExportedSender(i),e;await this._switchDC(e.newDc),a&&this.releaseExportedSender(i),i=void 0===t?this._sender:await this.getSender(t)}else if(e instanceof ft)await o.isReady(),o.after=void 0;else if(e instanceof tt&&"CONNECTION_NOT_INITED"===e.errorMessage)await this.disconnect(),await Be(2e3),await this.connect();else{if(!(e instanceof ot))throw o.finished.resolve(),a&&this.releaseExportedSender(i),e;if(!s)throw o.finished.resolve(),a&&this.releaseExportedSender(i),e}}o.resetPromise()}throw a&&this.releaseExportedSender(i),new Error(`Request was unsuccessful ${r} time(s)`)}async invokeBeacon(e,t){if("request"!==e.classType)throw new Error("You can only invoke MTProtoRequests");const n=void 0!==t,s=n?await this.getSender(t):this._sender;s.sendBeacon(e),n&&this.releaseExportedSender(s)}setIsPremium(e){this.isPremium=e}async getMe(){try{return(await this.invoke(new Ye.users.GetUsers({id:[new Ye.InputUserSelf]})))[0]}catch(e){this._log.warn("error while getting me"),this._log.warn(e)}}async loadConfig(){this._config||(this._config=await this.invoke(new Ye.help.GetConfig))}async start(e){if(this.isConnected()||await this.connect(),this.loadConfig(),await bs(this,e.shouldThrowIfUnauthorized))return;const t={apiId:this.apiId,apiHash:this.apiHash};await async function(e,t,n){let s;var a;s="botAuthToken"in n?await async function(e,t,n){const{apiId:s,apiHash:a}=t,{botAuthToken:i}=n,{user:o}=await e.invoke(new Ye.auth.ImportBotAuthorization({apiId:s,apiHash:a,botAuthToken:i}));return o}(e,t,n):"webAuthToken"in n&&n.webAuthToken?await async function(e,t,n){try{const{apiId:s,apiHash:a}=t,i=await e.invoke(new Ye.auth.ImportWebTokenAuthorization({webAuthToken:n.webAuthToken,apiId:s,apiHash:a}));if(i instanceof Ye.auth.Authorization)return i.user;throw new Error("SIGN_UP_REQUIRED")}catch(s){return s instanceof tt&&"SESSION_PASSWORD_NEEDED"===s.errorMessage?Is(e,0,n,!0):(e._log.error(`Failed to login with web token: ${s}`),n.webAuthTokenFailed(),_s(e,t,{...n,webAuthToken:void 0}))}}(e,t,n):await _s(e,t,n),e._log.info(`Signed in successfully as ${a=s,a instanceof Ye.User?a.lastName&&a.firstName?`${a.firstName} ${a.lastName}`:a.firstName?a.firstName:a.lastName?a.lastName:"":a instanceof Ye.Chat||a instanceof Ye.Channel?a.title:""}`)}(this,t,e)}uploadFile(e){return async function(e,t,n){const{file:s,onProgress:a}=t,i=Boolean(e.isPremium),{name:o,size:r}=s,c=Pe(ke(8),!0,!0),d=r>10485760,u=(...e)=>{n&&console.log(`⬆️ [${c}]`,...e)};u("Uploading file...");const l=1024*function(e){if(e<=104857600)return 128;if(e<=786432e3)return 256;if(e<=2097152e3)return 512;if(e<=4194304e3)return 512;throw new Error("File size too large")}(r),f=Math.floor((r+l-1)/l),g=Gs.map((({activeWorkers:e})=>e));let p=g.indexOf(Math.min(...g)),h=0;a&&a(h);let m=!1;const y=[];for(let t=0;t<f;t++){const o=p%(i?6:3);if(await Gs[o].requestWorker(),a?.isCanceled){Gs[o].releaseWorker();break}const r=(...e)=>{u(`[${o}]`,...e)},g=s.slice(t*l,(t+1)*l);y.push((async(t,s)=>{for(;;){let u;try{let a=!1;n&&setTimeout((()=>{a||r(`❗️️ getSender took too long j=${t}`)}),8e3),u=await e.getSender(e.session.dcId,o,i),a=!0;let l=!1;const g=await s.arrayBuffer();n&&setTimeout((()=>{l||r(`❗️️ sender.send took too long j=${t}`)}),6e3),await u.send(d?new Ye.upload.SaveBigFilePart({fileId:c,filePart:t,fileTotalParts:f,bytes:Fs.from(g)}):new Ye.upload.SaveFilePart({fileId:c,filePart:t,bytes:Fs.from(g)})),e.releaseExportedSender(u),l=!0}catch(n){if(r(`Upload part failed ${n?.toString()} j=${t}`),u&&!u.isConnected()){await Be(1e3);continue}if(n instanceof ut){n instanceof lt&&!m&&(u?._updateCallback(new Ms(!0)),m=!0),await Be(1e3*n.seconds);continue}throw Gs[o].releaseWorker(),u&&e.releaseExportedSender(u),n}if(Gs[o].releaseWorker(),a){if(a.isCanceled)throw new Error("USER_CANCELED");h+=1/f,r(100*h+"%"),a(h)}break}})(t,g)),p++}return await Promise.all(y),d?new Ye.InputFileBig({id:c,parts:f,name:o}):new Ye.InputFile({id:c,parts:f,name:o,md5Checksum:""})}(this,e,this._shouldDebugExportedSenders)}updateTwoFaSettings(e){return async function(e,{isCheckPassword:t,currentPassword:n,newPassword:s,hint:a="",email:i,emailCodeCallback:o,onEmailCodeError:r}){if(!s&&!n)throw new Error("Neither `currentPassword` nor `newPassword` is present");if(i&&(!o||!r))throw new Error("`email` present without `emailCodeCallback` and `onEmailCodeError`");const c=await e.invoke(new Ye.account.GetPassword),d=c.newAlgo;if(d instanceof Ye.PasswordKdfAlgoUnknown)throw new Error("Password algorithm is unknown");d.salt1=qs.concat([d.salt1,ke(32)]),!c.hasPassword&&n&&(n=void 0);const u=n?await gs(c,n):new Ye.InputCheckPasswordEmpty;if(t)await e.invoke(new Ye.auth.CheckPassword({password:u}));else try{await e.invoke(new Ye.account.UpdatePasswordSettings({password:u,newSettings:new Ye.account.PasswordInputSettings({newAlgo:d,newPasswordHash:s?await fs(d,s):qs.alloc(0),hint:a,email:i,newSecureSettings:void 0})}))}catch(t){if(!(t instanceof ht))throw t;for(;;)try{const n=await o(t.codeLength);if(!n)throw new Error("Code is empty");await e.invoke(new Ye.account.ConfirmPasswordEmail({code:n}));break}catch(e){r(e)}}}(this,e)}getTmpPassword(e,t){return async function(e,t,n=60){const s=await e.invoke(new Ye.account.GetPassword);if(!s)return;const a=await gs(s,t);return await e.invoke(new Ye.account.GetTmpPassword({password:a,period:n}))}(this,e,t)}getCurrentPassword(e){return async function(e,t){const n=await e.invoke(new Ye.account.GetPassword);if(n)return t?await gs(n,t):new Ye.InputCheckPasswordEmpty}(this,e)}addEventHandler(e,t){this._eventBuilders.push([t,e])}_handleUpdate(e){if(e instanceof Ye.Updates||e instanceof Ye.UpdatesCombined){const t=[];for(const n of[...e.users,...e.chats])t.push(n);this._processUpdate(e,t)}else e instanceof Ye.UpdateShort?this._processUpdate(e.update,void 0):this._processUpdate(e,void 0)}_processUpdate(e,t){e._entities=t||[];const n={update:e};this._dispatchUpdate(n)}async _dispatchUpdate(e){for(const[t,n]of this._eventBuilders){const s=t.build(e.update);s&&await n(s)}}isConnected(){return!(!this._sender||!this._sender.isConnected())}}function zs(e,t){let n=!1;return Promise.race([e(),Be(t).then((()=>n?void 0:Promise.reject(new Error("TIMEOUT"))))]).finally((()=>{n=!0}))}async function Ks(e,t,n){for(let s=0;s<t;s++)try{return await e()}catch(e){if(s===t-1)throw e;await Be(n)}}Os(Ws,"DEFAULT_OPTIONS",{connection:class extends cn{constructor(...e){super(...e),_n(this,"ObfuscatedIO",bn),_n(this,"PacketCodecClass",gn)}},fallbackConnection:un,useIPV6:!1,timeout:10,requestRetries:5,connectionRetries:1/0,connectionRetriesToFallback:1,retryDelay:1e3,retryMainConnectionDelay:1e4,autoReconnect:!0,sequentialUpdates:!1,floodSleepLimit:60,deviceModel:void 0,systemVersion:void 0,appVersion:void 0,langCode:"en",langPack:"weba",systemLangCode:"en",baseLogger:"gramjs",useWSS:!1,additionalDcsDisabled:!1,dcId:2,isTestServerRequested:!1,shouldAllowHttpTransport:!1,shouldForceHttpTransport:!1,shouldDebugExportedSenders:!1});const $s=Ws,Js=60,Qs=3600,Xs=86400;function Zs(e,t,n){return e*Qs+t*Js+n}function Ys(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}"undefined"==typeof File&&(self.File=class extends Blob{constructor(e,t,n){if(n){const{type:t,...s}=n;super(e,{type:t}),Ys(this,"name",void 0),Object.assign(this,s)}else super(e),Ys(this,"name",void 0);this.name=t}});const ea=e=>`#${e.toString(16).padStart(6,"0")}`;function ta(e){return e.hasOwnProperty("userId")}function na(e){return e.hasOwnProperty("chatId")}function sa(e,t){return"user"===t?e.toString():"channel"===t?`-1${e.toString().padStart(J-2,"0")}`:`-${e}`}function aa(e){return ta(e)?sa(e.userId,"user"):na(e)?sa(e.chatId,"chat"):sa(e.channelId,"channel")}function ia(e){const{color:t,backgroundEmojiId:n}=e;return{color:t,backgroundEmojiId:n?.toString()}}function oa(e){return e instanceof Ye.EmojiStatus?{type:"regular",documentId:e.documentId.toString(),until:e.until}:e instanceof Ye.EmojiStatusCollectible?{type:"collectible",collectibleId:e.collectibleId.toString(),documentId:e.documentId.toString(),title:e.title,slug:e.slug,patternDocumentId:e.patternDocumentId.toString(),centerColor:ea(e.centerColor),edgeColor:ea(e.edgeColor),patternColor:ea(e.patternColor),textColor:ea(e.textColor),until:e.until}:void 0}var ra=n(48287).hp;const ca="#111111DD",da="#E4D00A",ua={INVOKE:"#49DBF5",BEACON:"#F549DB",RESPONSE:"#6887F7",CONNECTING:"#E4D00A",CONNECTED:"#26D907","CONNECTING ERROR":"#D1191C","INVOKE ERROR":"#D1191C",UPDATE:"#0DD151","UNEXPECTED UPDATE":"#9C9C9C","UNEXPECTED RESPONSE":"#D1191C"},la={PHONE_NUMBER_INVALID:"ErrorPhoneNumberInvalid",PHONE_CODE_INVALID:"ErrorCodeInvalid",PASSWORD_HASH_INVALID:"ErrorIncorrectPassword",PHONE_PASSWORD_FLOOD:"ErrorPasswordFlood",PHONE_NUMBER_BANNED:"ErrorPhoneBanned",EMAIL_UNCONFIRMED:"ErrorEmailUnconfirmed",EMAIL_HASH_EXPIRED:"ErrorEmailHashExpired",NEW_SALT_INVALID:"ErrorNewSaltInvalid",SRP_PASSWORD_CHANGED:"ErrorPasswordChanged",CODE_INVALID:"ErrorEmailCodeInvalid",PASSWORD_MISSING:"ErrorPasswordMissing"};function fa(e){if(e instanceof Ye.Message||e instanceof Ye.MessageService)return aa(e.peerId)}function ga(e){return e instanceof Ye.DialogFilter||e instanceof Ye.DialogFilterChatlist}function pa(e){return String.fromCharCode(...e)}function ha(e){return ra.from(e,"binary")}function ma(e,...t){("UNEXPECTED RESPONSE"===e?console.error:"INVOKE ERROR"===e||"UNEXPECTED UPDATE"===e?console.warn:console.log)(`%cGramJS%c${e}`,`color: ${da}; background: ${ca}; padding: 0.25rem; border-radius: 0.25rem;`,`color: ${ua[e]}; background: ${ca}; padding: 0.25rem; border-radius: 0.25rem; margin-left: 0.25rem;`,...t)}function ya(e){return e instanceof Error||(c&&console.warn("Unexpected error type",e),!1)}function _a(e){let t;const n=e instanceof tt?e.errorMessage:void 0;return e instanceof ut?t={key:"ErrorFloodTime",variables:{time:ba(e.seconds)}}:e instanceof mt?t={key:"ErrorPasswordFresh",variables:{time:ba(e.seconds)}}:e instanceof tt&&(t={key:la[e.errorMessage]}),t||(t=e.message?{key:"ErrorUnexpectedMessage",variables:{error:e.message}}:{key:"ErrorUnexpected"}),{messageKey:t,errorMessage:n,error:e}}function ba(e){if(e<Js)return{key:"Seconds",variables:{count:e},options:{pluralValue:e}};if(e<Qs){const t=function(e,t){return(0,Math.ceil)(e/Js)}(e);return{key:"Minutes",variables:{count:t},options:{pluralValue:t}}}if(e<Xs){const t=function(e,t){return(0,Math.ceil)(e/Qs)}(e);return{key:"Hours",variables:{count:t},options:{pluralValue:t}}}const t=function(e,t){return(0,Math.ceil)(e/Xs)}(e);return{key:"Days",variables:{count:t},options:{pluralValue:t}}}function va(e,t=!1,n="image/jpeg"){return`${t?"":`data:${n};base64,`}${btoa(String.fromCharCode(...e))}`}function wa(e){const{flags:t,CONSTRUCTOR_ID:n,SUBCLASS_OF_ID:s,className:a,classType:i,getBytes:o,...r}=e;return r}var Sa=n(48287).hp;const Ia="BroadcastChannel"in self,Pa=Ia?new BroadcastChannel("tt-global"):void 0;let Ca=[];const Ma=oe((()=>{Pa.postMessage({type:"localDbUpdate",batchedUpdates:Ca}),Ca=[]}),100);function Ra(e){if(e instanceof Uint8Array)return Sa.from(e);if("object"==typeof e&&1===Object.keys(e).length&&"value"===Object.keys(e)[0])return fe()(e.value);if(Array.isArray(e))return e.map(Ra);if("object"!=typeof e||!("CONSTRUCTOR_ID"in e))return e;const t=e.className.split(".").reduce(((e,t)=>e[t]),Ye),n=wa(e);return new t(Object.keys(n).reduce(((e,t)=>(e[t]=Ra(n[t]),e)),{}))}function ka(e){return["localMessages","chats","users","messages","documents","stickerSets","photos","webDocuments","stories","commonBoxState","channelPtsById"].reduce(((t,n)=>{const s=e?.[n]??{},a=Object.keys(s).reduce(((e,t)=>{if("commonBoxState"===n||"channelPtsById"===n){const n=s;return e[t]=n[t],e}return e[t]=Ra(s[t]),e}),{});var i;return t[n]=Ia?(i=n,new Proxy(a,{get:(e,t,n)=>Reflect.get(e,t,n),set:(e,t,n)=>(Ca.push({name:i,prop:t,value:n}),Ma(),Reflect.set(e,t,n))})):a,t}),{})}const Aa=ka(),Ta=Aa;function Ea(){Pa&&Pa.postMessage({type:"localDbUpdateFull",localDb:Object.keys(Aa).reduce(((e,t)=>(e[t]={...Aa[t]},e)),{})})}let Ua;function Da(e){!function(e){Fa?Fa.push(e):Fa=[e],Va&&!D.has(e["@type"])||(Va=oe(xa,U,!0),Na=Math.random()),Va(Na)}(e)}function Ba(e){Ua(e)}c&&(globalThis.getLocalDb=()=>Aa);const xa=re((function(e){if(!Fa||e!==Na)return;const t=Fa;Fa=void 0,t.forEach(Ua)}));let Va,Na,Fa,Ga=function(e){return 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.Spoiler="MessageEntitySpoiler",e.CustomEmoji="MessageEntityCustomEmoji",e.Timestamp="MessageEntityTimestamp",e.Unknown="MessageEntityUnknown",e}({});const qa=-1,Ha="MESSAGE_DELETED";let Oa=function(e){return e[e.BlobUrl=0]="BlobUrl",e[e.Progressive=1]="Progressive",e[e.DownloadUrl=2]="DownloadUrl",e[e.Text=3]="Text",e}({});String.fromCharCode(8205);const La=/(?:\ud83c[\udd70\udd71\udd7e\udd7f]\ufe0f)|(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c[\udffc-\udfff]|\ud83e\udef1\ud83c\udffc\u200d\ud83e\udef2\ud83c[\udffb\udffd-\udfff]|\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\udef1\ud83c\udffe\u200d\ud83e\udef2\ud83c[\udffb-\udffd\udfff]|\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c[\udffb-\udffe]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d\udc8f\ud83c[\udffb-\udfff]|\ud83d\udc91\ud83c[\udffb-\udfff]|\ud83e\udd1d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d\udc8f\udc91]|\ud83e\udd1d)|(?:\ud83c\udfc3|\ud83d\udeb6|\ud83e\uddce)(?:\ud83c[\udffb-\udfff])?(?:\u200d[\u2640\u2642]\ufe0f)?(?:\u200d\u27a1\ufe0f)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\ud83e[\uddaf\uddbc\uddbd])(?:\u200d\u27a1\ufe0f)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf\uddaf-\uddb3\uddbc\uddbc\uddbd\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd\uddce\uddce\uddcf\uddd4\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83e\uddd1\u200d\ud83e\uddd1\u200d\ud83e\uddd2\u200d\ud83e\uddd2|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83e\uddd1\u200d\ud83e\uddd1\u200d\ud83e\uddd2|\ud83e\uddd1\u200d\ud83e\uddd2\u200d\ud83e\uddd2|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83d\ude36\u200d\ud83c\udf2b\ufe0f|\u26d3\ufe0f\u200d\ud83d\udca5|\u2764\ufe0f\u200d\ud83d\udd25|\u2764\ufe0f\u200d\ud83e\ude79|\ud83c\udf44\u200d\ud83d\udfeb|\ud83c\udf4b\u200d\ud83d\udfe9|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc26\u200d\ud83d\udd25|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83d\ude2e\u200d\ud83d\udca8|\ud83d\ude35\u200d\ud83d\udcab|\ud83d\ude42\u200d\u2194\ufe0f|\ud83d\ude42\u200d\u2195\ufe0f|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddd1\u200d\ud83e\uddd2|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b|\ud83d\udc26\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|\ud83e\udef0|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd\udec3-\udec5\udef1-\udef8]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udc8e\udc90\udc92-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udedc-\udedf\udeeb\udeec\udef4-\udefc\udfe0-\udfeb\udff0]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78-\uddb4\uddb7\uddba\uddbc-\uddcc\uddd0\uddde-\uddff\ude70-\ude7c\ude80-\ude88\ude90-\udebd\udebf-\udec2\udece-\udedb\udee0-\udee8]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,ja=[[/\u{1f3f3}\u200d\u{1f308}/gu,"🏳️‍🌈"],[/\u{1f3f3}\u200d\u26a7\ufe0f?/gu,"🏳️‍⚧️"],[/\u26d3\u200d\u{1f4a5}/gu,"⛓️‍💥"],[/\u200d([\u2640\u2642])(?!\ufe0f)/gu,"$1"]],Wa=100,za=8*Wa;function Ka(e){const t=e.matchAll(La);let n=0,s=0;for(const e of t){if(e.index!==s)return!1;n++,s=e.index+e[0].length}return s===e.length&&n}function $a(e,t){if(e.text)return!t&&1===Object.keys(e).length&&!e.text.entities?.some((e=>e.type!==Ga.CustomEmoji))&&function(e){const t=function(e){if(!e.match(La))return e;for(const[t,n]of ja)e=e.replace(t,n);return e}(e).split("\n"),n=t.join("");if(n.length>za)return!1;const s=Ka(n);if(!s||s>Wa)return!1;let a=t.length;for(const e of t){const t=Ka(e);if(!1===t)return!1;t>a&&(a=t)}return a}(e.text.text)||void 0}const Ja=/\b(?:(\d{1,2}):)?([0-5]?\d):([0-5]\d)\b/g;function Qa(e){const t={text:e.text,entities:e.entities?.filter((e=>e.type!==Ga.Timestamp))||[]},n=t.text;for(const e of n.matchAll(Ja)){const n=e[0],s=e[1],a=e[2],i=e[3],o=e.index??0,r=n.length,c=parseInt(a,10),d=parseInt(i,10);if(c>59||d>59)continue;let u;u=Zs(void 0!==s?parseInt(s,10):0,c,d);let l=!1;for(const e of t.entities)if(o<e.offset+e.length&&o+r>e.offset){l=!0;break}if(l)continue;const f={type:Ga.Timestamp,offset:o,length:r,timestamp:u};let g=!1;for(let e=0;e<t.entities.length;e++)if(o<t.entities[e].offset){t.entities.splice(e,0,f),g=!0;break}g||t.entities.push(f)}return t}function Xa(e,t){return e.reduce(((e,n)=>(e[n[t]]=n,e)),{})}function Za(e,t){return e.reduce(((e,n)=>{const[s,a]=t(n);return e[s]=a,e}),{})}function Ya(e,t){return t.reduce(((t,n)=>(t[n]=e[n],t)),{})}function ei(e,t){return t.reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{})}function ti(e,t){const n=new Set(t.map(String));return Ya(e,Object.keys(e).filter((e=>!n.has(e))))}function ni(e){return Object.keys(e).reduce(((t,n)=>{const s=n;return void 0!==e[s]&&(t[s]=e[s]),t}),{})}function si(e){return e.filter(Boolean)}function ai(e,t){const n=[];for(let s=0;s<e.length;s+=t)n.push(e.slice(s,s+t));return n}function ii(e,t){let n=0;const s=new Array(t),a=e.length/t,i=e[0],o=e[e.length-1];for(let r=0;r<t;r++){const t=Math.floor(r*a),c=((e[t-1]??i)+(e[t]??i)+(e[t+1]??o))/3;s[r]=c,n<c&&(n=c)}return{data:s,peak:n}}var oi=n(48287).hp;function ri(e){return e.startsWith("-")?(t=e).length===J&&t.startsWith("-1")?"channel":"chat":"user";var t}function ci(e){const t=ri(e);return"user"===t?new Ye.PeerUser({userId:Ti(e,"user")}):"channel"===t?new Ye.PeerChannel({channelId:Ti(e,"channel")}):new Ye.PeerChat({chatId:Ti(e,"chat")})}function di(e,t){const n=ri(e);return"user"===n?new Ye.InputPeerUser({userId:Ti(e,"user"),accessHash:fe()(t)}):"channel"===n?new Ye.InputPeerChannel({channelId:Ti(e,"channel"),accessHash:fe()(t)}):new Ye.InputPeerChat({chatId:Ti(e,"chat")})}function ui(e,t){if(e)return new Ye.PaidReactionPrivacyAnonymous;if(t){const e=li(t);if(e)return new Ye.PaidReactionPrivacyPeer({peer:e})}return new Ye.PaidReactionPrivacyDefault}function li(e){const t=ri(e);let n;if("user"===t){if(n=Ta.users[e]?.accessHash,!n)return}else if("channel"===t&&(n=Ta.chats[e]?.accessHash,!n))return;return di(e,String(n))}function fi(e,t){const n=ri(e);return"user"===n?new Ye.InputUser({userId:Ti(e,"user"),accessHash:fe()(t)}):"channel"===n?new Ye.InputChannel({channelId:Ti(e,"channel"),accessHash:fe()(t)}):Ti(e,"chat")}function gi(e,t){return new Ye.InputStickerSetID({id:fe()(e),accessHash:fe()(t)})}function pi(e){const t=Ta.documents[e.id];if(t)return new Ye.InputDocument(Ya(t,["id","accessHash","fileReference"]))}function hi(e){const t=pi(e);if(t)return new Ye.InputMediaDocument({id:t})}function mi(e,t=!1){return new Ye.InputMediaPoll({poll:new Ye.Poll({id:fe()(e.id),publicVoters:e.summary.isPublic,question:Ni(e.summary.question),answers:e.summary.answers.map((({text:e,option:t})=>new Ye.PollAnswer({text:Ni(e),option:ha(t)}))),quiz:e.summary.quiz,multipleChoice:e.summary.multipleChoice,closeDate:e.summary.closeDate,closePeriod:e.summary.closePeriod,closed:!!t||e.summary.closed}),correctAnswers:e.results.results?.filter((e=>e.isCorrect)).map((e=>ha(e.option))),solution:e.results.solution,solutionEntities:e.results.solutionEntities?.map(wi)})}function yi(){return Pe(ke(8),!0,!0)}function _i(){const e=ke(8),t=oi.alloc(4);return t.writeUInt32LE(Math.floor(Date.now()/1e3),0),e.set(t,4),Pe(e,!0,!0)}function bi(){return Pe(ke(4),!0,!0).toJSNumber()}function vi(e,t,n){return new Ye.Message({id:e,peerId:ci(t),fromId:ci(t),media:n.media})}function wi(e){const{type:t,offset:n,length:s}=e,a="userId"in e?Ta.users[e.userId]:void 0;switch(t){case Ga.Bold:return new Ye.MessageEntityBold({offset:n,length:s});case Ga.Italic:return new Ye.MessageEntityItalic({offset:n,length:s});case Ga.Underline:return new Ye.MessageEntityUnderline({offset:n,length:s});case Ga.Strike:return new Ye.MessageEntityStrike({offset:n,length:s});case Ga.Code:return new Ye.MessageEntityCode({offset:n,length:s});case Ga.Pre:return new Ye.MessageEntityPre({offset:n,length:s,language:e.language||""});case Ga.Blockquote:return new Ye.MessageEntityBlockquote({offset:n,length:s});case Ga.TextUrl:return new Ye.MessageEntityTextUrl({offset:n,length:s,url:e.url});case Ga.Url:return new Ye.MessageEntityUrl({offset:n,length:s});case Ga.Hashtag:return new Ye.MessageEntityHashtag({offset:n,length:s});case Ga.MentionName:return new Ye.InputMessageEntityMentionName({offset:n,length:s,userId:new Ye.InputUser({userId:fe()(a.id),accessHash:a.accessHash})});case Ga.Spoiler:return new Ye.MessageEntitySpoiler({offset:n,length:s});case Ga.CustomEmoji:return new Ye.MessageEntityCustomEmoji({offset:n,length:s,documentId:fe()(e.documentId)});default:return new Ye.MessageEntityUnknown({offset:n,length:s})}}function Si(e){const t=Ta.photos[e?.id];if(t)return new Ye.InputPhoto(Ya(t,["id","accessHash","fileReference"]))}function Ii({phone:e,firstName:t,lastName:n}){return new Ye.InputPhoneContact({clientId:fe()(1),phone:e,firstName:t,lastName:n})}function Pi(e,t=0){return new Ye.ChatBannedRights({...e,untilDate:t})}function Ci(e){return new Ye.ChatAdminRights(e)}function Mi(e){const{shippingAddress:t}=e;return new Ye.PaymentRequestedInfo({...e,shippingAddress:t?new Ye.PostAddress(t):void 0})}function Ri(e){switch(e){case"phoneNumber":return new Ye.InputPrivacyKeyPhoneNumber;case"addByPhone":return new Ye.InputPrivacyKeyAddedByPhone;case"lastSeen":return new Ye.InputPrivacyKeyStatusTimestamp;case"profilePhoto":return new Ye.InputPrivacyKeyProfilePhoto;case"forwards":return new Ye.InputPrivacyKeyForwards;case"chatInvite":return new Ye.InputPrivacyKeyChatInvite;case"phoneCall":return new Ye.InputPrivacyKeyPhoneCall;case"phoneP2P":return new Ye.InputPrivacyKeyPhoneP2P;case"voiceMessages":return new Ye.InputPrivacyKeyVoiceMessages;case"bio":return new Ye.InputPrivacyKeyAbout;case"birthday":return new Ye.InputPrivacyKeyBirthday;case"gifts":return new Ye.InputPrivacyKeyStarGiftsAutoSave}}function ki(e){switch(e){case"spam":return new Ye.InputReportReasonSpam;case"violence":return new Ye.InputReportReasonViolence;case"childAbuse":return new Ye.InputReportReasonChildAbuse;case"pornography":return new Ye.InputReportReasonPornography;case"copyright":return new Ye.InputReportReasonCopyright;case"fake":return new Ye.InputReportReasonFake;case"geoIrrelevant":return new Ye.InputReportReasonGeoIrrelevant;case"illegalDrugs":return new Ye.InputReportReasonIllegalDrugs;case"personalDetails":return new Ye.InputReportReasonPersonalDetails;case"other":return new Ye.InputReportReasonOther}}function Ai(e){return new Ye.DataJSON({data:JSON.stringify(e)})}function Ti(e,t){return"user"===t?fe()(e):"channel"===t?fe()(e.slice(2)):fe()(e.slice(1))}function Ei(e){return new Ye.InputGroupCall({id:fe()(e.id),accessHash:fe()(e.accessHash)})}function Ui({id:e,accessHash:t}){return new Ye.InputPhoneCall({id:fe()(e),accessHash:fe()(t)})}function Di(e){if("stars"===e.type)return new Ye.InputStorePaymentStarsTopup({stars:fe()(e.stars),currency:e.currency,amount:fe()(e.amount)});if("starsgift"===e.type)return new Ye.InputStorePaymentStarsGift({userId:fi(e.user.id,e.user.accessHash),stars:fe()(e.stars),currency:e.currency,amount:fe()(e.amount)});if("giftcode"===e.type)return new Ye.InputStorePaymentPremiumGiftCode({users:e.users.map((e=>fi(e.id,e.accessHash))),boostPeer:e.boostChannel?di(e.boostChannel.id,e.boostChannel.accessHash):void 0,currency:e.currency,amount:fe()(e.amount),message:e.message&&Ni(e.message)});const t=yi();return"starsgiveaway"===e.type?new Ye.InputStorePaymentStarsGiveaway({boostPeer:di(e.chat.id,e.chat.accessHash),additionalPeers:e.additionalChannels?.map((e=>di(e.id,e.accessHash))),stars:fe()(e.stars),countriesIso2:e.countries,prizeDescription:e.prizeDescription,onlyNewSubscribers:e.isOnlyForNewSubscribers||void 0,winnersAreVisible:e.areWinnersVisible||void 0,untilDate:e.untilDate,currency:e.currency,amount:fe()(e.amount),users:e.users,randomId:t}):new Ye.InputStorePaymentPremiumGiveaway({boostPeer:di(e.chat.id,e.chat.accessHash),additionalPeers:e.additionalChannels?.map((e=>di(e.id,e.accessHash))),countriesIso2:e.countries,prizeDescription:e.prizeDescription,onlyNewSubscribers:e.isOnlyForNewSubscribers||void 0,winnersAreVisible:e.areWinnersVisible||void 0,untilDate:e.untilDate,currency:e.currency,amount:fe()(e.amount),randomId:t})}function Bi(e){switch(e.type){case"message":return new Ye.InputInvoiceMessage({peer:di(e.chat.id,e.chat.accessHash),msgId:e.messageId});case"slug":return new Ye.InputInvoiceSlug({slug:e.slug});case"stargift":{const{peer:t,shouldHideName:n,giftId:s,message:a,shouldUpgrade:i}=e;return new Ye.InputInvoiceStarGift({peer:di(t.id,t.accessHash),hideName:n||void 0,giftId:fe()(s),message:a&&Ni(a),includeUpgrade:i})}case"stars":{const t=Di(e.purpose);return new Ye.InputInvoiceStars({purpose:t})}case"starsgiveaway":{const t=Di(e.purpose);return new Ye.InputInvoiceStars({purpose:t})}case"chatInviteSubscription":return new Ye.InputInvoiceChatInviteSubscription({hash:e.hash});case"stargiftUpgrade":return new Ye.InputInvoiceStarGiftUpgrade({stargift:Hi(e.inputSavedGift),keepOriginalDetails:e.shouldKeepOriginalDetails});case"stargiftTransfer":return new Ye.InputInvoiceStarGiftTransfer({stargift:Hi(e.inputSavedGift),toId:di(e.recipient.id,e.recipient.accessHash)});default:{const n=Di(e.purpose),s=(t=e.option,new Ye.PremiumGiftCodeOption({users:t.users,months:t.months,currency:t.currency,amount:fe()(t.amount)}));return new Ye.InputInvoicePremiumGiftCode({purpose:n,option:s})}}var t}function xi(e){switch(e?.type){case"emoji":return new Ye.ReactionEmoji({emoticon:e.emoticon});case"custom":return new Ye.ReactionCustomEmoji({documentId:fe()(e.documentId)});case"paid":return new Ye.ReactionPaid;default:return new Ye.ReactionEmpty}}function Vi(e){return"collectible"===e.type?new Ye.InputEmojiStatusCollectible({collectibleId:fe()(e.collectibleId),until:e.until}):e.documentId===V?new Ye.EmojiStatusEmpty:new Ye.EmojiStatus({documentId:fe()(e.documentId),until:e.until})}function Ni(e){return new Ye.TextWithEntities({text:e.text,entities:e.entities?.map(wi)||[]})}function Fi(e){return new Ye.InputBotAppID({id:fe()(e.id),accessHash:fe()(e.accessHash)})}function Gi(e){if("story"===e.type)return new Ye.InputReplyToStory({peer:li(e.peerId),storyId:e.storyId});if("message"===e.type){const{replyToMsgId:t,replyToTopId:n,replyToPeerId:s,quoteText:a}=e;return new Ye.InputReplyToMessage({replyToMsgId:t,topMsgId:n,replyToPeerId:s?li(s):void 0,quoteText:a?.text,quoteEntities:a?.entities?.map(wi)})}}function qi(e){const t=[];if(e.allowedUsers?.length&&t.push(new Ye.InputPrivacyValueAllowUsers({users:e.allowedUsers.map((({id:e,accessHash:t})=>fi(e,t)))})),e.allowedChats?.length&&t.push(new Ye.InputPrivacyValueAllowChatParticipants({chats:e.allowedChats.map((({id:e,type:t})=>Ti(e,"chatTypeBasicGroup"===t?"chat":"channel")))})),e.blockedUsers?.length&&t.push(new Ye.InputPrivacyValueDisallowUsers({users:e.blockedUsers.map((({id:e,accessHash:t})=>fi(e,t)))})),e.blockedChats?.length&&t.push(new Ye.InputPrivacyValueDisallowChatParticipants({chats:e.blockedChats.map((({id:e,type:t})=>Ti(e,"chatTypeBasicGroup"===t?"chat":"channel")))})),e.shouldAllowPremium&&t.push(new Ye.InputPrivacyValueAllowPremium),"allow"===e.botsPrivacy&&t.push(new Ye.InputPrivacyValueAllowBots),"disallow"===e.botsPrivacy&&t.push(new Ye.InputPrivacyValueDisallowBots),!e.isUnspecified)switch(e.visibility){case"everybody":t.push(new Ye.InputPrivacyValueAllowAll);break;case"contacts":t.push(new Ye.InputPrivacyValueAllowContacts);break;case"nonContacts":t.push(new Ye.InputPrivacyValueDisallowContacts);break;case"nobody":t.push(new Ye.InputPrivacyValueDisallowAll)}return t}function Hi(e){return"user"===e.type?new Ye.InputSavedStarGiftUser({msgId:e.messageId}):new Ye.InputSavedStarGiftChat({peer:di(e.chat.id,e.chat.accessHash),savedId:fe()(e.savedId)})}function Oi(e){e instanceof Ye.Message&&(e.media&&Li(e.media,e),e.replyTo instanceof Ye.MessageReplyHeader&&e.replyTo.replyMedia&&Li(e.replyTo.replyMedia,e)),e instanceof Ye.MessageService&&"photo"in e.action&&Wi($i(e.action.photo,e)),e instanceof Ye.SponsoredMessage&&e.photo&&Wi(e.photo)}function Li(e,t){e instanceof Ye.MessageMediaDocument&&e.document&&zi($i(e.document,t)),e instanceof Ye.MessageMediaWebPage&&e.webpage instanceof Ye.WebPage&&(e.webpage.document&&zi($i(e.webpage.document,t)),e.webpage.photo&&Wi($i(e.webpage.photo,t))),e instanceof Ye.MessageMediaGame&&(e.game.document&&zi($i(e.game.document,t)),Wi($i(e.game.photo,t))),e instanceof Ye.MessageMediaPhoto&&e.photo&&Wi($i(e.photo,t)),e instanceof Ye.MessageMediaInvoice&&(e.photo&&Qi($i(e.photo,t)),e.extendedMedia instanceof Ye.MessageExtendedMedia&&Li(e.extendedMedia.media,t)),e instanceof Ye.MessageMediaPaidMedia&&e.extendedMedia.forEach((e=>{e instanceof Ye.MessageExtendedMedia&&Li(e.media,t)}))}function ji(e,t){if(e instanceof Ye.StoryItem&&(e.media instanceof Ye.MessageMediaPhoto&&e.media.photo&&Wi(Ki(e.media.photo,t,e)),e.media instanceof Ye.MessageMediaDocument&&(e.media.document instanceof Ye.Document&&zi(Ki(e.media.document,t,e)),e.media.altDocuments)))for(const n of e.media.altDocuments)zi(Ki(n,t,e))}function Wi(e){e instanceof Ye.Photo&&(Ta.photos[String(e.id)]=e)}function zi(e){e instanceof Ye.Document&&(Ta.documents[String(e.id)]=e)}function Ki(e,t,n){if(!(e instanceof Ye.Document&&e instanceof Ye.Photo))return e;const s=e;return s.localRepairInfo={type:"story",peerId:t,id:n.id},s}function $i(e,t){if(!t?.peerId)return e;if(!(e instanceof Ye.Document||e instanceof Ye.Photo||e instanceof Ye.WebDocument))return e;const n=e;return n.localRepairInfo={type:"message",peerId:aa(t.peerId),id:t.id},n}function Ji(e){const t=sa(e.id,"user"),n=Ta.users[t];e.photo instanceof Ye.Photo&&Wi(e.photo),n&&!n.min&&e.min||(Ta.users[t]=e)}function Qi(e){Ta.webDocuments[e.url]=e}const Xi='<?xml version="1.0" encoding="utf-8"?><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 {{width}} {{height}}" xml:space="preserve"><path fill-opacity="0.1" d="{{path}}" /></svg>',Zi="AACAAAAHAAALMAAAQASTAVAAAZaacaaaahaaalmaaaqastava.az0123456789-,";function Yi(e){let t="M";const n=e.length;for(let s=0;s<n;s++){const n=e[s];n>=192?t+=Zi[n-128-64]:(n>=128?t+=",":n>=64&&(t+="-"),t+=String(63&n))}return t+="z",t}const eo={w:100,h:100};function to(e,t){if(!e||!e.length)return;const n=e.find((e=>e instanceof Ye.PhotoStrippedSize));if(!n)return;const s=e.filter((e=>e instanceof Ye.PhotoSize)),{w:a,h:i}=s.length?s[s.length-1]:eo,{bytes:o}=n;return{dataUri:va(t&&"image/jpeg"!==t?o:Jn(o),void 0,t),width:a,height:i}}function no(e,t){const{w:n,h:s}=t;var a,i,o;return{dataUri:`data:image/svg+xml;utf8,${a=e.bytes,i=n,o=s,Xi.replace("{{path}}",Yi(a)).replace("{{width}}",String(i)).replace("{{height}}",String(o))}`,width:n,height:s}}function so(e,t){const n=e.sizes.filter((e=>e instanceof Ye.PhotoSize||e instanceof Ye.PhotoSizeProgressive)).map(oo);return{mediaType:"photo",id:String(e.id),thumbnail:to(e.sizes),sizes:n,isSpoiler:t,date:e.date,...e.videoSizes&&{videoSizes:si(e.videoSizes.map(io)),isVideo:!0}}}function ao(e){return e.filter((e=>e instanceof Ye.PhotoSize||e instanceof Ye.PhotoSizeProgressive)).map(oo)}function io(e){if(!(e instanceof Ye.VideoSize))return;const{videoStartTs:t,size:n,h:s,w:a,type:i}=e;return{videoStartTs:t,size:n,height:s,width:a,type:i}}function oo(e){const{w:t,h:n,type:s}=e;return{width:t,height:n,type:s}}function ro(e){if(!(e.usernames||"username"in e&&e.username))return;const t=[];return"username"in e&&e.username&&t.push({username:e.username,isActive:!0,isEditable:!0}),e.usernames&&e.usernames.forEach((({username:e,active:n,editable:s})=>{t.push({username:e,...n&&{isActive:!0},...s&&{isEditable:!0}})})),t}function co(e){let t,n,s,a,i,o,r,c="none";const d=Ta.chats;return e.forEach((e=>{e instanceof Ye.PrivacyValueAllowAll?t||(t="everybody"):e instanceof Ye.PrivacyValueAllowContacts?t||(t="contacts"):e instanceof Ye.PrivacyValueAllowCloseFriends?t||(t="closeFriends"):e instanceof Ye.PrivacyValueDisallowContacts?t||(t="nonContacts"):e instanceof Ye.PrivacyValueDisallowAll?t||(t="nobody"):e instanceof Ye.PrivacyValueAllowUsers?s=e.users.map((e=>sa(e,"user"))):e instanceof Ye.PrivacyValueDisallowUsers?i=e.users.map((e=>sa(e,"user"))):e instanceof Ye.PrivacyValueAllowChatParticipants?a=e.chats.map((e=>{const t=sa(e,"chat"),n=sa(e,"channel");return d[t]?t:n})):e instanceof Ye.PrivacyValueDisallowChatParticipants?o=e.chats.map((e=>{const t=sa(e,"chat"),n=sa(e,"channel");return d[t]?t:n})):e instanceof Ye.PrivacyValueAllowPremium?r=!0:e instanceof Ye.PrivacyValueAllowBots?c="allow":e instanceof Ye.PrivacyValueDisallowBots&&(c="disallow")})),t||(t="nobody",n=!0),{visibility:t,isUnspecified:n,allowUserIds:s||[],allowChatIds:a||[],blockUserIds:i||[],blockChatIds:o||[],shouldAllowPremium:r,botsPrivacy:c}}function uo(e){const{text:t,entities:n}=e;return{text:t,entities:n.map(lo)}}function lo(e){const{className:t,offset:n,length:s}=e;return e instanceof Ye.MessageEntityMentionName?{type:Ga.MentionName,offset:n,length:s,userId:sa(e.userId,"user")}:e instanceof Ye.MessageEntityTextUrl?{type:Ga.TextUrl,offset:n,length:s,url:e.url}:e instanceof Ye.MessageEntityPre?{type:Ga.Pre,offset:n,length:s,language:e.language}:e instanceof Ye.MessageEntityCustomEmoji?{type:Ga.CustomEmoji,offset:n,length:s,documentId:e.documentId.toString()}:e instanceof Ye.MessageEntityBlockquote?{type:Ga.Blockquote,canCollapse:e.collapsed,offset:n,length:s}:{type:t,offset:n,length:s}}function fo(e){if("photoId"in e)return e.photoId.toString()}function go(e){return{botId:sa(e.botId,"user"),iconId:e.icon.toString(),description:e.description}}const po=30;function ho(e,t,n){if(e instanceof Ye.DocumentEmpty)return;const{mimeType:s,videoThumbs:a}=e,i=e.attributes.find((e=>e instanceof Ye.DocumentAttributeSticker)),o=e.attributes.find((e=>e instanceof Ye.DocumentAttributeCustomEmoji));if(!i&&!o)return;const r=s===G,c=s===q,d=Boolean(o),u=d&&o.textColor,l=e.attributes.find((e=>e instanceof Ye.DocumentAttributeImageSize)),f=e.attributes.find((e=>e instanceof Ye.DocumentAttributeVideo)),g=l||f,p=i||o,h=(b=p?.stickerset,b instanceof Ye.InputStickerSetID?{id:String(b.id),accessHash:String(b.accessHash)}:b instanceof Ye.InputStickerSetShortName?{shortName:b.shortName}:{isMissing:!0}),m=p?.alt,y=Boolean(o?.free??!0)&&!n,_=e.thumbs&&e.thumbs.find((e=>e instanceof Ye.PhotoCachedSize));var b;if(!(s!==q||self.isWebmSupported||_||e.thumbs&&e.thumbs.find((e=>e instanceof Ye.PhotoSize))))return;const v=e.thumbs&&e.thumbs.find((e=>e instanceof Ye.PhotoPathSize)),w=_?function(e){const{w:t,h:n,bytes:s}=e;return{dataUri:va(s,void 0,"image/webp"),width:t,height:n}}(_):v&&g?no(v,g):void 0,S=e.thumbs&&ao(e.thumbs),{w:I,h:P}=_||g||{},C=!t&&a&&si(a?.filter((e=>e instanceof Ye.VideoSize))).some((({type:e})=>"f"===e));return{mediaType:"sticker",id:String(e.id),stickerSetInfo:h,emoji:m,isCustomEmoji:d,isLottie:r,isVideo:c,width:I,height:P,thumbnail:w,hasEffect:C,isFree:y,shouldUseTextColor:u,previewPhotoSizes:S}}function mo(e){const{archived:t,installedDate:n,id:s,accessHash:a,title:i,thumbs:o,count:r,shortName:c,emojis:d,thumbDocumentId:u}=e,l=o?.some((e=>"s"===e.type)),f=o?.some((e=>"a"===e.type)),g=o?.some((e=>"v"===e.type)),p=u&&String(u),h=l||f||g||Boolean(p);return{isArchived:t,isEmoji:d,installedDate:n,id:String(s),accessHash:String(a),title:i,hasStaticThumb:l,hasAnimatedThumb:f,hasVideoThumb:g,hasThumbnail:h,thumbCustomEmojiId:p,count:r,shortName:c}}function yo(e){const t=mo(e.set);if(e instanceof Ye.StickerSetNoCovered)return t;const n=bo(e instanceof Ye.StickerSetCovered?[e.cover]:e instanceof Ye.StickerSetMultiCovered?e.covers:e.documents);return e instanceof Ye.StickerSetFullCovered?{...t,stickers:n,packs:_o(e.packs)}:{...t,covers:n}}function _o(e){return e.reduce(((e,{emoticon:t,documents:n})=>(e[t]=n.map((e=>{const t=Ta.documents[String(e)];if(t)return ho(t)})).filter(Boolean),e)),{})}function bo(e){return e.map((e=>{if(e instanceof Ye.Document){const t=ho(e);if(t)return Ta.documents[String(e.id)]=e,t}})).filter(Boolean)}function vo(e){if(e instanceof Ye.StarGiftUnique){const{id:t,num:n,ownerId:s,ownerName:a,title:i,attributes:o,availabilityIssued:r,availabilityTotal:c,slug:d,ownerAddress:u,giftAddress:l}=e;return{type:"starGiftUnique",id:t.toString(),number:n,ownerId:s&&aa(s),ownerName:a,ownerAddress:u,attributes:o.map(wo).filter(Boolean),title:i,totalCount:c,issuedCount:r,slug:d,giftAddress:l}}const{id:t,limited:n,stars:s,availabilityRemains:a,availabilityTotal:i,convertStars:o,firstSaleDate:r,lastSaleDate:c,soldOut:d,birthday:u,upgradeStars:l}=e;zi(e.sticker);const f=ho(e.sticker);return{type:"starGift",id:t.toString(),isLimited:n,sticker:f,stars:s.toJSNumber(),availabilityRemains:a,availabilityTotal:i,starsToConvert:o.toJSNumber(),firstSaleDate:r,lastSaleDate:c,isSoldOut:d,isBirthday:u,upgradeStars:l?.toJSNumber()}}function wo(e){if(e instanceof Ye.StarGiftAttributeModel){const t=ho(e.document);if(!t)return;return zi(e.document),{type:"model",name:e.name,rarityPercent:e.rarityPermille/10,sticker:t}}if(e instanceof Ye.StarGiftAttributePattern){const t=ho(e.document);if(!t)return;return zi(e.document),{type:"pattern",name:e.name,rarityPercent:e.rarityPermille/10,sticker:t}}if(e instanceof Ye.StarGiftAttributeBackdrop){const{name:t,rarityPermille:n,centerColor:s,edgeColor:a,patternColor:i,textColor:o}=e;return{type:"backdrop",name:t,rarityPercent:n/10,centerColor:ea(s),edgeColor:ea(a),patternColor:ea(i),textColor:ea(o)}}if(e instanceof Ye.StarGiftAttributeOriginalDetails){const{date:t,recipientId:n,message:s,senderId:a}=e;return{type:"originalDetails",date:t,recipientId:n&&aa(n),message:s&&uo(s),senderId:a&&aa(a)}}}function So(e){let t={};if(e.media){const n="peerId"in e?e:void 0;t={...Po(e.media,n)}}const n=e.media instanceof Ye.MessageMediaUnsupported;if(e.message&&!n&&!t.sticker&&!t.pollId&&!t.contact&&!t.video?.isRound){const n=Qa(Io(e.message,e.entities));t={...t,text:n}}return t}function Io(e,t){return{text:e,...t&&{entities:t.map(lo)}}}function Po(e,t){Li(e,t);const n="ttlSeconds"in e?e.ttlSeconds:void 0,s=function(e){return e instanceof Ye.MessageMediaDocument&&Boolean(!e.document&&e.voice)}(e);if(s)return{action:{mediaType:"action",type:"expired",isVoice:!0}};const a=function(e){return e instanceof Ye.MessageMediaDocument&&Boolean(!e.document&&e.round)}(e);if(a)return{action:{mediaType:"action",type:"expired",isRoundVideo:!0}};const i=function(e){if(!(e instanceof Ye.MessageMediaDocument&&e.document&&e.document instanceof Ye.Document))return;const t=e.document.attributes.find((e=>e instanceof Ye.DocumentAttributeAudio));if(!t||!t.voice)return;const{duration:n,waveform:s}=t;return{mediaType:"voice",id:String(e.document.id),size:e.document.size.toJSNumber(),duration:n,waveform:s?Array.from(s):void 0}}(e);if(i)return{voice:i,ttlSeconds:n};if("round"in e&&e.round){const t=Ro(e);if(t)return{video:t,ttlSeconds:n}}if(void 0!==n)return;if(e instanceof Ye.MessageMediaInvoice&&e.extendedMedia instanceof Ye.MessageExtendedMedia)return Po(e.extendedMedia.media,t);const o=function(e){if(e instanceof Ye.MessageMediaDocument&&e.document&&e.document instanceof Ye.Document)return ho(e.document,e.nopremium)}(e);if(o)return{sticker:o};const r=function(e){if(e instanceof Ye.MessageMediaPhoto&&e.photo&&e.photo instanceof Ye.Photo)return so(e.photo,e.spoiler)}(e);if(r)return{photo:r};const c=Ro(e),d=function(e){if(!(e instanceof Ye.MessageMediaDocument&&e.altDocuments))return;const t=e.altDocuments.filter((e=>e instanceof Ye.Document&&e.mimeType.startsWith("video"))).map((t=>Co(t,{isSpoiler:e.spoiler}))).filter(Boolean);return t.length?t:void 0}(e);if(c)return{video:c,altVideos:d};const u=function(e){if(!(e instanceof Ye.MessageMediaDocument&&e.document&&e.document instanceof Ye.Document))return;const t=e.document.attributes.find((e=>e instanceof Ye.DocumentAttributeAudio));if(!t||t.voice)return;const n=e.document.thumbs&&e.document.thumbs.filter((e=>e instanceof Ye.PhotoSize)).map((e=>oo(e)));return{mediaType:"audio",id:String(e.document.id),fileName:Bo(e.document,"audio"),thumbnailSizes:n,size:e.document.size.toJSNumber(),...Ya(e.document,["mimeType"]),...Ya(t,["duration","performer","title"])}}(e);if(u)return{audio:u};const l=function(e){if(e instanceof Ye.MessageMediaDocument&&e.document)return ko(e.document)}(e);if(l)return{document:l};const f=function(e){if(!(e instanceof Ye.MessageMediaContact))return;const{firstName:t,lastName:n,phoneNumber:s,userId:a}=e;return{mediaType:"contact",firstName:t,lastName:n,phoneNumber:s,userId:sa(a,"user")}}(e);if(f)return{contact:f};const g=function(e){if(e instanceof Ye.MessageMediaPoll)return e.poll.id.toString()}(e);if(g)return{pollId:g};const p=Do(e);if(p)return{webPage:p};const h=function(e){if(e instanceof Ye.MessageMediaInvoice)return function(e){const{description:t,title:n,photo:s,test:a,totalAmount:i,currency:o,receiptMsgId:r,extendedMedia:c}=e,d=c instanceof Ye.MessageExtendedMediaPreview?xo(c):void 0;return{mediaType:"invoice",title:n,description:t,photo:Vo(s),receiptMessageId:r,amount:i.toJSNumber(),currency:o,isTest:a,extendedMedia:d}}(e)}(e);if(h)return{invoice:h};const m=function(e){return e instanceof Ye.MessageMediaGeo?function(e){const t=To(e.geo);return t&&{mediaType:"geo",geo:t}}(e):e instanceof Ye.MessageMediaVenue?function(e){const{geo:t,title:n,provider:s,address:a,venueId:i,venueType:o}=e,r=To(t);return r&&{mediaType:"venue",geo:r,title:n,provider:s,address:a,venueId:i,venueType:o}}(e):e instanceof Ye.MessageMediaGeoLive?function(e){const{geo:t,period:n,heading:s}=e,a=To(t);return a&&{mediaType:"geoLive",geo:a,period:n,heading:s}}(e):void 0}(e);if(m)return{location:m};const y=function(e){if(e instanceof Ye.MessageMediaGame)return function(e){const{id:t,accessHash:n,shortName:s,title:a,description:i,photo:o,document:r}=e.game,c=o instanceof Ye.Photo?so(o):void 0,d=r instanceof Ye.Document?ko(r):void 0;return{mediaType:"game",id:t.toString(),accessHash:n.toString(),shortName:s,title:a,description:i,photo:c,document:d}}(e)}(e);if(y)return{game:y};const _=function(e){if(!(e instanceof Ye.MessageMediaStory))return;const t=aa(e.peer);return{mediaType:"storyData",id:e.id,peerId:t,...e.viaMention&&{isMention:!0}}}(e);if(_)return{storyData:_};const b=function(e){if(e instanceof Ye.MessageMediaGiveaway)return function(e){const{channels:t,months:n,stars:s,quantity:a,untilDate:i,countriesIso2:o,onlyNewSubscribers:r,prizeDescription:c}=e,d=t.map((e=>sa(e,"channel")));return{mediaType:"giveaway",channelIds:d,months:n,stars:s?.toJSNumber(),quantity:a,untilDate:i,countries:o,isOnlyForNewSubscribers:r,prizeDescription:c}}(e)}(e);if(b)return{giveaway:b};const v=function(e){if(e instanceof Ye.MessageMediaGiveawayResults)return function(e){const{months:t,untilDate:n,onlyNewSubscribers:s,launchMsgId:a,unclaimedCount:i,winners:o,winnersCount:r,additionalPeersCount:c,prizeDescription:d,refunded:u,channelId:l}=e,f=o.map((e=>sa(e,"user")));return{mediaType:"giveawayResults",months:t,untilDate:n,isOnlyForNewSubscribers:s,launchMessageId:a,channelId:sa(l,"channel"),unclaimedCount:i,additionalPeersCount:c,isRefunded:u,prizeDescription:d,winnerIds:f,winnersCount:r}}(e)}(e);if(v)return{giveawayResults:v};const w=function(e){if(!(e instanceof Ye.MessageMediaPaidMedia))return;const{starsAmount:t,extendedMedia:n}=e,s=n[0]instanceof Ye.MessageExtendedMedia;return s?{mediaType:"paidMedia",starsAmount:t.toJSNumber(),isBought:s,extendedMedia:No(n)}:{mediaType:"paidMedia",starsAmount:t.toJSNumber(),extendedMedia:n.filter((e=>e instanceof Ye.MessageExtendedMediaPreview)).map((e=>xo(e)))}}(e);return w?{paidMedia:w}:void 0}function Co(e,t){if(e instanceof Ye.DocumentEmpty)return;const{isSpoiler:n,timestamp:s}=t||{},{id:a,mimeType:i,thumbs:o,size:r,videoThumbs:c,attributes:d}=e;if(i===N&&!self.isWebmSupported)return;const u=d.find((e=>e instanceof Ye.DocumentAttributeVideo));if(!u)return;const l=d.find((e=>e instanceof Ye.DocumentAttributeAnimated)),f=c?.some((e=>e instanceof Ye.VideoSize&&"v"===e.type)),g=o&&ao(o),{duration:p,w:h,h:m,supportsStreaming:y=!1,roundMessage:_=!1,nosound:b}=u,v=_?function(e){const t=Math.min(Math.round(e),po);return Array.from({length:t},(()=>Math.floor(256*Math.random())))}(p):void 0;return{mediaType:"video",id:String(a),mimeType:i,duration:p,fileName:Bo(e,"video"),width:h,height:m,supportsStreaming:y,isRound:_,isGif:Boolean(l),thumbnail:to(o),size:r.toJSNumber(),isSpoiler:n,timestamp:s,hasVideoPreview:f,previewPhotoSizes:g,waveform:v,...b&&{noSound:!0}}}function Mo(e){if(e instanceof Ye.DocumentEmpty)return;const{id:t,mimeType:n,size:s,attributes:a}=e,i=a.find((e=>e instanceof Ye.DocumentAttributeAudio));if(!i)return;const{duration:o,title:r,performer:c}=i;return{mediaType:"audio",id:String(t),mimeType:n,duration:o,fileName:Bo(e,"audio"),title:r,performer:c,size:s.toJSNumber()}}function Ro(e){if(e instanceof Ye.MessageMediaDocument&&e.document instanceof Ye.Document&&e.document.mimeType.startsWith("video"))return Co(e.document,{isSpoiler:e.spoiler,timestamp:e.videoTimestamp})}function ko(e){if(!(e instanceof Ye.Document))return;const{id:t,size:n,mimeType:s,date:a,thumbs:i,attributes:o}=e,r=i&&i.find((e=>e instanceof Ye.PhotoSize));let c=i&&to(i);if(!c&&i&&r){const e=i.find((e=>e instanceof Ye.PhotoPathSize));e&&(c=no(e,r))}const d=i&&ao(i);let u,l;if(r)if(l={width:r.w,height:r.h},H.has(s)){u="photo";const e=o.find((e=>e instanceof Ye.DocumentAttributeImageSize));if(e){const{w:t,h:n}=e;l={width:t,height:n}}}else if(O.has(s)){u="video";const e=o.find((e=>e instanceof Ye.DocumentAttributeVideo));if(e){const{w:t,h:n}=e;l={width:t,height:n}}}return{mediaType:"document",id:String(t),size:n.toJSNumber(),mimeType:s,timestamp:a,fileName:Bo(e),thumbnail:c,innerMediaType:u,mediaSize:l,previewPhotoSizes:d}}function Ao(e){if(e instanceof Ye.MessageMediaPoll)return Eo(e.poll,e.results)}function To(e){if(e instanceof Ye.GeoPointEmpty)return;const{long:t,lat:n,accuracyRadius:s,accessHash:a}=e;return{long:t,lat:n,accessHash:a.toString(),accuracyRadius:s}}function Eo(e,t){const{id:n,answers:s}=e,a=s.map((e=>({text:uo(e.text),option:pa(e.option)})));return{mediaType:"poll",id:String(n),summary:{isPublic:e.publicVoters,question:uo(e.question),...Ya(e,["closed","multipleChoice","quiz","closePeriod","closeDate"]),answers:a},results:Uo(t)}}function Uo(e){const{results:t,totalVoters:n,recentVoters:s,solution:a,solutionEntities:i,min:o}=e,r=t?.map((({option:e,chosen:t,correct:n,voters:s})=>({isChosen:t,isCorrect:n,option:pa(e),votersCount:s})));return{isMin:o,totalVoters:n,recentVoterIds:s?.map((e=>aa(e))),results:r,solution:a,...i&&{solutionEntities:i.map(lo)}}}function Do(e){if(!(e instanceof Ye.MessageMediaWebPage&&e.webpage instanceof Ye.WebPage))return;const{id:t,photo:n,document:s,attributes:a}=e.webpage;let i,o,r,c,d;s instanceof Ye.Document&&s.mimeType.startsWith("video/")&&(i=Co(s)),s instanceof Ye.Document&&s.mimeType.startsWith("audio/")&&(o=Mo(s));const u=a?.find((e=>e instanceof Ye.WebPageAttributeStory)),l=a?.find((e=>e instanceof Ye.WebPageAttributeUniqueStarGift));if(u){const e=aa(u.peer);r={id:u.id,peerId:e},u.story instanceof Ye.StoryItem&&ji(u.story,e)}if(l){const e=vo(l.gift);c="starGiftUnique"===e.type?e:void 0}const f=a?.find((e=>e instanceof Ye.WebPageAttributeStickerSet));f&&(d={documents:bo(f.stickers),isEmoji:f.emojis,isWithTextColor:f.textColor});const g=e.forceSmallMedia?"small":e.forceLargeMedia?"large":void 0;return{mediaType:"webpage",id:Number(t),...Ya(e.webpage,["url","displayUrl","type","siteName","title","description","duration","hasLargeMedia"]),photo:n instanceof Ye.Photo?so(n):void 0,document:i||o||!s?void 0:ko(s),video:i,audio:o,story:r,gift:c,stickers:d,mediaSize:g}}function Bo(e,t="file"){const{mimeType:n,attributes:s}=e,a=s.find((e=>e instanceof Ye.DocumentAttributeFilename));if(a)return a.fileName;const i=n.split("/")[1];return`${t}${String(e.id)}.${i}`}function xo(e){const{w:t,h:n,thumb:s,videoDuration:a}=e;return{mediaType:"extendedMediaPreview",width:t,height:n,duration:a,thumbnail:s?to([s]):void 0}}function Vo(e){if(!e)return;const{url:t,size:n,mimeType:s}=e,a=e instanceof Ye.WebDocument?e.accessHash.toString():void 0,i=e.attributes.find((e=>e instanceof Ye.DocumentAttributeImageSize));return{mediaType:"webDocument",url:t,accessHash:a,size:n,mimeType:s,dimensions:i&&{width:i.w,height:i.h}}}function No(e){const t=e.filter((e=>e instanceof Ye.MessageExtendedMedia)).map((e=>Po(e.media))).filter(Boolean);if(t.length)return t}function Fo(e,t){if(!(e instanceof Ye.ReplyKeyboardMarkup||e instanceof Ye.ReplyInlineMarkup))return;const n=e.rows.map((({buttons:e})=>e.map((e=>{const{text:n}=e;return e instanceof Ye.KeyboardButton?{type:"command",text:n}:e instanceof Ye.KeyboardButtonUrl?e.url.includes("?startgroup=")?{type:"unsupported",text:n}:{type:"url",text:n,url:e.url}:e instanceof Ye.KeyboardButtonCallback?e.requiresPassword?{type:"unsupported",text:n}:{type:"callback",text:n,data:pa(e.data)}:e instanceof Ye.KeyboardButtonRequestPoll?{type:"requestPoll",text:n,isQuiz:e.quiz}:e instanceof Ye.KeyboardButtonRequestPhone?{type:"requestPhone",text:n}:e instanceof Ye.KeyboardButtonBuy?t?{type:"receipt",receiptMessageId:t}:{type:"buy",text:n}:e instanceof Ye.KeyboardButtonGame?{type:"game",text:n}:e instanceof Ye.KeyboardButtonSwitchInline?{type:"switchBotInline",text:n,query:e.query,isSamePeer:e.samePeer}:e instanceof Ye.KeyboardButtonUserProfile?{type:"userProfile",text:n,userId:e.userId.toString()}:e instanceof Ye.KeyboardButtonSimpleWebView?{type:"simpleWebView",text:n,url:e.url}:e instanceof Ye.KeyboardButtonWebView?{type:"webView",text:n,url:e.url}:e instanceof Ye.KeyboardButtonUrlAuth?{type:"urlAuth",text:n,url:e.url,buttonId:e.buttonId}:e instanceof Ye.KeyboardButtonCopy?{type:"copy",text:n,copyText:e.copyText}:{type:"unsupported",text:n}})).filter(Boolean)));return n.every((e=>!e.length))?void 0:{[e instanceof Ye.ReplyKeyboardMarkup?"keyboardButtons":"inlineButtons"]:n,...e instanceof Ye.ReplyKeyboardMarkup&&{keyboardPlaceholder:e.placeholder,isKeyboardSingleUse:e.singleUse,isKeyboardSelective:e.selective}}}function Go(e,t,n,s){const a={};if(e instanceof Ye.BotInlineMessageText)a.text={text:e.message,entities:e.entities?.map(lo)};else if(e instanceof Ye.BotInlineMessageMediaAuto)"photo"===t&&s instanceof Ye.Photo?a.photo=so(s):"audio"===t&&n instanceof Ye.Document?a.audio=Mo(n):"video"===t&&n instanceof Ye.Document?a.video=Co(n):"sticker"===t&&n instanceof Ye.Document?a.sticker=ho(n):"file"===t&&n instanceof Ye.Document?a.document=ko(n):"gif"===t&&n instanceof Ye.Document?a.video=Co(n):a.text={text:e.message,entities:e.entities?.map(lo)};else if(e instanceof Ye.BotInlineMessageMediaGeo)a.location={mediaType:"geo",geo:To(e.geo)};else if(e instanceof Ye.BotInlineMessageMediaVenue)a.location={mediaType:"venue",geo:To(e.geo),title:e.title,address:e.address,provider:e.provider,venueId:e.venueId,venueType:e.venueType};else if(e instanceof Ye.BotInlineMessageMediaContact)a.contact={mediaType:"contact",phoneNumber:e.phoneNumber,firstName:e.firstName,lastName:e.lastName,userId:"0"};else if(e instanceof Ye.BotInlineMessageMediaInvoice)a.invoice={mediaType:"invoice",isTest:e.test,title:e.title,description:e.description,photo:Vo(e.photo),currency:e.currency,amount:e.totalAmount.toJSNumber()};else{const t=e.forceSmallMedia?"small":e.forceLargeMedia?"large":void 0;a.webPage={mediaType:"webpage",id:bi(),mediaSize:t,url:e.url,displayUrl:e.url}}return{content:a,replyMarkup:Fo(e.replyMarkup)||void 0}}function qo(e,t){const{id:n,type:s,title:a,description:i,url:o,thumb:r,content:c,sendMessage:d}=e;return{id:n,queryId:t,type:s,sendMessage:Go(d,s),title:a,description:i,url:o,content:Vo(c),webThumbnail:Vo(r)}}function Ho(e,t){const{id:n,type:s,title:a,description:i,sendMessage:o,photo:r,document:c}=e;return{id:n,queryId:t,type:s,title:a,description:i,..."sticker"===s&&c instanceof Ye.Document&&{sticker:ho(c)},...r instanceof Ye.Photo&&{photo:so(r)},..."gif"===s&&c instanceof Ye.Document&&{gif:Co(c)},..."file"===s&&c instanceof Ye.Document&&{document:ko(c)},..."audio"===s&&c instanceof Ye.Document&&{audio:Mo(c)},..."video"===s&&c instanceof Ye.Document&&{video:Co(c)},sendMessage:Go(o,s,c,r)}}function Oo(e){return{id:e.botId.toString(),shouldRequestWriteAccess:e.requestWriteAccess,shortName:e.shortName,isForAttachMenu:e.showInAttachMenu,isForSideMenu:e.showInSideMenu,attachMenuPeerTypes:e.peerTypes&&(t=e.peerTypes,t.flatMap((e=>e instanceof Ye.AttachMenuPeerTypeBotPM?["bots"]:e instanceof Ye.AttachMenuPeerTypePM?["users"]:e instanceof Ye.AttachMenuPeerTypeChat?["chats","groups"]:e instanceof Ye.AttachMenuPeerTypeBroadcast?["channels"]:e instanceof Ye.AttachMenuPeerTypeSameBotPM?["self"]:[]))),icons:e.icons.map(Lo).filter(Boolean),isInactive:e.inactive,isDisclaimerNeeded:e.sideMenuDisclaimerNeeded};var t}function Lo(e){if(!(e.icon instanceof Ye.Document))return;const t=ko(e.icon);return t?(zi(e.icon),{name:e.name,document:t}):void 0}function jo(e,t){const{description:n,descriptionPhoto:s,descriptionDocument:a,userId:i,commands:o,menuButton:r,privacyPolicyUrl:c,hasPreviewMedias:d,appSettings:u}=e,l=i&&sa(i,"user"),f=s instanceof Ye.Photo?so(s):void 0,g=a instanceof Ye.Document?Co(a):void 0,p=o?.map((e=>function(e,t){return{botId:e,...wa(t)}}(l||t,e)));return{botId:l||t,description:n,gif:g,photo:f,menuButton:zo(r),privacyPolicyUrl:c,commands:p?.length?p:void 0,hasPreviewMedia:d,appSettings:u&&Wo(u)}}function Wo(e){const t=e.placeholderPath&&Yi(e.placeholderPath);return{backgroundColor:e.backgroundColor?ea(e.backgroundColor):void 0,backgroundDarkColor:e.backgroundDarkColor?ea(e.backgroundDarkColor):void 0,headerColor:e.headerColor?ea(e.headerColor):void 0,headerDarkColor:e.headerDarkColor?ea(e.headerDarkColor):void 0,placeholderPath:t}}function zo(e){return e instanceof Ye.BotMenuButton?{type:"webApp",text:e.text,url:e.url}:{type:"commands"}}function Ko(e){if(e instanceof Ye.BotAppNotModified)return;const{id:t,accessHash:n,title:s,description:a,shortName:i,photo:o,document:r}=e,c=o instanceof Ye.Photo?so(o):void 0,d=r instanceof Ye.Document?ko(r):void 0;return{id:t.toString(),accessHash:n.toString(),title:s,description:a,shortName:i,photo:c,document:d}}function $o(e){return e instanceof Ye.InlineQueryPeerTypeBotPM?"bots":e instanceof Ye.InlineQueryPeerTypePM?"users":e instanceof Ye.InlineQueryPeerTypeChat?"chats":e instanceof Ye.InlineQueryPeerTypeMegagroup?"supergroups":e instanceof Ye.InlineQueryPeerTypeBroadcast?"channels":e instanceof Ye.InlineQueryPeerTypeSameBotPM?"self":void 0}const Jo={mediaType:"action",type:"unsupported"};function Qo(e){return e instanceof Ye.PhoneCallDiscardReasonBusy?"busy":e instanceof Ye.PhoneCallDiscardReasonHangup?"hangup":e instanceof Ye.PhoneCallDiscardReasonMissed?"missed":"disconnect"}function Xo(e){const{recentReactions:t,results:n,canSeeList:s,reactionsAsTags:a,topReactors:i}=e;return{areTags:a,canSeeList:s,results:n.map(Yo).filter(Boolean).sort(Zo),recentReactions:t?.map(tr).filter(Boolean),topReactors:i?.map(er).filter(Boolean)}}function Zo(e,t){if("paid"===e.reaction.type)return-1;if("paid"===t.reaction.type)return 1;return t.count-e.count||(void 0!==e.chosenOrder&&void 0!==t.chosenOrder?e.chosenOrder-t.chosenOrder:void 0!==e.chosenOrder?1:void 0!==t.chosenOrder?-1:0)}function Yo(e){const{chosenOrder:t,count:n,reaction:s}=e,a=nr(s,!0);if(a)return{chosenOrder:t,count:n,reaction:a}}function er(e){const{count:t,my:n,top:s,anonymous:a,peerId:i}=e;return{peerId:i&&aa(i),count:t,isMy:n,isTop:s,isAnonymous:a}}function tr(e){const{peerId:t,reaction:n,big:s,unread:a,date:i,my:o}=e,r=nr(n);if(r)return{peerId:aa(t),reaction:r,addedDate:i,isUnread:a,isBig:s,isOwn:o}}function nr(e,t){return e instanceof Ye.ReactionEmoji?{type:"emoji",emoticon:e.emoticon}:e instanceof Ye.ReactionCustomEmoji?{type:"custom",documentId:e.documentId.toString()}:t&&e instanceof Ye.ReactionPaid?{type:"paid"}:void 0}function sr(e){const{reaction:t,title:n,count:s}=e,a=nr(t);if(a)return{reaction:a,title:n,count:s}}function ar(e){const{selectAnimation:t,staticIcon:n,reaction:s,title:a,appearAnimation:i,inactive:o,aroundAnimation:r,centerIcon:c,effectAnimation:d,activateAnimation:u,premium:l}=e;return{selectAnimation:ko(t),appearAnimation:ko(i),activateAnimation:ko(u),effectAnimation:ko(d),staticIcon:ko(n),aroundAnimation:r?ko(r):void 0,centerIcon:c?ko(c):void 0,reaction:{type:"emoji",emoticon:s},title:a,isInactive:o,isPremium:l}}function ir(e){const{id:t,emoticon:n,premiumRequired:s,staticIconId:a,effectStickerId:i,effectAnimationId:o}=e;return{id:t.toString(),emoticon:n,isPremium:s,staticIconId:a?.toString(),effectStickerId:i.toString(),effectAnimationId:o?.toString()}}const or=1e6,rr="temp",cr=63,dr=10;let ur,lr=0;function fr(e=0){return e+ ++lr/or}function gr(e){const t=fa(e);if(t&&(e instanceof Ye.Message||e instanceof Ye.MessageService))return pr(t,e)}function pr(e,t){const n=t.fromId?aa(t.fromId):void 0,s=!n&&e===ur,a=t.fwdFrom&&mr(t.fwdFrom,s),i=Boolean(!a||a.fromId===ur||a.isSavedOutgoing),o=s?i:Boolean(t.out&&!t.post),r=So(t),c=t.action&&function(e){if(e instanceof Ye.MessageActionChatCreate){const{title:t,users:n}=e;return{mediaType:"action",type:"chatCreate",title:t,userIds:n.map((e=>sa(e,"user")))}}if(e instanceof Ye.MessageActionChatEditTitle){const{title:t}=e;return{mediaType:"action",type:"chatEditTitle",title:t}}if(e instanceof Ye.MessageActionChatEditPhoto){const{photo:t}=e;return{mediaType:"action",type:"chatEditPhoto",photo:t instanceof Ye.Photo?so(t):void 0}}if(e instanceof Ye.MessageActionChatDeletePhoto)return{mediaType:"action",type:"chatDeletePhoto"};if(e instanceof Ye.MessageActionChatAddUser){const{users:t}=e;return{mediaType:"action",type:"chatAddUser",userIds:t.map((e=>sa(e,"user")))}}if(e instanceof Ye.MessageActionChatDeleteUser){const{userId:t}=e;return{mediaType:"action",type:"chatDeleteUser",userId:sa(t,"user")}}if(e instanceof Ye.MessageActionChatJoinedByLink){const{inviterId:t}=e;return{mediaType:"action",type:"chatJoinedByLink",inviterId:sa(t,"user")}}if(e instanceof Ye.MessageActionChannelCreate){const{title:t}=e;return{mediaType:"action",type:"channelCreate",title:t}}if(e instanceof Ye.MessageActionChatMigrateTo){const{channelId:t}=e;return{mediaType:"action",type:"chatMigrateTo",channelId:sa(t,"channel")}}if(e instanceof Ye.MessageActionChannelMigrateFrom){const{title:t,chatId:n}=e;return{mediaType:"action",type:"channelMigrateFrom",title:t,chatId:sa(n,"chat")}}if(e instanceof Ye.MessageActionPinMessage)return{mediaType:"action",type:"pinMessage"};if(e instanceof Ye.MessageActionHistoryClear)return{mediaType:"action",type:"historyClear"};if(e instanceof Ye.MessageActionGameScore){const{gameId:t,score:n}=e;return{mediaType:"action",type:"gameScore",gameId:t.toString(),score:n}}if(e instanceof Ye.MessageActionPaymentSent){const{recurringInit:t,recurringUsed:n,currency:s,totalAmount:a,invoiceSlug:i,subscriptionUntilDate:o}=e;return{mediaType:"action",type:"paymentSent",isRecurringInit:t,isRecurringUsed:n,currency:s,totalAmount:a.toJSNumber(),invoiceSlug:i,subscriptionUntilDate:o}}if(e instanceof Ye.MessageActionPhoneCall){const{video:t,callId:n,reason:s,duration:a}=e;return{mediaType:"action",type:"phoneCall",isVideo:t,callId:n.toString(),reason:s&&Qo(s),duration:a}}if(e instanceof Ye.MessageActionScreenshotTaken)return{mediaType:"action",type:"screenshotTaken"};if(e instanceof Ye.MessageActionCustomAction){const{message:t}=e;return{mediaType:"action",type:"customAction",message:t}}if(e instanceof Ye.MessageActionBotAllowed){const{attachMenu:t,fromRequest:n,domain:s,app:a}=e;return{mediaType:"action",type:"botAllowed",isAttachMenu:t,isFromRequest:n,domain:s,app:a&&Ko(a)}}if(e instanceof Ye.MessageActionBoostApply){const{boosts:t}=e;return{mediaType:"action",type:"boostApply",boosts:t}}if(e instanceof Ye.MessageActionContactSignUp)return{mediaType:"action",type:"contactSignUp"};if(e instanceof Ye.MessageActionGroupCall){const{call:t,duration:n}=e;return{mediaType:"action",type:"groupCall",call:{id:t.id.toString(),accessHash:t.accessHash.toString()},duration:n}}if(e instanceof Ye.MessageActionInviteToGroupCall){const{call:t,users:n}=e;return{mediaType:"action",type:"inviteToGroupCall",call:{id:t.id.toString(),accessHash:t.accessHash.toString()},userIds:n.map((e=>sa(e,"user")))}}if(e instanceof Ye.MessageActionGroupCallScheduled){const{call:t,scheduleDate:n}=e;return{mediaType:"action",type:"groupCallScheduled",call:{id:t.id.toString(),accessHash:t.accessHash.toString()},scheduleDate:n}}if(e instanceof Ye.MessageActionChatJoinedByRequest)return{mediaType:"action",type:"chatJoinedByRequest"};if(e instanceof Ye.MessageActionWebViewDataSent){const{text:t}=e;return{mediaType:"action",type:"webViewDataSent",text:t}}if(e instanceof Ye.MessageActionGiftPremium){const{currency:t,amount:n,months:s,cryptoCurrency:a,cryptoAmount:i,message:o}=e;return{mediaType:"action",type:"giftPremium",currency:t,amount:n.toJSNumber(),months:s,cryptoCurrency:a,cryptoAmount:i?.toJSNumber(),message:o&&uo(o)}}if(e instanceof Ye.MessageActionTopicCreate){const{title:t,iconColor:n,iconEmojiId:s}=e;return{mediaType:"action",type:"topicCreate",title:t,iconColor:n,iconEmojiId:s?.toString()}}if(e instanceof Ye.MessageActionTopicEdit){const{title:t,iconEmojiId:n,closed:s,hidden:a}=e;return{mediaType:"action",type:"topicEdit",title:t,iconEmojiId:n?.toString(),isClosed:s,isHidden:a}}if(e instanceof Ye.MessageActionSuggestProfilePhoto){const{photo:t}=e;return t instanceof Ye.Photo?{mediaType:"action",type:"suggestProfilePhoto",photo:so(t)}:Jo}if(e instanceof Ye.MessageActionGiftCode){const{viaGiveaway:t,unclaimed:n,boostPeer:s,months:a,slug:i,currency:o,amount:r,cryptoCurrency:c,cryptoAmount:d,message:u}=e;return{mediaType:"action",type:"giftCode",isViaGiveaway:t,isUnclaimed:n,boostPeerId:s&&aa(s),months:a,slug:i,currency:o,amount:r?.toJSNumber(),cryptoCurrency:c,cryptoAmount:d?.toJSNumber(),message:u&&uo(u)}}if(e instanceof Ye.MessageActionGiveawayLaunch){const{stars:t}=e;return{mediaType:"action",type:"giveawayLaunch",stars:t?.toJSNumber()}}if(e instanceof Ye.MessageActionGiveawayResults){const{stars:t,winnersCount:n,unclaimedCount:s}=e;return{mediaType:"action",type:"giveawayResults",isStars:t,winnersCount:n,unclaimedCount:s}}if(e instanceof Ye.MessageActionPaymentRefunded){const{peer:t,currency:n,totalAmount:s}=e;return{mediaType:"action",type:"paymentRefunded",peerId:aa(t),currency:n,totalAmount:s.toJSNumber()}}if(e instanceof Ye.MessageActionGiftStars){const{currency:t,amount:n,stars:s,cryptoCurrency:a,cryptoAmount:i,transactionId:o}=e;return{mediaType:"action",type:"giftStars",currency:t,amount:n.toJSNumber(),stars:s.toJSNumber(),cryptoCurrency:a,cryptoAmount:i?.toJSNumber(),transactionId:o}}if(e instanceof Ye.MessageActionPrizeStars){const{unclaimed:t,stars:n,transactionId:s,boostPeer:a,giveawayMsgId:i}=e;return{mediaType:"action",type:"prizeStars",isUnclaimed:t,stars:n.toJSNumber(),transactionId:s,boostPeerId:aa(a),giveawayMsgId:i}}if(e instanceof Ye.MessageActionStarGift){const{nameHidden:t,saved:n,converted:s,upgraded:a,refunded:i,canUpgrade:o,gift:r,message:c,convertStars:d,upgradeMsgId:u,upgradeStars:l,fromId:f,peer:g,savedId:p}=e,h=vo(r);return"starGift"!==h.type?Jo:{mediaType:"action",type:"starGift",isNameHidden:t,isSaved:n,isConverted:s,isUpgraded:a,isRefunded:i,canUpgrade:o,gift:h,message:c&&uo(c),starsToConvert:d?.toJSNumber(),upgradeMsgId:u,alreadyPaidUpgradeStars:l?.toJSNumber(),fromId:f&&aa(f),peerId:g&&aa(g),savedId:p&&sa(p,"user")}}if(e instanceof Ye.MessageActionStarGiftUnique){const{upgrade:t,transferred:n,saved:s,refunded:a,gift:i,canExportAt:o,transferStars:r,fromId:c,peer:d,savedId:u}=e,l=vo(i);return"starGiftUnique"!==l.type?Jo:{mediaType:"action",type:"starGiftUnique",isUpgrade:t,isTransferred:n,isSaved:s,isRefunded:a,gift:l,canExportAt:o,transferStars:r?.toJSNumber(),fromId:c&&aa(c),peerId:d&&aa(d),savedId:u&&sa(u,"user")}}return Jo}(t.action);c&&(r.action=c);const d=t.date>ms()+dr,u=t.media instanceof Ye.MessageMediaInvoice&&Boolean(t.media.extendedMedia),l=Boolean(t.editDate)&&!t.editHide,{inlineButtons:f,keyboardButtons:g,keyboardPlaceholder:p,isKeyboardSingleUse:h,isKeyboardSelective:m}=Fo(t.replyMarkup,t.media instanceof Ye.MessageMediaInvoice?t.media.receiptMsgId:void 0)||{},{mediaUnread:y,postAuthor:_}=t,b=t.groupedId&&String(t.groupedId),v=Boolean(b)&&!(r.document||r.audio||r.sticker),w=t.replyMarkup instanceof Ye.ReplyKeyboardHide,S=t.replyMarkup instanceof Ye.ReplyKeyboardHide&&t.replyMarkup.selective,I=t.noforwards||u,P=!t.noforwards,C=$a(r,b),M=t.replies?.comments,R=t.fromBoostsApplied,k=t.factcheck&&_r(t.factcheck),A=t.videoProcessingPending,T=t.reactionsArePossible,E=t.invertMedia,U=t.savedPeerId&&aa(t.savedPeerId);return{id:t.id,chatId:e,isOutgoing:o,content:r,date:t.date,senderId:n,viewsCount:t.views,forwardsCount:t.forwards,isScheduled:d,isFromScheduled:t.fromScheduled,isSilent:t.silent,isPinned:t.pinned,reactions:t.reactions&&Xo(t.reactions),emojiOnlyCount:C,...t.replyTo&&{replyInfo:yr(t.replyTo,t)},forwardInfo:a,isEdited:l,editDate:t.editDate,isMediaUnread:y,hasUnreadMention:t.mentioned&&y,areReactionsPossible:T,isMentioned:t.mentioned,...b&&{groupedId:b,isInAlbum:v},inlineButtons:f,...g&&{keyboardButtons:g,keyboardPlaceholder:p,isKeyboardSingleUse:h,isKeyboardSelective:m},...w&&{shouldHideKeyboardButtons:w,isHideKeyboardSelective:S},...t.viaBotId&&{viaBotId:sa(t.viaBotId,"user")},postAuthorTitle:_,isProtected:I,isForwardingAllowed:P,hasComments:M,savedPeerId:U,senderBoosts:R,viaBusinessBotId:t.viaBusinessBotId?.toString(),factCheck:k,effectId:t.effect?.toString(),isInvertedMedia:E,isVideoProcessingPending:A,reportDeliveryUntilDate:t.reportDeliveryUntilDate}}function hr(e){if(e instanceof Ye.DraftMessageEmpty)return;const{message:t,entities:n,replyTo:s,date:a,effect:i}=e,o=s instanceof Ye.InputReplyToMessage?{type:"message",replyToMsgId:s.replyToMsgId,replyToTopId:s.topMsgId,replyToPeerId:s.replyToPeerId&&aa(s.replyToPeerId),quoteText:s.quoteText?Io(s.quoteText,s.quoteEntities):void 0}:void 0;return{text:t?Io(t,n):void 0,replyInfo:o,date:a,effectId:i?.toString()}}function mr(e,t=!1){const n=e.savedFromPeer&&aa(e.savedFromPeer),s=e.fromId&&aa(e.fromId);return{date:e.date,savedDate:e.savedDate,isImported:e.imported,isChannelPost:Boolean(e.channelPost),channelPostId:e.channelPost,isLinkedChannelPost:Boolean(e.channelPost&&n===s&&e.savedFromMsgId===e.channelPost&&!t),savedFromPeerId:n,isSavedOutgoing:e.savedOut,fromId:s,fromChatId:s||n,fromMessageId:e.savedFromMsgId||e.channelPost,hiddenUserName:e.fromName,postAuthorTitle:e.postAuthor}}function yr(e,t){if(e instanceof Ye.MessageReplyStoryHeader)return{type:"story",peerId:aa(e.peer),storyId:e.storyId};if(e instanceof Ye.MessageReplyHeader){const{replyFrom:n,replyToMsgId:s,replyToTopId:a,replyMedia:i,replyToPeerId:o,forumTopic:r,quote:c,quoteText:d,quoteEntities:u}=e;return{type:"message",replyToMsgId:s,replyToTopId:a,isForumTopic:r,replyFrom:n&&mr(n),replyToPeerId:o&&aa(o),replyMedia:i&&Po(i,t),isQuote:c,quoteText:d?Io(d,u):void 0}}}function _r(e){return{shouldFetch:e.needCheck,hash:e.hash.toString(),text:e.text&&uo(e.text),countryCode:e.country}}function br(e){const{filename:t,blobUrl:n,previewBlobUrl:s,mimeType:a,size:i,audio:o,shouldSendAsFile:r,shouldSendAsSpoiler:c,ttlSeconds:d}=e;if(!r){if(e.quick){if(H.has(a)){const{width:t,height:a}=e.quick;return{photo:{mediaType:"photo",id:rr,sizes:[],thumbnail:{width:t,height:a,dataUri:s||n},blobUrl:n,date:Math.round(Date.now()/1e3),isSpoiler:c}}}if(O.has(a)){const{width:o,height:r,duration:d}=e.quick;return{video:{mediaType:"video",id:rr,mimeType:a,duration:d||0,fileName:t,width:o,height:r,blobUrl:n,...s&&{thumbnail:{width:o,height:r,dataUri:s}},size:i,isSpoiler:c}}}}if(e.voice){const{duration:t,waveform:n}=e.voice,{data:s}=ii(n,cr);return{voice:{mediaType:"voice",id:rr,duration:t,waveform:s,size:i},ttlSeconds:d}}if(L.has(a)){const{duration:e,performer:n,title:s}=o||{};return{audio:{mediaType:"audio",id:rr,mimeType:a,fileName:t,size:i,duration:e||0,title:s,performer:n}}}}return{document:{mediaType:"document",mimeType:a,fileName:t,size:i,...s&&{previewBlobUrl:s}}}}function vr(e){const t=fa(e);if(t&&e instanceof Ye.Message&&e.replies)return wr(e.replies,e.id,t)}function wr(e,t,n){const{channelId:s,replies:a,maxId:i,readMaxId:o,recentRepliers:r,comments:c}=e,d=s?sa(s,"channel"):void 0;if(d===Y)return;const u={messagesCount:a,...i&&{lastMessageId:i},...o&&{lastReadMessageId:o},...r&&{recentReplierIds:r.map(aa)}};return c?{...u,isCommentsInfo:!0,chatId:d,originChannelId:n,originMessageId:t}:{...u,isCommentsInfo:!1,chatId:n,threadId:t}}function Sr(e){const{shortcutId:t,shortcut:n,topMessage:s}=e;return{id:t,shortcut:n,topMessageId:s}}function Ir(e){return e instanceof Ye.ReportResultReported?{type:"reported"}:e instanceof Ye.ReportResultAddComment?{type:"comment",isOptional:e.optional,option:pa(e.option)}:{type:"selectOption",title:e.title,options:e.options.map((e=>({text:e.text,option:pa(e.option)})))}}function Pr(e,t){return t instanceof Ye.BotInlineMediaResult?(t.document instanceof Ye.Document&&zi(t.document),t.photo instanceof Ye.Photo&&Wi(t.photo),Ho(t,e)):(t.thumb&&Qi(t.thumb),qo(t,e))}function Cr(e,t){if(t instanceof Ye.StoryItemDeleted)return{id:t.id,peerId:e,isDeleted:!0};if(t instanceof Ye.StoryItemSkipped){const{id:n,date:s,expireDate:a,closeFriends:i}=t;return{id:n,peerId:e,...i&&{isForCloseFriends:!0},date:s,expireDate:a}}const{edited:n,pinned:s,expireDate:a,id:i,date:o,caption:r,entities:c,media:d,privacy:u,views:l,public:f,noforwards:g,closeFriends:p,contacts:h,selectedContacts:m,mediaAreas:y,sentReaction:_,out:b,fwdFrom:v,fromId:w}=t,S={...Po(d)};r&&(S.text=Io(r,c));const I=_&&nr(_);return ni({id:i,peerId:e,date:o,expireDate:a,content:S,isPublic:f,isEdited:n,isInProfile:s,isForContacts:h,isForSelectedContacts:m,isForCloseFriends:p,noForwards:g,views:l&&Mr(l),isOut:b,visibility:u&&co(u),mediaAreas:y?.map(Ar).filter(Boolean),sentReaction:I,forwardInfo:v&&Tr(v),fromId:w&&aa(w)})}function Mr(e){return ni({hasViewers:e.hasViewers,viewsCount:e.viewsCount,forwardsCount:e.forwardsCount,reactionsCount:e.reactionsCount,reactions:e.reactions?.map(Yo).filter(Boolean),recentViewerIds:e.recentViewers?.map((e=>sa(e,"user")))})}function Rr(e){const{blockedMyStoriesFrom:t,blocked:n}=e;if(e instanceof Ye.StoryView)return ni({type:"user",peerId:sa(e.userId,"user"),date:e.date,reaction:e.reaction&&nr(e.reaction),areStoriesBlocked:n||t,isUserBlocked:n});if(e instanceof Ye.StoryViewPublicForward){const s=gr(e.message);if(!s)return;return{type:"forward",peerId:s.chatId,messageId:s.id,message:s,date:s.date,areStoriesBlocked:n||t,isUserBlocked:n}}if(e instanceof Ye.StoryViewPublicRepost){const s=aa(e.peerId),a=Cr(s,e.story);if(!("content"in a))return;return{type:"repost",peerId:s,storyId:e.story.id,date:a.date,story:a,areStoriesBlocked:n||t,isUserBlocked:n}}}function kr(e){return{activeUntil:e.activeUntilDate,cooldownUntil:e.cooldownUntilDate}}function Ar(e){const t=function(e){const{x:t,y:n,w:s,h:a,rotation:i,radius:o}=e;return{x:t,y:n,width:s,height:a,rotation:i,radius:o}}(e.coordinates);if(e instanceof Ye.MediaAreaVenue){const{geo:n,title:s}=e,a=To(n);if(!a)return;return{type:"venue",coordinates:t,geo:a,title:s}}if(e instanceof Ye.MediaAreaGeoPoint){const{geo:n}=e,s=To(n);if(!s)return;return{type:"geoPoint",coordinates:t,geo:s}}if(e instanceof Ye.MediaAreaSuggestedReaction){const{reaction:n,dark:s,flipped:a}=e,i=nr(n);if(!i)return;return{type:"suggestedReaction",coordinates:t,reaction:i,...s&&{isDark:!0},...a&&{isFlipped:!0}}}if(e instanceof Ye.MediaAreaChannelPost){const{channelId:n,msgId:s}=e;return{type:"channelPost",coordinates:t,channelId:sa(n,"channel"),messageId:s}}if(e instanceof Ye.MediaAreaUrl){const{url:n}=e;return{type:"url",coordinates:t,url:n}}if(e instanceof Ye.MediaAreaWeather){const{emoji:n,temperatureC:s,color:a}=e;return{type:"weather",coordinates:t,emoji:n,temperatureC:s,color:a}}if(e instanceof Ye.MediaAreaStarGift){const{slug:n}=e;return{type:"uniqueGift",coordinates:t,slug:n}}}function Tr(e){const{from:t,fromName:n,storyId:s,modified:a}=e;return{storyId:s,fromPeerId:t&&aa(t),fromName:n,isModified:a}}function Er(e){const{address:t,geoPoint:n}=e;return{address:t,geo:n&&To(n)}}function Ur(e){const{timezoneId:t,weeklyOpen:n}=e;return{timezoneId:t,workHours:n.map((({startMinute:e,endMinute:t})=>({startMinute:e,endMinute:t})))}}function Dr(e){const{title:t,description:n,sticker:s}=e;return{title:t,description:n,sticker:s&&ho(s)}}function Br(e){const{fullUser:{about:t,commonChatsCount:n,pinnedMsgId:s,botInfo:a,blocked:i,profilePhoto:o,voiceMessagesForbidden:r,premiumGifts:c,hasScheduled:d,fallbackPhoto:u,personalPhoto:l,translationsDisabled:f,storiesPinnedAvailable:g,contactRequirePremium:p,businessWorkHours:h,businessLocation:m,businessIntro:y,birthday:_,personalChannelId:b,personalChannelMessage:v,sponsoredEnabled:w,stargiftsCount:S,botVerification:I,botCanManageEmojiStatus:P},users:C}=e,M=sa(C[0].id,"user");return{bio:t,commonChatsCount:n,pinnedMessageId:s,isBlocked:Boolean(i),noVoiceMessages:r,hasPinnedStories:Boolean(g),isTranslationDisabled:f,profilePhoto:o instanceof Ye.Photo?so(o):void 0,fallbackPhoto:u instanceof Ye.Photo?so(u):void 0,personalPhoto:l instanceof Ye.Photo?so(l):void 0,premiumGifts:c?.map((e=>function(e){const{months:t,currency:n,amount:s,botUrl:a}=e;return{months:t,currency:n,amount:s.toJSNumber(),botUrl:a}}(e))),botInfo:a&&jo(a,M),isContactRequirePremium:p,birthday:_&&Fr(_),businessLocation:m&&Er(m),businessWorkHours:h&&Ur(h),businessIntro:y&&Dr(y),personalChannelId:b&&sa(b,"channel"),personalChannelMessageId:v,botVerification:I&&go(I),areAdsEnabled:w,starGiftCount:S,isBotCanManageEmojiStatus:P,hasScheduledMessages:d}}function xr(e){if(!(e instanceof Ye.User))return;const{id:t,firstName:n,lastName:s,fake:a,scam:i,support:o,closeFriend:r,storiesUnavailable:c,storiesMaxId:d,bot:u,botActiveUsers:l,botVerificationIcon:f,botInlinePlaceholder:g,botAttachMenu:p,botCanEdit:h}=e,m=e.photo instanceof Ye.UserProfilePhoto?Boolean(e.photo.hasVideo):void 0,y=e.photo&&fo(e.photo),_=(w=e).bot?"userTypeBot":w.deleted?"userTypeDeleted":"userTypeRegular",b=ro(e),v=e.emojiStatus?oa(e.emojiStatus):void 0;var w;return{id:sa(t,"user"),isMin:Boolean(e.min),fakeType:i?"scam":a?"fake":void 0,...e.self&&{isSelf:!0},isPremium:Boolean(e.premium),...e.verified&&{isVerified:!0},...r&&{isCloseFriend:!0},...o&&{isSupport:!0},...(e.contact||e.mutualContact)&&{isContact:!0},type:_,firstName:n,lastName:s,hasMainMiniApp:Boolean(e.botHasMainApp),canEditBot:h,..."userTypeBot"===_&&{canBeInvitedToGroup:!e.botNochats},...b&&{usernames:b},phoneNumber:e.phone||"",noStatus:!e.status,...e.accessHash&&{accessHash:String(e.accessHash)},avatarPhotoId:y,emojiStatus:v,hasVideoAvatar:m,areStoriesHidden:Boolean(e.storiesHidden),maxStoryId:d,hasStories:Boolean(d)&&!c,...u&&g&&{botPlaceholder:g},...u&&p&&{isAttachBot:p},botActiveUsers:l,botVerificationIconId:f?.toString(),color:e.color&&ia(e.color)}}function Vr(e){return!e||e instanceof Ye.UserStatusEmpty?{type:"userStatusEmpty"}:e instanceof Ye.UserStatusOnline?{type:"userStatusOnline",expires:e.expires}:e instanceof Ye.UserStatusOffline?{type:"userStatusOffline",wasOnline:e.wasOnline}:e instanceof Ye.UserStatusRecently?{type:"userStatusRecently",isReadDateRestrictedByMe:e.byMe}:e instanceof Ye.UserStatusLastWeek?{type:"userStatusLastWeek",isReadDateRestrictedByMe:e.byMe}:{type:"userStatusLastMonth",isReadDateRestrictedByMe:e.byMe}}function Nr(e){const t={};return e.forEach((e=>{if("status"in e){const n=sa(e.id,"user");t[n]=Vr(e.status)}})),t}function Fr(e){return wa(e)}function Gr(e){if(e instanceof Ye.WallPaperNoFile)return;const{slug:t}=e,n=ko(e.document);return n?{slug:t,document:n}:void 0}function qr(e){return{isCurrent:Boolean(e.current),isOfficialApp:Boolean(e.officialApp),isPasswordPending:Boolean(e.passwordPending),hash:String(e.hash),areCallsEnabled:!e.callRequestsDisabled,areSecretChatsEnabled:!e.encryptedRequestsDisabled,isUnconfirmed:e.unconfirmed,...Ya(e,["deviceModel","platform","systemVersion","appName","appVersion","dateCreated","dateActive","ip","country","region"])}}function Hr(e){return{hash:String(e.hash),botId:sa(e.botId,"user"),...Ya(e,["platform","browser","dateCreated","dateActive","ip","region","domain"])}}function Or(e){const{silent:t,muteUntil:n,showPreviews:s,otherSound:a}=e;return{hasSound:!(a instanceof Ye.NotificationSoundNone),isSilentPosting:t,mutedUntil:n,shouldShowPreviews:s}}function Lr(e,t){const{hidden:n,iso2:s,defaultName:a,name:i}=e,{countryCode:o,prefixes:r,patterns:c}=t||{};return{isHidden:n,iso2:s,defaultName:a,name:i,countryCode:o,prefixes:r,patterns:c}}function jr(e){if(!(e instanceof Ye.JsonNull))return e instanceof Ye.JsonString||e instanceof Ye.JsonBool||e instanceof Ye.JsonNumber?e.value:e instanceof Ye.JsonArray?e.value.map(jr):e.value.reduce(((e,t)=>(e[t.key]=jr(t.value),e)),{})}function Wr(e){if(e instanceof Ye.UrlAuthResultRequest){const{bot:t,domain:n,requestWriteAccess:s}=e,a=xr(t);if(!a)return;return Ji(t),{type:"request",domain:n,shouldRequestWriteAccess:s,bot:a}}return e instanceof Ye.UrlAuthResultAccepted?{type:"accepted",url:e.url}:e instanceof Ye.UrlAuthResultDefault?{type:"default"}:void 0}function zr(e){return e.strings.reduce(((e,t)=>(e[t.key]=function(e){return e instanceof Ye.LangPackString?e.value:e instanceof Ye.LangPackStringPluralized?ti(wa(e),["key"]):void 0}(t),e)),{})}function Kr(e){const t=[],n=e.reduce(((e,n)=>(n instanceof Ye.LangPackStringDeleted&&t.push(n.key),n instanceof Ye.LangPackString&&(e[n.key]=n.value),n instanceof Ye.LangPackStringPluralized&&(e[n.key]=ni({zero:n.zeroValue,one:n.oneValue,two:n.twoValue,few:n.fewValue,many:n.manyValue,other:n.otherValue})),e)),{});return{keysToRemove:t,strings:n}}function $r(e){const{name:t,nativeName:n,langCode:s,pluralCode:a,rtl:i,stringsCount:o,translatedCount:r,translationsUrl:c,beta:d,official:u}=e;return{name:t,nativeName:n,langCode:s,pluralCode:a,isRtl:i,isBeta:d,isOfficial:u,stringsCount:o,translatedCount:r,translationsUrl:c}}function Jr(e){if(e instanceof Ye.help.PeerColorSet)return e.colors.map((e=>ea(e)))}function Qr(e){const{id:t,name:n,utcOffset:s}=e;return{id:t,name:n,utcOffset:s}}function Xr(e,t=!1){const n=Boolean("min"in e&&e.min),s="accessHash"in e?String(e.accessHash):void 0,a="photo"in e&&e.photo&&"hasVideo"in e.photo&&e.photo.hasVideo,i="photo"in e&&e.photo?fo(e.photo):void 0,o=Boolean("signatures"in e&&e.signatures),r=Boolean("hasLink"in e&&e.hasLink),c=Boolean("scam"in e&&e.scam),d=Boolean("fake"in e&&e.fake),u=Boolean("joinToSend"in e&&e.joinToSend),l=Boolean("joinRequest"in e&&e.joinRequest),f=ro(e),g=Boolean("forum"in e&&e.forum),p=Boolean("storiesHidden"in e&&e.storiesHidden),h="storiesMaxId"in e?e.storiesMaxId:void 0,m="botVerificationIcon"in e?e.botVerificationIcon?.toString():void 0,y=Boolean("storiesUnavailable"in e&&e.storiesUnavailable),_="color"in e&&e.color?ia(e.color):void 0,b="emojiStatus"in e&&e.emojiStatus?oa(e.emojiStatus):void 0,v="level"in e?e.level:void 0,w=Boolean("signatureProfiles"in e&&e.signatureProfiles),S="subscriptionUntilDate"in e?e.subscriptionUntilDate:void 0;return{isMin:n,hasPrivateLink:r,areSignaturesShown:o,areProfilesShown:w,usernames:f,accessHash:s,hasVideoAvatar:a,avatarPhotoId:i,..."verified"in e&&{isVerified:e.verified},..."callActive"in e&&{isCallActive:e.callActive},..."callNotEmpty"in e&&{isCallNotEmpty:e.callNotEmpty},..."date"in e&&{creationDate:e.date},..."participantsCount"in e&&void 0!==e.participantsCount&&{membersCount:e.participantsCount},..."noforwards"in e&&{isProtected:Boolean(e.noforwards)},isSupport:t||void 0,...Yr(e),..."creator"in e&&{isCreator:e.creator},...ec(e),...tc(e),fakeType:c?"scam":d?"fake":void 0,color:_,isJoinToSend:u,isJoinRequest:l,isForum:g,areStoriesHidden:p,maxStoryId:h,hasStories:Boolean(h)&&!y,emojiStatus:b,boostLevel:v,botVerificationIconId:m,subscriptionUntil:S}}function Zr(e,t){const{peer:n,folderId:s,unreadMark:a,unreadCount:i,unreadMentionsCount:o,unreadReactionsCount:r,readOutboxMaxId:c,readInboxMaxId:d,draft:u,viewForumAsMessages:l}=e;return{id:aa(n),...s&&{folderId:s},type:sc(t),title:ic(n,t),lastReadOutboxMessageId:c,lastReadInboxMessageId:d,unreadCount:i,unreadMentionsCount:o,unreadReactionsCount:r,...a&&{hasUnreadMark:!0},...u instanceof Ye.DraftMessage&&{draftDate:u.date},...l&&{isForumAsMessages:!0},...Xr(t)}}function Yr(e){return e instanceof Ye.Chat||e instanceof Ye.Channel?{adminRights:e.adminRights?wa(e.adminRights):void 0,currentUserBannedRights:"bannedRights"in e&&e.bannedRights?wa(e.bannedRights):void 0,defaultBannedRights:e.defaultBannedRights?wa(e.defaultBannedRights):void 0}:{}}function ec(e){if(e instanceof Ye.ChatForbidden)return{isForbidden:!0};if(e instanceof Ye.ChannelForbidden)return{isRestricted:!0};const t={};if("restricted"in e){const n=e.restricted?function(e){if(!e)return;const t=e.find((({platform:e})=>"all"===e));return t?Ya(t,["reason","text"]):void 0}(e.restrictionReason):void 0;n&&Object.assign(t,{isRestricted:!0,restrictionReason:n})}return e instanceof Ye.Chat&&Object.assign(t,{isNotJoined:e.left}),e instanceof Ye.Channel&&Object.assign(t,{isNotJoined:e.left}),t}function tc(e){return!("migratedTo"in e)||!e.migratedTo||e.migratedTo instanceof Ye.InputChannelEmpty?{}:{migratedTo:{chatId:aa(e.migratedTo),...e.migratedTo instanceof Ye.InputChannel&&{accessHash:String(e.migratedTo.accessHash)}}}}function nc(e,t=!1){if(!(e instanceof Ye.ChatEmpty||e instanceof Ye.UserEmpty))return{id:sa(e.id,e instanceof Ye.User?"user":e instanceof Ye.Chat||e instanceof Ye.ChatForbidden?"chat":"channel"),type:sc(e),title:e instanceof Ye.User?oc(e):e.title,...Xr(e,t)}}function sc(e){return e instanceof Ye.User||e instanceof Ye.UserEmpty?"chatTypePrivate":e instanceof Ye.Chat||e instanceof Ye.ChatForbidden||e instanceof Ye.ChatEmpty?"chatTypeBasicGroup":e.megagroup?"chatTypeSuperGroup":"chatTypeChannel"}function ac(e){return ta(e)?`user${e.userId}`:na(e)?`chat${e.chatId}`:`chat${e.channelId}`}function ic(e,t){return ta(e)?oc(t):t.title}function oc(e){return e.firstName?`${e.firstName}${e.lastName?` ${e.lastName}`:""}`:e.lastName||""}function rc(e){return{userId:e instanceof Ye.ChannelParticipantBanned||e instanceof Ye.ChannelParticipantLeft?aa(e.peer):sa(e.userId,"user"),inviterId:"inviterId"in e&&e.inviterId?sa(e.inviterId,"user"):void 0,joinedDate:"date"in e?e.date:void 0,kickedByUserId:"kickedBy"in e&&e.kickedBy?sa(e.kickedBy,"user"):void 0,promotedByUserId:"promotedBy"in e&&e.promotedBy?sa(e.promotedBy,"user"):void 0,bannedRights:"bannedRights"in e?wa(e.bannedRights):void 0,adminRights:"adminRights"in e?wa(e.adminRights):void 0,customTitle:"rank"in e?e.rank:void 0,isViaRequest:"viaRequest"in e?e.viaRequest:void 0,...(e instanceof Ye.ChannelParticipantAdmin||e instanceof Ye.ChatParticipantAdmin)&&{isAdmin:!0},...(e instanceof Ye.ChannelParticipantCreator||e instanceof Ye.ChatParticipantCreator)&&{isOwner:!0}}}function cc(e){return e instanceof Ye.ChatParticipants||e instanceof Ye.channels.ChannelParticipants?e.participants.map(rc).filter(Boolean):void 0}function dc(e){let t,n="";if(!(e.action instanceof Ye.SendMessageCancelAction)){if(e.action instanceof Ye.SendMessageTypingAction)n="lng_user_typing";else if(e.action instanceof Ye.SendMessageRecordVideoAction)n="lng_send_action_record_video";else if(e.action instanceof Ye.SendMessageUploadVideoAction)n="lng_send_action_upload_video";else if(e.action instanceof Ye.SendMessageRecordAudioAction)n="lng_send_action_record_audio";else if(e.action instanceof Ye.SendMessageUploadAudioAction)n="lng_send_action_upload_audio";else if(e.action instanceof Ye.SendMessageUploadPhotoAction)n="lng_send_action_upload_photo";else if(e.action instanceof Ye.SendMessageUploadDocumentAction)n="lng_send_action_upload_file";else if(e.action instanceof Ye.SendMessageGeoLocationAction)n="selecting a location to share";else if(e.action instanceof Ye.SendMessageChooseContactAction)n="selecting a contact to share";else if(e.action instanceof Ye.SendMessageGamePlayAction)n="lng_playing_game";else if(e.action instanceof Ye.SendMessageRecordRoundAction)n="lng_send_action_record_round";else if(e.action instanceof Ye.SendMessageUploadRoundAction)n="lng_send_action_upload_round";else if(e.action instanceof Ye.SendMessageChooseStickerAction)n="lng_send_action_choose_sticker";else{if(e.action instanceof Ye.SpeakingInGroupCallAction)return;if(e.action instanceof Ye.SendMessageEmojiInteractionSeen)n="lng_user_action_watching_animations",t=e.action.emoticon;else if(e.action instanceof Ye.SendMessageEmojiInteraction)return}return{action:n,...t&&{emoji:t},...!(e instanceof Ye.UpdateUserTyping)&&{userId:aa(e.fromId)},timestamp:Date.now()+1e3*hs()}}}function uc(e){return e instanceof Ye.DialogFilterChatlist?{...ei(e,["id","emoticon"]),excludedChatIds:[],includedChatIds:e.includePeers.map(aa).filter(Boolean),pinnedChatIds:e.pinnedPeers.map(aa).filter(Boolean),hasMyInvites:e.hasMyInvites,isChatList:!0,noTitleAnimations:e.titleNoanimate,title:uo(e.title)}:{...ei(e,["id","emoticon","contacts","nonContacts","groups","bots","excludeMuted","excludeRead","excludeArchived"]),channels:e.broadcasts,pinnedChatIds:e.pinnedPeers.map(aa).filter(Boolean),includedChatIds:e.includePeers.map(aa).filter(Boolean),excludedChatIds:e.excludePeers.map(aa).filter(Boolean),title:uo(e.title),noTitleAnimations:e.titleNoanimate}}function lc({filter:e,description:t}){if(e instanceof Ye.DialogFilter||e instanceof Ye.DialogFilterChatlist)return{...uc(e),description:t}}function fc(e){return e.reduce(((e,t)=>{const n=sa(t.userId,"user");return t.commands&&(e=e.concat(t.commands.map((e=>({botId:n,...wa(e)}))))),e}),[])}function gc(e){const{revoked:t,date:n,expireDate:s,link:a,permanent:i,startDate:o,usage:r,usageLimit:c,requested:d,requestNeeded:u,title:l,adminId:f}=e;return{isRevoked:t,date:n,expireDate:s,link:a,isPermanent:i,startDate:o,usage:r,usageLimit:c,isRequestNeeded:u,requested:d,title:l,adminId:sa(f,"user")}}function pc({autoarchived:e,reportSpam:t,addContact:n,blockContact:s}){return{isAutoArchived:Boolean(e),canReportSpam:Boolean(t),canAddContact:Boolean(n),canBlockContact:Boolean(s)}}function hc(e){return e instanceof Ye.ChatReactionsAll?{type:"all",areCustomAllowed:e.allowCustom}:e instanceof Ye.ChatReactionsSome?{type:"some",allowed:e.reactions.map((e=>nr(e))).filter(Boolean)}:void 0}function mc(e){return{id:aa(e.peer),isPremium:e.premiumRequired}}function yc(e){if(e instanceof Ye.ForumTopicDeleted)return;const{id:t,my:n,closed:s,pinned:a,hidden:i,short:o,date:r,title:c,iconColor:d,iconEmojiId:u,topMessage:l,unreadCount:f,unreadMentionsCount:g,unreadReactionsCount:p,fromId:h,notifySettings:m}=e;return{id:t,isClosed:s,isPinned:a,isHidden:i,isOwner:n,isMin:o,date:r,title:c,iconColor:d,iconEmojiId:u?.toString(),lastMessageId:l,unreadCount:f,unreadMentionsCount:g,unreadReactionsCount:p,fromId:aa(h),notifySettings:Or(m)}}function _c(e){if(!(e instanceof Ye.ExportedChatlistInvite))return;const{title:t,url:n,peers:s}=e;return{title:t,url:n,peerIds:s.map(aa).filter(Boolean)}}function bc(e){return{id:e.userId.toString(),isRequiringPremiumToMessage:e.premiumRequiredForPm,isRequiringPremiumToInvite:e.premiumWouldAllowInvite}}function vc(e){const{color:t,participants:n,participantsCount:s,photo:a,title:i,about:o,scam:r,fake:c,verified:d,megagroup:u,channel:l,broadcast:f,requestNeeded:g,subscriptionFormId:p,subscriptionPricing:h,canRefulfillSubscription:m,botVerification:y}=e;let _;return a instanceof Ye.Photo&&(Wi(a),_=so(a)),n?.forEach(Ji),{title:i,about:o,isFake:c,isScam:r,isVerified:d,isSuperGroup:u,isPublic:e.public,participantsCount:s,color:t,isChannel:l,isBroadcast:f,isRequestNeeded:g,photo:_,subscriptionFormId:p?.toString(),subscriptionPricing:h&&wc(h),canRefulfillSubscription:m,participantIds:n?.map((e=>sa(e.id,"user"))).filter(Boolean),botVerification:y&&go(y)}}function wc(e){return{period:e.period,amount:e.amount.toJSNumber()}}const Sc=new Set(["User","UserEmpty"]),Ic=new Set(["ChatEmpty","Chat","ChatForbidden","Channel","ChannelForbidden"]),Pc=new Set(["Message","MessageEmpty","MessageService"]);function Cc(e){if(!e||"object"!=typeof e)return;if(!("users"in e||"chats"in e||"messages"in e))return;let t,n;const s=[],a=[];"users"in e&&Array.isArray(e.users)&&Sc.has(e.users[0]?.className)&&(t=Xa(e.users.map((e=>(e instanceof Ye.User&&Ji(e),xr(e)))).filter(Boolean),"id")),"chats"in e&&Array.isArray(e.chats)&&Ic.has(e.chats[0]?.className)&&(n=Xa(e.chats.map((e=>((e instanceof Ye.Chat||e instanceof Ye.Channel)&&function(e){const t=sa(e.id,e instanceof Ye.Chat?"chat":"channel"),n=Ta.chats[t],s=n&&"min"in n&&n.min,a="min"in e&&e.min;n&&!s&&a||(Ta.chats[t]=e)}(e),nc(e)))).filter(Boolean),"id")),"messages"in e&&Array.isArray(e.messages)&&Pc.has(e.messages[0]?.className)&&e.messages.forEach((e=>{Oi(e);const t=vr(e);t&&s.push(t);const n="media"in e&&e.media&&Ao(e.media);n&&a.push(n)})),(t||n||s?.length)&&Ba({"@type":"updateEntities",users:t,chats:n,threadInfos:s?.length?s:void 0,polls:a?.length?a:void 0})}function Mc(e){Oi(e);const t=vr(e);t&&Ba({"@type":"updateThreadInfo",threadInfo:t})}class Rc{constructor(e){var t,n,s,a;this.comparator=e,t=this,s=void 0,(n="symbol"==typeof(a=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n="queue"))?a:a+"")in t?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,this.queue=[]}add(e){const t=this.binarySearch(e);this.queue.splice(t,0,e)}pop(){return this.queue.shift()}get size(){return this.queue.length}clear(){this.queue=[]}binarySearch(e){let t=0,n=this.queue.length;for(;t<n;){const s=Math.floor((t+n)/2),a=this.comparator(e,this.queue[s]);if(0===a)return s;a>0?t=s+1:n=s}return t}}function kc(e){const{self:t,min:n,about:s,date:a,versioned:i,canSelfUnmute:o,justJoined:r,left:c,muted:d,mutedByYou:u,source:l,volume:f,volumeByAdmin:g,videoJoined:p,peer:h,video:m,presentation:y,raiseHandRating:_}=e;return{isSelf:t,isMin:n,canSelfUnmute:o,isLeft:c,isMuted:d,isMutedByMe:u,hasJustJoined:r,isVolumeByAdmin:g,isVersioned:i,isVideoJoined:p,about:s,source:l,raiseHandRating:_?.toString(),volume:f,date:new Date(a),isUser:ta(h),id:aa(h),video:m?Ac(m):void 0,presentation:y?Ac(y):void 0}}function Ac(e){const{audioSource:t,endpoint:n,paused:s,sourceGroups:a}=e;return{audioSource:t,endpoint:n,isPaused:s,sourceGroups:a.map(Tc)}}function Tc(e){return{semantics:e.semantics,sources:e.sources}}function Ec(e){const{id:t,accessHash:n}=e;if(e instanceof Ye.GroupCallDiscarded)return{connectionState:"discarded",id:t.toString(),accessHash:n.toString(),participantsCount:0,version:0,participants:{}};const{version:s,participantsCount:a,streamDcId:i,scheduleDate:o,canChangeJoinMuted:r,joinMuted:c,canStartVideo:d,scheduleStartSubscribed:u}=e;return{connectionState:"disconnected",isLoaded:!0,id:t.toString(),accessHash:n.toString(),version:s,participantsCount:a,streamDcId:i,scheduleDate:o,canChangeJoinMuted:r,joinMuted:c,canStartVideo:d,scheduleStartSubscribed:u,participants:{}}}function Uc(e){const{id:t}=e;let n={id:t.toString()};if(e instanceof Ye.PhoneCallAccepted||e instanceof Ye.PhoneCallWaiting||e instanceof Ye.PhoneCall||e instanceof Ye.PhoneCallRequested){const{accessHash:t,adminId:s,date:a,video:i,participantId:o,protocol:r}=e;n={...n,accessHash:t.toString(),adminId:s.toString(),participantId:o.toString(),date:a,isVideo:i,protocol:Bc(r)}}if(e instanceof Ye.PhoneCall){const{p2pAllowed:t,gAOrB:s,keyFingerprint:a,connections:i,startDate:o}=e;n={...n,state:"active",gAOrB:Array.from(s),keyFingerprint:a.toString(),startDate:o,isP2pAllowed:Boolean(t),connections:i.map(Dc).filter(Boolean)}}return e instanceof Ye.PhoneCallDiscarded&&(n={...n,state:"discarded",duration:e.duration,reason:(s=e.reason,s instanceof Ye.PhoneCallDiscardReasonMissed?"missed":s instanceof Ye.PhoneCallDiscardReasonBusy?"busy":s instanceof Ye.PhoneCallDiscardReasonHangup?"hangup":"disconnect"),needRating:e.needRating,needDebug:e.needDebug}),e instanceof Ye.PhoneCallWaiting&&(n={...n,state:"waiting",receiveDate:e.receiveDate}),e instanceof Ye.PhoneCallAccepted&&(n={...n,state:"accepted",gB:Array.from(e.gB)}),e instanceof Ye.PhoneCallRequested&&(n={...n,state:"requested",gAHash:Array.from(e.gAHash)}),n;var s}function Dc(e){if(e instanceof Ye.PhoneConnectionWebrtc){const{username:t,password:n,turn:s,stun:a,ip:i,ipv6:o,port:r}=e;return{username:t,password:n,isTurn:s,isStun:a,ip:i,ipv6:o,port:r}}}function Bc(e){const{libraryVersions:t,minLayer:n,maxLayer:s,udpP2p:a,udpReflector:i}=e;return{libraryVersions:t,minLayer:n,maxLayer:s,isUdpP2p:a,isUdpReflector:i}}function xc(){return new Ye.PhoneCallProtocol({libraryVersions:["4.0.0"],minLayer:92,maxLayer:92,udpReflector:!0,udpP2p:!0})}const Vc=10**9;function Nc(e){return e instanceof Ye.PostInteractionCountersMessage?{msgId:e.msgId,forwardsCount:e.forwards,viewsCount:e.views,reactionsCount:e.reactions}:e instanceof Ye.PostInteractionCountersStory?{storyId:e.storyId,reactionsCount:e.reactions,viewsCount:e.views,forwardsCount:e.forwards}:void 0}function Fc(e){return{viewsGraph:Hc(e.viewsGraph),reactionsGraph:Hc(e.reactionsByEmotionGraph)}}function Gc(e){if(e&&"messages"in e)return e.messages.map((t=>Wc(t,e.chats)))}function qc(e){if(e&&"forwards"in e)return e.forwards.map((t=>{if(t instanceof Ye.PublicForwardMessage)return Wc(t.message,e.chats);const{peer:n,story:s}=t;return{peerId:aa(n),storyId:s.id,viewsCount:s.views?.viewsCount||0,reactionsCount:s.views?.reactionsCount||0}}))}function Hc(e,t,n,s){if(e.error)return;const a=JSON.parse(e.json.data),[i,...o]=a.columns,r=a.y_scaled;return{type:t?"area":a.types.y0,zoomToken:e.zoomToken,labelFormatter:a.xTickFormatter,tooltipFormatter:a.xTooltipFormatter,labels:i.slice(1),hideCaption:!a.subchart.show,hasSecondYAxis:r,isStacked:a.stacked&&!r,isPercentage:t,isCurrency:n,currencyRate:s,datasets:o.map((e=>{const t=e[0];return{name:a.names[t],color:(n=a.colors[t],n.substring(n.indexOf("#"))),values:e.slice(1)};var n})),...Oc(a.subchart.defaultZoom,i.slice(1))}}function Oc(e,t){const[n,s]=e;let a=0,i=t.length-1;return t.forEach(((e,t)=>{!a&&e>=n&&(a=t),!i&&e>=s&&(i=t)})),{minimapRange:{begin:Math.max(0,a/(t.length-1)),end:Math.min(1,i/(t.length-1))},labelFromIndex:a,labelToIndex:i}}function Lc({current:e,previous:t}){const n=e-t;return{current:e,change:n,percentage:(n?Math.abs(n)/t*100:0).toFixed(2)}}function jc(e){return{part:e.part,total:e.total,percentage:(e.part/e.total*100).toFixed(2)}}function Wc(e,t){const n=aa(e.peerId),s=t.find((e=>sa(e.id,"channel")===n)),a=s&&"photo"in s&&s.photo instanceof Ye.Photo?s.photo:void 0;return{messageId:e.id,views:e.views,title:s.title,chat:{id:n,type:"chatTypeChannel",title:s.title,usernames:ro(s),avatarPhotoId:a&&fo(a),hasVideoAvatar:Boolean(a?.videoSizes)}}}function zc({currentBalance:e,availableBalance:t,overallRevenue:n,withdrawalEnabled:s}){return{currentBalance:Number(e)/Vc,availableBalance:Number(t)/Vc,overallRevenue:Number(n)/Vc,isWithdrawalEnabled:s}}function Kc(e){if(e)return Object.values(e).map((e=>({id:e.id,title:e.title,amount:e.prices.reduce(((e,t)=>e+t.amount.toJSNumber()),0),prices:e.prices.map((({label:e,amount:t})=>({label:e,amount:t.toJSNumber()})))})))}function $c(e){const{photo:t}=e;if(t&&Qi(t),e instanceof Ye.payments.PaymentReceiptStars){const{botId:n,currency:s,date:a,description:i,title:o,totalAmount:r,transactionId:c,invoice:d}=e;return{type:"stars",currency:s,date:a,botId:sa(n,"user"),description:i,title:o,totalAmount:-r.toJSNumber(),transactionId:c,photo:Vo(t),invoice:Jc(d)}}const{invoice:n,info:s,shipping:a,totalAmount:i,credentialsTitle:o,tipAmount:r,title:c,description:d,botId:u,currency:l,date:f,providerId:g}=e,{shippingAddress:p,phone:h,name:m}=s||{};let y,_;return a&&(y=a.prices.map((({label:e,amount:t})=>({label:e,amount:t.toJSNumber()}))),_=a.title),{type:"regular",info:{shippingAddress:p,phone:h,name:m},totalAmount:i.toJSNumber(),currency:l,date:f,credentialsTitle:o,shippingPrices:y,shippingMethod:_,tipAmount:r?r.toJSNumber():0,title:c,description:d,botId:sa(u,"user"),providerId:g.toString(),photo:t&&Vo(t),invoice:Jc(n)}}function Jc(e){const{test:t,currency:n,prices:s,recurring:a,termsUrl:i,maxTipAmount:o,suggestedTipAmounts:r,emailRequested:c,emailToProvider:d,nameRequested:u,phoneRequested:l,phoneToProvider:f,shippingAddressRequested:g,flexible:p,subscriptionPeriod:h}=e,m=s.map((({label:e,amount:t})=>({label:e,amount:t.toJSNumber()})));return{totalAmount:s.reduce(((e,t)=>e.add(t.amount)),fe()(0)).toJSNumber(),currency:n,isTest:t,isRecurring:a,termsUrl:i,prices:m,maxTipAmount:o?.toJSNumber(),suggestedTipAmounts:r?.map((e=>e.toJSNumber())),isEmailRequested:c,isEmailSentToProvider:d,isNameRequested:u,isPhoneRequested:l,isPhoneSentToProvider:f,isShippingAddressRequested:g,isFlexible:p,subscriptionPeriod:h}}function Qc(e){const{statusText:t,statusEntities:n,videos:s,videoSections:a,periodOptions:i}=e;return{statusText:t,statusEntities:n.map(lo),videoSections:a,videos:s.map(ko).filter(Boolean),options:i.map(Xc)}}function Xc(e){const{current:t,canPurchaseUpgrade:n,currency:s,amount:a,botUrl:i,months:o}=e;return{isCurrent:t,canPurchaseUpgrade:n,currency:s,amount:a.toJSNumber(),botUrl:i,months:o}}function Zc(e){const{userId:t,multiplier:n,expires:s,giveaway:a,gift:i,stars:o}=e;return{userId:t&&sa(t,"user"),multiplier:n,expires:s,isFromGiveaway:a,isGift:i,stars:o?.toJSNumber()}}function Yc(e){const{date:t,expires:n,slot:s,cooldownUntilDate:a,peer:i}=e;return{date:t,expires:n,slot:s,cooldownUntil:a,chatId:i&&aa(i)}}function ed(e){const{date:t,fromId:n,months:s,giveawayMsgId:a,toId:i,usedDate:o,viaGiveaway:r}=e;return{date:t,months:s,toId:i&&sa(i,"user"),fromId:n&&aa(n),usedAt:o,isFromGiveaway:r,giveawayMessageId:a}}function td(e){const{amount:t,currency:n,months:s,users:a}=e;return{amount:t.toJSNumber(),currency:n,months:s,users:a}}function nd(e){const{extended:t,stars:n,amount:s,currency:a}=e;return{isExtended:t,stars:n.toJSNumber(),amount:s.toJSNumber(),currency:a}}function sd(e){return{amount:e.amount.toJSNumber(),nanos:e.nanos}}function ad(e){const{extended:t,default:n,stars:s,yearlyBoosts:a,amount:i,winners:o,currency:r}=e,c=o?.map((e=>function(e){const{default:t,users:n,perUserStars:s}=e;return{isDefault:t,users:n,perUserStars:s.toJSNumber()}}(e))).filter(Boolean);return{isExtended:t,isDefault:n,yearlyBoosts:a,stars:s.toJSNumber(),amount:i.toJSNumber(),currency:r,winners:c}}function id(e){return e instanceof Ye.StarsTransactionPeerAppStore?{type:"appStore"}:e instanceof Ye.StarsTransactionPeerPlayMarket?{type:"playMarket"}:e instanceof Ye.StarsTransactionPeerPremiumBot?{type:"premiumBot"}:e instanceof Ye.StarsTransactionPeerFragment?{type:"fragment"}:e instanceof Ye.StarsTransactionPeerAds?{type:"ads"}:e instanceof Ye.StarsTransactionPeerAPI?{type:"api"}:e instanceof Ye.StarsTransactionPeer?{type:"peer",id:aa(e.peer)}:{type:"unsupported"}}function od(e){const{date:t,id:n,peer:s,stars:a,description:i,photo:o,title:r,refund:c,extendedMedia:d,failed:u,msgId:l,pending:f,gift:g,reaction:p,subscriptionPeriod:h,stargift:m,giveawayPostId:y,starrefCommissionPermille:_,stargiftUpgrade:b}=e;o&&Qi(o);const v=d?.map((e=>Po(e))).filter(Boolean),w=_?_/10:void 0;return{id:n,date:t,peer:id(s),stars:sd(a),title:r,description:i,photo:o&&Vo(o),isRefund:c,hasFailed:u,isPending:f,messageId:l,isGift:g,extendedMedia:v,subscriptionPeriod:h,isReaction:p,starGift:m&&vo(m),giveawayPostId:y,starRefCommision:w,isGiftUpgrade:b}}function rd(e){const{id:t,peer:n,pricing:s,untilDate:a,canRefulfill:i,canceled:o,chatInviteHash:r,missingBalance:c,botCanceled:d,photo:u,title:l,invoiceSlug:f}=e;return u&&Qi(u),{id:t,peerId:aa(n),until:a,pricing:wc(s),isCancelled:o,canRefulfill:i,hasMissingBalance:c,chatInviteHash:r,hasBotCancelled:d,title:l,photo:u&&Vo(u),invoiceSlug:f}}function cd(e){const{amount:t,currency:n,stars:s,extended:a}=e;return{amount:t.toJSNumber(),currency:n,stars:s.toJSNumber(),isExtended:a}}const dd=new Map,ud=[],ld=(e,t)=>{const n=e.topicId?`${e.chatId}-${e.topicId}`:e.chatId;if(dd.has(n)&&(clearTimeout(dd.get(n)),dd.delete(n)),e.mutedUntil===E||e.mutedUntil<=ms())return;if(ud.push(e),ud.sort(((e,t)=>t.mutedUntil-e.mutedUntil)),!ud.pop())return;const s=setTimeout((()=>{if(t(),ud.length){const e=ud.pop();e&&ld(e,t)}}),1e3*(e.mutedUntil-ms()));dd.set(n,s)};function fd(e,t=0,n){ld({chatId:e,mutedUntil:t},(()=>n({"@type":"updateChatNotifySettings",chatId:e,settings:{mutedUntil:0}})))}class gd{constructor(e,t){this.pts=e,this.ptsCount=t}}class pd{constructor(e,t,n){this.channelId=e,this.pts=t,this.ptsCount=n}}const hd=new Set;function md(e){if(e instanceof Sn)i=e.timeOffset,ps=i,Da({"@type":"updateServerTimeOffset",serverTimeOffset:e.timeOffset});else if(e instanceof wn){let t;switch(e.state){case wn.disconnected:t="connectionStateConnecting";break;case wn.broken:t="connectionStateBroken";break;case wn.connected:default:t="connectionStateReady"}Da({"@type":"updateConnectionState",connectionState:t})}else if(e instanceof Ye.UpdateNewMessage||e instanceof Ye.UpdateNewScheduledMessage||e instanceof Ye.UpdateNewChannelMessage||e instanceof Ye.UpdateShortChatMessage||e instanceof Ye.UpdateShortMessage){let t,n,s;if(e instanceof Ye.UpdateShortChatMessage)t=pr(sa((a=e).chatId,"chat"),{...a,fromId:ci(sa(a.fromId,"user")),peerId:ci(sa(a.chatId,"chat"))});else if(e instanceof Ye.UpdateShortMessage)t=function(e){return pr(sa(e.userId,"user"),{...e,fromId:ci(e.out?ur:sa(e.userId,"user")),peerId:ci(e.out?sa(e.userId,"user"):ur)})}(e);else{const a=e.message;if(a instanceof Ye.MessageEmpty)return void(c&&console.error("Unexpected update:",e.className,e));Mc(a),t=gr(a),a instanceof Ye.Message&&(n=a.media&&Ao(a.media)),s="replyMarkup"in e.message&&e.message?.replyMarkup instanceof Ye.ReplyKeyboardForceReply&&(!e.message.replyMarkup.selective||t.isMentioned)}if(e instanceof Ye.UpdateNewScheduledMessage?Da({"@type":hd.has(t.id)?"updateScheduledMessage":"newScheduledMessage",id:t.id,chatId:t.chatId,message:t,poll:n}):Da({"@type":!hd.has(t.id)||t.viaBotId||t.content.action?"newMessage":"updateMessage",id:t.id,chatId:t.chatId,message:t,shouldForceReply:s,poll:n}),e.message instanceof Ye.MessageService){const{action:n}=e.message;if(n instanceof Ye.MessageActionChatEditTitle)Da({"@type":"updateChat",id:t.chatId,chat:{title:n.title}});else if(n instanceof Ye.MessageActionChatEditPhoto){const s=n.photo instanceof Ye.Photo&&so(n.photo);if(!s)return;const a=function(e){if(e instanceof Ye.PhotoEmpty)return new Ye.ChatPhotoEmpty;const{dcId:t,id:n}=e;return new Ye.ChatPhoto({dcId:t,photoId:n})}(n.photo),i=fa(e.message);Ta.chats[i]&&(Ta.chats[i].photo=a),Wi(n.photo),Da({"@type":"updateNewProfilePhoto",peerId:t.chatId,photo:s})}else if(n instanceof Ye.MessageActionChatDeletePhoto){const n=fa(e.message);Ta.chats[n]&&(Ta.chats[n].photo=new Ye.ChatPhotoEmpty),Da({"@type":"updateDeleteProfilePhoto",peerId:t.chatId})}else if(n instanceof Ye.MessageActionChatDeleteUser)e._entities&&e._entities.some((e=>e instanceof Ye.User&&Boolean(e.self)&&e.id===n.userId))&&Da({"@type":"updateChat",id:t.chatId,chat:{isForbidden:!0,isNotJoined:!0}});else if(n instanceof Ye.MessageActionChatAddUser)e._entities&&e._entities.some((e=>e instanceof Ye.User&&Boolean(e.self)&&n.users.includes(e.id)))&&Da({"@type":"updateChatJoin",id:t.chatId});else if(n instanceof Ye.MessageActionGroupCall)!n.duration&&n.call&&Da({"@type":"updateGroupCallChatId",chatId:t.chatId,call:{id:n.call.id.toString(),accessHash:n.call.accessHash.toString()}});else if(n instanceof Ye.MessageActionTopicEdit){const t=e.message.replyTo instanceof Ye.MessageReplyHeader?e.message.replyTo:void 0,{replyToMsgId:n,replyToTopId:s,forumTopic:a}=t||{},i=a&&(s||n)||ee;Da({"@type":"updateTopic",chatId:aa(e.message.peerId),topicId:i})}else n instanceof Ye.MessageActionTopicCreate&&Da({"@type":"updateTopics",chatId:aa(e.message.peerId)})}}else if(e instanceof Ye.UpdateQuickReplyMessage){const t=gr(e.message);if(!t)return;Da({"@type":"updateQuickReplyMessage",id:t.id,message:t})}else if(e instanceof Ye.UpdateDeleteQuickReplyMessages)Da({"@type":"deleteQuickReplyMessages",quickReplyId:e.shortcutId,messageIds:e.messages});else if(e instanceof Ye.UpdateQuickReplies)Da({"@type":"updateQuickReplies",quickReplies:e.quickReplies.map(Sr)});else if(e instanceof Ye.UpdateNewQuickReply)Da({"@type":"updateQuickReplies",quickReplies:[Sr(e.quickReply)]});else if(e instanceof Ye.UpdateDeleteQuickReply)Da({"@type":"deleteQuickReply",quickReplyId:e.shortcutId});else if(e instanceof Ye.UpdateEditMessage||e instanceof Ye.UpdateEditChannelMessage){const t=e.message;if(t instanceof Ye.MessageEmpty)return void(c&&console.error("Unexpected update:",e.className,e));Mc(t);const n=ti(gr(t),["isOutgoing"]),s=t instanceof Ye.Message&&t.media?Ao(t.media):void 0;Da({"@type":"updateMessage",id:n.id,chatId:n.chatId,message:n,poll:s})}else if(e instanceof Ye.UpdateMessageReactions)Da({"@type":"updateMessageReactions",id:e.msgId,chatId:aa(e.peer),reactions:Xo(e.reactions)});else if(e instanceof Ye.UpdateMessageExtendedMedia){const t=aa(e.peer),n=e.extendedMedia[0]instanceof Ye.MessageExtendedMedia;if(n){const s=No(e.extendedMedia);if(!s?.length)return;return void Da({"@type":"updateMessageExtendedMedia",id:e.msgId,chatId:t,isBought:n,extendedMedia:s})}const s=n?void 0:e.extendedMedia.filter((e=>e instanceof Ye.MessageExtendedMediaPreview)).map((e=>xo(e))).filter(Boolean);if(!s?.length)return;Da({"@type":"updateMessageExtendedMedia",id:e.msgId,chatId:t,extendedMedia:s})}else if(e instanceof Ye.UpdateDeleteMessages)Da({"@type":"deleteMessages",ids:e.messages});else if(e instanceof Ye.UpdateDeleteScheduledMessages)Da({"@type":"deleteScheduledMessages",ids:e.messages,newIds:e.sentMessages,chatId:aa(e.peer)});else if(e instanceof Ye.UpdateDeleteChannelMessages){const t=sa(e.channelId,"channel");Da({"@type":"deleteMessages",ids:e.messages,chatId:t})}else if(e instanceof Ye.UpdateServiceNotification)if(e.popup)Da({"@type":"error",error:{message:e.message}});else{const t=function(e,t){const n=fr(t),s=So(e);return{id:n,chatId:$,date:e.inboxDate||t,content:s,isInvertedMedia:e.invertMedia,isOutgoing:!1}}(e,Date.now()/1e3+hs());Mc(vi(t.id,t.chatId,e)),Da({"@type":"updateServiceNotification",message:t})}else if(e instanceof Ye.UpdateMessageID||e instanceof Ye.UpdateShortSentMessage)hd.add(e.id);else if(e instanceof Ye.UpdateReadMessagesContents)Da({"@type":"updateCommonBoxMessages",ids:e.messages,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}});else if(e instanceof Ye.UpdateChannelReadMessagesContents)Da({"@type":"updateChannelMessages",channelId:sa(e.channelId,"channel"),ids:e.messages,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}});else if(e instanceof Ye.UpdateMessagePoll){const{pollId:t,poll:n,results:s}=e;if(n){const e=Eo(n,s);Da({"@type":"updateMessagePoll",pollId:String(t),pollUpdate:e})}else{const e=Uo(s);Da({"@type":"updateMessagePoll",pollId:String(t),pollUpdate:{results:e}})}}else if(e instanceof Ye.UpdateMessagePollVote)Da({"@type":"updateMessagePollVote",pollId:String(e.pollId),peerId:aa(e.peer),options:e.options.map(pa)});else if(e instanceof Ye.UpdateChannelMessageViews)Da({"@type":"updateMessage",chatId:sa(e.channelId,"channel"),id:e.id,message:{viewsCount:e.views}});else if(e instanceof Ye.UpdateChannelMessageForwards)Da({"@type":"updateMessage",chatId:sa(e.channelId,"channel"),id:e.id,message:{forwardsCount:e.forwards}});else if(e instanceof Ye.UpdateReadHistoryInbox)Da({"@type":"updateChatInbox",id:aa(e.peer),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof Ye.UpdateReadHistoryOutbox)Da({"@type":"updateChat",id:aa(e.peer),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof Ye.UpdateReadChannelInbox)Da({"@type":"updateChat",id:sa(e.channelId,"channel"),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof Ye.UpdateReadChannelOutbox)Da({"@type":"updateChat",id:sa(e.channelId,"channel"),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof Ye.UpdateReadChannelDiscussionInbox)Da({"@type":"updateThreadInfo",threadInfo:{chatId:sa(e.channelId,"channel"),threadId:e.topMsgId,lastReadInboxMessageId:e.readMaxId}});else if(e instanceof Ye.UpdateReadChannelDiscussionOutbox)Da({"@type":"updateChat",id:sa(e.channelId,"channel"),chat:{lastReadOutboxMessageId:e.readMaxId}});else if(e instanceof Ye.UpdateDialogPinned&&e.peer instanceof Ye.DialogPeer)Da({"@type":"updateChatPinned",id:aa(e.peer.peer),isPinned:e.pinned||!1});else if(e instanceof Ye.UpdatePinnedDialogs)Da({"@type":"updatePinnedChatIds",ids:e.order?e.order.filter((e=>e instanceof Ye.DialogPeer)).map((e=>aa(e.peer))):[],folderId:e.folderId||void 0});else if(e instanceof Ye.UpdateSavedDialogPinned&&e.peer instanceof Ye.DialogPeer)Da({"@type":"updateSavedDialogPinned",id:aa(e.peer.peer),isPinned:e.pinned||!1});else if(e instanceof Ye.UpdatePinnedSavedDialogs)Da({"@type":"updatePinnedSavedDialogIds",ids:e.order?e.order.filter((e=>e instanceof Ye.DialogPeer)).map((e=>aa(e.peer))):[]});else if(e instanceof Ye.UpdateFolderPeers)e.folderPeers.forEach((e=>{const{folderId:t,peer:n}=e;Da({"@type":"updateChatListType",id:aa(n),folderId:t})}));else if(e instanceof Ye.UpdateDialogFilter){const{id:t,filter:n}=e;Da({"@type":"updateChatFolder",id:t,folder:ga(n)?uc(n):void 0})}else if(e instanceof Ye.UpdateDialogFilterOrder)Da({"@type":"updateChatFoldersOrder",orderedIds:e.order});else if(e instanceof Ye.UpdateChatParticipants){const t=cc(e.participants);Da({"@type":"updateChatMembers",id:sa(e.participants.chatId,"chat"),replacedMembers:t})}else if(e instanceof Ye.UpdateChatParticipantAdd){const t=rc(Ya(e,["userId","inviterId","date"]));Da({"@type":"updateChatMembers",id:sa(e.chatId,"chat"),addedMember:t})}else if(e instanceof Ye.UpdateChatParticipantDelete)Da({"@type":"updateChatMembers",id:sa(e.chatId,"chat"),deletedMemberId:sa(e.userId,"user")});else if(e instanceof Ye.UpdatePinnedMessages||e instanceof Ye.UpdatePinnedChannelMessages)Da({"@type":"updatePinnedIds",chatId:e instanceof Ye.UpdatePinnedMessages?aa(e.peer):sa(e.channelId,"channel"),messageIds:e.messages,isPinned:e.pinned});else if(e instanceof Ye.UpdateUserTyping||e instanceof Ye.UpdateChatUserTyping){const t=e instanceof Ye.UpdateUserTyping?sa(e.userId,"user"):sa(e.chatId,"chat");e.action instanceof Ye.SendMessageEmojiInteraction?Da({"@type":"updateStartEmojiInteraction",id:t,emoji:e.action.emoticon,messageId:e.action.msgId,interaction:(s=JSON.parse(e.action.interaction.data),{timestamps:s.a.map((({t:e})=>e))})}):Da({"@type":"updateChatTypingStatus",id:t,typingStatus:dc(e)})}else if(e instanceof Ye.UpdateChannelUserTyping)Da({"@type":"updateChatTypingStatus",id:sa(e.channelId,"channel"),threadId:e.topMsgId,typingStatus:dc(e)});else if(e instanceof Ye.UpdateChannel){const{_entities:t}=e;if(!t)return;const n=t.find((e=>e instanceof Ye.Channel||e instanceof Ye.ChannelForbidden));if(n instanceof Ye.Channel){const t=nc(n);t&&(Da({"@type":"updateChat",id:t.id,chat:t}),Da({"@type":t.isNotJoined?"updateChatLeave":"updateChatJoin",id:sa(e.channelId,"channel")}))}else if(n instanceof Ye.ChannelForbidden){const t=sa(e.channelId,"channel");Da({"@type":"updateChat",id:t,chat:{isRestricted:!0}}),Da({"@type":"updateChatLeave",id:t})}else 0===t.length&&Da({"@type":"resetMessages",id:sa(e.channelId,"channel")})}else if(e instanceof Ye.UpdateDialogUnreadMark&&e.peer instanceof Ye.DialogPeer)Da({"@type":"updateChat",id:aa(e.peer.peer),chat:{hasUnreadMark:e.unread}});else if(e instanceof Ye.UpdateChatDefaultBannedRights)Da({"@type":"updateChat",id:aa(e.peer),chat:{defaultBannedRights:wa(e.defaultBannedRights)}});else if(e instanceof Ye.UpdateUserStatus)Da({"@type":"updateUserStatus",userId:sa(e.userId,"user"),status:Vr(e.status)});else if(e instanceof Ye.UpdateUser)Da({"@type":"updateRequestUserUpdate",id:sa(e.userId,"user")});else if(e instanceof Ye.UpdateUserEmojiStatus){const t=oa(e.emojiStatus);Da({"@type":"updateUserEmojiStatus",userId:sa(e.userId,"user"),emojiStatus:t})}else if(e instanceof Ye.UpdateUserName){const t=sa(e.userId,"user"),n=Ta.users[t];Da({"@type":"updateUser",id:t,user:{...n?.mutualContact&&!n.self?Ya(e,[]):Ya(e,["firstName","lastName"]),usernames:ro(e)}})}else if(e instanceof Ye.UpdateUserPhone){const{userId:t,phone:n}=e;Da({"@type":"updateUser",id:sa(t,"user"),user:{phoneNumber:n}})}else if(e instanceof Ye.UpdatePeerSettings){const{_entities:t,settings:n}=e;if(!t)return;t?.length&&(t.filter((e=>e instanceof Ye.User&&!e.contact)).forEach((e=>{Da({"@type":"deleteContact",id:sa(e.id,"user")})})),t.filter((e=>e instanceof Ye.User&&e.contact)).map(xr).forEach((e=>{e&&Da({"@type":"updateUser",id:e.id,user:{...e,...n&&{settings:pc(n)}}})})))}else if(e instanceof Ye.UpdateNotifySettings){const{notifySettings:t,peer:n}=e,s=n.className,a=Or(t);if(n instanceof Ye.NotifyPeer){const e=aa(n.peer);return fd(e,a.mutedUntil,Da),void Da({"@type":"updateChatNotifySettings",chatId:e,settings:a})}if(n instanceof Ye.NotifyForumTopic){const e=aa(n.peer);return function(e,t,n=0,s){ld({chatId:e,topicId:t,mutedUntil:n},(()=>s({"@type":"updateTopicNotifySettings",chatId:e,topicId:t,settings:{mutedUntil:0}})))}(e,n.topMsgId,a.mutedUntil,Da),void Da({"@type":"updateTopicNotifySettings",chatId:e,topicId:n.topMsgId,settings:a})}const i="NotifyUsers"===s?"users":"NotifyChats"===s?"groups":"NotifyBroadcasts"===s?"channels":void 0;if(!i)return;Da({"@type":"updateDefaultNotifySettings",peerType:i,settings:a})}else if(e instanceof Ye.UpdatePeerBlocked)Da({"@type":"updatePeerBlocked",id:aa(e.peerId),isBlocked:e.blocked,isBlockedFromStories:e.blockedMyStoriesFrom});else if(e instanceof Ye.UpdatePrivacy){const t=function(e){switch(e.className){case"PrivacyKeyPhoneNumber":return"phoneNumber";case"PrivacyKeyAddedByPhone":return"addByPhone";case"PrivacyKeyStatusTimestamp":return"lastSeen";case"PrivacyKeyProfilePhoto":return"profilePhoto";case"PrivacyKeyPhoneCall":return"phoneCall";case"PrivacyKeyPhoneP2P":return"phoneP2P";case"PrivacyKeyForwards":return"forwards";case"PrivacyKeyVoiceMessages":return"voiceMessages";case"PrivacyKeyChatInvite":return"chatInvite";case"PrivacyKeyAbout":return"bio";case"PrivacyKeyBirthday":return"birthday";case"PrivacyKeyStarGiftsAutoSave":return"gifts"}}(e.key);t&&Da({"@type":"updatePrivacy",key:t,rules:co(e.rules)})}else if(e instanceof Ye.UpdateDraftMessage)Da({"@type":"draftMessage",chatId:aa(e.peer),threadId:e.topMsgId,draft:hr(e.draft)});else if(e instanceof Ye.UpdateContactsReset)Da({"@type":"updateResetContactList"});else if(e instanceof Ye.UpdateFavedStickers)Da({"@type":"updateFavoriteStickers"});else if(e instanceof Ye.UpdateRecentStickers)Da({"@type":"updateRecentStickers"});else if(e instanceof Ye.UpdateRecentReactions)Da({"@type":"updateRecentReactions"});else if(e instanceof Ye.UpdateSavedReactionTags)Da({"@type":"updateSavedReactionTags"});else if(e instanceof Ye.UpdateMoveStickerSetToTop)e.masks||Da({"@type":"updateMoveStickerSetToTop",isCustomEmoji:e.emojis,id:e.stickerset.toString()});else if(e instanceof Ye.UpdateStickerSets)Da({"@type":"updateStickerSets"});else if(e instanceof Ye.UpdateStickerSetsOrder)e.masks||Da({"@type":"updateStickerSetsOrder",order:e.order.map((e=>e.toString())),isCustomEmoji:e.emojis});else if(e instanceof Ye.UpdateNewStickerSet){if(e.stickerset instanceof Ye.messages.StickerSet){const t=mo(e.stickerset.set);Da({"@type":"updateStickerSet",id:t.id,stickerSet:t})}}else if(e instanceof Ye.UpdateSavedGifs)Da({"@type":"updateSavedGifs"});else if(e instanceof Ye.UpdateGroupCall)Da({"@type":"updateGroupCall",call:Ec(e.call)});else if(e instanceof Ye.UpdateGroupCallConnection)Da({"@type":"updateGroupCallConnection",data:JSON.parse(e.params.data),presentation:Boolean(e.presentation)});else if(e instanceof Ye.UpdateGroupCallParticipants)Da({"@type":"updateGroupCallParticipants",groupCallId:(n=e.call,n.id.toString()),participants:e.participants.map(kc)});else if(e instanceof Ye.UpdatePendingJoinRequests)Da({"@type":"updatePendingJoinRequests",chatId:aa(e.peer),recentRequesterIds:e.recentRequesters.map((e=>sa(e,"user"))),requestsPending:e.requestsPending});else if(e instanceof Ye.UpdatePhoneCall)Da({"@type":"updatePhoneCall",call:Uc(e.phoneCall)});else if(e instanceof Ye.UpdatePhoneCallSignalingData)Da({"@type":"updatePhoneCallSignalingData",callId:e.phoneCallId.toString(),data:Array.from(e.data)});else if(e instanceof Ye.UpdateWebViewResultSent){const{queryId:t}=e;Da({"@type":"updateWebViewResultSent",queryId:t.toString()})}else if(e instanceof Ye.UpdateBotMenuButton){const{botId:t,button:n}=e;Da({"@type":"updateBotMenuButton",botId:sa(t,"user"),button:zo(n)})}else if(e instanceof Ye.UpdateTranscribedAudio)Da({"@type":"updateTranscribedAudio",transcriptionId:e.transcriptionId.toString(),text:e.text,isPending:e.pending});else if(e instanceof Ye.UpdateConfig)Da({"@type":"updateConfig"});else if(e instanceof Ye.UpdateChannelPinnedTopic)Da({"@type":"updatePinnedTopic",chatId:sa(e.channelId,"channel"),topicId:e.topicId,isPinned:Boolean(e.pinned)});else if(e instanceof Ye.UpdateChannelPinnedTopics)Da({"@type":"updatePinnedTopicsOrder",chatId:sa(e.channelId,"channel"),order:e.order||[]});else if(e instanceof Ye.UpdateRecentEmojiStatuses)Da({"@type":"updateRecentEmojiStatuses"});else if(e instanceof Ye.UpdateStory){const{story:t}=e,n=aa(e.peer),s=Cr(n,t);ji(t,n),t instanceof Ye.StoryItemDeleted?Da({"@type":"deleteStory",peerId:n,storyId:t.id}):Da({"@type":"updateStory",peerId:n,story:s})}else if(e instanceof Ye.UpdateReadStories)Da({"@type":"updateReadStories",peerId:aa(e.peer),lastReadId:e.maxId});else if(e instanceof Ye.UpdateSentStoryReaction){const t=nr(e.reaction);Da({"@type":"updateSentStoryReaction",peerId:aa(e.peer),storyId:e.storyId,reaction:t})}else if(e instanceof Ye.UpdateStoriesStealthMode)Da({"@type":"updateStealthMode",stealthMode:kr(e.stealthMode)});else if(e instanceof Ye.UpdateAttachMenuBots)Da({"@type":"updateAttachMenuBots"});else if(e instanceof Ye.UpdateNewAuthorization)Da({"@type":"updateNewAuthorization",hash:e.hash.toString(),date:e.date,device:e.device,location:e.location,isUnconfirmed:e.unconfirmed});else if(e instanceof Ye.UpdateChannelViewForumAsMessages)Da({"@type":"updateViewForumAsMessages",chatId:sa(e.channelId,"channel"),isEnabled:!!e.enabled||void 0});else if(e instanceof Ye.UpdateStarsBalance)Da({"@type":"updateStarsBalance",balance:sd(e.balance)});else if(e instanceof Ye.UpdatePaidReactionPrivacy)Da({"@type":"updatePaidReactionPrivacy",private:(t=e.private,t instanceof Ye.PaidReactionPrivacyAnonymous?{type:"anonymous"}:t instanceof Ye.PaidReactionPrivacyPeer?{type:"peer",peerId:aa(t.peer)}:{type:"default"})});else if(e instanceof Ye.UpdateLangPackTooLong)Da({"@type":"updateLangPackTooLong",langCode:e.langCode});else if(e instanceof Ye.UpdateLangPack){const{strings:t,keysToRemove:n}=Kr(e.difference.strings);Da({"@type":"updateLangPack",version:e.difference.version,strings:t,keysToRemove:n})}else e instanceof Ms?Da({"@type":"updatePremiumFloodWait",isUpload:e.isUpload}):e instanceof gd||e instanceof pd||c&&ma("UNEXPECTED UPDATE","object"==typeof e&&"className"in e?e.className:e);var t,n,s,a,i}const yd="0",_d=1e3,bd=500;let vd,wd,Sd=!1;const Id=new Map,Pd=new Rc((function(e,t){return("seqStart"in e?e.seqStart:e.seq)-("seqStart"in t?t.seqStart:t.seq)})),Cd=new Map;function Md(e){Ta.commonBoxState.seq=e.seq,Ta.commonBoxState.date=e.date,Ta.commonBoxState.pts=e.pts,Ta.commonBoxState.qts=e.qts}function Rd(e,t,n){if(e instanceof wn)return e.state===wn.connected&&Sd&&Dd(),void md(e);if(e instanceof Sn)md(e);else if(void 0!==Ta.commonBoxState.seq)return e instanceof Ye.Updates||e instanceof Ye.UpdatesCombined?(t&&(e._isFromDifference=!0),void function(e,t){Pd.add(e),t||Td()}(e,n)):"pts"in e?e instanceof Ye.UpdateChannelTooLong?void Vd(Bd(e)):(t&&(e._isFromDifference=!0),void function(e,t){const n=Bd(e),s=Cd.get(n)||new Rc(Ld);s.add(e),Cd.set(n,s),t||Ed(n)}(e,n)):void md(e)}function kd(e,t){if(!(Ta.chats[e]instanceof Ye.Channel))return void(c&&console.error(`[UpdateManager] Channel ${e} not found in localDb`));const n=Ta.channelPtsById[e];n&&n<t?Ud(e):Ta.channelPtsById[e]=t}function Ad(e){if("seq"in e&&e.seq&&(Ta.commonBoxState.seq=e.seq,Ta.commonBoxState.date=e.date),"qts"in e&&(Ta.commonBoxState.qts=e.qts),"pts"in e){const t=Bd(e);t!==yd?Ta.channelPtsById[t]=e.pts:Ta.commonBoxState.pts=e.pts}if(e instanceof Ye.UpdatesCombined||e instanceof Ye.Updates){Cc(e);const t=e.users.concat(e.chats);e.updates.forEach((e=>{t&&(e._entities=t),Rd(e)}))}else md(e)}function Td(){if(!Pd.size)return;const e=Pd.pop(),t=Ta.commonBoxState.seq,n="seqStart"in e?e.seqStart:e.seq;if(0===n||e._isFromDifference&&n>=t+1)Ad(e);else if(n===t+1)clearTimeout(wd),wd=void 0,Ad(e);else if(n>t+1)return Pd.add(e),void Dd();Td()}function Ed(e){const t=Cd.get(e);if(!t?.size)return;const n=t.pop(),s=e===yd?Ta.commonBoxState.pts:Ta.channelPtsById[e],a=n.pts,i=Od(n);if(void 0!==s){if(n._isFromDifference&&a>=s+i)Ad(n);else if(a===s+i)clearTimeout(Id.get(e)),Id.delete(e),Ad(n);else if(a>s+i)return t.add(n),void(e===yd?Dd():Ud(e));Ed(e)}}function Ud(e){if(Id.has(e))return;const t=setTimeout((async()=>{await Vd(e),Id.delete(e)}),bd);Id.set(e,t)}function Dd(){wd||(wd=setTimeout((async()=>{await xd(),wd=void 0}),bd))}function Bd(e){return"channelId"in e&&"pts"in e?sa(e.channelId,"channel"):e instanceof Ye.UpdateNewChannelMessage||e instanceof Ye.UpdateEditChannelMessage?sa(e.message.peerId.channelId,"channel"):yd}async function xd(){if(!Sd)throw new Error("UpdatesManager not initialized");if(!Ta.commonBoxState?.date)return void Nd();Da({"@type":"updateFetchingDifference",isFetching:!0});const e=await vd(new Ye.updates.GetDifference({pts:Ta.commonBoxState.pts,date:Ta.commonBoxState.date,qts:Ta.commonBoxState.qts}));if(!e||e instanceof Ye.updates.DifferenceTooLong)Nd();else{if(e instanceof Ye.updates.DifferenceEmpty)return Ta.commonBoxState.seq=e.seq,Ta.commonBoxState.date=e.date,void Da({"@type":"updateFetchingDifference",isFetching:!1});Hd(e),Md(e instanceof Ye.updates.DifferenceSlice?e.intermediateState:e.state),e instanceof Ye.updates.DifferenceSlice?xd():Da({"@type":"updateFetchingDifference",isFetching:!1})}}async function Vd(e){const t=Ta.chats[e];if(!(t&&t instanceof Ye.Channel&&t.accessHash&&Ta.channelPtsById[e]))return void(c&&console.error("[UpdateManager] Channel for difference not found",e,t));const n=await vd(new Ye.updates.GetChannelDifference({channel:fi(e,t.accessHash.toString()),pts:Ta.channelPtsById[e],filter:new Ye.ChannelMessagesFilterEmpty,limit:_d}));n?n instanceof Ye.updates.ChannelDifferenceTooLong?Nd():(Ta.channelPtsById[e]=n.pts,n instanceof Ye.updates.ChannelDifferenceEmpty?Ed(e):(Hd(n,e),n.final||Vd(e))):c&&console.warn("[UpdatesManager] Failed to get ChannelDifference",e,t)}function Nd(){Fd(),Da({"@type":"requestSync"}),qd()}function Fd(){Cd.clear(),Pd.clear(),clearTimeout(wd),wd=void 0,Id.forEach((e=>{clearTimeout(e)})),Id.clear(),Ta.commonBoxState={},Object.keys(Ta.channelPtsById).forEach((e=>{Ta.channelPtsById[e]=0})),Sd=!1}function Gd(e,t){const n="chatTypeChannel"===e.type||"chatTypeSuperGroup"===e.type?Ti(e.id,"channel"):void 0;var s,a,i;Rd((s=t.pts,a=t.ptsCount,(i=n)?new pd(i,s,a):new gd(s,a)))}async function qd(){const e=await vd(new Ye.updates.GetState);e&&(Md(e),Sd=!0)}function Hd(e,t){e.newMessages.forEach((e=>{md(new Ye.UpdateNewMessage({message:e,pts:0,ptsCount:0}))})),Cc(e);const n=new Set;e.otherUpdates.forEach((e=>{const t=Bd(e);e instanceof Ye.UpdateChannelTooLong&&n.add(Bd(e));const s=!n.has(t);Rd(e,s,!s)})),t?Ed(t):Td()}function Od(e){return"ptsCount"in e?e.ptsCount:0}function Ld(e,t){const n=e.pts-t.pts;return 0!==n?n:Od(t)-Od(e)}const jd={};function Wd(){Da({"@type":"updateWebAuthTokenFailed"})}function zd(){return Da(Zd("authorizationStateWaitPhoneNumber")),new Promise(((e,t)=>{jd.resolve=e,jd.reject=t}))}function Kd(e=!1){return Da({...Zd("authorizationStateWaitCode"),isCodeViaApp:e}),new Promise(((e,t)=>{jd.resolve=e,jd.reject=t}))}function $d(e,t){return Da({...Zd("authorizationStateWaitPassword"),hint:e,noReset:t}),new Promise((e=>{jd.resolve=e}))}function Jd(){return Da(Zd("authorizationStateWaitRegistration")),new Promise((e=>{jd.resolve=e}))}function Qd(e){return Da({...Zd("authorizationStateWaitQrCode"),qrCode:{token:btoa(String.fromCharCode(...e.token)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),expires:e.expires}}),new Promise(((e,t)=>{jd.reject=t}))}function Xd(e){const{messageKey:t}=_a(e);Da({"@type":"updateAuthorizationError",errorKey:t})}function Zd(e){return{"@type":"updateAuthorizationState",authorizationState:e}}function Yd(e){jd.resolve&&jd.resolve(e)}function eu(e){jd.resolve&&jd.resolve(e)}function tu(e){jd.resolve&&jd.resolve(e)}function nu(e){const{firstName:t,lastName:n}=e;jd.resolve&&jd.resolve([t,n])}function su(){jd.reject&&jd.reject(new Error("RESTART_AUTH"))}function au(){jd.reject&&jd.reject(new Error("RESTART_AUTH_WITH_QR"))}const iu=self.caches;let ou;async function ru(){return!!iu&&(ou=ou??await iu.has("test").then((()=>!0)).catch((()=>!1)),ou)}let cu=function(e){return e[e.Text=0]="Text",e[e.Blob=1]="Blob",e[e.Json=2]="Json",e[e.ArrayBuffer=3]="ArrayBuffer",e}({});async function du(e,t,n,s=!1){if(iu)try{const a=r?`${d}/${t.replace(/:/g,"_")}`:new Request(t.replace(/:/g,"_")),i=await iu.open(e),o=await i.match(a);if(!o)return;const c=o.headers.get("Content-Type");switch(n){case cu.Text:return await o.text();case cu.Blob:{if(t.startsWith("avatar")&&c&&c.startsWith("text"))return;const e=await o.blob(),n=!e.type||!s&&e.type.includes("html");let a=e.type||c;return n&&a?(s||(a=a.replace(/html/gi,"")),new Blob([e],{type:a})):e}case cu.Json:return await o.json();case cu.ArrayBuffer:return await o.arrayBuffer();default:return}}catch(e){return void console.warn(e)}}async function uu(e,t,n){if(!iu)return!1;try{const s="string"==typeof n||n instanceof Blob||n instanceof ArrayBuffer?n:JSON.stringify(n),a=r?`${d}/${t.replace(/:/g,"_")}`:new Request(t.replace(/:/g,"_")),i=new Response(s),o=await iu.open(e);return await o.put(a,i),!0}catch(e){return console.warn(e),!1}}async function lu(e,t){try{if(!iu)return;const n=await iu.open(e);return await n.delete(t)}catch(e){return void console.warn(e)}}async function fu(e){try{if(!iu)return;return await iu.delete(e)}catch(e){return void console.warn(e)}}const gu=new Set(["sticker","wallpaper","photo","webDocument","document"]),pu=new Set(["s","m","x","y","w","a","b","c","d"]),hu=new Set(["u","v"]);async function mu({url:e,mediaFormat:t,start:n,end:a,isHtmlAllowed:i},o,r){const{data:c,mimeType:d,fullSize:h}=await async function(e,t,n,s,a,i){const o=_u(e);if(!o)return;const{entityType:r,entityId:c,sizeType:d,params:u,mediaMatchType:l}=o;if("staticMap"===r){const e=fe()(c),n=new URLSearchParams(u),s=Number(n.get("long")),a=Number(n.get("lat")),i=Number(n.get("w")),o=Number(n.get("h")),r=Number(n.get("zoom")),d=Number(n.get("scale")),l=n.get("accuracy_radius"),f=l?Number(l):void 0;return{mimeType:"image/png",data:await t.downloadStaticMap(e,s,a,i,o,r,d,f)}}let f;switch(r){case"channel":case"chat":f=Ta.chats[c];break;case"user":f=Ta.users[c];break;case"sticker":case"wallpaper":case"document":f=Ta.documents[c];break;case"photo":f=Ta.photos[c];break;case"stickerSet":f=Ta.stickerSets[c];break;case"webDocument":f=Ta.webDocuments[c]}if(f){if(gu.has(r)){const e=await t.downloadMedia(f,{sizeType:d,start:s,end:a,progressCallback:n,workers:p});let o,r;return d&&pu.has(d)?o="image/jpeg":d&&hu.has(d)?o="video/mp4":f instanceof Ye.Photo?o="image/jpeg":f instanceof Ye.WebDocument?(o=f.mimeType,r=f.size):f instanceof Ye.Document&&(o=f.mimeType,r=f.size.toJSNumber()),!i&&o&&(o=o.replace(/html/gi,"")),{mimeType:o,data:e,fullSize:r}}if("stickerSet"===r){const e=await t.downloadStickerSetThumb(f);return{mimeType:e&&yu(e),data:e}}{const e=await t.downloadProfilePhoto(f,"profile"===l);return{mimeType:e&&yu(e),data:e}}}}(e,o,r,n,a,i)||{};if(!c)return;const m=await async function(e,t,n){if(e instanceof File)return e;switch(t){case Oa.BlobUrl:return new Blob([e],{type:n});case Oa.Text:return e.toString();case Oa.Progressive:case Oa.DownloadUrl:return e.buffer}}(c,t,d);if(!m)return;const y=t!==Oa.Progressive&&(t!==Oa.BlobUrl||m.size<=g);return!u&&s&&y&&uu(e.startsWith("avatar")?f:l,e,m),{dataBlob:t===Oa.Progressive?"":m,arrayBuffer:t===Oa.Progressive?m:void 0,mimeType:d,fullSize:h}}function yu(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 _u(e){const t=e.startsWith("staticMap")?e.match(/(staticMap):([0-9-]+)(\?.+)/):e.startsWith("webDocument")?e.match(/(webDocument):(.+)/):e.match(/(avatar|profile|photo|stickerSet|sticker|wallpaper|document)([-\d\w./]+)(?::\d+)?(\?size=\w+)?/);if(!t)return;const n=t[1],s=t[2];let a;const i=t[3],o=i?.replace("?size=","")||void 0;return a="avatar"===t[1]||"profile"===t[1]?ri(s):t[1],{mediaMatchType:n,entityType:a,entityId:s,sizeType:o,params:i}}class bu extends AbortController{constructor(...e){var t,n,s,a;super(...e),t=this,n="threads",s=new Map,(n="symbol"==typeof(a=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n))?a:a+"")in t?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s}getThreadSignal(e){let t=this.threads.get(e);return t||(t=new AbortController,this.threads.set(e,t)),t.signal}abortThread(e,t){this.threads.get(e)?.abort(t),this.threads.delete(e)}abort(e){super.abort(e),this.threads.forEach((t=>t.abort(e))),this.threads.clear()}}const vu="Unknown UserAgent",wu="Unknown platform";$t.setLevel("warn");const Su={build:e=>e},Iu=new Map,Pu=new Map;let Cu,Mu;function Ru({isPremium:e}){Cu.setIsPremium(e)}const ku=2500;async function Au(e=!1,t=!1){!e&&Cu.isConnected()&&await Promise.race([Du(new Ye.auth.LogOut),ce(ku)]),t||(Object.assign(Aa,ka()),Fd()),await Cu.destroy()}async function Tu(){await Cu.disconnect()}function Eu(e){Da({"@type":"updateSession",sessionData:e})}function Uu(e){Rd(e),e instanceof Ye.UpdatesTooLong?async function(){try{await Du(new Ye.users.GetFullUser({id:new Ye.InputUserSelf}),{shouldThrow:!0})}catch(e){"AUTH_KEY_UNREGISTERED"!==e.errorMessage&&"SESSION_REVOKED"!==e.errorMessage||Da({"@type":"updateConnectionState",connectionState:"connectionStateBroken"})}}():("updates"in e?e.updates:[e]).forEach((e=>{if(!(e instanceof Ye.UpdateConfig))return;const t=e._entities?.find((e=>e instanceof Ye.User&&sa(e.id,"user")===Mu));t instanceof Ye.User&&Ru({isPremium:Boolean(t.premium)})}))}async function Du(e,t={}){const{shouldThrow:n,shouldIgnoreUpdates:s,dcId:a,shouldIgnoreErrors:i,abortControllerChatId:o,abortControllerThreadId:r,shouldRetryOnTimeout:d,abortControllerGroup:u}=t,l=Boolean(t.shouldReturnTrue);let f;if(o){let e=Iu.get(o);e||(e=new bu,Iu.set(o,e)),f=r?e.getThreadSignal(r):e.signal}if(u){let e=Pu.get(u);e||(e=new AbortController,Pu.set(u,e)),f=e.signal}try{c&&ma("INVOKE",e.className);const t=await Cu.invoke(e,a,f,d);return Cc(t),c&&ma("RESPONSE",e.className,t),!s&&function(e){return e instanceof Ye.UpdatesTooLong||e instanceof Ye.UpdateShortMessage||e instanceof Ye.UpdateShortChatMessage||e instanceof Ye.UpdateShort||e instanceof Ye.UpdatesCombined||e instanceof Ye.Updates||e instanceof Ye.UpdateShortSentMessage}(t)&&Rd(t),l?t&&!0:t}catch(t){if(i)return;if(c&&(ma("INVOKE ERROR",e.className),console.debug("invokeRequest failed with payload",e),console.error(t)),n)throw t;return void function(e,t){const n=e instanceof tt?e.errorMessage:e.message;Da({"@type":"error",error:{message:n,isSlowMode:"FLOOD"===n&&(t instanceof Ye.messages.SendMessage||t instanceof Ye.messages.SendMedia||t instanceof Ye.messages.SendMultiMedia),hasErrorKey:!0}})}(t,e)}}function Bu(e,t){c&&ma("BEACON",e.className),Cu.invokeBeacon(e,t)}async function xu(e,t){try{return await mu(e,Cu,t)}catch(n){if(n instanceof tt){if(n.errorMessage.startsWith("FILE_REFERENCE")){if(await Hu({url:e.url}))return mu(e,Cu,t);c&&console.error("Failed to repair file reference",e.url)}if("FILE_ID_INVALID"===n.errorMessage&&e.url.includes("avatar"))return void(c&&console.warn("Inaccessible avatar image",e.url))}throw c&&console.error("Failed to download media",e.url,n),n}}function Vu(e,t){return Cu.uploadFile({file:e,onProgress:t,workers:h})}function Nu(e){return Cu.updateTwoFaSettings(e)}function Fu(e){const{chatId:t,threadId:n}=e,s=Iu.get(t);if(!n)return s?.abort("Chat change"),void Iu.delete(t);s?.abortThread(n,"Thread change")}function Gu(e){Pu.get(e)?.abort(),Pu.delete(e)}async function qu(){const e=await Du(new Ye.users.GetFullUser({id:new Ye.InputUserSelf}));if(!(e&&e.users[0]instanceof Ye.User))return;const t=e.users[0];Ji(t);const n=Br(e),s=xr(t);var a;a=s.id,ur=a,function(e,t){Da({"@type":"updateCurrentUser",currentUser:e,currentUserFullInfo:t})}(s,n),Mu=s.id,Ru({isPremium:Boolean(s.isPremium)})}async function Hu({url:e}){const t=_u(e);if(!t)return;const{entityId:n,mediaMatchType:s}=t;if("document"===s||"photo"===s||"webDocument"===s){const e="document"===s?Ta.documents[n]:"webDocument"===s?Ta.webDocuments[n]:Ta.photos[n];if(!e)return!1;const t=e;if(!t.localRepairInfo)return!1;const{localRepairInfo:a}=t;if("story"===a.type)return await async function(e,t){const n=li(e);if(!n)return!1;const s=await Du(new Ye.stories.GetStoriesByID({peer:n,id:[t]}),{shouldIgnoreErrors:!0});return!!s&&(s.stories.forEach((t=>{const n=Cr(e,t);n&&!("isDeleted"in n)&&(ji(t,e),Da({"@type":"updateStory",peerId:e,story:n}))})),!0)}(a.peerId,a.id);if("message"===a.type)return await async function(e,t){const n=ri(e),s=li(e);if(!s)return!1;const a=await Du("channel"===n?new Ye.channels.GetMessages({channel:s,id:[new Ye.InputMessageID({id:t})]}):new Ye.messages.GetMessages({id:[new Ye.InputMessageID({id:t})]}),{shouldIgnoreErrors:!0});if(!a||a instanceof Ye.messages.MessagesNotModified)return!1;s&&"pts"in a&&kd(e,a.pts);const i=a.messages[0];if(i instanceof Ye.MessageEmpty)return!1;Mc(i);const o=gr(i);return o&&Da({"@type":"updateMessage",chatId:o.chatId,id:o.id,message:o}),!0}(a.peerId,a.id)}return!1}function Ou(e){Cu.setForceHttpTransport(e)}function Lu(e){Cu.setAllowHttpTransport(e)}function ju(e){Cu.setShouldDebugExportedSenders(e)}function Wu(e){Ud(e)}async function zu({peer:e,reason:t,description:n}){return await Du(new Ye.account.ReportPeer({peer:di(e.id,e.accessHash),reason:ki(t),message:n}))}async function Ku({peer:e,photo:t,reason:n,description:s}){const a=Si(t);if(a)return await Du(new Ye.account.ReportProfilePhoto({peer:di(e.id,e.accessHash),photoId:a,reason:ki(n),message:s}))}async function $u({hash:e,areCallsEnabled:t,areSecretChatsEnabled:n,isConfirmed:s}){return await Du(new Ye.account.ChangeAuthorizationSettings({hash:fe()(e),...void 0!==t?{callRequestsDisabled:!t}:void 0,...void 0!==n?{encryptedRequestsDisabled:!n}:void 0,...s&&{confirmed:s}}))}async function Ju({days:e}){return await Du(new Ye.account.SetAuthorizationTTL({authorizationTtlDays:e}))}async function Qu({slug:e}){const t=await Du(new Ye.account.ResolveBusinessChatLink({slug:e}),{shouldIgnoreErrors:!0});var n;if(t)return{chatLink:{chatId:aa((n=t).peer),text:Io(n.message,n.entities)}}}function Xu({enabled:e}){return Du(new Ye.account.ToggleSponsoredMessages({enabled:e}),{shouldReturnTrue:!0})}async function Zu({limit:e,offsetDate:t,offsetPeer:n,offsetId:s,archived:a,withPinned:i,lastLocalServiceMessageId:o}){const r=n&&di(n.id,n.accessHash)||new Ye.InputPeerEmpty,c=await Du(new Ye.messages.GetDialogs({offsetPeer:r,offsetId:s,limit:e,offsetDate:t,folderId:a?Z:void 0,...i&&{excludePinned:!0}})),d=i?await Du(new Ye.messages.GetPinnedDialogs({folderId:a?Z:void 0})):void 0;if(!c||c instanceof Ye.messages.DialogsNotModified)return;const u=(d?d.messages:[]).concat(c.messages).map(gr).filter(Boolean),l=Wl(c);d&&Object.assign(l,Wl(d,l));const f=[],g={},p={},h=(d?.dialogs||[]).concat(c.dialogs),m=[],y={};h.forEach((e=>{if(!(e instanceof Ye.Dialog)||!a&&e.folderId===Z||a&&e.folderId!==Z)return;const t=Zr(e,l[ac(e.peer)]);y[t.id]=e.topMessage,e.pts&&kd(t.id,e.pts),t.id===$&&o&&o>e.topMessage&&(y[t.id]=o),t.isListed=!0,f.push(t);const n=Or(e.notifySettings);if(Object.values(ni(n)).length&&(p[t.id]=n,fd(t.id,n.mutedUntil,Da)),i&&e.pinned&&m.push(t.id),e.draft){const n=hr(e.draft);n&&(g[t.id]=n)}}));const _=f.map((e=>e.id)),b=c.users.map(xr).filter(Boolean),v=Nr((d?.users||[]).concat(c.users));let w;w=c instanceof Ye.messages.DialogsSlice?c.count:_.length;const S=f[f.length-1],I=y[S?.id],P=I,C=S?.id,M=u.reverse().find((e=>e.chatId===S?.id&&e.id===I))?.date;return{chatIds:_,chats:f,users:b,userStatusesById:v,draftsById:g,orderedPinnedIds:i?m:void 0,totalChatCount:w,lastMessageByChatId:y,messages:u,notifyExceptionById:p,nextOffsetId:P,nextOffsetPeerId:C,nextOffsetDate:M}}async function Yu({limit:e,offsetDate:t,offsetPeer:n,offsetId:s,withPinned:a}){const i=n&&di(n.id,n.accessHash)||new Ye.InputPeerEmpty,o=await Du(new Ye.messages.GetSavedDialogs({offsetPeer:i,offsetId:s,limit:e,offsetDate:t,...a&&{excludePinned:!0}})),r=a?await Du(new Ye.messages.GetPinnedSavedDialogs):void 0;if(!o||o instanceof Ye.messages.SavedDialogsNotModified)return;const c=r&&!(r instanceof Ye.messages.SavedDialogsNotModified),d=(c?r.messages:[]).concat(o.messages).map(gr).filter(Boolean),u=Wl(o);c&&Object.assign(u,Wl(r,u));const l=(c?r.dialogs:[]).concat(o.dialogs),f=[],g=[],p={},h=[];l.forEach((e=>{const t=function(e,t){const{peer:n}=e;return{id:aa(n),type:sc(t),title:ic(n,t),...Xr(t)}}(e,u[ac(e.peer)]),n=aa(e.peer);f.push(n),a&&e.pinned&&g.push(n),p[n]=e.topMessage,h.push(t)}));const m=o.users.map(xr).filter(Boolean),y=Nr((c?r.users:[]).concat(o.users));let _;_=o instanceof Ye.messages.SavedDialogsSlice?o.count:f.length;const b=h[h.length-1],v=p[b?.id],w=v,S=b?.id,I=d.reverse().find((e=>e.chatId===b?.id&&e.id===v))?.date;return{chatIds:f,chats:h,users:m,userStatusesById:y,orderedPinnedIds:a?g:void 0,totalChatCount:_,lastMessageByChatId:p,messages:d,draftsById:{},notifyExceptionById:{},nextOffsetId:w,nextOffsetPeerId:S,nextOffsetDate:I}}function el(e){const{id:t,accessHash:n}=e;return fi(t,n)instanceof Ye.InputChannel?async function(e){const{id:t,adminRights:n}=e,s=e.accessHash,a=await Du(new Ye.channels.GetFullChannel({channel:fi(t,s)}));if(!(a&&a.fullChat instanceof Ye.ChannelFull))return;const{about:i,onlineCount:o,exportedInvite:r,slowmodeSeconds:c,slowmodeNextSendDate:d,migratedFromChatId:u,migratedFromMaxId:l,canViewParticipants:f,canViewStats:g,linkedChatId:p,hiddenPrehistory:h,call:m,botInfo:y,availableReactions:_,reactionsLimit:b,defaultSendAs:v,requestsPending:w,recentRequesters:S,statsDc:I,participantsCount:P,stickerset:C,chatPhoto:M,participantsHidden:R,translationsDisabled:k,storiesPinnedAvailable:A,viewForumAsMessages:T,emojiset:E,boostsApplied:U,boostsUnrestrict:D,botVerification:B,canViewRevenue:x,paidReactionsAvailable:V,hasScheduled:N,stargiftsCount:F,stargiftsAvailable:G}=a.fullChat;M&&Wi(M);const q=r instanceof Ye.ChatInviteExported?r.link:void 0,{members:H,userStatusesById:O}=f&&await xl({chat:e})||{},{members:L,userStatusesById:j}=f&&n&&await xl({chat:e,memberFilter:"kicked"})||{},{members:W,userStatusesById:z}=f&&await xl({chat:e,memberFilter:"admin"})||{},K=y?fc(y):void 0,$=e.isNotJoined||"chatTypeChannel"!==e.type?void 0:await Vl({chat:e}),J=$?.member,Q=J?.joinedDate?{joinedDate:J.joinedDate,inviterId:J.inviterId,isViaRequest:J.isViaRequest}:void 0,X=a.chats.map((e=>nc(e))).filter(Boolean);if(a?.chats?.length>1){const[,e]=a.chats,t=nc(e);t&&Da({"@type":"updateChat",id:t.id,chat:t})}a.fullChat.pts&&kd(e.id,a.fullChat.pts);const Z={...O,...j,...z};return{fullInfo:{...M instanceof Ye.Photo&&{profilePhoto:so(M)},about:i,onlineCount:o,inviteLink:q,slowMode:c?{seconds:c,nextSendDate:d}:void 0,migratedFrom:u?{chatId:sa(u,"chat"),maxMessageId:l}:void 0,canViewMembers:f,canViewStatistics:g,canViewMonetization:x,isPreHistoryHidden:h,joinInfo:Q,members:H,kickedMembers:L,adminMembersById:W?Xa(W,"userId"):void 0,groupCallId:m?String(m.id):void 0,linkedChatId:p?sa(p,"channel"):void 0,botCommands:K,enabledReactions:hc(_),reactionsLimit:b,sendAsId:v?aa(v):void 0,requestsPending:w,recentRequesterIds:S?.map((e=>sa(e,"user"))),statisticsDcId:I,stickerSet:C?mo(C):void 0,emojiSet:E?mo(E):void 0,areParticipantsHidden:R,isTranslationDisabled:k,hasPinnedStories:Boolean(A),boostsApplied:U,boostsToUnrestrict:D,botVerification:B&&go(B),isPaidReactionAvailable:V,hasScheduledMessages:N,starGiftCount:F,areStarGiftsAvailable:Boolean(G)},chats:X,userStatusesById:Z,groupCall:m?{chatId:t,isLoaded:!1,id:m.id.toString(),accessHash:m?.accessHash.toString(),participants:{},version:0,participantsCount:0,connectionState:"disconnected"}:void 0,membersCount:P,...T&&{isForumAsMessages:!0}}}(e):async function(e){const t=await Du(new Ye.messages.GetFullChat({chatId:fi(e)}));if(!(t&&t.fullChat instanceof Ye.ChatFull))return;const{about:n,participants:s,exportedInvite:a,botInfo:i,call:o,availableReactions:r,recentRequesters:c,requestsPending:d,chatPhoto:u,translationsDisabled:l,reactionsLimit:f,hasScheduled:g}=t.fullChat;u&&Wi(u);const p=cc(s),h=p?p.filter((({isAdmin:e,isOwner:t})=>e||t)):void 0,m=i?fc(i):void 0,y=a instanceof Ye.ChatInviteExported?a.link:void 0,_=Nr(t.users),b=t.chats.map((e=>nc(e))).filter(Boolean);return{fullInfo:{...u instanceof Ye.Photo&&{profilePhoto:so(u)},about:n,members:p,adminMembersById:h?Xa(h,"userId"):void 0,canViewMembers:!0,botCommands:m,inviteLink:y,groupCallId:o?.id.toString(),enabledReactions:hc(r),reactionsLimit:f,requestsPending:d,recentRequesterIds:c?.map((e=>sa(e,"user"))),isTranslationDisabled:l,isPreHistoryHidden:!0,hasScheduledMessages:g},chats:b,userStatusesById:_,groupCall:o?{chatId:e,isLoaded:!1,id:o.id.toString(),accessHash:o.accessHash.toString(),connectionState:"disconnected",participantsCount:0,version:0,participants:{}}:void 0,membersCount:p?.length}}(t)}async function tl(e){const{id:t,accessHash:n}=e,s=await Du(new Ye.messages.GetPeerSettings({peer:di(t,n)}),{abortControllerChatId:t});if(s)return{settings:pc(s.settings)}}async function nl({query:e}){const t=await Du(new Ye.contacts.Search({q:e,limit:m}));if(!t)return;const n=t.myResults.map(aa),s=t.results.map(aa).filter((e=>!n.includes(e)));return{accountResultIds:n,globalResultIds:s}}async function sl({type:e,user:t}){let n;if("self"===e||"user"===e){const s=await Du(new Ye.users.GetUsers({id:["user"===e&&t?fi(t.id,t.accessHash):new Ye.InputUserSelf]}));if(!s||!s.length)return;[n]=s}else if("support"===e){const e=await Du(new Ye.help.GetSupport);if(!e||!e.user)return;n=e.user}const s=nc(n,"support"===e);if(s)return Da({"@type":"updateChat",id:s.id,chat:s}),{chatId:s.id}}async function al({chat:e,lastLocalMessage:t,noLastMessage:n}){const{id:s,accessHash:a}=e,i=await Du(new Ye.messages.GetPeerDialogs({peers:[new Ye.InputDialogPeer({peer:di(s,a)})]}));if(!i)return;const o=i.dialogs[0];if(!(o&&o instanceof Ye.Dialog))return;const r=Wl(i)[ac(o.peer)];if(!r)return;const c=gr(i.messages[0]),d=t&&(!c||t.date>c.date)?t:c,u=Zr(o,r);Da({"@type":"updateChat",id:s,chat:u}),!n&&d&&Da({"@type":"updateChatLastMessage",id:s,lastMessage:d}),Md(i.state);const l=Or(o.notifySettings);fd(u.id,l.mutedUntil,Da)}function il({chat:e,draft:t}){return Du(new Ye.messages.SaveDraft({peer:di(e.id,e.accessHash),message:t?.text?.text||"",entities:t?.text?.entities?.map(wi),replyTo:t?.replyInfo&&Gi(t.replyInfo)}))}function ol({chat:e,settings:t}){Du(new Ye.account.UpdateNotifySettings({peer:new Ye.InputNotifyPeer({peer:di(e.id,e.accessHash)}),settings:new Ye.InputPeerNotifySettings({muteUntil:t.mutedUntil,showPreviews:t.shouldShowPreviews,silent:t.isSilentPosting})})),Da({"@type":"updateChatNotifySettings",chatId:e.id,settings:t}),al({chat:e,noLastMessage:!0})}function rl({chat:e,topicId:t,isMuted:n,mutedUntil:s=0}){n&&!s&&(s=E),Du(new Ye.account.UpdateNotifySettings({peer:new Ye.InputNotifyForumTopic({peer:di(e.id,e.accessHash),topMsgId:t}),settings:new Ye.InputPeerNotifySettings({muteUntil:s})})),Da({"@type":"updateTopicNotifySettings",chatId:e.id,topicId:t,settings:{mutedUntil:s}})}async function cl({title:e,about:t="",users:n}){const s=await Du(new Ye.channels.CreateChannel({broadcast:!0,title:e,about:t}),{shouldThrow:!0});if(!(s instanceof Ye.Updates))return void(c&&console.error("Unexpected channel creation update",s));const a=s.chats[0];if(!(a&&a instanceof Ye.Channel))return void(c&&console.error("Created channel not found",s));const i=nc(a);let o;if(n?.length){const e=await Du(new Ye.channels.InviteToChannel({channel:fi(i.id,i.accessHash),users:n.map((({id:e,accessHash:t})=>fi(e,t)))}));if(!e)return;Uu(e.updates),o=e.missingInvitees.map(bc)}return{channel:i,missingUsers:o}}function dl({channelId:e,accessHash:t}){return Du(new Ye.channels.JoinChannel({channel:fi(e,t)}),{shouldReturnTrue:!0,shouldThrow:!0})}function ul({chat:e,user:t,shouldRevokeHistory:n}){if("chatTypeBasicGroup"===e.type)return Du(new Ye.messages.DeleteChatUser({chatId:fi(e.id,e.accessHash),userId:fi(t.id,t.accessHash),revokeHistory:n||void 0}),{shouldReturnTrue:!0})}function ll({chatId:e}){return Du(new Ye.messages.DeleteChat({chatId:fi(e)}),{shouldReturnTrue:!0})}function fl({channelId:e,accessHash:t}){return Du(new Ye.channels.LeaveChannel({channel:fi(e,t)}),{shouldReturnTrue:!0})}function gl({channelId:e,accessHash:t}){return Du(new Ye.channels.DeleteChannel({channel:fi(e,t)}),{shouldReturnTrue:!0})}async function pl({title:e,users:t}){const n=await Du(new Ye.messages.CreateChat({title:e,users:t.map((({id:e,accessHash:t})=>fi(e,t)))}));if(!n)return;Uu(n.updates);const s=n.missingInvitees.map(bc),a=n.updates.chats[0];if(a&&a instanceof Ye.Chat)return{chat:nc(a),missingUsers:s};c&&console.error("Created chat not found",n.updates)}async function hl({chatId:e,accessHash:t,photo:n}){const s=fi(e,t);let a;if(n instanceof File){const e=await Vu(n);a=new Ye.InputChatUploadedPhoto({file:e})}else if(n){const e=Si(n);if(!e)return!1;a=new Ye.InputChatPhoto({id:e})}else a=new Ye.InputChatPhotoEmpty;return Du(s instanceof Ye.InputChannel?new Ye.channels.EditPhoto({channel:s,photo:a}):new Ye.messages.EditChatPhoto({chatId:s,photo:a}),{shouldReturnTrue:!0})}async function ml({chat:e,shouldBePinned:t}){const{id:n,accessHash:s}=e;await Du(new Ye.messages.ToggleDialogPin({peer:new Ye.InputDialogPeer({peer:di(n,s)}),pinned:t||void 0}))&&Da({"@type":"updateChatPinned",id:e.id,isPinned:t})}async function yl({chat:e,shouldBePinned:t}){const{id:n,accessHash:s}=e;await Du(new Ye.messages.ToggleSavedDialogPin({peer:new Ye.InputDialogPeer({peer:di(n,s)}),pinned:t||void 0}))&&Da({"@type":"updateSavedDialogPinned",id:e.id,isPinned:t})}function _l({chat:e,folderId:t}){const{id:n,accessHash:s}=e;return Du(new Ye.folders.EditPeerFolders({folderPeers:[new Ye.InputFolderPeer({peer:di(n,s),folderId:t})]}),{shouldReturnTrue:!0})}async function bl(){const e=await Du(new Ye.messages.GetDialogFilters);if(!e)return;const{filters:t}=e,n=t.findIndex((e=>e instanceof Ye.DialogFilterDefault)),s=t.filter(ga),a=s.map((({id:e})=>e));return-1!==n&&a.splice(n,0,X),{byId:Xa(s.map(uc),"id"),orderedIds:a}}async function vl(){const e=await Du(new Ye.messages.GetSuggestedDialogFilters);if(e)return e.map(lc).filter(Boolean)}async function wl({id:e,folderUpdate:t}){t.excludedChatIds=t.excludedChatIds.filter((e=>!t.includedChatIds.includes(e)));const n=function(e){const{emoticon:t,contacts:n,nonContacts:s,groups:a,channels:i,bots:o,excludeArchived:r,excludeMuted:c,excludeRead:d,pinnedChatIds:u,includedChatIds:l,excludedChatIds:f,noTitleAnimations:g}=e,p=u?u.map(li).filter(Boolean):[],h=l?l.map(li).filter(Boolean):[],m=f?f.map(li).filter(Boolean):[];return e.isChatList?new Ye.DialogFilterChatlist({id:e.id,title:Ni(e.title),emoticon:t||void 0,pinnedPeers:p,includePeers:h,hasMyInvites:e.hasMyInvites,titleNoanimate:g}):new Ye.DialogFilter({id:e.id,title:Ni(e.title),emoticon:t||void 0,contacts:n||void 0,nonContacts:s||void 0,groups:a||void 0,bots:o||void 0,excludeArchived:r||void 0,excludeMuted:c||void 0,excludeRead:d||void 0,broadcasts:i||void 0,pinnedPeers:p,includePeers:h,excludePeers:m,titleNoanimate:g})}(t);await Du(new Ye.messages.UpdateDialogFilter({id:e,filter:n}))&&Da({"@type":"updateChatFolder",id:e,folder:t})}async function Sl(e){const t=await Du(new Ye.messages.UpdateDialogFilter({id:e,filter:void 0})),n=await vl();t&&Da({"@type":"updateChatFolder",id:e,folder:void 0}),n&&Da({"@type":"updateRecommendedChatFolders",folders:n})}function Il(e){return Du(new Ye.messages.UpdateDialogFiltersOrder({order:e}))}async function Pl({chat:e,hasUnreadMark:t}){const{id:n,accessHash:s}=e;await Du(new Ye.messages.MarkDialogUnread({peer:new Ye.InputDialogPeer({peer:di(n,s)}),unread:t||void 0}))&&Da({"@type":"updateChat",id:e.id,chat:{hasUnreadMark:t}})}async function Cl(e){return Rl(await Du(new Ye.contacts.ResolvePhone({phone:e})))}async function Ml(e,t){return Rl(await Du(new Ye.contacts.ResolveUsername({username:e,referer:t})))}function Rl(e){if(!e)return;const{users:t,chats:n}=e,s=n.length?nc(n[0]):nc(t[0]);return s?{chat:s,user:xr(t[0])}:void 0}function kl({chat:e,isEnabled:t}){const{id:n,accessHash:s}=e,a=fi(n,s);return Du(new Ye.channels.TogglePreHistoryHidden({channel:a,enabled:t}),{shouldReturnTrue:!0})}function Al({chat:e,bannedRights:t}){const{id:n,accessHash:s}=e,a=di(n,s);return Du(new Ye.messages.EditChatDefaultBannedRights({peer:a,bannedRights:Pi(t)}),{shouldReturnTrue:!0})}function Tl({chat:e,user:t,bannedRights:n,untilDate:s}){const a=fi(e.id,e.accessHash),i=di(t.id,t.accessHash);return Du(new Ye.channels.EditBanned({channel:a,participant:i,bannedRights:Pi(n,s)}),{shouldReturnTrue:!0})}function El({chat:e,user:t,adminRights:n,customTitle:s=""}){const a=fi(e.id,e.accessHash),i=fi(t.id,t.accessHash);return Du(new Ye.channels.EditAdmin({channel:a,userId:i,adminRights:Ci(n),rank:s}),{shouldReturnTrue:!0})}async function Ul(e,t){const n=fi(e.id,e.accessHash);await Du(n instanceof Ye.InputChannel?new Ye.channels.EditTitle({channel:n,title:t}):new Ye.messages.EditChatTitle({chatId:n,title:t}),{shouldReturnTrue:!0})}async function Dl(e,t){await Du(new Ye.messages.EditChatAbout({peer:di(e.id,e.accessHash),about:t}))&&Da({"@type":"updateChatFullInfo",id:e.id,fullInfo:{about:t}})}function Bl({chat:e,areSignaturesEnabled:t,areProfilesEnabled:n}){const{id:s,accessHash:a}=e,i=fi(s,a);return Du(new Ye.channels.ToggleSignatures({channel:i,signaturesEnabled:t||void 0,profilesEnabled:n||void 0}),{shouldReturnTrue:!0})}async function xl({chat:e,memberFilter:t="recent",offset:n,query:s=""}){let a;switch(t){case"kicked":a=new Ye.ChannelParticipantsKicked({q:s});break;case"admin":a=new Ye.ChannelParticipantsAdmins;break;case"search":a=new Ye.ChannelParticipantsSearch({q:s});break;default:a=new Ye.ChannelParticipantsRecent}const i=await Du(new Ye.channels.GetParticipants({channel:fi(e.id,e.accessHash),filter:a,offset:n,limit:y}),{abortControllerChatId:e.id});if(!i||i instanceof Ye.channels.ChannelParticipantsNotModified)return;const o=Nr(i.users);return{members:cc(i),userStatusesById:o}}async function Vl({chat:e,peer:t}){const n=t?di(t.id,t.accessHash):new Ye.InputPeerSelf,s=await Du(new Ye.channels.GetParticipant({channel:fi(e.id,e.accessHash),participant:n}),{abortControllerChatId:e.id});if(!s)return;const a=Nr(s.users),i=rc(s.participant);return i?{member:i,userStatusesById:a}:void 0}async function Nl(){const e=await Du(new Ye.channels.GetGroupsForDiscussion);if(e)return e.chats.map((e=>nc(e)))}function Fl({channel:e,chat:t}){return Du(new Ye.channels.SetDiscussionGroup({broadcast:di(e.id,e.accessHash),group:t?di(t.id,t.accessHash):new Ye.InputChannelEmpty}),{shouldReturnTrue:!0})}async function Gl(e){const t=await Du(new Ye.messages.MigrateChat({chatId:fi(e.id)}),{shouldThrow:!0});if(!(t&&t instanceof Ye.Updates))return void(c&&console.error("Unexpected channel creation update",t));const n=t.updates.find((e=>e instanceof Ye.UpdateChannel)).channelId;return nc(t.chats.find((e=>e instanceof Ye.Channel&&e.id.toString()===n.toString())))}async function ql(e){const t=await Du(new Ye.messages.CheckChatInvite({hash:e}));if(!t)return;if(t instanceof Ye.ChatInvite)return{chat:void 0,invite:vc(t),users:t.participants?.map(xr).filter(Boolean)};const n=nc(t.chat);return n?{chat:n,invite:void 0,users:void 0}:void 0}async function Hl(e,t){try{if("chatTypeChannel"===e.type||"chatTypeSuperGroup"===e.type){const n=await Du(new Ye.channels.InviteToChannel({channel:fi(e.id,e.accessHash),users:t.map((e=>fi(e.id,e.accessHash)))}));if(!n)return;return Uu(n.updates),n.missingInvitees.map(bc)}const n=await Promise.all(t.map((async t=>{const n=await Du(new Ye.messages.AddChatUser({chatId:fi(e.id),userId:fi(t.id,t.accessHash)}));if(n)return Uu(n.updates),n.missingInvitees.map(bc)})));if(n)return n.flat().filter(Boolean)}catch(e){Da({"@type":"error",error:{message:e instanceof tt?e.errorMessage:e.message}})}}function Ol(e,t){return"chatTypeChannel"===e.type||"chatTypeSuperGroup"===e.type?Tl({chat:e,user:t,bannedRights:{viewMessages:!0,sendMessages:!0,sendMedia:!0,sendStickers:!0,sendGifs:!0,sendGames:!0,sendInline:!0,embedLinks:!0,sendPolls:!0,changeInfo:!0,inviteUsers:!0,pinMessages:!0,manageTopics:!0,sendPhotos:!0,sendVideos:!0,sendRoundvideos:!0,sendAudios:!0,sendVoices:!0,sendDocs:!0,sendPlain:!0},untilDate:E}):Du(new Ye.messages.DeleteChatUser({chatId:fi(e.id),userId:fi(t.id,t.accessHash)}),{shouldReturnTrue:!0})}function Ll(e,t){return Du(new Ye.channels.ToggleJoinToSend({channel:fi(e.id,e.accessHash),enabled:t}),{shouldReturnTrue:!0})}function jl(e,t){return Du(new Ye.channels.ToggleJoinRequest({channel:fi(e.id,e.accessHash),enabled:t}),{shouldReturnTrue:!0})}function Wl(e,t){const n={};return e.chats?.forEach((e=>{const s=`chat${e.id}`;t?.[s]&&"min"in e&&e.min||(n[s]=e)})),e.users?.forEach((e=>{const s=`user${e.id}`;t?.[s]&&"min"in e&&e.min||(n[s]=e)})),n}async function zl({hash:e}){const t=await Du(new Ye.messages.ImportChatInvite({hash:e}));if(t instanceof Ye.Updates&&t.chats.length)return nc(t.chats[0])}function Kl({chat:e,enabledReactions:t,reactionsLimit:n}){return Du(new Ye.messages.SetChatAvailableReactions({peer:di(e.id,e.accessHash),availableReactions:(s=t,"all"===s?.type?new Ye.ChatReactionsAll({allowCustom:s.areCustomAllowed}):"some"===s?.type?new Ye.ChatReactionsSome({reactions:s.allowed.map(xi)}):new Ye.ChatReactionsNone),reactionsLimit:n}),{shouldReturnTrue:!0});var s}function $l({chat:e,isProtected:t}){const{id:n,accessHash:s}=e;return Du(new Ye.messages.ToggleNoForwards({peer:di(n,s),enabled:t}),{shouldReturnTrue:!0})}function Jl({chat:e,isEnabled:t}){const{id:n,accessHash:s}=e;return Du(new Ye.channels.ToggleParticipantsHidden({channel:di(n,s),enabled:t}),{shouldReturnTrue:!0})}function Ql({chat:e,isEnabled:t}){const{id:n,accessHash:s}=e;return Du(new Ye.channels.ToggleForum({channel:di(n,s),enabled:t}),{shouldReturnTrue:!0,shouldThrow:!0})}async function Xl({chat:e,title:t,iconColor:n,iconEmojiId:s,sendAs:a}){const{id:i,accessHash:o}=e,r=await Du(new Ye.channels.CreateForumTopic({channel:di(i,o),title:t,iconColor:n,iconEmojiId:s?fe()(s):void 0,sendAs:a?di(a.id,a.accessHash):void 0,randomId:yi()}));if(r instanceof Ye.Updates&&r.updates.length)return r.updates?.find((e=>e instanceof Ye.UpdateMessageID))?.id}async function Zl({chat:e,query:t,offsetTopicId:n,offsetId:s,offsetDate:a,limit:i=A}){const{id:o,accessHash:r}=e,c=await Du(new Ye.channels.GetForumTopics({channel:di(o,r),limit:i,q:t,offsetTopic:n,offsetId:s,offsetDate:a}));if(!c)return;const{count:d,orderByCreateDate:u}=c;return{topics:c.topics.map(yc).filter(Boolean),messages:c.messages.map(gr).filter(Boolean),count:d+1,shouldOrderByCreateDate:u,draftsById:c.topics.reduce(((e,t)=>(t instanceof Ye.ForumTopic&&t.draft&&(e[t.id]=hr(t.draft)),e)),{}),readInboxMessageIdByTopicId:c.topics.reduce(((e,t)=>(t instanceof Ye.ForumTopic&&t.readInboxMaxId&&(e[t.id]=t.readInboxMaxId),e)),{})}}async function Yl({chat:e,topicId:t}){const{id:n,accessHash:s}=e,a=await Du(new Ye.channels.GetForumTopicsByID({channel:di(n,s),topics:[t]}));if(!(a?.topics.length&&a.topics[0]instanceof Ye.ForumTopic))return;const i=a.messages.map(gr).filter(Boolean);return{topic:yc(a.topics[0]),messages:i}}async function ef({chat:e,topicId:t}){const{id:n,accessHash:s}=e,a=await Du(new Ye.channels.DeleteTopicHistory({channel:di(n,s),topMsgId:t}));a&&(Gd(e,a),a.offset&&await ef({chat:e,topicId:t}))}function tf({chat:e,topicId:t,isPinned:n}){const{id:s,accessHash:a}=e;return Du(new Ye.channels.UpdatePinnedForumTopic({channel:di(s,a),topicId:t,pinned:n}),{shouldReturnTrue:!0})}function nf({chat:e,topicId:t,title:n,iconEmojiId:s,isClosed:a,isHidden:i}){const{id:o,accessHash:r}=e;return Du(new Ye.channels.EditForumTopic({channel:di(o,r),topicId:t,title:n,iconEmojiId:t!==ee&&s?fe()(s):void 0,closed:a,hidden:i}),{shouldReturnTrue:!0})}async function sf({slug:e}){const t=await Du(new Ye.chatlists.CheckChatlistInvite({slug:e})),n=function(e,t){return e instanceof Ye.chatlists.ChatlistInvite?{slug:t,title:uo(e.title),noTitleAnimations:e.titleNoanimate,emoticon:e.emoticon,peerIds:e.peers.map(aa).filter(Boolean)}:e instanceof Ye.chatlists.ChatlistInviteAlready?{slug:t,folderId:e.filterId,missingPeerIds:e.missingPeers.map(aa).filter(Boolean),alreadyPeerIds:e.alreadyPeers.map(aa).filter(Boolean)}:void 0}(t,e);if(t&&n)return{invite:n}}function af({slug:e,peers:t}){return Du(new Ye.chatlists.JoinChatlistInvite({slug:e,peers:t.map((e=>di(e.id,e.accessHash)))}),{shouldReturnTrue:!0,shouldThrow:!0})}async function of({folderId:e}){const t=await Du(new Ye.chatlists.GetLeaveChatlistSuggestions({chatlist:new Ye.InputChatlistDialogFilter({filterId:e})}));if(t)return t.map(aa)}function rf({folderId:e,peers:t}){return Du(new Ye.chatlists.LeaveChatlist({chatlist:new Ye.InputChatlistDialogFilter({filterId:e}),peers:t.map((e=>di(e.id,e.accessHash)))}),{shouldReturnTrue:!0})}async function cf({folderId:e,title:t,peers:n}){const s=await Du(new Ye.chatlists.ExportChatlistInvite({chatlist:new Ye.InputChatlistDialogFilter({filterId:e}),title:t||"",peers:n.map((e=>di(e.id,e.accessHash)))}),{shouldThrow:!0});if(s&&!(s.filter instanceof Ye.DialogFilterDefault))return{filter:uc(s.filter),invite:_c(s.invite)}}function df({folderId:e,slug:t}){return Du(new Ye.chatlists.DeleteExportedInvite({chatlist:new Ye.InputChatlistDialogFilter({filterId:e}),slug:t}))}async function uf({folderId:e,slug:t,title:n,peers:s}){const a=await Du(new Ye.chatlists.EditExportedInvite({chatlist:new Ye.InputChatlistDialogFilter({filterId:e}),slug:t,title:n,peers:s.map((e=>di(e.id,e.accessHash)))}),{shouldThrow:!0});if(a)return _c(a)}async function lf({folderId:e}){const t=await Du(new Ye.chatlists.GetExportedInvites({chatlist:new Ye.InputChatlistDialogFilter({filterId:e})}));if(t)return{invites:t.invites.map(_c).filter(Boolean)}}function ff({chat:e,isEnabled:t}){return Du(new Ye.messages.TogglePeerTranslations({disabled:!t||void 0,peer:di(e.id,e.accessHash)}))}function gf({chat:e,isEnabled:t}){const{id:n,accessHash:s}=e,a=fi(n,s);return Du(new Ye.channels.ToggleViewForumAsMessages({channel:a,enabled:Boolean(t)}),{shouldReturnTrue:!0})}async function pf({chat:e}){const t=await Du(new Ye.channels.GetChannelRecommendations({channel:e&&fi(e.id,e.accessHash)}));if(!t)return;const n=t?.chats.map((e=>nc(e))).filter(Boolean);return{similarChannels:n,count:t instanceof Ye.messages.ChatsSlice?t.count:n.length}}var hf=n(48287).hp;const mf=1e3,yf=63;async function _f({chat:e,threadId:t,offsetId:n,isSavedDialog:s,...a}){const i=t===qa?Ye.messages.GetHistory:s?Ye.messages.GetSavedHistory:Ye.messages.GetReplies;let o;try{o=await Du(new i({peer:di(e.id,e.accessHash),...t!==qa&&!s&&{msgId:Number(t)},...n&&{offsetId:Math.min(n,E)},...a}),{shouldThrow:!0,abortControllerChatId:e.id,abortControllerThreadId:t})}catch(t){"CHANNEL_PRIVATE"===t.errorMessage&&Da({"@type":"updateChat",id:e.id,chat:{isRestricted:!0}})}if(o&&!(o instanceof Ye.messages.MessagesNotModified)&&o.messages)return{messages:o.messages.map(gr).filter(Boolean),users:o.users.map(xr).filter(Boolean),chats:o.chats.map((e=>nc(e))).filter(Boolean),count:!(o instanceof Ye.messages.Messages)&&o.count}}async function bf({chat:e,messageId:t}){const n="channel"===ri(e.id);let s;try{s=await Du(n?new Ye.channels.GetMessages({channel:fi(e.id,e.accessHash),id:[new Ye.InputMessageID({id:t})]}):new Ye.messages.GetMessages({id:[new Ye.InputMessageID({id:t})]}),{shouldThrow:!0,abortControllerChatId:e.id})}catch(e){const{message:t}=e;"CHANNEL_PRIVATE"!==t&&Da({"@type":"error",error:{message:t,isSlowMode:!1,hasErrorKey:!0}})}if(!s||s instanceof Ye.messages.MessagesNotModified)return;"pts"in s&&kd(e.id,s.pts);const a=s.messages[0];if(!a)return;if(a instanceof Ye.MessageEmpty)return Ha;Mc(a);const i=gr(a);return i?{message:i}:void 0}let vf=Promise.resolve();function wf({chat:e,lastMessageId:t,text:n,entities:s,replyInfo:a,attachment:i,sticker:o,story:r,gif:d,poll:u,contact:l,isSilent:f,scheduledAt:g,groupedId:p,noWebPage:h,sendAs:m,shouldUpdateStickerSetOrder:y,wasDrafted:_,isInvertedMedia:b,effectId:v,webPageMediaSize:w,webPageUrl:S},I){const{message:P,poll:C}=function(e,t,n,s,a,i,o,r,c,d,u,l,f,g,p,h){const m=fr(t),y=i&&br(i),_="chatTypeChannel"===e.type,b=a&&(P=a,C=e.isForum,"story"===P.type?{type:"story",peerId:P.peerId,storyId:P.storyId}:{type:"message",replyToMsgId:P.replyToMsgId,replyToTopId:P.replyToTopId,replyToPeerId:P.replyToPeerId,quoteText:P.quoteText,isForumTopic:!(!C||!P.replyToTopId)||void 0,...Boolean(P.quoteText)&&{isQuote:!0}}),v=c&&function(e,t){return{mediaType:"poll",id:String(t),summary:Ya(e.summary,["question","answers"]),results:{}}}(c,m),w=n?Qa({text:n,entities:s}):void 0,S={id:m,chatId:e.id,content:ni({text:w,...y,sticker:o,video:r||y?.video,contact:d,storyData:g&&{mediaType:"storyData",...g},pollId:v?.id}),date:l||Math.round(Date.now()/1e3)+hs(),isOutgoing:!_,senderId:f?.id||ur,replyInfo:b,...u&&{groupedId:u,...y&&(y.photo||y.video)&&{isInAlbum:!0}},...l&&{isScheduled:!0},isForwardingAllowed:!0,isInvertedMedia:p,effectId:h},I=$a(S.content,S.groupedId);var P,C;return{message:{...S,...I&&{emojiOnlyCount:I}},poll:v}}(e,t,n,s,a,i,o,d,u,l,p,g,m,r,b,v);Da({"@type":P.isScheduled?"newScheduledMessage":"newMessage",id:P.id,chatId:e.id,message:P,poll:C,wasDrafted:_});const M=setTimeout((()=>{Da({"@type":P.isScheduled?"updateScheduledMessage":"updateMessage",id:P.id,chatId:e.id,message:{sendingState:"messageSendingStatePending"}})}),mf),R=yi();if(p)return function({chat:e,text:t,entities:n,replyInfo:s,attachment:a,groupedId:i,isSilent:o,scheduledAt:r,sendAs:d},u,l,f){let g=-1;Sf[i]||(Sf[i]={counter:0,singleMediaByIndex:{},localMessages:{}}),g=Sf[i].counter++;const p=vf;return vf=(async()=>{let h;try{h=await Cf(l,a,f)}catch(e){return c&&console.warn(e),Sf[i].counter--,void await p}const m=await async function(e,t){const n=await Du(new Ye.messages.UploadMedia({peer:e,media:t})),s=t.spoiler;if(n instanceof Ye.MessageMediaPhoto&&n.photo&&n.photo instanceof Ye.Photo){const{photo:{id:e,accessHash:t,fileReference:a}}=n;return new Ye.InputMediaPhoto({id:new Ye.InputPhoto({id:e,accessHash:t,fileReference:a}),spoiler:s})}if(n instanceof Ye.MessageMediaDocument&&n.document&&n.document instanceof Ye.Document){const{document:{id:e,accessHash:t,fileReference:a}}=n;return new Ye.InputMediaDocument({id:new Ye.InputDocument({id:e,accessHash:t,fileReference:a}),spoiler:s})}}(di(e.id,e.accessHash),h);if(await p,!m)return Sf[i].counter--,void(c&&console.warn("Failed to upload grouped media"));if(Sf[i].singleMediaByIndex[g]=new Ye.InputSingleMedia({media:m,randomId:u,message:t||"",entities:n?n.map(wi):void 0}),Sf[i].localMessages[u.toString()]=l,Object.keys(Sf[i].singleMediaByIndex).length<Sf[i].counter)return;const{singleMediaByIndex:y,localMessages:_}=Sf[i];delete Sf[i];const b=await Du(new Ye.messages.SendMultiMedia({clearDraft:!0,peer:di(e.id,e.accessHash),multiMedia:Object.values(y),replyTo:s&&Gi(s),...o&&{silent:o},...r&&{scheduleDate:r},...d&&{sendAs:di(d.id,d.accessHash)}}),{shouldIgnoreUpdates:!0});b&&hg(_,b)})(),vf}({chat:e,text:n,entities:s,replyInfo:a,attachment:i,groupedId:p,isSilent:f,scheduledAt:g},R,P,I);const k=(async()=>{let t;if(i)try{t=await Cf(P,i,I)}catch(e){return c&&console.warn(e),void await vf}else o?t=hi(o):d?t=hi(d):u?t=function(e,t){const{summary:n,quiz:s}=e,a=new Ye.Poll({id:t,publicVoters:n.isPublic,question:Ni(n.question),answers:n.answers.map((({text:e,option:t})=>new Ye.PollAnswer({text:Ni(e),option:ha(t)}))),quiz:n.quiz,multipleChoice:n.multipleChoice});if(!s)return new Ye.InputMediaPoll({poll:a});const i=s.correctAnswers.map(ha),{solution:o}=s,r=s.solutionEntities?s.solutionEntities.map(wi):[];return new Ye.InputMediaPoll({poll:a,correctAnswers:i,...o&&{solution:o,solutionEntities:r}})}(u,R):r?t=function(e){const t=li(e.peerId);return new Ye.InputMediaStory({peer:t,id:e.id})}(r):S&&w?t=new Ye.InputMediaWebPage({url:S,forceLargeMedia:"large"===w||void 0,forceSmallMedia:"small"===w||void 0}):l&&(t=new Ye.InputMediaContact({phoneNumber:l.phoneNumber,firstName:l.firstName,lastName:l.lastName,vcard:""}));const p=t?Ye.messages.SendMedia:Ye.messages.SendMessage;try{const i=await Du(new p({clearDraft:!0,message:n||"",entities:s?s.map(wi):void 0,peer:di(e.id,e.accessHash),randomId:R,replyTo:a&&Gi(a),...f&&{silent:f},...g&&{scheduleDate:g},...t&&{media:t},...h&&{noWebpage:h},...m&&{sendAs:di(m.id,m.accessHash)},...y&&{updateStickersetsOrder:y},...b&&{invertMedia:b},...v&&{effect:fe()(v)}}),{shouldThrow:!0,shouldIgnoreUpdates:!0});i&&mg(P,i)}catch(t){"PRIVACY_PREMIUM_REQUIRED"===t.errorMessage&&Da({"@type":"updateRequestUserUpdate",id:e.id}),Da({"@type":"updateMessageSendFailed",chatId:e.id,localId:P.id,error:t.message}),clearTimeout(M)}})();return k}const Sf={};async function If({chat:e,message:t,text:n,entities:s,attachment:a,noWebPage:i},o){const r=1e3*t.date>Date.now()+1e3*hs(),d=a&&br(a),u=n&&!a?.shouldSendAsFile?t.isInvertedMedia:void 0,l={...d||t.content,...n&&{text:{text:n,entities:s}}},f={...t,content:l,isInvertedMedia:u};Da({"@type":r?"updateScheduledMessage":"updateMessage",id:t.id,chatId:e.id,message:f});try{let c;a&&(c=await Cf(t,a,o));const d=s&&s.map(wi);await Du(new Ye.messages.EditMessage({message:n||"",entities:d,media:c,peer:di(e.id,e.accessHash),id:t.id,...r&&{scheduleDate:t.date},...i&&{noWebpage:i},...u&&{invertMedia:u}}),{shouldThrow:!0})}catch(n){c&&console.warn(n);const{message:s}=n;Da({"@type":"error",error:{message:s,hasErrorKey:!0}}),Da({"@type":r?"updateScheduledMessage":"updateMessage",id:t.id,chatId:e.id,message:t})}}async function Pf({chat:e,message:t,scheduledAt:n}){await Du(new Ye.messages.EditMessage({peer:di(e.id,e.accessHash),id:t.id,scheduleDate:n}))}async function Cf(e,t,n){const{filename:s,blobUrl:a,mimeType:i,quick:o,voice:r,audio:c,previewBlobUrl:d,shouldSendAsFile:u,shouldSendAsSpoiler:l,ttlSeconds:f}=t,g=t=>{n.isCanceled?g.isCanceled=!0:n(t,function(e){const{chatId:t}=e;return function(e,t){return`msg${e}-${t}`}(t,"randomId"in e?Number(e.randomId):e.previousLocalId||e.id)}(e))},p=async(e,t)=>Vu(await async function(e,t){const n=await async function(e){return(await fetch(e)).blob()}(e);return function(e,t){return new File([e],t,{lastModified:Date.now(),type:e.type})}(n,t)}(e,s),t),h=O.has(i),m=c||h||u,[y,_]=await Promise.all(si([p(a,g),m&&d&&p(d)])),b=[new Ye.DocumentAttributeFilename({fileName:s})];if(!u){if(o){if(H.has(i)&&i!==F)return new Ye.InputMediaUploadedPhoto({file:y,spoiler:l});if(h){const{width:e,height:t,duration:n}=o;void 0!==n&&b.push(new Ye.DocumentAttributeVideo({duration:n,w:e,h:t,supportsStreaming:!0}))}}if(c){const{duration:e,title:t,performer:n}=c;b.push(new Ye.DocumentAttributeAudio({duration:e,title:t,performer:n}))}if(r){const{duration:e,waveform:t}=r,{data:n}=ii(t,yf);b.push(new Ye.DocumentAttributeAudio({voice:!0,duration:e,waveform:hf.from(n)}))}}return new Ye.InputMediaUploadedDocument({file:y,mimeType:i,attributes:b,thumb:_,forceFile:u,spoiler:l,ttlSeconds:f})}async function Mf({chat:e,messageId:t,isUnpin:n,isOneSide:s,isSilent:a}){await Du(new Ye.messages.UpdatePinnedMessage({peer:di(e.id,e.accessHash),id:t,...n&&{unpin:!0},...s&&{pmOneside:!0},...a&&{silent:!0}}))}async function Rf({chat:e,threadId:t}){const n=await Du(new Ye.messages.UnpinAllMessages({peer:di(e.id,e.accessHash),...t&&{topMsgId:Number(t)}}));n&&(Gd(e,n),n.offset&&await Rf({chat:e,threadId:t}))}async function kf({chat:e,messageIds:t,shouldDeleteForAll:n}){const s="channel"===ri(e.id),a=await Du(s?new Ye.channels.DeleteMessages({channel:fi(e.id,e.accessHash),id:t}):new Ye.messages.DeleteMessages({id:t,...n&&{revoke:!0}}));a&&(Gd(e,a),Da({"@type":"deleteMessages",ids:t,...s&&{chatId:e.id}}))}async function Af({chat:e,peer:t,isRepeat:n=!1}){const s=await Du(new Ye.channels.DeleteParticipantHistory({channel:fi(e.id,e.accessHash),participant:di(t.id,t.accessHash)}));s&&(Gd(e,s),n||Da({"@type":"deleteParticipantHistory",chatId:e.id,peerId:t.id}),s.offset&&await Af({chat:e,peer:t,isRepeat:!0}))}function Tf({chat:e,messageIds:t}){Du(new Ye.messages.DeleteScheduledMessages({peer:di(e.id,e.accessHash),id:t}))}async function Ef({chat:e,shouldDeleteForAll:t}){const n="channel"===ri(e.id),s=await Du(n?new Ye.channels.DeleteHistory({channel:fi(e.id,e.accessHash)}):new Ye.messages.DeleteHistory({peer:di(e.id,e.accessHash),...t&&{revoke:!0},...!t&&{just_clear:!0}}));s&&("offset"in s&&(Gd(e,s),s.offset)?await Ef({chat:e,shouldDeleteForAll:t}):Da({"@type":"deleteHistory",chatId:e.id}))}async function Uf({chat:e}){const t=await Du(new Ye.messages.DeleteSavedHistory({peer:di(e.id,e.accessHash)}));t&&(Gd(e,t),t.offset?await Uf({chat:e}):Da({"@type":"deleteSavedHistory",chatId:e.id}))}async function Df({peer:e,messageIds:t,description:n,option:s}){try{const a=await Du(new Ye.messages.Report({peer:di(e.id,e.accessHash),id:t,option:ha(s),message:n}),{shouldThrow:!0});if(!a)return;return{result:Ir(a),error:void 0}}catch(e){const t=e.message;if(t===j)return{result:void 0,error:t};throw e}}function Bf({peer:e,chat:t,messageIds:n}){return Du(new Ye.channels.ReportSpam({participant:di(e.id,e.accessHash),channel:fi(t.id,t.accessHash),id:n}))}async function xf({peer:e,threadId:t,action:n}){const s=function(e){switch(e.type){case"cancel":return new Ye.SendMessageCancelAction;case"typing":return new Ye.SendMessageTypingAction;case"recordAudio":return new Ye.SendMessageRecordAudioAction;case"chooseSticker":return new Ye.SendMessageChooseStickerAction;case"playingGame":return new Ye.SendMessageGamePlayAction}}(n);if(s)try{return await Du(new Ye.messages.SetTyping({peer:di(e.id,e.accessHash),topMsgId:Number(t),action:s}),{shouldThrow:!0,abortControllerChatId:e.id,abortControllerThreadId:t})}catch(e){}else c&&console.warn("Unsupported message action",n)}async function Vf({chat:e,threadId:t,maxId:n=0}){const s="channel"===ri(e.id),a=Math.min(n,E);if(s&&t===qa)await Du(new Ye.channels.ReadHistory({channel:fi(e.id,e.accessHash),maxId:a}));else if(s)await Du(new Ye.messages.ReadDiscussion({peer:di(e.id,e.accessHash),msgId:Number(t),readMaxId:a}));else{const t=await Du(new Ye.messages.ReadHistory({peer:di(e.id,e.accessHash),maxId:a}));t&&Gd(e,t)}t===qa?al({chat:e,noLastMessage:!0}):e.isForum&&Da({"@type":"updateTopic",chatId:e.id,topicId:Number(t)})}async function Nf({chat:e,messageIds:t}){const n="channel"===ri(e.id),s=await Du(n?new Ye.channels.ReadMessageContents({channel:fi(e.id,e.accessHash),id:t}):new Ye.messages.ReadMessageContents({id:t}));s&&(!0!==s&&Gd(e,s),Da({...n?{"@type":"updateChannelMessages",channelId:e.id}:{"@type":"updateCommonBoxMessages"},ids:t,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}}))}async function Ff({chat:e,ids:t,shouldIncrement:n}){const s=ai(t,S),a=await Promise.all(s.map((t=>Du(new Ye.messages.GetMessagesViews({peer:di(e.id,e.accessHash),id:t,increment:n})))));if(!a||a.some((e=>!e)))return;const i=a.flatMap((e=>e.views));return{viewsInfo:t.map(((t,n)=>{const{views:s,forwards:a,replies:o}=i[n];return{id:t,views:s,forwards:a,threadInfo:o?wr(o,t,e.id):void 0}}))}}async function Gf({chat:e,ids:t}){const n=ai(t,S),s=await Promise.all(n.map((t=>Du(new Ye.messages.GetFactCheck({peer:di(e.id,e.accessHash),msgId:t})))));if(s&&!s.some((e=>!e)))return s.flatMap((e=>e)).map(_r)}function qf(){return Du(new Ye.messages.GetPaidReactionPrivacy,{shouldReturnTrue:!0})}function Hf({chat:e,messageIds:t}){return Du(new Ye.messages.ReportMessagesDelivery({peer:di(e.id,e.accessHash),id:t}))}async function Of({chat:e,messageId:t}){const[n,s]=await Promise.all([Du(new Ye.messages.GetDiscussionMessage({peer:di(e.id,e.accessHash),msgId:t}),{abortControllerChatId:e.id,abortControllerThreadId:t}),_f({chat:e,threadId:t,offsetId:1,addOffset:-1,limit:1})]);if(!n||!s)return;const a=n.messages.map(gr).filter(Boolean),i=a.concat(s.messages),o=n.messages[n.messages.length-1]?.id;if(!o)return;const{unreadCount:r,maxId:c,readInboxMaxId:d,readOutboxMaxId:u}=n;return{messages:i,topMessages:a,unreadCount:r,threadId:o,lastReadInboxMessageId:d,lastReadOutboxMessageId:u,lastMessageId:c,chatId:a[0]?.chatId,firstMessageId:s.messages[0]?.id}}async function Lf({peer:e,isSavedDialog:t,savedTag:n,type:s,query:a="",threadId:i,minDate:o,maxDate:r,...c}){let d;switch(s){case"media":d=new Ye.InputMessagesFilterPhotoVideo;break;case"documents":d=new Ye.InputMessagesFilterDocument;break;case"links":d=new Ye.InputMessagesFilterUrl;break;case"audio":d=new Ye.InputMessagesFilterMusic;break;case"voice":d=new Ye.InputMessagesFilterRoundVoice;break;case"profilePhoto":d=new Ye.InputMessagesFilterChatPhotos;break;default:d=new Ye.InputMessagesFilterEmpty}const u=di(e.id,e.accessHash),l=await Du(new Ye.messages.Search({peer:t?new Ye.InputPeerSelf:u,savedPeerId:t?u:void 0,savedReaction:n&&[xi(n)],topMsgId:i===qa||t?void 0:Number(i),filter:d,q:a,minDate:o,maxDate:r,...c}),{abortControllerChatId:e.id,abortControllerThreadId:i});if(!l||l instanceof Ye.messages.MessagesNotModified||!l.messages)return;const f=Nr(l.users),g=l.messages.map(gr).filter(Boolean);let p,h=g.length;return(l instanceof Ye.messages.MessagesSlice||l instanceof Ye.messages.ChannelMessages)&&(h=l.count,g.length&&(p=g[g.length-1].id)),{userStatusesById:f,messages:g,totalCount:h,nextOffsetId:p}}async function jf({query:e,offsetRate:t=0,offsetPeer:n,offsetId:s,limit:a,type:i="text",minDate:o,maxDate:r,context:c="all"}){let d;switch(i){case"media":d=new Ye.InputMessagesFilterPhotoVideo;break;case"documents":d=new Ye.InputMessagesFilterDocument;break;case"links":d=new Ye.InputMessagesFilterUrl;break;case"audio":d=new Ye.InputMessagesFilterMusic;break;case"voice":d=new Ye.InputMessagesFilterRoundVoice;break;default:if(!(e||r&&o))return;d=new Ye.InputMessagesFilterEmpty}const u=n&&di(n.id,n.accessHash)||new Ye.InputPeerEmpty,l=await Du(new Ye.messages.SearchGlobal({q:e,offsetRate:t,offsetPeer:u,offsetId:s,broadcastsOnly:"channels"===i||"channels"===c||void 0,groupsOnly:"groups"===c||void 0,usersOnly:"users"===c||void 0,limit:a,filter:d,minDate:o,maxDate:r}));if(!l||l instanceof Ye.messages.MessagesNotModified||!l.messages)return;const f=Nr(l.users),g=l.messages.map(gr).filter(Boolean);let p=g.length;p=l instanceof Ye.messages.MessagesSlice||l instanceof Ye.messages.ChannelMessages?l.count:l.messages.length;const h=l.messages[l.messages.length-1],m=fa(h),y="nextRate"in l&&l.nextRate?l.nextRate:void 0,_=h?.id;return{messages:g,userStatusesById:f,totalCount:p,nextOffsetRate:y,nextOffsetPeerId:m,nextOffsetId:_}}async function Wf({hashtag:e,offsetRate:t,offsetPeer:n,offsetId:s,limit:a}){const i=n&&di(n.id,n.accessHash)||new Ye.InputPeerEmpty,o=await Du(new Ye.channels.SearchPosts({hashtag:e,offsetRate:t,offsetId:s,offsetPeer:i,limit:a}));if(!o||o instanceof Ye.messages.MessagesNotModified)return;const r=Nr(o.users),c=o.messages.map(gr).filter(Boolean);let d=c.length;d=o instanceof Ye.messages.MessagesSlice||o instanceof Ye.messages.ChannelMessages?o.count:o.messages.length;const u=o.messages[o.messages.length-1],l=fa(u),f="nextRate"in o&&o.nextRate?o.nextRate:void 0,g=u?.id;return{messages:c,userStatusesById:r,totalCount:d,nextOffsetRate:f,nextOffsetPeerId:l,nextOffsetId:g}}async function zf({text:e}){const t=Ni(e),n=await Du(new Ye.messages.GetWebPagePreview({message:t.text,entities:t.entities}));return n&&Do(n.media)}async function Kf({chat:e,messageId:t,options:n}){const{id:s,accessHash:a}=e;await Du(new Ye.messages.SendVote({peer:di(s,a),msgId:t,options:n.map(ha)}))}async function $f({chat:e,messageId:t,poll:n}){const{id:s,accessHash:a}=e;await Du(new Ye.messages.EditMessage({peer:di(s,a),id:t,media:mi(n,!0)}))}async function Jf({chat:e,messageId:t,option:n,offset:s,limit:a,shouldResetVoters:i}){const{id:o,accessHash:r}=e,c=await Du(new Ye.messages.GetPollVotes({peer:di(o,r),id:t,...n&&{option:ha(n)},...s&&{offset:s},...a&&{limit:a}}));if(!c)return;const d=c.votes.map((e=>({peerId:aa(e.peer),date:e.date})));return{count:c.count,votes:d,nextOffset:c.nextOffset,shouldResetVoters:i}}async function Qf({chat:e,ids:t}){await Du(new Ye.messages.GetExtendedMedia({peer:di(e.id,e.accessHash),id:t}))}async function Xf({fromChat:e,toChat:t,toThreadId:n,messages:s,isSilent:a,scheduledAt:i,sendAs:o,withMyScore:r,noAuthors:c,noCaptions:d,isCurrentUserPremium:u,wasDrafted:l,lastMessageId:f}){const g=s.map((({id:e})=>e)),p=s.map(yi),h={};s.forEach(((e,s)=>{const a=function({toChat:e,toThreadId:t,message:n,scheduledAt:s,noAuthors:a,noCaptions:i,isCurrentUserPremium:o,lastMessageId:r,sendAs:c}){const d=fr(r),{content:u,chatId:l,id:f,senderId:g,groupedId:p,isInAlbum:h,isInvertedMedia:m}=n,y=u.audio,_=e.id===ur&&(l!==e.id||n.forwardInfo)&&!y,b=Object.keys(u).length>1&&u.text&&i,v=!o,w=u.text?.entities&&v?{text:u.text.text,entities:u.text.entities.filter((e=>e.type!==Ga.CustomEmoji))}:u.text,S=w&&Qa(w),I=$a(u,p),P={...u,text:b?void 0:S},C=t&&t!==qa?{type:"message",replyToMsgId:t,replyToTopId:t,isForumTopic:e.isForum||void 0}:void 0;return{id:d,chatId:e.id,content:P,date:s||Math.round(Date.now()/1e3)+hs(),isOutgoing:!_&&"chatTypeChannel"!==e.type,senderId:c?.id||ur,sendingState:"messageSendingStatePending",groupedId:p,isInAlbum:h,isForwardingAllowed:!0,replyInfo:C,isInvertedMedia:m,...t&&e?.isForum&&{isTopicReply:!0},...I&&{emojiOnlyCount:I},...n.chatId!==ur&&!y&&!a&&{forwardInfo:{date:n.forwardInfo?.date||n.date,savedDate:n.date,isChannelPost:!1,fromChatId:l,fromMessageId:f,fromId:g,savedFromPeerId:n.chatId}},...n.chatId===ur&&!a&&{forwardInfo:n.forwardInfo},...s&&{isScheduled:!0}}}({toChat:t,toThreadId:Number(n),message:e,scheduledAt:i,noAuthors:c,noCaptions:d,isCurrentUserPremium:u,lastMessageId:f,sendAs:o});h[p[s].toString()]=a,Da({"@type":a.isScheduled?"newScheduledMessage":"newMessage",id:a.id,chatId:t.id,message:a,wasDrafted:l})}));try{const s=await Du(new Ye.messages.ForwardMessages({fromPeer:di(e.id,e.accessHash),toPeer:di(t.id,t.accessHash),randomId:p,id:g,withMyScore:r||void 0,silent:a||void 0,dropAuthor:c||void 0,dropMediaCaptions:d||void 0,...n&&{topMsgId:Number(n)},...i&&{scheduleDate:i},...o&&{sendAs:di(o.id,o.accessHash)}}),{shouldThrow:!0,shouldIgnoreUpdates:!0});s&&hg(h,s)}catch(e){Object.values(h).forEach((n=>{Da({"@type":"updateMessageSendFailed",chatId:t.id,localId:n.id,error:e.message})}))}}async function Zf({chat:e,timestamp:t}){const n=await Du(new Ye.messages.GetHistory({peer:di(e.id,e.accessHash),offsetDate:t,addOffset:-1,limit:1}));if(n&&!(n instanceof Ye.messages.MessagesNotModified)&&n.messages&&n.messages.length)return n.messages[0].id}async function Yf({chat:e}){const{id:t,accessHash:n}=e,s=await Du(new Ye.messages.GetScheduledHistory({peer:di(t,n)}),{abortControllerChatId:t});if(s&&!(s instanceof Ye.messages.MessagesNotModified)&&s.messages)return{messages:s.messages.map(gr).filter(Boolean)}}async function eg({chat:e,ids:t}){const{id:n,accessHash:s}=e;await Du(new Ye.messages.SendScheduledMessages({peer:di(n,s),id:t}))}async function tg({chat:e,threadId:t}){const n=await Du(new Ye.messages.Search({peer:di(e.id,e.accessHash),filter:new Ye.InputMessagesFilterPinned,q:"",limit:_,topMsgId:Number(t)}),{abortControllerChatId:e.id,abortControllerThreadId:t});if(n&&!(n instanceof Ye.messages.MessagesNotModified)&&n.messages)return{messages:n.messages.map(gr).filter(Boolean)}}async function ng({chat:e,messageId:t}){const n=await Du(new Ye.messages.GetMessageReadParticipants({peer:di(e.id,e.accessHash),msgId:t}));return n?n.reduce(((e,t)=>(e[t.userId.toString()]=t.date,e)),{}):void 0}async function sg({chat:e,isForPaidReactions:t}){const n=await Du(new Ye.channels.GetSendAs({forPaidReactions:t,peer:di(e.id,e.accessHash)}),{shouldIgnoreErrors:!0,abortControllerChatId:e.id});if(n)return n.peers.map(mc)}function ag({sendAs:e,chat:t}){return Du(new Ye.messages.SaveDefaultSendAs({peer:di(t.id,t.accessHash),sendAs:di(e.id,e.accessHash)}))}async function ig({peer:e}){const t=await Du(new Ye.messages.GetSponsoredMessages({peer:di(e.id,e.accessHash)}));if(t&&!(t instanceof Ye.messages.SponsoredMessagesEmpty)&&t.messages.length)return{messages:t.messages.map((t=>function(e,t){const{message:n,entities:s,randomId:a,recommended:i,sponsorInfo:o,additionalInfo:r,buttonText:c,canReport:d,title:u,url:l,color:f}=e;let g,p;return e.photo instanceof Ye.Photo&&(Wi(e.photo),g=so(e.photo)),e.media&&(p=Po(e.media)),{chatId:t,randomId:pa(a),expiresAt:Math.round(Date.now()/1e3)+T,isRecommended:i,sponsorInfo:o,additionalInfo:r,buttonText:c,canReport:d,title:u,url:l,peerColor:f&&ia(f),photo:g,content:{...p,text:Io(n,s)}}}(t,e.id))).filter(Boolean)}}async function og({peer:e,random:t}){await Du(new Ye.messages.ViewSponsoredMessage({peer:di(e.id,e.accessHash),randomId:ha(t)}))}function rg({peer:e,random:t,isMedia:n,isFullscreen:s}){return Du(new Ye.messages.ClickSponsoredMessage({media:n||void 0,fullscreen:s||void 0,peer:di(e.id,e.accessHash),randomId:ha(t)}))}async function cg({peer:e,randomId:t,option:n}){try{const s=await Du(new Ye.messages.ReportSponsoredMessage({peer:di(e.id,e.accessHash),randomId:ha(t),option:ha(n)}),{shouldThrow:!0});if(!s)return;return function(e){return e instanceof Ye.channels.SponsoredMessageReportResultReported?{type:"reported"}:e instanceof Ye.channels.SponsoredMessageReportResultAdsHidden?{type:"hidden"}:{type:"selectOption",title:e.title,options:e.options.map((e=>({text:e.text,option:pa(e.option)})))}}(s)}catch(e){return e instanceof tt&&"PREMIUM_ACCOUNT_REQUIRED"===e.errorMessage?{type:"premiumRequired"}:void 0}}async function dg({chat:e,threadId:t}){const n=await Du(new Ye.messages.ReadMentions({peer:di(e.id,e.accessHash),topMsgId:t?Number(t):void 0}));n&&(Gd(e,n),n.offset&&await dg({chat:e,threadId:t}))}async function ug({chat:e,threadId:t}){const n=await Du(new Ye.messages.ReadReactions({peer:di(e.id,e.accessHash),topMsgId:t?Number(t):void 0}));n&&(Gd(e,n),n.offset&&await ug({chat:e,threadId:t}))}async function lg({chat:e,threadId:t,...n}){const s=await Du(new Ye.messages.GetUnreadMentions({peer:di(e.id,e.accessHash),topMsgId:t?Number(t):void 0,limit:k,...n}));if(s&&!(s instanceof Ye.messages.MessagesNotModified)&&s.messages)return{messages:s.messages.map(gr).filter(Boolean)}}async function fg({chat:e,threadId:t,...n}){const s=await Du(new Ye.messages.GetUnreadReactions({peer:di(e.id,e.accessHash),topMsgId:t?Number(t):void 0,limit:R,...n}));if(s&&!(s instanceof Ye.messages.MessagesNotModified)&&s.messages)return{messages:s.messages.map(gr).filter(Boolean)}}async function gg({chat:e,messageId:t}){const n=await Du(new Ye.messages.TranscribeAudio({msgId:t,peer:di(e.id,e.accessHash)}));if(n)return Da({"@type":"updateTranscribedAudio",isPending:n.pending,transcriptionId:n.transcriptionId.toString(),text:n.text}),n.transcriptionId.toString()}async function pg(e){let t;const n="chat"in e;if(n){const{chat:n,messageIds:s,toLanguageCode:a}=e;t=await Du(new Ye.messages.TranslateText({peer:di(n.id,n.accessHash),id:s,toLang:a}))}else{const{text:n,toLanguageCode:s}=e;t=await Du(new Ye.messages.TranslateText({text:n.map((e=>Ni(e))),toLang:s}))}if(!t)return;const s=t.result.map((e=>uo(e)));return n&&Da({"@type":"updateMessageTranslations",chatId:e.chat.id,messageIds:e.messageIds,translations:s,toLanguageCode:e.toLanguageCode}),s}function hg(e,t){if(!("updates"in t))return void Uu(t);t.updates.filter((e=>e instanceof Ye.UpdateMessageID)).forEach((n=>{const s=t.updates.find((e=>e instanceof Ye.UpdateNewScheduledMessage&&e.message.id===n.id));mg(e[n.randomId.toString()],n,s)}));const n=t.updates.filter((e=>!(e instanceof Ye.UpdateMessageID||e instanceof Ye.UpdateNewScheduledMessage)));t.updates=n,Uu(t)}function mg(e,t,n){let s,a,i;if(t instanceof Ye.UpdateShortSentMessage||t instanceof Ye.UpdateMessageID?s=t:"updates"in t&&(s=t.updates.find((e=>e instanceof Ye.UpdateMessageID)),n=t.updates.find((e=>e instanceof Ye.UpdateNewScheduledMessage))),!s)return void Uu(t);s instanceof Ye.UpdateShortSentMessage&&(e.content.text&&s.entities&&(a={text:Io(e.content.text.text,s.entities)}),s.media&&(a={...a,...Po(s.media,{peerId:ci(e.chatId),id:s.id})},i=Ao(s.media)),Mc(vi(s.id,e.chatId,s)));const o=n?.message&&gr(n.message),r="date"in s&&s.date<ms();if(o?.isVideoProcessingPending)Da({"@type":"updateVideoProcessingPending",chatId:e.chatId,localId:e.id,newScheduledMessageId:o?.id});else{const t={...e,...a&&{content:{...e.content,...a}},id:s.id,sendingState:void 0,..."date"in s&&{date:s.date}};Da({"@type":e.isScheduled&&!r?"updateScheduledMessageSendSucceeded":"updateMessageSendSucceeded",chatId:e.chatId,localId:e.id,message:t,poll:i})}Uu(t)}async function yg({chat:e,messageId:t}){const{id:n,accessHash:s}=e,a=di(n,s),i=await Du(new Ye.messages.GetOutboxReadDate({peer:a,msgId:t}),{shouldThrow:!0});if(i)return{date:i.date}}async function _g(){const e=await Du(new Ye.messages.GetQuickReplies({}));if(e&&!(e instanceof Ye.messages.QuickRepliesNotModified))return{messages:e.messages.map(gr).filter(Boolean),quickReplies:e.quickReplies.map(Sr)}}async function bg({chat:e,shortcutId:t}){const n=await Du(new Ye.messages.GetQuickReplyMessages({shortcutId:t}));if(!n||n instanceof Ye.messages.MessagesNotModified)return;const s=n.messages.map((e=>e.id)),a=s.map(yi),i=await Du(new Ye.messages.SendQuickReplyMessages({peer:di(e.id,e.accessHash),shortcutId:t,id:s,randomId:a}),{shouldIgnoreUpdates:!0});if(i){if("updates"in i){const e=i.updates.filter((e=>!(e instanceof Ye.UpdateMessageID)));i.updates=e}Uu(i)}}async function vg({id:e,chat:t,shouldIncludeThread:n,shouldIncludeGrouped:s}){const a=await Du(new Ye.channels.ExportMessageLink({channel:fi(t.id,t.accessHash),id:e,thread:n||void 0,grouped:s||void 0}));return a?.link}async function wg({bot:e,id:t}){const n=await Du(new Ye.messages.GetPreparedInlineMessage({bot:fi(e.id,e.accessHash),id:t}));if(n)return function(e){const t=e.queryId.toString();return{queryId:t,result:Pr(t,e.result),peerTypes:e.peerTypes?.map($o),cacheTime:e.cacheTime}}(n)}async function Sg({id:e,accessHash:t}){const n=fi(e,t);if(!(n instanceof Ye.InputUser))return;const s=await Du(new Ye.users.GetFullUser({id:n}));if(!s)return;s.fullUser.profilePhoto&&Wi(s.fullUser.profilePhoto),s.fullUser.personalPhoto&&Wi(s.fullUser.personalPhoto),s.fullUser.fallbackPhoto&&Wi(s.fullUser.fallbackPhoto);const a=s.fullUser.botInfo;a?.descriptionPhoto&&Wi(a.descriptionPhoto),a?.descriptionDocument instanceof Ye.Document&&(Ta.documents[a.descriptionDocument.id.toString()]=a.descriptionDocument),s.fullUser.businessIntro?.sticker instanceof Ye.Document&&(Ta.documents[s.fullUser.businessIntro.sticker.id.toString()]=s.fullUser.businessIntro.sticker);const i=Br(s),o=s.users.map(xr).filter(Boolean),r=s.chats.map((e=>nc(e))).filter(Boolean),c=o.find((({id:t})=>t===e));return Da({"@type":"updateUser",id:e,user:c,fullInfo:i}),{user:c,fullInfo:i,users:o,chats:r}}async function Ig(e,t){const n=await Du(new Ye.messages.GetCommonChats({userId:fi(e.id,e.accessHash),maxId:t?Ti(t,ri(t)):void 0}));if(!n)return;const s=n.chats.map((e=>nc(e))).filter(Boolean).map((({id:e})=>e));return{chatIds:s,count:"count"in n?n.count:s.length}}async function Pg(){const e=await Du(new Ye.help.GetNearestDc);return e?.country}async function Cg(){const e=await Du(new Ye.contacts.GetTopPeers({correspondents:!0}));if(e instanceof Ye.contacts.TopPeers)return{ids:e.users.map(xr).filter((e=>Boolean(e)&&!e.isSelf)).map((({id:e})=>e))}}async function Mg(){const e=await Du(new Ye.contacts.GetContacts({hash:fe()("0")}));if(e&&!(e instanceof Ye.contacts.ContactsNotModified))return{users:e.users.map(xr).filter(Boolean),userStatusesById:Nr(e.users)}}async function Rg({users:e}){const t=await Du(new Ye.users.GetUsers({id:e.map((({id:e,accessHash:t})=>di(e,t)))}));if(t&&t.length)return{users:t.map(xr).filter(Boolean),userStatusesById:Nr(t)}}async function kg({phone:e,firstName:t,lastName:n}){const s=await Du(new Ye.contacts.ImportContacts({contacts:[Ii({phone:e||"",firstName:t||"",lastName:n||""})]}));return s instanceof Ye.contacts.ImportedContacts&&s.users.length&&Ji(s.users[0]),s?.imported.length?sa(s.imported[0].userId,"user"):void 0}function Ag({id:e,accessHash:t,phoneNumber:n="",firstName:s="",lastName:a="",shouldSharePhoneNumber:i=!1}){return Du(new Ye.contacts.AddContact({id:fi(e,t),firstName:s,lastName:a,phone:n,...i&&{addPhonePrivacyException:i}}),{shouldReturnTrue:!0})}async function Tg({id:e,accessHash:t}){const n=fi(e,t);n instanceof Ye.InputUser&&await Du(new Ye.contacts.DeleteContacts({id:[n]}))&&Da({"@type":"deleteContact",id:e})}async function Eg({peer:e,offset:t=0,limit:n=0}){const s="title"in e?e:void 0,a=s?void 0:e;if(a){const{id:e,accessHash:s}=a,i=await Du(new Ye.photos.GetUserPhotos({userId:fi(e,s),limit:n,offset:t,maxId:fe()("0")}));if(!i)return;i.photos.forEach(Wi);const o=i instanceof Ye.photos.PhotosSlice?i.count:i.photos.length,r=t+i.photos.length,c=r<o?r:void 0;return{count:o,photos:i.photos.filter((e=>e instanceof Ye.Photo)).map((e=>so(e))),nextOffsetId:c}}if(s?.isRestricted)return;const i=await Lf({peer:e,type:"profilePhoto",limit:n});if(!i)return;const{messages:o,totalCount:r,nextOffsetId:c}=i;return{count:r,photos:o.map((e=>"chatEditPhoto"===e.content.action?.type&&e.content.action.photo)).filter(Boolean),nextOffsetId:c}}function Ug(e){const{id:t,accessHash:n}=e;return Du(new Ye.messages.ReportSpam({peer:di(t,n)}),{shouldReturnTrue:!0})}function Dg(e){return Du(new Ye.account.UpdateEmojiStatus({emojiStatus:Vi(e)}),{shouldReturnTrue:!0})}function Bg(e){const t=e.map((e=>Ti(e,"user")));return Du(new Ye.contacts.EditCloseFriends({id:t}),{shouldReturnTrue:!0})}async function xg({hash:e="0"}){const t=await Du(new Ye.messages.GetEmojiStickers({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.AllStickersNotModified))return t.sets.forEach((e=>{(e.thumbs?.length||e.thumbDocumentId)&&(Ta.stickerSets[String(e.id)]=e)})),{hash:String(t.hash),sets:t.sets.map(mo)}}async function Vg({hash:e="0"}){const t=await Du(new Ye.messages.GetAllStickers({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.AllStickersNotModified))return t.sets.forEach((e=>{e.thumbs?.length&&(Ta.stickerSets[String(e.id)]=e)})),{hash:String(t.hash),sets:t.sets.map(mo)}}async function Ng({hash:e="0"}){const t=await Du(new Ye.messages.GetRecentStickers({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.RecentStickersNotModified))return{hash:String(t.hash),stickers:bo(t.stickers.slice(0,B))}}async function Fg({hash:e="0"}){const t=await Du(new Ye.messages.GetFavedStickers({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.FavedStickersNotModified))return{hash:String(t.hash),stickers:bo(t.stickers)}}async function Gg({hash:e="0"}){const t=await Du(new Ye.messages.GetFeaturedStickers({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.FeaturedStickersNotModified))return{hash:String(t.hash),isPremium:Boolean(t.premium),sets:t.sets.map(yo)}}async function qg(){const e=await Du(new Ye.messages.GetFeaturedEmojiStickers({hash:fe()(0)}));if(e&&!(e instanceof Ye.messages.FeaturedStickersNotModified))return e.sets.forEach((({set:e})=>{e.thumbDocumentId&&(Ta.stickerSets[String(e.id)]=e)})),{isPremium:Boolean(e.premium),sets:e.sets.map(yo)}}async function Hg({sticker:e,unfave:t}){const n=new Ye.messages.FaveSticker({id:pi(e),unfave:t});await Du(n)&&Da({"@type":"updateFavoriteStickers"})}function Og({sticker:e}){return Du(new Ye.messages.SaveRecentSticker({id:pi(e),unsave:!0}))}function Lg(){return Du(new Ye.messages.ClearRecentStickers)}async function jg({stickerSetInfo:e}){if("isMissing"in e)return;const t=await Du(new Ye.messages.GetStickerSet({stickerset:"id"in e?gi(e.id,e.accessHash):(n=e.shortName,new Ye.InputStickerSetShortName({shortName:n}))}),{shouldThrow:!0});var n;return t instanceof Ye.messages.StickerSet?(Ta.stickerSets[String(t.set.id)]=t.set,{set:mo(t.set),stickers:bo(t.documents),packs:_o(t.packs)}):void 0}async function Wg({documentId:e}){if(!e.length)return;const t=await Du(new Ye.messages.GetCustomEmojiDocuments({documentId:e.map((e=>fe()(e)))}));return t?bo(t):void 0}async function zg(){const e=await Du(new Ye.messages.GetStickerSet({stickerset:new Ye.InputStickerSetAnimatedEmoji}));if(e instanceof Ye.messages.StickerSet)return{set:mo(e.set),stickers:bo(e.documents)}}async function Kg(){const e=await Du(new Ye.messages.GetStickerSet({stickerset:new Ye.InputStickerSetAnimatedEmojiAnimations}));if(e instanceof Ye.messages.StickerSet)return{set:mo(e.set),stickers:bo(e.documents)}}async function $g(){const e=await Du(new Ye.messages.GetStickerSet({stickerset:new Ye.InputStickerSetEmojiGenericAnimations}));if(e instanceof Ye.messages.StickerSet)return{set:mo(e.set),stickers:bo(e.documents)}}async function Jg(){const e=await Du(new Ye.messages.GetStickerSet({stickerset:new Ye.InputStickerSetPremiumGifts}));if(e instanceof Ye.messages.StickerSet)return{set:mo(e.set),stickers:bo(e.documents)}}async function Qg(){const e=await Du(new Ye.messages.GetStickerSet({stickerset:new Ye.InputStickerSetEmojiDefaultTopicIcons}));if(e instanceof Ye.messages.StickerSet)return{set:mo(e.set),stickers:bo(e.documents)}}async function Xg(){const e=await Du(new Ye.messages.GetStickerSet({stickerset:new Ye.InputStickerSetEmojiDefaultStatuses}));if(e instanceof Ye.messages.StickerSet)return{set:mo(e.set),stickers:bo(e.documents)}}async function Zg({hash:e="0"}){const t=await Du(new Ye.account.GetCollectibleEmojiStatuses({hash:fe()(e)}));if(t instanceof Ye.account.EmojiStatuses)return{statuses:t.statuses.map(oa).filter(Boolean),hash:String(t.hash)}}async function Yg({query:e,hash:t="0"}){const n=await Du(new Ye.messages.SearchStickerSets({q:e,hash:fe()(t)}));if(n&&!(n instanceof Ye.messages.FoundStickerSetsNotModified))return{hash:String(n.hash),sets:n.sets.map(yo)}}async function ep({hash:e="0"}){const t=await Du(new Ye.messages.GetSavedGifs({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.SavedGifsNotModified))return{hash:String(t.hash),gifs:dp(t.gifs)}}function tp({gif:e,shouldUnsave:t}){return Du(new Ye.messages.SaveGif({id:pi(e),unsave:t}),{shouldReturnTrue:!0})}async function np({stickerSetId:e,accessHash:t}){await Du(new Ye.messages.InstallStickerSet({stickerset:gi(e,t)}))&&Da({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:Date.now()}})}async function sp({stickerSetId:e,accessHash:t}){await Du(new Ye.messages.UninstallStickerSet({stickerset:gi(e,t)}))&&Da({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:void 0}})}let ap;async function ip({query:e,offset:t="",username:n=Q}){if(!ap){const e=await Du(new Ye.contacts.ResolveUsername({username:n}));if(!(e&&e.users[0]instanceof Ye.User))return;ap=new Ye.InputUser({userId:e.peer.userId,accessHash:e.users[0].accessHash})}const s=await Du(new Ye.messages.GetInlineBotResults({bot:ap,peer:new Ye.InputPeerEmpty,query:e,offset:t}));if(!s)return;const a=s.results.map((e=>{if(e instanceof Ye.BotInlineMediaResult)return e.document})).filter(Boolean);return{nextOffset:s.nextOffset,gifs:dp(a)}}async function op({emoji:e,hash:t="0"}){const n=await Du(new Ye.messages.GetStickers({emoticon:e,hash:fe()(t)}));if(n&&!(n instanceof Ye.messages.StickersNotModified))return{stickers:bo(n.stickers),hash:String(n.hash)}}async function rp({language:e,fromVersion:t}){const n=await Du(new Ye.messages.GetEmojiKeywordsDifference({langCode:e,fromVersion:t}));if(n)return{language:n.langCode,version:n.version,keywords:n.keywords.reduce(((e,t)=>(e[t.keyword]=t.emoticons,e)),{})}}async function cp(e="0"){const t=await Du(new Ye.account.GetRecentEmojiStatuses({hash:fe()(e)}));if(!t||t instanceof Ye.account.EmojiStatusesNotModified)return;const n=t.statuses.slice(0,x).map(oa).filter(Boolean).map((({documentId:e})=>e)),s=await Wg({documentId:n});return{hash:String(t.hash),emojiStatuses:s}}function dp(e){return e.map((e=>{if(e instanceof Ye.Document){const t=Co(e);if(t)return Ta.documents[String(e.id)]=e,t}})).filter(Boolean)}async function up({username:e}){try{return{result:await Du(new Ye.channels.CheckUsername({channel:new Ye.InputChannelEmpty,username:e}),{shouldThrow:!0}),error:void 0}}catch(e){const t=e.message;if(W.has(t))return{result:!1,error:t};throw e}}async function lp({chat:e,username:t}){const n=await Du(new Ye.channels.UpdateUsername({channel:fi(e.id,e.accessHash),username:t}));let s=t?[{username:t,isEditable:!0,isActive:!0}]:[];return e.usernames&&(s=s.concat(e.usernames.filter((e=>e.username&&!e.isEditable)))),n&&Da({"@type":"updateChat",id:e.id,chat:{usernames:s.length?s:void 0}}),n}async function fp({chat:e}){const t=await Du(new Ye.channels.DeactivateAllUsernames({channel:fi(e.id,e.accessHash)}));if(t){const t=e.usernames?e.usernames.map((e=>({...e,isActive:!1}))).filter((e=>e.username)):void 0;Da({"@type":"updateChat",id:e.id,chat:{usernames:t}})}return t}async function gp({chat:e,usageLimit:t,expireDate:n}){const s=await Du(new Ye.messages.ExportChatInvite({peer:di(e.id,e.accessHash),usageLimit:t,expireDate:n}));if(s instanceof Ye.ChatInviteExported)return Da({"@type":"updateChatFullInfo",id:e.id,fullInfo:{inviteLink:s.link}}),s.link}async function pp({peer:e,admin:t,limit:n=0,isRevoked:s}){const a=await Du(new Ye.messages.GetExportedChatInvites({peer:di(e.id,e.accessHash),adminId:fi(t.id,t.accessHash),limit:n,revoked:s||void 0}),{abortControllerChatId:e.id});if(a)return{invites:a.invites.filter((e=>e instanceof Ye.ChatInviteExported)).map(gc)}}async function hp({peer:e,isRevoked:t,link:n,expireDate:s,usageLimit:a,isRequestNeeded:i,title:o}){const r=await Du(new Ye.messages.EditExportedChatInvite({link:n,peer:di(e.id,e.accessHash),expireDate:s,usageLimit:i?void 0:a,requestNeeded:i,title:o,revoked:t||void 0}));if(r){if(r instanceof Ye.messages.ExportedChatInvite&&r.invite instanceof Ye.ChatInviteExported){const e=gc(r.invite);return{oldInvite:e,newInvite:e}}if(r instanceof Ye.messages.ExportedChatInviteReplaced&&r.invite instanceof Ye.ChatInviteExported&&r.newInvite instanceof Ye.ChatInviteExported)return{oldInvite:gc(r.invite),newInvite:gc(r.newInvite)}}}async function mp({peer:e,expireDate:t,usageLimit:n,isRequestNeeded:s,title:a}){const i=await Du(new Ye.messages.ExportChatInvite({peer:di(e.id,e.accessHash),expireDate:t,usageLimit:s?void 0:n,requestNeeded:s||void 0,title:a}));if(i instanceof Ye.ChatInviteExported)return gc(i)}async function yp({peer:e,link:t}){return await Du(new Ye.messages.DeleteExportedChatInvite({peer:di(e.id,e.accessHash),link:t}))}async function _p({peer:e,admin:t}){return await Du(new Ye.messages.DeleteRevokedExportedChatInvites({peer:di(e.id,e.accessHash),adminId:fi(t.id,t.accessHash)}))}async function bp({peer:e,link:t,offsetDate:n=0,offsetUser:s,limit:a=0,isRequested:i}){const o=await Du(new Ye.messages.GetChatInviteImporters({peer:di(e.id,e.accessHash),link:t,offsetDate:n,offsetUser:s?fi(s.id,s.accessHash):new Ye.InputUserEmpty,limit:a,requested:i||void 0}),{abortControllerChatId:e.id});if(o)return{importers:o.importers.map((e=>function(e){const{userId:t,date:n,about:s,requested:a,viaChatlist:i}=e;return{userId:sa(t,"user"),date:n,about:s,isRequested:a,isFromChatList:i}}(e)))}}function vp({peer:e,user:t,isApproved:n}){return Du(new Ye.messages.HideChatJoinRequest({peer:di(e.id,e.accessHash),userId:fi(t.id,t.accessHash),approved:n||void 0}),{shouldReturnTrue:!0})}function wp({peer:e,isApproved:t,link:n}){return Du(new Ye.messages.HideAllChatJoinRequests({peer:di(e.id,e.accessHash),approved:t||void 0,link:n}),{shouldReturnTrue:!0})}function Sp(e){const{id:t,accessHash:n}=e;return Du(new Ye.messages.HidePeerSettingsBar({peer:di(t,n)}))}var Ip=n(48287).hp;function Pp(e){const{emojies_sounds:t}=e;return t?Object.keys(t).reduce(((e,n)=>{const s=t[n];return Ta.documents[s.id]=new Ye.Document({id:fe()(s.id),accessHash:fe()(s.access_hash),dcId:1,mimeType:"audio/ogg",fileReference:Ip.alloc(0),size:fe()(0)}),e[n]=s.id,e}),{}):{}}function Cp(e,t,n){return[e[`${t}_default`]||ae[n][0],e[`${t}_premium`]||ae[n][1]]}const Mp=["ar","fa","id","ko","uz","en"];function Rp({firstName:e,lastName:t,about:n}){return Du(new Ye.account.UpdateProfile({firstName:e||"",lastName:t||"",about:n||""}),{shouldReturnTrue:!0})}async function kp(e){try{return{result:await Du(new Ye.account.CheckUsername({username:e}),{shouldThrow:!0}),error:void 0}}catch(e){if(e instanceof tt&&W.has(e.errorMessage))return{result:!1,error:e.errorMessage};throw e}}function Ap(e){return Du(new Ye.account.UpdateUsername({username:e}),{shouldReturnTrue:!0})}async function Tp(e,t){const n=e?Si(e):new Ye.InputPhotoEmpty,s=await Du(new Ye.photos.UpdateProfilePhoto({id:n,...t?{fallback:!0}:void 0}));if(s)return s.photo instanceof Ye.Photo?(Wi(s.photo),{photo:so(s.photo)}):void 0}async function Ep(e,t,n=!1,s=0,a){const i=await Vu(e),o=await Du(new Ye.photos.UploadProfilePhoto({...a?{bot:di(a.id,a.accessHash)}:void 0,...n?{video:i,videoStartTs:s}:{file:i},...t?{fallback:!0}:void 0}));if(o)return o.photo instanceof Ye.Photo?(Wi(o.photo),{photo:so(o.photo)}):void 0}async function Up({file:e,isSuggest:t,user:n}){const s=e?await Vu(e):void 0,a=await Du(new Ye.photos.UploadContactProfilePhoto({userId:fi(n.id,n.accessHash),file:s,...t?{suggest:!0}:{save:!0}}));if(a)return a.photo instanceof Ye.Photo?(Wi(a.photo),{photo:so(a.photo)}):{photo:void 0}}async function Dp(e){const t=e.map(Si).filter(Boolean),n=await Du(new Ye.photos.DeletePhotos({id:t}),{shouldReturnTrue:!0});return n&&e.forEach((e=>{delete Ta.photos[e.id]})),n}async function Bp(){const e=await Du(new Ye.account.GetWallPapers({hash:fe()("0")}));if(!e||e instanceof Ye.account.WallPapersNotModified)return;const t=e.wallpapers.filter((e=>e instanceof Ye.WallPaper&&e.document instanceof Ye.Document&&!e.pattern&&"application/x-tgwallpattern"!==e.document.mimeType));return t.forEach((e=>{Ta.documents[String(e.document.id)]=e.document})),{wallpapers:t.map(Gr).filter(Boolean)}}async function xp(e){const t=await Vu(e),n=await Du(new Ye.account.UploadWallPaper({file:t,mimeType:e.type,settings:new Ye.WallPaperSettings}));if(!(n&&n instanceof Ye.WallPaper))return;const s=Gr(n);return s?(Ta.documents[String(n.document.id)]=n.document,{wallpaper:s}):void 0}async function Vp({isOnlyStories:e}){const t=await Du(new Ye.contacts.GetBlocked({myStoriesFrom:e,limit:b}));if(t)return{blockedIds:t.blocked.map((e=>aa(e.peerId))),totalCount:t instanceof Ye.contacts.BlockedSlice?t.count:t.blocked.length}}function Np({user:e,isOnlyStories:t}){return Du(new Ye.contacts.Block({id:di(e.id,e.accessHash),myStoriesFrom:t}))}function Fp({user:e,isOnlyStories:t}){return Du(new Ye.contacts.Unblock({id:di(e.id,e.accessHash),myStoriesFrom:t}))}async function Gp(){const e=await Du(new Ye.account.GetAuthorizations);if(e)return{authorizations:Xa(e.authorizations.map(qr),"hash"),ttlDays:e.authorizationTtlDays}}function qp(e){return Du(new Ye.account.ResetAuthorization({hash:fe()(e)}))}function Hp(){return Du(new Ye.auth.ResetAuthorizations)}async function Op(){const e=await Du(new Ye.account.GetWebAuthorizations);if(e)return{webAuthorizations:Xa(e.authorizations.map(Hr),"hash")}}function Lp(e){return Du(new Ye.account.ResetWebAuthorization({hash:fe()(e)}))}function jp(){return Du(new Ye.account.ResetWebAuthorizations)}async function Wp(){const e=await Du(new Ye.account.GetNotifyExceptions({compareSound:!0}),{shouldIgnoreUpdates:!0});if(e instanceof Ye.Updates||e instanceof Ye.UpdatesCombined)return e.updates.reduce(((e,t)=>t instanceof Ye.UpdateNotifySettings&&t.peer instanceof Ye.NotifyPeer?(e[aa(t.peer.peer)]=Or(t.notifySettings),e):e),{})}async function zp(){return await Du(new Ye.account.GetContactSignUpNotification)}async function Kp(){const[e,t,n]=await Promise.all([Du(new Ye.account.GetNotifySettings({peer:new Ye.InputNotifyUsers})),Du(new Ye.account.GetNotifySettings({peer:new Ye.InputNotifyChats})),Du(new Ye.account.GetNotifySettings({peer:new Ye.InputNotifyBroadcasts}))]);if(e&&t&&n)return{users:Or(e),groups:Or(t),channels:Or(n)}}function $p(e){return Du(new Ye.account.SetContactSignUpNotification({silent:e}))}function Jp(e,{isMuted:t,shouldShowPreviews:n}){let s;s="users"===e?new Ye.InputNotifyUsers:"groups"===e?new Ye.InputNotifyChats:new Ye.InputNotifyBroadcasts;const a={showPreviews:n,muteUntil:t?E:0};return Du(new Ye.account.UpdateNotifySettings({peer:s,settings:new Ye.InputPeerNotifySettings(a)}))}async function Qp({langPack:e,langCode:t}){const n=await Du(new Ye.langpack.GetLangPack({langPack:e,langCode:t}));if(!n)return;const{strings:s,keysToRemove:a}=Kr(n.strings);return{version:n.version,strings:s,keysToRemove:a}}async function Xp({langPack:e,langCode:t,fromVersion:n}){const s=await Du(new Ye.langpack.GetDifference({langPack:e,langCode:t,fromVersion:n}));if(!s)return;const{strings:a,keysToRemove:i}=Kr(s.strings);return{version:s.version,strings:a,keysToRemove:i}}async function Zp(){const e=await Du(new Ye.langpack.GetLanguages({langPack:K}));if(e)return e.map($r)}async function Yp({langPack:e,langCode:t}){const n=await Du(new Ye.langpack.GetLanguage({langPack:e,langCode:t}));if(n)return $r(n)}async function eh({langPack:e,langCode:t,keys:n}){const s=await Du(new Ye.langpack.GetStrings({langPack:e,langCode:t,keys:n}));if(s)return Kr(s)}async function th({sourceLangPacks:e,langCode:t}){const n=(await Promise.all(e.map((e=>Du(new Ye.langpack.GetLangPack({langPack:e,langCode:Mp.includes(t)?`${t}-raw`:t})))))).filter(Boolean).map(zr);if(n.length)return{langPack:Object.assign({},...n.reverse())}}async function nh(e){const t=Ri(e),n=await Du(new Ye.account.GetPrivacy({key:t}));if(n)return{rules:co(n.rules)}}function sh(e){const t=Cu.session.getAuthKey().getKey();return Du(new Ye.account.RegisterDevice({tokenType:10,secret:t,appSandbox:!1,otherUids:[],token:e}))}function ah(e){return Du(new Ye.account.UnregisterDevice({tokenType:10,otherUids:[],token:e}))}async function ih(e,t){const n=Ri(e),s=qi(t),a=await Du(new Ye.account.SetPrivacy({key:n,rules:s}));if(a)return{rules:co(a.rules)}}async function oh(e){await Du(new Ye.account.UpdateStatus({offline:!e}))}async function rh(){const e=await Du(new Ye.account.GetContentSettings);if(e)return{isSensitiveEnabled:Boolean(e.sensitiveEnabled),canChangeSensitive:Boolean(e.sensitiveCanChange)}}function ch(e){return Du(new Ye.account.SetContentSettings({sensitiveEnabled:e||void 0}))}async function dh(e){const t=await Du(new Ye.help.GetAppConfig({hash:e}));if(!t||t instanceof Ye.help.AppConfigNotModified)return;const{config:n,hash:s}=t;return function(e,t){const n=jr(e);return{emojiSounds:Pp(n),seenByMaxChatMembers:n.chat_read_mark_size_threshold,seenByExpiresAt:n.chat_read_mark_expire_period,readDateExpiresAt:n.pm_read_date_expire_period,autologinDomains:n.autologin_domains||[],urlAuthDomains:n.url_auth_domains||[],maxUniqueReactions:n.reactions_uniq_max??se,premiumBotUsername:n.premium_bot_username,premiumInvoiceSlug:n.premium_invoice_slug,premiumPromoOrder:n.premium_promo_order,isPremiumPurchaseBlocked:n.premium_purchase_blocked,isGiveawayGiftsPurchaseAvailable:n.giveaway_gifts_purchase_available,defaultEmojiStatusesStickerSetId:n.default_emoji_statuses_stickerset_id,topicsPinnedLimit:n.topics_pinned_limit,maxUserReactionsDefault:n.reactions_user_max_default,maxUserReactionsPremium:n.reactions_user_max_premium,hiddenMembersMinCount:n.hidden_members_group_size_min,giveawayAddPeersMax:n.giveaway_add_peers_max,giveawayBoostsPerPremium:n.giveaway_boosts_per_premium,giveawayCountriesMax:n.giveaway_countries_max,boostsPerSentGift:n.boosts_per_sent_gift,canDisplayAutoarchiveSetting:n.autoarchive_setting_available,limits:{uploadMaxFileparts:Cp(n,"upload_max_fileparts","uploadMaxFileparts"),stickersFaved:Cp(n,"stickers_faved_limit","stickersFaved"),savedGifs:Cp(n,"saved_gifs_limit","savedGifs"),dialogFiltersChats:Cp(n,"dialog_filters_chats_limit","dialogFiltersChats"),dialogFilters:Cp(n,"dialog_filters_limit","dialogFilters"),dialogFolderPinned:Cp(n,"dialogs_pinned_limit","dialogFolderPinned"),captionLength:Cp(n,"caption_length_limit","captionLength"),channels:Cp(n,"channels_limit","channels"),channelsPublic:Cp(n,"channels_public_limit","channelsPublic"),aboutLength:Cp(n,"about_length_limit","aboutLength"),chatlistInvites:Cp(n,"chatlist_invites_limit","chatlistInvites"),chatlistJoined:Cp(n,"chatlist_joined_limit","chatlistJoined"),recommendedChannels:Cp(n,"recommended_channels_limit","recommendedChannels"),savedDialogsPinned:Cp(n,"saved_dialogs_pinned_limit","savedDialogsPinned")},hash:t,areStoriesHidden:n.stories_all_hidden,storyExpirePeriod:n.story_expire_period??te,storyViewersExpirePeriod:n.story_viewers_expire_period??ne,storyChangelogUserId:n.stories_changelog_user_id?.toString()??$,maxPinnedStoriesCount:n.stories_pinned_to_top_count_max,groupTranscribeLevelMin:n.group_transcribe_level_min,canLimitNewMessagesWithoutPremium:n.new_noncontact_peers_require_premium_without_ownpremium,bandwidthPremiumNotifyPeriod:n.upload_premium_speedup_notify_period,bandwidthPremiumUploadSpeedup:n.upload_premium_speedup_upload,bandwidthPremiumDownloadSpeedup:n.upload_premium_speedup_download,channelRestrictAdsLevelMin:n.channel_restrict_sponsored_level_min,paidReactionMaxAmount:n.stars_paid_reaction_amount_max,isChannelRevenueWithdrawalEnabled:n.channel_revenue_withdrawal_enabled,isStarsGiftEnabled:n.stars_gifts_enabled,starGiftMaxMessageLength:n.stargifts_message_length_max,starGiftMaxConvertPeriod:n.stargifts_convert_period_max,starRefStartPrefixes:n.starref_start_param_prefixes,tonExplorerUrl:n.ton_blockchain_explorer_url,savedGiftPinLimit:n.stargifts_pinned_to_top_limit}}(n,s)}async function uh(){const e=await Du(new Ye.help.GetConfig);if(e)return function(e){const{testMode:t,expires:n,gifSearchUsername:s,chatSizeMax:a,autologinToken:i,reactionsDefault:o,messageLengthMax:r,editTimeLimit:c,forwardedCountMax:d}=e;return{isTestServer:t,expiresAt:n,gifSearchUsername:s,defaultReaction:o&&nr(o),maxGroupSize:a,autologinToken:i,maxMessageLength:r,editTimeLimit:c,maxForwardedCount:d}}(e)}async function lh(e){const t=await Du(new Ye.help.GetPeerColors({hash:e}));if(!t)return;const n=function(e){if(e instanceof Ye.help.PeerColors)return Za(e.colors,(e=>[e.colorId,{isHidden:e.hidden,colors:e.colors&&Jr(e.colors),darkColors:e.darkColors&&Jr(e.darkColors)}]))}(t);return n?{colors:n,hash:t instanceof Ye.help.PeerColors?t.hash:void 0}:void 0}async function fh(e){const t=await Du(new Ye.help.GetTimezonesList({hash:e}));if(t&&!(t instanceof Ye.help.TimezonesListNotModified))return{timezones:t.timezones.map(Qr),hash:t.hash}}async function gh({langCode:e="en"}){const t=await Du(new Ye.help.GetCountriesList({langCode:e}));if(t instanceof Ye.help.CountriesList)return function(e){const t=e.filter((({hidden:e})=>!e));return{phoneCodes:t.map((e=>e.countryCodes.map((t=>Lr(e,t))))).flat().sort(((e,t)=>e.name?e.name.localeCompare(t.name):e.defaultName.localeCompare(t.defaultName))),general:t.map((e=>Lr(e,e.countryCodes[0]))).sort(((e,t)=>e.name?e.name.localeCompare(t.name):e.defaultName.localeCompare(t.defaultName)))}}(t.countries)}async function ph(){const e=await Du(new Ye.account.GetGlobalPrivacySettings);if(e)return{shouldArchiveAndMuteNewNonContact:Boolean(e.archiveAndMuteNewNoncontactPeers),shouldHideReadMarks:Boolean(e.hideReadMarks),shouldNewNonContactPeersRequirePremium:Boolean(e.newNoncontactPeersRequirePremium)}}async function hh({shouldArchiveAndMuteNewNonContact:e,shouldHideReadMarks:t,shouldNewNonContactPeersRequirePremium:n}){const s=await Du(new Ye.account.SetGlobalPrivacySettings({settings:new Ye.GlobalPrivacySettings({...e&&{archiveAndMuteNewNoncontactPeers:!0},...t&&{hideReadMarks:!0},...n&&{newNoncontactPeersRequirePremium:!0}})}));if(s)return{shouldArchiveAndMuteNewNonContact:Boolean(s.archiveAndMuteNewNoncontactPeers),shouldHideReadMarks:Boolean(s.hideReadMarks),shouldNewNonContactPeersRequirePremium:Boolean(s.newNoncontactPeersRequirePremium)}}function mh({chatId:e,accessHash:t,username:n,isActive:s}){return Du(e?new Ye.channels.ToggleUsername({channel:fi(e,t),username:n,active:s}):new Ye.account.ToggleUsername({username:n,active:s}))}function yh({chatId:e,accessHash:t,usernames:n}){return Du(e?new Ye.channels.ReorderUsernames({channel:fi(e,t),order:n}):new Ye.account.ReorderUsernames({order:n}))}const _h={};async function bh(){const e=await Du(new Ye.account.GetPassword);if(!e)return;const{hint:t,hasPassword:n}=e;return{hint:t,hasPassword:n}}function vh(e){return Da({"@type":"updateTwoFaStateWaitCode",length:e}),new Promise(((e,t)=>{_h.resolve=e,_h.reject=t}))}function wh(e,t){try{return function(e,t){return Cu.getTmpPassword(e,t)}(e,t)}catch(e){if(!ya(e))return;return Promise.resolve(_a(e))}}function Sh(e){try{return t=e,Cu.getCurrentPassword(t)}catch(e){if(!ya(e))return;return Promise.resolve(_a(e))}var t}async function Ih(e){try{return await Nu({isCheckPassword:!0,currentPassword:e}),!0}catch(e){return kh(e),!1}}async function Ph(e){try{return await Nu({currentPassword:e}),!0}catch(e){return kh(e),!1}}async function Ch(e,t,n,s){try{return await Nu({currentPassword:e,newPassword:t,hint:n,email:s,emailCodeCallback:vh,onEmailCodeError:kh}),!0}catch(e){return kh(e),!1}}async function Mh(e,t){try{return await Nu({currentPassword:e,newPassword:e,email:t,emailCodeCallback:vh,onEmailCodeError:kh}),!0}catch(e){return kh(e),!1}}function Rh(e){_h.resolve(e)}function kh(e){Da({"@type":"updateTwoFaError",messageKey:_a(e).messageKey})}async function Ah({chatId:e,accessHash:t,messageId:n,data:s,isGame:a}){const i=await Du(new Ye.messages.GetBotCallbackAnswer({peer:di(e,t),msgId:n,data:s?ha(s):void 0,game:a||void 0}));return i?wa(i):void 0}async function Th(){const e=await Du(new Ye.contacts.GetTopPeers({botsInline:!0}));if(e instanceof Ye.contacts.TopPeers)return{ids:e.users.map(xr).filter(Boolean).map((({id:e})=>e))}}async function Eh(){const e=await Du(new Ye.contacts.GetTopPeers({botsApp:!0}));if(e instanceof Ye.contacts.TopPeers)return{ids:e.users.map(xr).filter(Boolean).map((({id:e})=>e))}}async function Uh({username:e}){const t=await Du(new Ye.contacts.ResolveUsername({username:e}));if(t&&t.users[0]instanceof Ye.User&&t.users[0].bot&&t.users[0].botInlinePlaceholder)return Ji(t.users[0]),{user:xr(t.users[0]),chat:nc(t.users[0])}}async function Dh({bot:e,chat:t,query:n,offset:s=""}){const a=await Du(new Ye.messages.GetInlineBotResults({bot:di(e.id,e.accessHash),peer:di(t.id,t.accessHash),query:n,offset:s}));var i,o,r,c,d,u;if(a)return{isGallery:Boolean(a.gallery),help:e.botPlaceholder,nextOffset:(d=e.usernames[0].username,u=a.nextOffset,"gif"===d&&"0"===u?"":u),switchPm:(c=a.switchPm,c?Ya(c,["text","startParam"]):void 0),switchWebview:(r=a.switchWebview,r?Ya(r,["text","url"]):void 0),results:(i=String(a.queryId),o=a.results,o.map((e=>e instanceof Ye.BotInlineMediaResult?(e.document instanceof Ye.Document&&zi(e.document),e.photo instanceof Ye.Photo&&Wi(e.photo),Ho(e,i)):(e.thumb&&Qi(e.thumb),qo(e,i))))),cacheTime:a.cacheTime}}async function Bh({chat:e,replyInfo:t,resultId:n,queryId:s,sendAs:a,isSilent:i,scheduleDate:o}){const r=yi();await Du(new Ye.messages.SendInlineBotResult({clearDraft:!0,randomId:r,queryId:fe()(s),peer:di(e.id,e.accessHash),id:n,scheduleDate:o,replyTo:t&&Gi(t),...i&&{silent:!0},...a&&{sendAs:di(a.id,a.accessHash)}}))}async function xh({bot:e,startParam:t}){const n=yi();await Du(new Ye.messages.StartBot({bot:di(e.id,e.accessHash),peer:di(e.id,e.accessHash),randomId:n,startParam:t}))}async function Vh({isSilent:e,peer:t,bot:n,url:s,startParam:a,replyInfo:i,theme:o,sendAs:r,isFromBotMenu:c,isFullscreen:d}){const u=await Du(new Ye.messages.RequestWebView({silent:e||void 0,peer:di(t.id,t.accessHash),bot:di(n.id,n.accessHash),url:s,startParam:a,themeParams:o?Ai(o):void 0,fromBotMenu:c||void 0,platform:z,replyTo:i&&Gi(i),fullscreen:!!d||void 0,...r&&{sendAs:di(r.id,r.accessHash)}}));if(u instanceof Ye.WebViewResultUrl)return{url:u.url,queryId:u.queryId?.toString(),isFullScreen:Boolean(u.fullscreen)}}async function Nh({peer:e,bot:t,startParam:n,mode:s,theme:a}){const i=await Du(new Ye.messages.RequestMainWebView({peer:di(e.id,e.accessHash),bot:di(t.id,t.accessHash),startParam:n,fullscreen:"fullscreen"===s||void 0,themeParams:a?Ai(a):void 0,platform:z}));if(i instanceof Ye.WebViewResultUrl)return{url:i.url,queryId:i.queryId?.toString(),isFullscreen:Boolean(i.fullscreen)}}async function Fh({bot:e,url:t,theme:n,startParam:s,isFromSwitchWebView:a,isFromSideMenu:i}){const o=await Du(new Ye.messages.RequestSimpleWebView({url:t,bot:di(e.id,e.accessHash),themeParams:n?Ai(n):void 0,platform:z,startParam:s,fromSwitchWebview:a||void 0,fromSideMenu:i||void 0}));return o?.url}async function Gh({bot:e,appName:t}){const n=await Du(new Ye.messages.GetBotApp({app:new Ye.InputBotAppShortName({botId:fi(e.id,e.accessHash),shortName:t})}));if(n&&!(n instanceof Ye.BotAppNotModified))return function(e){const{app:t,inactive:n,requestWriteAccess:s}=e,a=Ko(t);if(a)return{...a,isInactive:n,shouldRequestWriteAccess:s}}(n)}async function qh({peer:e,app:t,startParam:n,mode:s,theme:a,isWriteAllowed:i}){const o=await Du(new Ye.messages.RequestAppWebView({peer:di(e.id,e.accessHash),app:Fi(t),startParam:n,themeParams:a?Ai(a):void 0,platform:z,writeAllowed:i||void 0,fullscreen:"fullscreen"===s||void 0}));return{url:o?.url,isFullscreen:Boolean(o?.fullscreen)}}function Hh({isSilent:e,peer:t,bot:n,queryId:s,replyInfo:a,sendAs:i}){return Du(new Ye.messages.ProlongWebView({silent:e||void 0,peer:di(t.id,t.accessHash),bot:di(n.id,n.accessHash),queryId:fe()(s),replyTo:a&&Gi(a),...i&&{sendAs:di(i.id,i.accessHash)}}))}async function Oh({bot:e,buttonText:t,data:n}){const s=yi();await Du(new Ye.messages.SendWebViewData({bot:di(e.id,e.accessHash),buttonText:t,data:n,randomId:s}))}async function Lh({hash:e}){const t=await Du(new Ye.messages.GetAttachMenuBots({hash:e?fe()(e):void 0}));if(t instanceof Ye.AttachMenuBots)return{hash:t.hash.toString(),bots:Xa(t.bots.map(Oo),"id")}}async function jh({bot:e}){const t=await Du(new Ye.messages.GetAttachMenuBot({bot:di(e.id,e.accessHash)}));if(t instanceof Ye.AttachMenuBotsBot)return{bot:Oo(t.bot)}}function Wh({bot:e,isWriteAllowed:t,isEnabled:n}){return Du(new Ye.messages.ToggleBotInAttachMenu({bot:di(e.id,e.accessHash),writeAllowed:t||void 0,enabled:n}))}async function zh({chat:e,buttonId:t,messageId:n}){const s=await Du(new Ye.messages.RequestUrlAuth({peer:di(e.id,e.accessHash),buttonId:t,msgId:n}));if(!s)return;const a=Wr(s);return"request"===a?.type&&Da({"@type":"updateUser",id:a.bot.id,user:a.bot}),a}async function Kh({chat:e,messageId:t,buttonId:n,isWriteAllowed:s}){const a=await Du(new Ye.messages.AcceptUrlAuth({peer:di(e.id,e.accessHash),msgId:t,buttonId:n,writeAllowed:s||void 0}));if(!a)return;const i=Wr(a);return"request"===i?.type&&Da({"@type":"updateUser",id:i.bot.id,user:i.bot}),i}async function $h({url:e}){const t=await Du(new Ye.messages.RequestUrlAuth({url:e}));if(!t)return;const n=Wr(t);return"request"===n?.type&&Da({"@type":"updateUser",id:n.bot.id,user:n.bot}),n}async function Jh({url:e,isWriteAllowed:t}){const n=await Du(new Ye.messages.AcceptUrlAuth({url:e,writeAllowed:t||void 0}));if(!n)return;const s=Wr(n);return"request"===s?.type&&Da({"@type":"updateUser",id:s.bot.id,user:s.bot}),s}function Qh({bot:e}){return Du(new Ye.bots.CanSendMessage({bot:fi(e.id,e.accessHash)}))}function Xh({bot:e}){return Du(new Ye.bots.AllowSendMessage({bot:fi(e.id,e.accessHash)}),{shouldReturnTrue:!0})}async function Zh({bot:e,customMethod:t,parameters:n}){try{const s=await Du(new Ye.bots.InvokeWebViewCustomMethod({bot:di(e.id,e.accessHash),params:new Ye.DataJSON({data:n}),customMethod:t}),{shouldThrow:!0});return{result:JSON.parse(s.data)}}catch(e){return{error:e.message}}}async function Yh({bot:e}){const t=await Du(new Ye.bots.GetPreviewMedias({bot:di(e.id,e.accessHash)}));if(t)return t.map((e=>({content:Po(e.media),date:e.date})))}function em({bot:e,fileName:t,url:n}){return Du(new Ye.bots.CheckDownloadFileParams({bot:di(e.id,e.accessHash),fileName:t,url:n}),{shouldReturnTrue:!0})}function tm({bot:e,isEnabled:t}){return Du(new Ye.bots.ToggleUserEmojiStatusPermission({bot:di(e.id,e.accessHash),enabled:t}),{shouldReturnTrue:!0})}function nm({bot:e,langCode:t,name:n,about:s,description:a}){return Du(new Ye.bots.SetBotInfo({bot:di(e.id,e.accessHash),langCode:t,name:n||"",about:s||"",description:a||""}),{shouldReturnTrue:!0})}async function sm({offset:e="",limit:t}){const n=await Du(new Ye.bots.GetPopularAppBots({offset:e,limit:t}));if(n)return{peerIds:n.users.map(xr).filter(Boolean).map((({id:e})=>e)),nextOffset:n.nextOffset}}async function am({user:e}){if(!e)return;const t=fi(e.id,e.accessHash),n=await Du(new Ye.bots.GetBotRecommendations({bot:t}));if(!n)return;const s=n?.users.map(xr).filter(Boolean);return{similarBots:s,count:n instanceof Ye.users.UsersSlice?n.count:s.length}}var im=n(48287).hp;async function om({call:e}){const t=await Du(new Ye.phone.GetGroupCall({call:Ei(e)}));if(t)return{groupCall:Ec(t.call)}}function rm({call:e}){return Du(new Ye.phone.DiscardGroupCall({call:Ei(e)}),{shouldReturnTrue:!0})}function cm({call:e,participant:t,muted:n,presentationPaused:s,videoStopped:a,videoPaused:i,volume:o,raiseHand:r}){return Du(new Ye.phone.EditGroupCallParticipant({call:Ei(e),participant:di(t.id,t.accessHash),...void 0!==a&&{videoStopped:a},...void 0!==i&&{videoPaused:i},...void 0!==n&&{muted:n},...void 0!==s&&{presentationPaused:s},...void 0!==r&&{raiseHand:r},...void 0!==o&&{volume:o}}),{shouldReturnTrue:!0})}function dm({groupCall:e,title:t}){return Du(new Ye.phone.EditGroupCallTitle({title:t,call:Ei(e)}),{shouldReturnTrue:!0})}async function um({call:e,canSelfUnmute:t}){const n=await Du(new Ye.phone.ExportGroupCallInvite({canSelfUnmute:t||void 0,call:Ei(e)}));if(n)return n.link}async function lm({call:e,offset:t}){const n=await Du(new Ye.phone.GetGroupParticipants({call:Ei(e),ids:[],sources:[],offset:t||"",limit:v}));n&&Da({"@type":"updateGroupCallParticipants",groupCallId:e.id,participants:n.participants.map(kc),nextOffset:n.nextOffset})}function fm({call:e,isPageUnload:t}){const n=new Ye.phone.LeaveGroupCall({call:Ei(e)});t?Bu(n):Du(n,{shouldReturnTrue:!0})}async function gm({call:e,inviteHash:t,params:n}){const s=await Du(new Ye.phone.JoinGroupCall({call:Ei(e),joinAs:new Ye.InputPeerSelf,muted:!0,videoStopped:!0,params:new Ye.DataJSON({data:JSON.stringify(n)}),inviteHash:t}),{shouldRetryOnTimeout:!0,abortControllerGroup:"call"});if(s&&s instanceof Ye.Updates){const e=s.updates.find((e=>e instanceof Ye.UpdateGroupCall));if(!(e instanceof Ye.UpdateGroupCall))return;return Ec(e.call)}}async function pm({peer:e}){const t=bi(),n=await Du(new Ye.phone.CreateGroupCall({peer:di(e.id,e.accessHash),randomId:t}));if(n&&n instanceof Ye.Updates){const e=n.updates[0];if(e instanceof Ye.UpdateGroupCall)return Ec(e.call)}}function hm({call:e,params:t}){return Du(new Ye.phone.JoinGroupCallPresentation({call:Ei(e),params:new Ye.DataJSON({data:JSON.stringify(t)})}),{shouldReturnTrue:!0})}function mm({call:e,subscribed:t}){return Du(new Ye.phone.ToggleGroupCallStartSubscription({call:Ei(e),subscribed:t}),{shouldReturnTrue:!0,shouldIgnoreErrors:!0})}function ym({call:e}){return Du(new Ye.phone.LeaveGroupCallPresentation({call:Ei(e)}),{shouldReturnTrue:!0})}async function _m(){const e=await Du(new Ye.messages.GetDhConfig({}));if(e&&!(e instanceof Ye.messages.DhConfigNotModified))return{g:e.g,p:Array.from(e.p),random:Array.from(e.random)}}function bm({call:e,isBusy:t,isPageUnload:n}){const s=new Ye.phone.DiscardCall({peer:Ui(e),reason:t?new Ye.PhoneCallDiscardReasonBusy:new Ye.PhoneCallDiscardReasonHangup});n?Bu(s):Du(s,{shouldReturnTrue:!0})}async function vm({user:e,gAHash:t,isVideo:n}){const s=await Du(new Ye.phone.RequestCall({randomId:bi(),userId:di(e.id,e.accessHash),gAHash:im.from(t),...n&&{video:!0},protocol:xc()}));if(s)return Da({"@type":"updatePhoneCall",call:Uc(s.phoneCall)}),!0}function wm({call:e,rating:t,comment:n}){return Du(new Ye.phone.SetCallRating({rating:t,peer:Ui(e),comment:n}),{shouldReturnTrue:!0})}function Sm({call:e}){return Du(new Ye.phone.ReceivedCall({peer:Ui(e)}))}async function Im({call:e,gB:t}){const n=await Du(new Ye.phone.AcceptCall({peer:Ui(e),gB:im.from(t),protocol:xc()}));if(n)return Da({"@type":"updatePhoneCall",call:e=Uc(n.phoneCall)}),!0}async function Pm({call:e,gA:t,keyFingerprint:n}){const s=await Du(new Ye.phone.ConfirmCall({peer:Ui(e),gA:im.from(t),keyFingerprint:fe()(n),protocol:xc()}));if(s)return Da({"@type":"updatePhoneCall",call:e=Uc(s.phoneCall)}),!0}function Cm({data:e,call:t}){return Du(new Ye.phone.SendSignalingData({data:im.from(e),peer:Ui(t)}))}function Mm({chat:e,emoticon:t}){return Du(new Ye.messages.SetTyping({peer:di(e.id,e.accessHash),action:new Ye.SendMessageEmojiInteractionSeen({emoticon:t})}),{abortControllerChatId:e.id})}function Rm({chat:e,emoticon:t,messageId:n,timestamps:s}){return Du(new Ye.messages.SetTyping({peer:di(e.id,e.accessHash),action:new Ye.SendMessageEmojiInteraction({emoticon:t,msgId:n,interaction:new Ye.DataJSON({data:JSON.stringify({v:1,a:s.map((e=>({t:e,i:1})))})})})}),{abortControllerChatId:e.id})}async function km(){const e=await Du(new Ye.messages.GetAvailableReactions({}));if(e&&!(e instanceof Ye.messages.AvailableReactionsNotModified))return e.reactions.forEach((e=>{e.staticIcon instanceof Ye.Document&&(Ta.documents[String(e.staticIcon.id)]=e.staticIcon),e.selectAnimation instanceof Ye.Document&&(Ta.documents[String(e.selectAnimation.id)]=e.selectAnimation),e.aroundAnimation instanceof Ye.Document&&(Ta.documents[String(e.aroundAnimation.id)]=e.aroundAnimation),e.appearAnimation instanceof Ye.Document&&(Ta.documents[String(e.appearAnimation.id)]=e.appearAnimation),e.centerIcon instanceof Ye.Document&&(Ta.documents[String(e.centerIcon.id)]=e.centerIcon)})),e.reactions.map(ar)}async function Am(){const e=await Du(new Ye.messages.GetAvailableEffects({}));if(!e||e instanceof Ye.messages.AvailableEffectsNotModified)return;const t=new Map(e.documents.map((e=>[String(e.id),e])));e.documents.forEach((e=>{e instanceof Ye.Document&&(Ta.documents[String(e.id)]=e)}));const n=e.effects.map(ir),s=[],a=[];for(const e of n)if(e.effectAnimationId){const n=t.get(e.effectStickerId),s=n&&ho(n,!1,e.isPremium);s&&a.push(s)}else{const t=ho(Ta.documents[e.effectStickerId]);t&&s.push(t)}return{effects:n,emojis:a,stickers:s}}function Tm({chat:e,messageId:t,reactions:n,shouldAddToRecent:s}){return Du(new Ye.messages.SendReaction({reaction:n?.map((e=>xi(e))),peer:di(e.id,e.accessHash),msgId:t,...s&&{addToRecent:!0}}),{shouldReturnTrue:!0,shouldThrow:!0})}function Em({chat:e,messageId:t,count:n,isPrivate:s,peerId:a}){return Du(new Ye.messages.SendPaidReaction({peer:di(e.id,e.accessHash),msgId:t,randomId:_i(),count:n,private:ui(s,a)}),{shouldReturnTrue:!0,shouldThrow:!0})}function Um({ids:e,chat:t}){ai(e,S).forEach((e=>{Du(new Ye.messages.GetMessagesReactions({id:e,peer:di(t.id,t.accessHash)}),{shouldReturnTrue:!0,abortControllerChatId:t.id})}))}async function Dm({chat:e,messageId:t,reaction:n,offset:s}){const a=await Du(new Ye.messages.GetMessageReactionsList({peer:di(e.id,e.accessHash),id:t,...n&&{reaction:xi(n)},limit:M,...s&&{offset:s}}));if(!a)return;const{nextOffset:i,reactions:o,count:r}=a;return{nextOffset:i,reactions:o.map(tr).filter(Boolean),count:r}}function Bm({reaction:e}){return Du(new Ye.messages.SetDefaultReaction({reaction:xi(e)}))}async function xm({hash:e="0"}){const t=await Du(new Ye.messages.GetTopReactions({limit:P,hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.ReactionsNotModified))return{hash:String(t.hash),reactions:t.reactions.map((e=>nr(e))).filter(Boolean)}}async function Vm({hash:e="0"}){const t=await Du(new Ye.messages.GetRecentReactions({limit:C,hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.ReactionsNotModified))return{hash:String(t.hash),reactions:t.reactions.map((e=>nr(e))).filter(Boolean)}}function Nm(){return Du(new Ye.messages.ClearRecentReactions)}async function Fm({hash:e="0"}){const t=await Du(new Ye.messages.GetDefaultTagReactions({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.ReactionsNotModified))return{hash:String(t.hash),reactions:t.reactions.map((e=>nr(e))).filter(Boolean)}}async function Gm({hash:e="0"}){const t=await Du(new Ye.messages.GetSavedReactionTags({hash:fe()(e)}));if(t&&!(t instanceof Ye.messages.SavedReactionTagsNotModified))return{hash:String(t.hash),tags:t.tags.map(sr).filter(Boolean)}}function qm({reaction:e,title:t}){return Du(new Ye.messages.UpdateSavedReactionTag({reaction:xi(e),title:t}),{shouldReturnTrue:!0})}async function Hm({chat:e,dcId:t}){const n=await Du(new Ye.stats.GetBroadcastStats({channel:fi(e.id,e.accessHash)}),{dcId:t});var s;if(n)return{stats:(s=n,{growthGraph:Hc(s.growthGraph),followersGraph:Hc(s.followersGraph),muteGraph:Hc(s.muteGraph),topHoursGraph:Hc(s.topHoursGraph),languagesGraph:s.languagesGraph.token,viewsBySourceGraph:s.viewsBySourceGraph.token,newFollowersBySourceGraph:s.newFollowersBySourceGraph.token,interactionsGraph:s.interactionsGraph.token,reactionsByEmotionGraph:s.reactionsByEmotionGraph.token,storyInteractionsGraph:s.storyInteractionsGraph.token,storyReactionsByEmotionGraph:s.storyReactionsByEmotionGraph.token,followers:Lc(s.followers),viewsPerPost:Lc(s.viewsPerPost),sharesPerPost:Lc(s.sharesPerPost),enabledNotifications:jc(s.enabledNotifications),reactionsPerPost:Lc(s.reactionsPerPost),viewsPerStory:Lc(s.viewsPerStory),sharesPerStory:Lc(s.sharesPerStory),reactionsPerStory:Lc(s.reactionsPerStory),recentPosts:s.recentPostsInteractions.map(Nc).filter(Boolean)}),users:[]}}async function Om({peer:e,dcId:t}){const n=await Du(new Ye.stats.GetBroadcastRevenueStats({peer:di(e.id,e.accessHash)}),{dcId:t});var s;if(n)return{topHoursGraph:Hc((s=n).topHoursGraph),revenueGraph:Hc(s.revenueGraph,void 0,!0,s.usdRate),balances:zc(s.balances),usdRate:s.usdRate}}async function Lm({chat:e,dcId:t}){const n=await Du(new Ye.stats.GetMegagroupStats({channel:fi(e.id,e.accessHash)}),{dcId:t});var s,a;if(n)return{stats:(s=n,{growthGraph:Hc(s.growthGraph),membersGraph:Hc(s.membersGraph),topHoursGraph:Hc(s.topHoursGraph),languagesGraph:s.languagesGraph.token,messagesGraph:s.messagesGraph.token,actionsGraph:s.actionsGraph.token,period:(a=s.period,{maxDate:a.maxDate,minDate:a.minDate}),members:Lc(s.members),viewers:Lc(s.viewers),messages:Lc(s.messages),posters:Lc(s.posters)})}}async function jm({chat:e,messageId:t,dcId:n}){const s=await Du(new Ye.stats.GetMessageStats({channel:fi(e.id,e.accessHash),msgId:t}),{dcId:n});if(s)return Fc(s)}async function Wm({chat:e,messageId:t,dcId:n,offset:s}){const a=await Du(new Ye.stats.GetMessagePublicForwards({channel:fi(e.id,e.accessHash),msgId:t,offset:s,limit:I}),{dcId:n});if(a)return{forwards:Gc(a),count:a.count,nextOffset:a.nextOffset}}async function zm({token:e,x:t,isPercentage:n,dcId:s}){const a=await Du(new Ye.stats.LoadAsyncGraph({token:e,...t&&{x:fe()(t)}}),{dcId:s});if(a)return Hc(a,n)}async function Km({chat:e,storyId:t,dcId:n}){const s=await Du(new Ye.stats.GetStoryStats({peer:di(e.id,e.accessHash),id:t}),{dcId:n});if(s)return Fc(s)}async function $m({chat:e,storyId:t,dcId:n,offset:s}){const a=await Du(new Ye.stats.GetStoryPublicForwards({peer:di(e.id,e.accessHash),id:t,offset:s,limit:I}),{dcId:n});if(a)return{publicForwards:qc(a),count:a.count,nextOffset:a.nextOffset}}async function Jm({peer:e,currentPassword:t}){try{const n=await Sh(t);if(!n)return;if("error"in n)return n;const s=await Du(new Ye.stats.GetBroadcastRevenueWithdrawalUrl({peer:di(e.id,e.accessHash),password:n}),{shouldThrow:!0});if(!s)return;return{url:s.url}}catch(e){if(!ya(e))return;return _a(e)}}var Qm=n(48287).hp;function Xm(e,t,n){var s;return(t="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?s:s+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Zm;class Ym{constructor(e){this.isOutgoing=e,Xm(this,"state",void 0),Xm(this,"seq",0),Xm(this,"gA",void 0),Xm(this,"gB",void 0),Xm(this,"p",void 0),Xm(this,"random",void 0),Xm(this,"waitForState",void 0),Xm(this,"resolveState",void 0),this.waitForState=new Promise((e=>{this.resolveState=e}))}async requestCall({p:e,g:t,random:n}){const s=Pe(Qm.from(e),!1),a=Pe(Qm.from(n),!1),i=Ue(fe()(t),a,s);this.gA=i,this.p=s,this.random=a;const o=await Ee(De(i));return Array.from(o)}acceptCall({p:e,g:t,random:n}){const s=Pe(e,!1),a=Pe(n,!1),i=Ue(fe()(t),a,s);return this.gB=i,this.p=s,this.random=a,Array.from(De(i))}async confirmCall(e,t,n){if(!this.random||!this.p)throw new Error("Values not set");this.isOutgoing?this.gB=Pe(Qm.from(e),!1):this.gA=Pe(Qm.from(e),!1);const s=Ue(this.isOutgoing?this.gB:this.gA,this.random,this.p),a=Pe((await Te(De(s))).slice(-8).reverse(),!1),i=await async function(e,t,n,s){const a=await Ee(Qm.concat([new Uint8Array(e),new Uint8Array(t)])),i=[],o=s.length-1;for(let e=0;e!==a.byteLength;e+=8){const t=(r=a.subarray(e,e+8),fe()(r[0]).and(127).shiftLeft(56).or(fe()(r[1]).shiftLeft(48)).or(fe()(r[2]).shiftLeft(40)).or(fe()(r[3]).shiftLeft(32)).or(fe()(r[4]).shiftLeft(24)).or(fe()(r[5]).shiftLeft(16)).or(fe()(r[6]).shiftLeft(8)).or(fe()(r[7]))).modPow(1,o).toJSNumber(),c=s[t],d=s[t+1]-c;i.push(String.fromCharCode(...n.subarray(c,c+d)))}var r;return i.join("")}(De(s),De(this.gA),t,n),o=new Dn;return await o.setKey(De(s)),this.state=new Rn(o,new $t,!0,this.isOutgoing),this.resolveState(),{gA:Array.from(De(this.gA)),keyFingerprint:a.toString(),emojis:i}}async encode(e){if(!this.state)return;const t=new Uint32Array(1);t[0]=this.seq++;const n=await this.state.encryptMessageData(Qm.concat([Ae(t),Qm.from(e)]));return Array.from(n)}async decode(e){if(!this.state)return this.waitForState.then((()=>this.decode(e)));const t=await this.state.decryptMessageData(Qm.from(e));return JSON.parse(t.toString())}}function ey(e){Zm=new Ym(...e)}function ty(){Zm=void 0}function ny(e){return Zm.encode(...e)}async function sy(e){if(Zm)return await Zm.decode(...e)}function ay(e){return Zm.confirmCall(...e)}function iy(e){return Zm.acceptCall(...e)}function oy(e){return Zm.requestCall(...e)}async function ry({stateHash:e,isFirstRequest:t=!1,isHidden:n=!1}){const s=t?n?{hidden:!0}:{}:{state:e,next:!0,...n&&{hidden:!0}},a=await Du(new Ye.stories.GetAllStories(s));if(!a)return;if(a instanceof Ye.stories.AllStoriesNotModified)return{state:a.state,stealthMode:kr(a.stealthMode)};const i=a.peerStories.reduce(((e,t)=>{const n=aa(t.peer),s=function(e){const t=aa(e.peer);return Za(e.stories,(e=>[e.id,Cr(t,e)]))}(t),{profileIds:a,orderedIds:i,lastUpdatedAt:o}=Object.values(s).reduce(((e,t)=>("isInProfile"in t&&t.isInProfile&&e.profileIds.push(t.id),"isDeleted"in t||(e.orderedIds.push(t.id),e.lastUpdatedAt=Math.max(t.date,e.lastUpdatedAt||0)),e)),{profileIds:[],orderedIds:[],lastUpdatedAt:void 0});return 0===i.length||(e[n]={byId:s,orderedIds:i,profileIds:a,lastUpdatedAt:o,lastReadId:t.maxReadId}),e}),{});return a.peerStories.forEach((e=>e.stories.forEach((t=>ji(t,aa(e.peer)))))),{peerStories:i,hasMore:a.hasMore,state:a.state,stealthMode:kr(a.stealthMode)}}async function cy({peer:e}){const t=await Du(new Ye.stories.GetPeerStories({peer:di(e.id,e.accessHash)}));if(!t)return;const n=Za(t.stories.stories,(t=>[t.id,Cr(e.id,t)]));return t.stories.stories.forEach((t=>ji(t,e.id))),{stories:n,lastReadStoryId:t.stories.maxReadId}}function dy({peer:e,offsetId:t}){return Py({method:new Ye.stories.GetPinnedStories({peer:di(e.id,e.accessHash),offsetId:t,limit:w}),peerId:e.id})}function uy({peer:e,offsetId:t}){return Py({method:new Ye.stories.GetStoriesArchive({peer:e&&di(e.id,e.accessHash),offsetId:t,limit:w}),peerId:e.id})}async function ly({peer:e,ids:t}){const n=await Du(new Ye.stories.GetStoriesByID({peer:di(e.id,e.accessHash),id:t}));if(!n)return;const s=t.reduce(((t,s)=>{const a=n.stories.find((({id:e})=>e===s));return t[s]=a?Cr(e.id,a):{id:s,peerId:e.id,isDeleted:!0},t}),{});return n.stories.forEach((t=>ji(t,e.id))),{pinnedIds:n.pinnedToTop,stories:s}}function fy({peer:e,storyId:t}){return Du(new Ye.stories.IncrementStoryViews({peer:di(e.id,e.accessHash),id:[t]}))}function gy({peer:e,storyId:t}){return Du(new Ye.stories.ReadStories({peer:di(e.id,e.accessHash),maxId:t}))}function py({peer:e,storyId:t}){return Du(new Ye.stories.DeleteStories({peer:di(e.id,e.accessHash),id:[t]}))}function hy({peer:e,storyId:t,isInProfile:n}){return Du(new Ye.stories.TogglePinned({peer:di(e.id,e.accessHash),id:[t],pinned:n}))}function my({peer:e,storyIds:t}){return Du(new Ye.stories.TogglePinnedToTop({peer:di(e.id,e.accessHash),id:t}))}async function yy({peer:e,storyId:t,areJustContacts:n,query:s,areReactionsFirst:a,limit:i=w,offset:o=""}){const r=await Du(new Ye.stories.GetStoryViewsList({peer:di(e.id,e.accessHash),id:t,justContacts:n,q:s,reactionsFirst:a,limit:i,offset:o}));if(r)return{views:r.views.map(Rr).filter(Boolean),nextOffset:r.nextOffset,reactionsCount:r.reactionsCount,viewsCount:r.count}}async function _y({peer:e,storyIds:t}){const n=await Du(new Ye.stories.GetStoriesViews({peer:di(e.id,e.accessHash),id:t}));if(n?.views[0])return{views:Mr(n.views[0])}}async function by({peer:e,storyId:t}){const n=await Du(new Ye.stories.ExportStoryLink({peer:di(e.id,e.accessHash),id:t}));if(n)return n.link}async function vy({peer:e,storyId:t,description:n,option:s}){try{const a=await Du(new Ye.stories.Report({peer:di(e.id,e.accessHash),id:[t],option:ha(s),message:n}),{shouldThrow:!0});if(!a)return;return{result:Ir(a),error:void 0}}catch(e){const t=e.message;if(t===j)return{result:void 0,error:t};throw e}}function wy({peer:e,id:t,privacy:n}){return Du(new Ye.stories.EditStory({peer:di(e.id,e.accessHash),id:t,privacyRules:qi(n)}),{shouldReturnTrue:!0})}function Sy({peer:e,isHidden:t}){return Du(new Ye.stories.TogglePeerStoriesHidden({peer:di(e.id,e.accessHash),hidden:t}))}function Iy({peers:e}){return Du(new Ye.stories.GetPeerMaxIDs({id:e.map((e=>di(e.id,e.accessHash)))}),{shouldIgnoreErrors:!0})}async function Py({method:e,peerId:t}){const n=await Du(e);if(!n)return;const s=Za(n.stories,(e=>[e.id,Cr(t,e)]));return n.stories.forEach((e=>ji(e,t))),{count:n.count,stories:s,pinnedIds:n.pinnedToTop}}function Cy({peer:e,storyId:t,reaction:n,shouldAddToRecent:s}){return Du(new Ye.stories.SendReaction({reaction:n?xi(n):new Ye.ReactionEmpty,peer:di(e.id,e.accessHash),storyId:t,...s&&{addToRecent:!0}}),{shouldReturnTrue:!0})}function My({isForPast:e,isForFuture:t}){return Du(new Ye.stories.ActivateStealthMode({past:e,future:t}),{shouldReturnTrue:!0})}async function Ry({inputInvoice:e,requestInfo:t,shouldSave:n}){const s=await Du(new Ye.payments.ValidateRequestedInfo({invoice:Bi(e),save:n||void 0,info:Mi(t)}));if(!s)return;const{id:a,shippingOptions:i}=s;return a?{id:a,shippingOptions:Kc(i)}:void 0}async function ky({inputInvoice:e,formId:t,requestedInfoId:n,shippingOptionId:s,credentials:a,savedCredentialId:i,temporaryPassword:o,tipAmount:r}){const c=o&&i?new Ye.InputPaymentCredentialsSaved({id:i,tmpPassword:ha(o)}):new Ye.InputPaymentCredentials({save:a.save,data:new Ye.DataJSON({data:JSON.stringify(a.data)})}),d=await Du(new Ye.payments.SendPaymentForm({formId:fe()(t),invoice:Bi(e),requestedInfoId:n,shippingOptionId:s,credentials:c,...r&&{tipAmount:fe()(r)}}));return!!d&&(d instanceof Ye.payments.PaymentVerificationNeeded?void Da({"@type":"updatePaymentVerificationNeeded",url:d.url}):(Uu(d.updates),Boolean(d)))}async function Ay({formId:e,inputInvoice:t}){const n=await Du(new Ye.payments.SendStarsForm({formId:fe()(e),invoice:Bi(t)}));if(n){if(!(n instanceof Ye.payments.PaymentVerificationNeeded)){if(Uu(n.updates),"chatInviteSubscription"===t.type){const e="updates"in n.updates?n.updates.updates:void 0,t=e?.find((e=>e instanceof Ye.UpdateChannel))?.channelId;if(!t)return;return{channelId:sa(t,"channel")}}return{completed:!0}}c&&console.warn("Unexpected PaymentVerificationNeeded in sendStarsForm")}}async function Ty(e,t){try{const n=await Du(new Ye.payments.GetPaymentForm({invoice:Bi(e),themeParams:t?Ai(t):void 0}),{shouldThrow:!0});if(!n)return;return function(e){if(e instanceof Ye.payments.PaymentFormStarGift){const{formId:t}=e;return{type:"stargift",formId:String(t),invoice:Jc(e.invoice)}}if(e instanceof Ye.payments.PaymentFormStars){const{botId:t,formId:n,title:s,description:a,photo:i}=e;return i&&Qi(i),{type:"stars",botId:sa(t,"user"),formId:String(n),title:s,description:a,photo:Vo(i),invoice:Jc(e.invoice)}}const{formId:t,canSaveCredentials:n,passwordMissing:s,providerId:a,nativeProvider:i,nativeParams:o,savedInfo:r,invoice:c,savedCredentials:d,url:u,botId:l,description:f,title:g,photo:p}=e;p&&Qi(p);const{shippingAddress:h}=r||{},m=r?wa(r):void 0;m&&h&&(m.shippingAddress=wa(h));const y=o?JSON.parse(o.data):{};return{type:"regular",title:g,description:f,photo:Vo(p),url:u,botId:sa(l,"user"),canSaveCredentials:n,isPasswordMissing:s,formId:String(t),providerId:String(a),nativeProvider:i,savedInfo:m,invoice:Jc(c),nativeParams:{needCardholderName:Boolean(y?.need_cardholder_name),needCountry:Boolean(y?.need_country),needZip:Boolean(y?.need_zip),publishableKey:y?.publishable_key,publicToken:y?.public_token,tokenizeUrl:y?.tokenize_url},savedCredentials:d&&(_=d,_.map((({id:e,title:t})=>({id:e,title:t}))))};var _}(n)}catch(e){return e instanceof Error?(Da({"@type":"error",error:{message:e.message,hasErrorKey:!0}}),{error:e.message}):void 0}}async function Ey(e,t){const n=await Du(new Ye.payments.GetPaymentReceipt({peer:di(e.id,e.accessHash),msgId:t}));if(n)return{receipt:$c(n)}}async function Uy(){const e=await Du(new Ye.help.GetPremiumPromo);if(e)return e.videos.forEach((e=>{e instanceof Ye.Document&&(Ta.documents[e.id.toString()]=e)})),{promo:Qc(e)}}async function Dy(e){const t=await wh(e);if(t)return"error"in t?t:{value:pa(t.tmpPassword),validUntil:t.validUntil}}async function By(){const e=await Du(new Ye.premium.GetMyBoosts);if(e)return{boosts:e.myBoosts.map(Yc)}}async function xy({chat:e,slots:t}){const n=await Du(new Ye.premium.ApplyBoost({peer:di(e.id,e.accessHash),slots:t}));if(n)return{boosts:n.myBoosts.map(Yc)}}async function Vy({chat:e}){const t=await Du(new Ye.premium.GetBoostsStatus({peer:di(e.id,e.accessHash)}));if(t)return function(e){const{level:t,boostUrl:n,boosts:s,giftBoosts:a,myBoost:i,currentLevelBoosts:o,nextLevelBoosts:r,premiumAudience:c,prepaidGiveaways:d}=e;return{level:t,currentLevelBoosts:o,boosts:s,hasMyBoost:Boolean(i),boostUrl:n,giftBoosts:a,nextLevelBoosts:r,...c&&{premiumSubscribers:jc(c)},...d&&{prepaidGiveaways:d.map((e=>{return(t=e)instanceof Ye.PrepaidGiveaway?{type:"giveaway",id:t.id.toString(),date:t.date,months:t.months,quantity:t.quantity}:{type:"starsGiveaway",id:t.id.toString(),stars:t.stars.toJSNumber(),quantity:t.quantity,boosts:t.boosts,date:t.date};var t}))}}}(t)}async function Ny({chat:e,isGifts:t,offset:n="",limit:s}){const a=await Du(new Ye.premium.GetBoostsList({peer:di(e.id,e.accessHash),gifts:t||void 0,offset:n,limit:s}));if(!a)return;const i=a.boosts.map(Zc);return{count:a.count,boostList:i,nextOffset:a.nextOffset}}async function Fy({peer:e,messageId:t}){const n=await Du(new Ye.payments.GetGiveawayInfo({peer:di(e.id,e.accessHash),msgId:t}));if(n)return function(e){if(e instanceof Ye.payments.GiveawayInfo){const{startDate:t,adminDisallowedChatId:n,disallowedCountry:s,joinedTooEarlyDate:a,participating:i,preparingResults:o}=e;return{type:"active",startDate:t,isParticipating:i,adminDisallowedChatId:n&&sa(n,"channel"),disallowedCountry:s,joinedTooEarlyDate:a,isPreparingResults:o}}{const{activatedCount:t,finishDate:n,giftCodeSlug:s,winner:a,refunded:i,startDate:o,winnersCount:r,starsPrize:c}=e;return{type:"results",startDate:o,activatedCount:t,finishDate:n,winnersCount:r,giftCodeSlug:s,isRefunded:i,isWinner:a,starsPrize:c?.toJSNumber()}}}(n)}async function Gy({slug:e}){const t=await Du(new Ye.payments.CheckGiftCode({slug:e}));if(t)return{code:ed(t)}}function qy({slug:e}){return Du(new Ye.payments.ApplyGiftCode({slug:e}),{shouldReturnTrue:!0})}async function Hy({chat:e}){const t=await Du(new Ye.payments.GetPremiumGiftCodeOptions({boostPeer:e&&di(e.id,e.accessHash)}));if(t)return t.map(td)}function Oy({chat:e,giveawayId:t,paymentPurpose:n}){return Du(new Ye.payments.LaunchPrepaidGiveaway({peer:di(e.id,e.accessHash),giveawayId:fe()(t),purpose:Di(n)}),{shouldReturnTrue:!0})}async function Ly(e){const t="username"in e?new Ye.InputCollectibleUsername({username:e.username}):new Ye.InputCollectiblePhone({phone:e.phone}),n=await Du(new Ye.fragment.GetCollectibleInfo({collectible:t}));if(n)return function(e){const{amount:t,currency:n,cryptoAmount:s,cryptoCurrency:a,purchaseDate:i,url:o}=e;return{amount:t.toJSNumber(),currency:n,cryptoAmount:s.toJSNumber(),cryptoCurrency:a,purchaseDate:i,url:o}}(n)}async function jy(){const e=await Du(new Ye.payments.GetStarsGiveawayOptions);if(e)return e.map(ad)}async function Wy(){const e=await Du(new Ye.payments.GetStarGifts({}));if(e&&!(e instanceof Ye.payments.StarGiftsNotModified))return e.gifts.map(vo).filter((e=>"starGift"===e.type))}async function zy({peer:e,offset:t="",limit:n,filter:s}){const a={peer:di(e.id,e.accessHash),offset:t,limit:n,...s&&{sortByValue:"byValue"===s.sortType||void 0,excludeUnlimited:!s.shouldIncludeUnlimited||void 0,excludeLimited:!s.shouldIncludeLimited||void 0,excludeUnique:!s.shouldIncludeUnique||void 0,excludeSaved:!s.shouldIncludeDisplayed||void 0,excludeUnsaved:!s.shouldIncludeHidden||void 0}},i=await Du(new Ye.payments.GetSavedStarGifts(a));if(i)return{gifts:i.gifts.map((t=>function(e,t){const{gift:n,date:s,convertStars:a,fromId:i,message:o,msgId:r,nameHidden:c,unsaved:d,upgradeStars:u,transferStars:l,canUpgrade:f,savedId:g,canExportAt:p,pinnedToTop:h}=e,m=g&&t?{type:"chat",chatId:t,savedId:g.toString()}:r?{type:"user",messageId:r}:void 0;return{gift:vo(n),date:s,starsToConvert:a?.toJSNumber(),fromId:i&&aa(i),message:o&&uo(o),messageId:r,isNameHidden:c,isUnsaved:d,canUpgrade:f,alreadyPaidUpgradeStars:u?.toJSNumber(),transferStars:l?.toJSNumber(),inputGift:m,savedId:g?.toString(),canExportAt:p,isPinned:h}}(t,e.id))),nextOffset:i.nextOffset}}function Ky({inputGift:e,shouldUnsave:t}){return Du(new Ye.payments.SaveStarGift({stargift:Hi(e),unsave:t||void 0}))}function $y({inputSavedGift:e}){return Du(new Ye.payments.ConvertStarGift({stargift:Hi(e)}))}async function Jy({chat:e}){const t=await Du(new Ye.payments.GetStarsGiftOptions({userId:e&&di(e.id,e.accessHash)}));if(t)return t.map(nd)}async function Qy(){const e=await Du(new Ye.payments.GetStarsStatus({peer:new Ye.InputPeerSelf}));if(e)return{nextHistoryOffset:e.nextOffset,history:e.history?.map(od),nextSubscriptionOffset:e.subscriptionsNextOffset,subscriptions:e.subscriptions?.map(rd),balance:sd(e.balance)}}async function Xy({peer:e,offset:t,isInbound:n,isOutbound:s}){const a=e?di(e.id,e.accessHash):new Ye.InputPeerSelf,i=await Du(new Ye.payments.GetStarsTransactions({peer:a,offset:t,inbound:n,outbound:s}));if(i)return{nextOffset:i.nextOffset,history:i.history?.map(od),balance:sd(i.balance)}}async function Zy({id:e,peer:t}){const n=t?di(t.id,t.accessHash):new Ye.InputPeerSelf,s=await Du(new Ye.payments.GetStarsTransactionsByID({peer:n,id:[new Ye.InputStarsTransaction({id:e})]}));if(s?.history?.[0])return{transaction:od(s?.history[0])}}async function Yy({offset:e,peer:t}){const n=t?di(t.id,t.accessHash):new Ye.InputPeerSelf,s=await Du(new Ye.payments.GetStarsSubscriptions({peer:n,offset:e}));if(s?.subscriptions)return{nextOffset:s.subscriptionsNextOffset,subscriptions:s.subscriptions.map(rd),balance:sd(s.balance)}}async function e_({peer:e,subscriptionId:t,isCancelled:n}){return await Du(new Ye.payments.ChangeStarsSubscription({peer:e?di(e.id,e.accessHash):new Ye.InputPeerSelf,subscriptionId:t,canceled:n}))}async function t_({peer:e,subscriptionId:t}){return await Du(new Ye.payments.FulfillStarsSubscription({peer:e?di(e.id,e.accessHash):new Ye.InputPeerSelf,subscriptionId:t}))}async function n_(){const e=await Du(new Ye.payments.GetStarsTopupOptions);if(e)return e.map(cd)}async function s_({slug:e}){const t=await Du(new Ye.payments.GetUniqueStarGift({slug:e}));if(!t)return;const n=vo(t.gift);return"starGiftUnique"===n.type?n:void 0}async function a_({giftId:e}){const t=await Du(new Ye.payments.GetStarGiftUpgradePreview({giftId:fe()(e)}));if(t)return t.sampleAttributes.map(wo).filter(Boolean)}function i_({inputSavedGift:e,shouldKeepOriginalDetails:t}){return Du(new Ye.payments.UpgradeStarGift({stargift:Hi(e),keepOriginalDetails:t}),{shouldReturnTrue:!0})}function o_({inputSavedGift:e,toPeer:t}){return Du(new Ye.payments.TransferStarGift({stargift:Hi(e),toId:di(t.id,t.accessHash)}),{shouldReturnTrue:!0})}function r_({inputSavedGifts:e,peer:t}){return Du(new Ye.payments.ToggleStarGiftsPinnedToTop({stargift:e.map(Hi),peer:di(t.id,t.accessHash)}),{shouldReturnTrue:!0})}async function c_({inputGift:e,password:t}){try{const n=await Sh(t);if(!n)return;if("error"in n)return n;const s=await Du(new Ye.payments.GetStarGiftWithdrawalUrl({stargift:Hi(e),password:n}),{shouldThrow:!0});if(!s)return;return{url:s.url}}catch(e){if(!ya(e))return;return _a(e)}}function d_(e,t,n){var s;!function(e){Ua=e}(e),n&&(s=n,Object.assign(Aa,ka(s))),async function(e){c&&console.log(">>> START INIT API");const{userAgent:t,platform:n,sessionData:s,isWebmSupported:a,maxBufferSize:r,webAuthToken:d,dcId:u,mockScenario:l,shouldForceHttpTransport:f,shouldAllowHttpTransport:g,shouldDebugExportedSenders:p,langCode:h,isTestServerRequested:m}=e,y=new ns(s,Eu);self.isWebmSupported=a,self.maxBufferSize=r,Cu=new $s(y,Number("2496"),"8da85b0d5bfe62527e5b244c209159c3",{deviceModel:navigator.userAgent||t||vu,systemVersion:n||wu,appVersion:`10.9.44 ${i}`,useWSS:!0,additionalDcsDisabled:o,shouldDebugExportedSenders:p,shouldForceHttpTransport:f,shouldAllowHttpTransport:g,dcId:u,langPack:K,langCode:h,systemLangCode:navigator.language,isTestServerRequested:m}),Cu.addEventHandler(Uu,Su);try{c&&(ma("CONNECTING"),self.invoke=Du,self.GramJs=Ye);try{Cu.setPingCallback(xd),await Cu.start({phoneNumber:zd,phoneCode:Kd,password:$d,firstAndLastNames:Jd,qrCode:Qd,onError:Xd,initialMethod:"iOS"===n||"Android"===n?"phoneNumber":"qrCode",shouldThrowIfUnauthorized:Boolean(s),webAuthToken:d,webAuthTokenFailed:Wd,mockScenario:l})}catch(e){if(console.error(e),"Disconnect"!==e.message&&"Cannot send requests while disconnected"!==e.message)return void Da({"@type":"updateConnectionState",connectionState:"connectionStateBroken"})}c&&(console.log(">>> FINISH INIT API"),ma("CONNECTED")),Da(Zd("authorizationStateReady")),Eu(y.getSessionData()),Da({"@type":"updateApiReady"}),async function(e){vd=e,await qd(),Sd=!0,Dd()}(Du),qu()}catch(e){throw c&&ma("CONNECTING ERROR",e),e}}(t)}const u_=ie.reduce(((e,t)=>(e[t]=console[t],e)),{});self.onerror=e=>{console.error(e),m_({type:"unhandledError",error:{message:e.error.message||"Uncaught exception in worker"}})},self.addEventListener("unhandledrejection",(e=>{console.error(e),m_({type:"unhandledError",error:{message:e.reason.message||"Uncaught rejection in worker"}})}));let l_=[],f_=[],g_=[];const p_=new Map;c&&console.log(">>> FINISH LOAD WORKER"),onmessage=({data:e})=>{e.payloads.forEach((async e=>{switch(e.type){case"initApi":{const{messageId:t,args:n}=e;await d_(y_,n[0],n[1]),t&&m_({type:"methodResponse",messageId:t,response:!0});break}case"callMethod":{const{messageId:t,name:n,args:s,withCallback:i}=e;try{if(t&&i){const e=(...e)=>{const n=e[e.length-1];m_({type:"methodCallback",messageId:t,callbackArgs:e},n instanceof ArrayBuffer?n:void 0)};p_.set(t,e),s.push(e)}const e=await function(e,...t){return a[e](...t)}(n,...s);c&&"object"==typeof e&&"CONSTRUCTOR_ID"in e&&ma("UNEXPECTED RESPONSE",`${n}: ${e.className}`);const{arrayBuffer:o}="object"==typeof e&&"arrayBuffer"in e&&e||{};t&&m_({type:"methodResponse",messageId:t,response:e},o)}catch(e){c&&console.error(e),t&&m_({type:"methodResponse",messageId:t,error:{message:e.message}})}t&&p_.delete(t);break}case"cancelProgress":{const t=p_.get(e.messageId);t&&(t.isCanceled=!0);break}case"ping":m_({type:"methodResponse",messageId:e.messageId});break;case"toggleDebugMode":e.isEnabled?ie.forEach((e=>{console[e]=(...t)=>{postMessage({type:"debugLog",level:e,args:JSON.parse(JSON.stringify(t,((e,t)=>"bigint"==typeof t?t.toString():t)))})}})):ie.forEach((e=>{console[e]=u_[e]}))}}))};const h_=re((()=>{g_.length&&l_.unshift({type:"updates",updates:g_});const e={payloads:l_},t=f_;g_=[],l_=[],f_=[],t.length?postMessage(e,t):postMessage(e)}));function m_(e,t){l_.push(e),t&&f_.push(t),h_()}function y_(e){c&&"updateUserStatus"!==e["@type"]&&"updateServerTimeOffset"!==e["@type"]&&ma("UPDATE",e["@type"],e),g_.push(e),h_()}}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var i=s[e]={id:e,loaded:!1,exports:{}};return n[e].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}a.m=n,a.x=()=>{var e=a.O(void 0,[7784,8287,2786],(()=>a(2012)));return a.O(e)},e=[],a.O=(t,n,s,i)=>{if(!n){var o=1/0;for(u=0;u<e.length;u++){for(var[n,s,i]=e[u],r=!0,c=0;c<n.length;c++)(!1&i||o>=i)&&Object.keys(a.O).every((e=>a.O[e](n[c])))?n.splice(c--,1):(r=!1,i<o&&(o=i));if(r){e.splice(u--,1);var d=s();void 0!==d&&(t=d)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,s,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,n)=>(a.f[n](e,t),t)),[])),a.u=e=>e+"."+{2786:"8822cfc420377e0acc77",7784:"4e167a928464165e6412",8287:"9cf863b4d9b47c10d271"}[e]+".js",a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var s=n.length-1;s>-1&&(!e||!/^http(s?):/.test(e));)e=n[s--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={2012:1};a.f.i=(t,n)=>{e[t]||importScripts(a.p+a.u(t))};var t=self.webpackChunktelegram_t=self.webpackChunktelegram_t||[],n=t.push.bind(t);t.push=t=>{var[s,i,o]=t;for(var r in i)a.o(i,r)&&(a.m[r]=i[r]);for(o&&o(a);s.length;)e[s.pop()]=1;n(t)}})(),t=a.x,a.x=()=>Promise.all([7784,8287,2786].map(a.e,a)).then(t),a.x()})();
//# sourceMappingURL=2012.3787307be72fe09f426e.js.map