mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-14 18:27:10 +01:00
2 lines
28 KiB
JavaScript
2 lines
28 KiB
JavaScript
|
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[8422],{27225:(t,e,a)=>{a.d(e,{Co:()=>S,bZ:()=>M,ft:()=>R});var i=a(33555),n=a(6137),s=a(91713),o=a(83716),d=a(71226),r=a(5161),c=a(11192),l=a(60782),h=a(69118),u=a(83158),p=a(53551),f=a(78958),C=a(42431),I=a(16974),m=a(50711),g=a(9211);const v={id:o.aw,accessHash:"0",type:"userTypeRegular",isMin:!0,username:"",phoneNumber:""},w=(0,h.P2)((t=>t()),3e3,!0),y=(0,h.Ds)((t=>t()),500,!1,!0);async function b(t,e,a){var s;let h=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=(0,i.Rd)();const p=null===(s=(0,c.VF)(u))||void 0===s?void 0:s.message,f=await(0,d.t9)("fetchChats",{limit:o.Ov,offsetDate:a,archived:"archived"===t,withPinned:h,serverTimeOffset:u.serverTimeOffset,lastLocalServiceMessage:p});if(!f)return;const{chatIds:C}=f;if(C.length>0&&C[0]===e&&C.shift(),u=(0,i.Rd)(),h&&"active"===t){if(!C.includes(o.aw)){const t=await(0,d.t9)("fetchChat",{type:"user",user:v});u=(0,i.Rd)();const e=t&&(0,c.Z1)(u,t.chatId);e&&(C.unshift(e.id),f.chats.unshift(e),p&&(e.lastMessage=p))}const e=(0,c.jr)(u),a=e?[e]:[],n=(0,c.P2)(u)||[];u.currentUserId&&u.users.byId[u.currentUserId]&&n.push(u.users.byId[u.currentUserId]),u=(0,r.s5)(u,(0,l.ee)(n.concat(f.users),"id")),u=(0,r.ps)(u,f.userStatusesById),u=(0,r.SL)(u,(0,l.ee)(a.concat(f.chats),"id")),u=(0,r.Mg)(u,t,C)}else h&&"archived"===t?(u=(0,r.Sh)(u,(0,l.ee)(f.users,"id")),u=(0,r.zn)(u,f.userStatusesById),u=(0,r.GL)(u,(0,l.ee)(f.chats,"id")),u=(0,r.Mg)(u,t,C)):(u=(0,r.Sh)(u,(0,l.ee)(f.users,"id")),u=(0,r.zn)(u,f.userStatusesById),u=(0,r.GL)(u,(0,l.ee)(f.chats,"id")),u=(0,r.B1)(u,t,C));u=(0,r.vv)(u,t,f),Object.keys(f.draftsById).forEach((t=>{u=(0,r.pf)(u,t,n._f,"draft",f.draftsById[t])})),Object.keys(f.replyingToById).forEach((t=>{u=(0,r.pf)(u,t,n._f,"replyingToId",f.replyingToById[t])})),0!==C.length||u.chats.isFullyLoaded[t]||(u={...u,chats:{...u.chats,isFullyLoaded:{...u.chats.isFullyLoaded,[t]:!0}}}),(0,i.R3)(u)}async function R(t){const e=await(0,d.t9)("fetchFullChat",t);if(!e)return;const{users:a,userStatusesById:n,fullInfo:s,groupCall:o,membersCount:c}=e;let h=(0,i.Rd)();if(a&&(h=(0,r.Sh)(h,(0,l.ee)(a,"id"))),n&&(h=(0,r.zn)(h,n)),o){const t=(0,C.$5)(h,o.id);h=(0,f.AH)(h,o.id,(0,l.CE)(o,["connectionState"]),void 0,t?void 0:o.participantsCount)}h=(0,r.a4)(h,t.id,{fullInfo:s,...c&&{membersCount:c}}),(0,i.R3)(h);const u=s.stickerSet;return u&&(0,i.Sv)().loadStickers({stickerSetInfo:{id:u.id,accessHash:u.accessHash}}),e}async function M(t){try{return await(0,d.t9)("migrateChat",t)}catch(t){return void("CHANNELS_TOO_MUCH"===t.message?(0,i.Sv)().openLimitReachedModal({limit:"channels"}):(0,i.Sv)().showDialog({data:{...t,hasErrorKey:!0}}))}}async function S(t){const e=(0,i.Rd)(),a=(0,c.DI)(e,t);if(a&&!a.isMin)return a;const n=await(0,d.t9)("getChatByUsername",t);return n?((0,i.R3)((0,r.a4)((0,i.Rd)(),n.id,n)),n):void 0}async function P(t,e,a,n){const s=await S(a);if(!s)return;const o=(0,c.dy)((0,i.Rd)(),s.id);o&&o.isAttachMenuBot?t.callAttachMenuBot({botId:o.id,chatId:e,..."string"==typeof n&&{startParam:n}}):t.showNotification({message:m.i0("WebApp.AddToAttachmentUnavailableError")})}(0,i.iw)("preloadTopChatMessages",(async(t,e)=>{const a=new Set;for(let i=0;i<o.Mo;i++){await(0,h.wO)(100);const{chatId:i}=(0,c.Bt)(t)||{},s=(0,I.gO)(o.Nf),d=null==s?void 0:s.find((t=>t!==i&&!a.has(t)));if(!d)return;a.add(d),e.loadViewportMessages({chatId:d,threadId:n._f})}})),(0,i.iw)("openChat",((t,e,a)=>{var i;const{id:s,threadId:o=n._f}=a;if(!s)return;const{currentUserId:r}=t,l=(0,c.Z1)(t,s);if(null!=l&&l.hasUnreadMark&&e.toggleChatUnread({id:s}),null!=l&&null!==(i=l.lastMessage)&&void 0!==i&&i.threadInfo&&e.requestThreadInfoUpdate({chatId:l.lastMessage.threadInfo.chatId,threadId:l.lastMessage.threadInfo.threadId}),l)(0,u.Hp)(l)&&!l.isMin&&e.requestChatUpdate({chatId:s});else if(s===r)(0,d.t9)("fetchChat",{type:"self"});else{const e=(0,c.dy)(t,s);e&&(0,d.t9)("fetchChat",{type:"user",user:e})}o!==n._f&&((0,c.qS)(t,s,o)||e.requestThreadInfoUpdate({chatId:s,threadId:o}))})),(0,i.iw)("openLinkedChat",(async(t,e,a)=>{var i;cons
|
||
|
//# sourceMappingURL=8422.402220aac177878abbf2.js.map
|