mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-26 20:34:44 +01:00
2 lines
29 KiB
JavaScript
2 lines
29 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),r=a(71226),d=a(5161),c=a(11192),l=a(60782),h=a(69118),u=a(83158),f=a(53551),p=a(78958),C=a(42431),m=a(16974),I=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 f=null===(s=(0,c.VF)(u))||void 0===s?void 0:s.message,p=await(0,r.t9)("fetchChats",{limit:o.Ov,offsetDate:a,archived:"archived"===t,withPinned:h,serverTimeOffset:u.serverTimeOffset,lastLocalServiceMessage:f});if(!p)return;const{chatIds:C}=p;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,r.t9)("fetchChat",{type:"user",user:v});u=(0,i.Rd)();const e=t&&(0,c.Z1)(u,t.chatId);e&&(C.unshift(e.id),p.chats.unshift(e),f&&(e.lastMessage=f))}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,d.s5)(u,(0,l.ee)(n.concat(p.users),"id")),u=(0,d.ps)(u,p.userStatusesById),u=(0,d.SL)(u,(0,l.ee)(a.concat(p.chats),"id")),u=(0,d.Mg)(u,t,C)}else h&&"archived"===t?(u=(0,d.Sh)(u,(0,l.ee)(p.users,"id")),u=(0,d.zn)(u,p.userStatusesById),u=(0,d.GL)(u,(0,l.ee)(p.chats,"id")),u=(0,d.Mg)(u,t,C)):(u=(0,d.Sh)(u,(0,l.ee)(p.users,"id")),u=(0,d.zn)(u,p.userStatusesById),u=(0,d.GL)(u,(0,l.ee)(p.chats,"id")),u=(0,d.B1)(u,t,C));u=(0,d.vv)(u,t,p),Object.keys(p.draftsById).forEach((t=>{u=(0,d.pf)(u,t,n._f,"draft",p.draftsById[t])})),Object.keys(p.replyingToById).forEach((t=>{u=(0,d.pf)(u,t,n._f,"replyingToId",p.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,r.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,d.Sh)(h,(0,l.ee)(a,"id"))),n&&(h=(0,d.zn)(h,n)),o){const t=(0,C.$5)(h,o.id);h=(0,p.AH)(h,o.id,(0,l.CE)(o,["connectionState"]),void 0,t?void 0:o.participantsCount)}h=(0,d.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,r.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,r.t9)("getChatByUsername",t);return n?((0,i.R3)((0,d.a4)((0,i.Rd)(),n.id,n)),n):void 0}async function P(t,e){const a=await S(e);if(!a)return;const n=(0,c.dy)(t,a.id);return n?(0,u.cS)(n)&&n.isAttachBot?n:void(0,i.Sv)().showNotification({message:I.i0("WebApp.AddToAttachmentUnavailableError")}):void 0}async function B(t,e,a,n){const s=await S(a);if(!s)return;const o=(0,c.dy)((0,i.Rd)(),s.id);o&&o.isAttachBot?t.callAttachBot({botId:o.id,chatId:e,..."string"==typeof n&&{startParam:n}}):t.showNotification({message:I.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,m.gO)(o.Nf),r=null==s?void 0:s.find((t=>t!==i&&!a.has(t)));if(!r)return;a.add(r),e.loadViewportMessages({chatId:r,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:d}=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===d)(0,r.t9)("fetchChat",{type:"self"});
|
||
|
//# sourceMappingURL=8422.cfa7884f5b7ee933b6c3.js.map
|