tweb/public/12.5fb212a201f60bc4a935.chunk.js
Eduard Kuzmenko 183b0a9a31 Build
2021-07-19 18:29:09 +03:00

2 lines
45 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.

(this.webpackJsonp=this.webpackJsonp||[]).push([[12,4,16,20],{19:function(e,t,s){"use strict";s.r(t);var a=s(35),n=s(40),i=s(14),r=s(74),o=s(60),d=s(31),h=s(83),c=s(90),l=s(28),u=s(12),p=s(79),g=s(2),f=s(29),m=s(98),_=s(33),v=s(48);let b;const C=new o.a("page-password",!0,()=>{const e=new p.a({className:"page-password",withInputWrapper:!0,titleLangKey:"Login.Password.Title",subtitleLangKey:"Login.Password.Subtitle"}),t=Object(d.a)("btn-primary btn-color-primary"),i=new u.default.IntlElement({key:"Login.Next"});t.append(i.element);const o=new h.a({label:"LoginPassword",name:"password"});let C;b=o.input,e.inputWrapper.append(o.container,t);let P,y=()=>(C||(C=window.setInterval(y,1e4)),r.a.getState().then(e=>{P=e,P.hint?Object(_.a)(o.label,Object(m.a)(l.b.wrapEmojiText(P.hint))):o.setLabel()}));const w=e=>{if(e&&Object(g.a)(e),!b.value.length)return void b.classList.add("error");const n=Object(v.a)([b,t],!0);let d=b.value;i.update({key:"PleaseWait"});const h=Object(a.f)(t);r.a.check(d,P).then(e=>{switch(e._){case"auth.authorization":clearInterval(C),s.e(5).then(s.bind(null,17)).then(e=>{e.default.mount()}),S&&S.remove();break;default:t.removeAttribute("disabled"),i.update({key:e._}),h.remove()}}).catch(e=>{n(),o.input.classList.add("error"),e.type,i.update({key:"PASSWORD_HASH_INVALID"}),b.select(),h.remove(),y()})};Object(f.b)(t,w),b.addEventListener("keypress",(function(e){if(this.classList.remove("error"),i.update({key:"Login.Next"}),"Enter"===e.key)return w()}));const U=n.b.isMobile?100:166,S=new c.a(o,U);return e.imageDiv.append(S.container),Promise.all([S.load(),y()])},null,()=>{b.focus(),i.default.pushToState("authState",{_:"authStatePassword"})});t.default=C},33:function(e,t,s){"use strict";function a(e,t){if("string"==typeof t)return void(e.innerHTML=t);const s=e.firstChild;s?e.lastChild===s?s.replaceWith(t):(e.textContent="",e.append(t)):e.append(t)}s.d(t,"a",(function(){return a}))},34:function(e,t,s){"use strict";var a=s(35),n=s(26),i=s(57),r=s(93);function o(e){return e&&e.toLowerCase()||""}var d=s(47),h=s(30),c=s(12),l=s(27),u=s(94),p=s(55),g=s(28),f=s(13),m=s(89),_=s(58),v=s(37),b=s(38),C=s(14);const P=new class{constructor(){this.storage=C.default.storages.users,this.updateUsersStatuses=()=>{const e=Object(d.h)(!0);for(const t in this.users){const s=this.users[t];s.status&&"userStatusOnline"===s.status._&&s.status.expires<e&&(s.status={_:"userStatusOffline",was_online:s.status.expires},f.default.dispatchEvent("user_update",s.id),this.setUserToStateIfNeeded(s))}},this.clear(!0),setInterval(this.updateUsersStatuses,6e4),f.default.addEventListener("state_synchronized",this.updateUsersStatuses),f.default.addMultipleEventsListeners({updateUserStatus:e=>{const t=e.user_id,s=this.users[t];s&&(s.status=e.status,s.status&&("expires"in s.status&&(s.status.expires-=p.a.serverTimeOffset),"was_online"in s.status&&(s.status.was_online-=p.a.serverTimeOffset)),f.default.dispatchEvent("user_update",t),this.setUserToStateIfNeeded(s))},updateUserPhoto:e=>{const t=e.user_id,s=this.users[t];s?(this.forceUserOnline(t),"userProfilePhotoEmpty"===e.photo._?delete s.photo:s.photo=Object(h.i)(s.photo,e.photo),this.setUserToStateIfNeeded(s),f.default.dispatchEvent("user_update",t),f.default.dispatchEvent("avatar_update",t)):console.warn("No user by id:",t)},updateUserName:e=>{const t=e.user_id,s=this.users[t];s&&(this.forceUserOnline(t),this.saveApiUser(Object.assign({},s,{first_name:e.first_name,last_name:e.last_name,username:e.username}),!0))}}),f.default.addEventListener("language_change",e=>{const t=this.getSelf().id;this.contactsIndex.indexObject(t,this.getUserSearchText(t))}),C.default.getState().then(e=>{const t=C.default.storagesResults.users;if(t.length)for(let e=0,s=t.length;e<s;++e){const s=t[e];s&&(this.users[s.id]=s)}const s=e.contactsList;s&&Array.isArray(s)&&(s.forEach(e=>{this.pushContact(e)}),s.length&&(this.contactsFillPromise=Promise.resolve(this.contactsList))),C.default.addEventListener("peerNeeded",e=>{e<0||this.storage.getFromCache(e)||this.storage.set({[e]:this.getUser(e)})}),C.default.addEventListener("peerUnneeded",e=>{e<0||!this.storage.getFromCache(e)||this.storage.delete(e)})})}clear(e=!1){if(e)this.users={},this.usernames={};else{const e=C.default.storagesResults.users;for(const t in this.users){const s=+t;if(s&&!C.default.isPeerNeeded(s)){const t=this.users[s];t.username&&delete this.usernames[o(t.username)],e.findAndSplice(e=>e.id===s),this.storage.delete(s),delete this.users[s]}}}this.contactsIndex=new m.a,this.contactsFillPromise=void 0,this.contactsList=new Set,this.updatedContactsList=!1}onContactsModified(){const e=[...this.contactsList];C.default.pushToState("contactsList",e)}fillContacts(){if(this.contactsFillPromise&&this.updatedContactsList)return this.contactsFillPromise;this.updatedContactsList=!0;const e=l.a.invokeApi("contacts.getContacts").then(t=>("contacts.contacts"===t._&&(this.saveApiUsers(t.users),t.contacts.forEach(e=>{this.pushContact(e.user_id)}),this.onContactsModified()),this.contactsFillPromise=e,this.contactsList));return this.contactsFillPromise||(this.contactsFillPromise=e)}resolveUsername(e){return"@"===e[0]&&(e=e.slice(1)),e=e.toLowerCase(),this.usernames[e]?Promise.resolve(this.users[this.usernames[e]]):l.a.invokeApi("contacts.resolveUsername",{username:e}).then(e=>(this.saveApiUsers(e.users),v.a.saveApiChats(e.chats),b.a.getPeer(b.a.getPeerId(e.peer))))}pushContact(e){this.contactsList.add(e),this.contactsIndex.indexObject(e,this.getUserSearchText(e)),C.default.requestPeer(e,"contacts")}getUserSearchText(e){const t=this.users[e];if(!t)return"";return[t.first_name,t.last_name,t.phone,t.username,t.pFlags.self?c.default.format("SavedMessages",!0):"",t.pFlags.self?"Saved Messages":""].filter(Boolean).join(" ")}getContacts(e,t=!1){return this.fillContacts().then(s=>{let a=[...s];if(e){const t=this.contactsIndex.search(e);a=[...a].filter(e=>t.has(e))}return a.sort((e,t)=>{const s=(this.users[e]||{}).sortName||"",a=(this.users[t]||{}).sortName||"";return s.localeCompare(a)}),t&&this.testSelfSearch(e)&&(a.findAndSplice(e=>e===f.default.myId),a.unshift(f.default.myId)),a})}toggleBlock(e,t){return l.a.invokeApiSingle(t?"contacts.block":"contacts.unblock",{id:b.a.getInputPeerById(e)}).then(s=>(s&&_.a.processLocalUpdate({_:"updatePeerBlocked",peer_id:b.a.getOutputPeer(e),blocked:t}),s))}testSelfSearch(e){const t=this.getSelf(),s=new m.a;return s.indexObject(t.id,this.getUserSearchText(t.id)),s.search(e).has(t.id)}saveApiUsers(e,t){e.forEach(e=>this.saveApiUser(e,t))}saveApiUser(e,t){var s,a;if("userEmpty"===e._)return;const n=e.id,i=this.users[n];if(void 0===e.pFlags&&(e.pFlags={}),e.pFlags.min&&void 0!==i)return;const d=e.first_name+" "+(e.last_name||"");if(e.username){const t=o(e.username);this.usernames[t]=n}e.sortName=e.pFlags.deleted?"":Object(r.a)(d,!1),e.initials=g.a.getAbbreviation(d),e.status&&(e.status.expires&&(e.status.expires-=p.a.serverTimeOffset),e.status.was_online&&(e.status.was_online-=p.a.serverTimeOffset));let c=!1,l=!1;if(void 0===i)this.users[n]=e;else{e.first_name===i.first_name&&e.last_name===i.last_name&&e.username===i.username||(l=!0);(null===(s=i.photo)||void 0===s?void 0:s.photo_id)!==(null===(a=e.photo)||void 0===a?void 0:a.photo_id)&&(c=!0),Object(h.i)(i,e),f.default.dispatchEvent("user_update",n)}c&&f.default.dispatchEvent("avatar_update",e.id),l&&f.default.dispatchEvent("peer_title_edit",e.id),this.setUserToStateIfNeeded(e)}setUserToStateIfNeeded(e){C.default.isPeerNeeded(e.id)&&this.storage.set({[e.id]:e})}formatUserPhone(e){return"+"+Object(a.c)(e).formatted}getUserStatusForSort(e){if("number"==typeof e&&(e=this.getUser(e).status),e){const t="userStatusOnline"===e._?e.expires:"userStatusOffline"===e._?e.was_online:0;if(t)return t;switch(e._){case"userStatusRecently":return 3;case"userStatusLastWeek":return 2;case"userStatusLastMonth":return 1}}return 0}getUser(e){return Object(h.f)(e)?e:this.users[e]||{id:e,pFlags:{deleted:!0},access_hash:""}}getSelf(){return this.getUser(f.default.myId)}getUserStatusString(e){var t;let s,a;switch(e){case u.a:s="Peer.RepliesNotifications";break;case 777e3:s="Peer.ServiceNotifications";break;default:{if(this.isBot(e)){s="Bot";break}const n=this.getUser(e);if(!n){s="";break}if(n.pFlags.support){s="SupportStatus";break}switch(null===(t=n.status)||void 0===t?void 0:t._){case"userStatusRecently":s="Lately";break;case"userStatusLastWeek":s="WithinAWeek";break;case"userStatusLastMonth":s="WithinAMonth";break;case"userStatusOffline":{const e=n.status.was_online,t=Date.now()/1e3;if(t-e<60)s="Peer.Status.justNow";else if(t-e<3600){s="Peer.Status.minAgo";a=[(t-e)/60|0]}else if(t-e<86400){s="LastSeen.HoursAgo";a=[(t-e)/3600|0]}else{s="Peer.Status.LastSeenAt";const t=new Date(1e3*e);a=[("0"+t.getDate()).slice(-2)+"."+("0"+(t.getMonth()+1)).slice(-2),("0"+t.getHours()).slice(-2)+":"+("0"+t.getMinutes()).slice(-2)]}break}case"userStatusOnline":s="Online";break;default:s="ALongTimeAgo"}break}}return Object(c.i18n)(s,a)}isBot(e){return this.users[e]&&this.users[e].pFlags.bot}isContact(e){return this.contactsList.has(e)||this.users[e]&&this.users[e].pFlags.contact}isRegularUser(e){const t=this.users[e];return t&&!this.isBot(e)&&!t.pFlags.deleted&&!t.pFlags.support}isNonContactUser(e){return this.isRegularUser(e)&&!this.isContact(e)&&e!==f.default.myId}hasUser(e,t){const s=this.users[e];return Object(h.f)(s)&&(t||!s.pFlags.min)}canSendToUser(e){const t=this.getUser(e);return!t.pFlags.deleted&&"replies"!==t.username}getUserPhoto(e){const t=this.getUser(e);return t&&t.photo||{_:"userProfilePhotoEmpty"}}getUserString(e){const t=this.getUser(e);return"u"+e+(t.access_hash?"_"+t.access_hash:"")}getUserInput(e){const t=this.getUser(e);return t.pFlags&&t.pFlags.self?{_:"inputUserSelf"}:{_:"inputUser",user_id:e,access_hash:t.access_hash}}forceUserOnline(e,t){if(this.isBot(e))return;const s=Object(d.h)(!0);if(t){if(s-t>=60)return}else if(_.a.updatesState.syncLoading)return;const a=this.getUser(e);a&&a.status&&"userStatusOnline"!==a.status._&&"userStatusEmpty"!==a.status._&&!a.pFlags.support&&!a.pFlags.deleted&&(a.status={_:"userStatusOnline",expires:s+60},f.default.dispatchEvent("user_update",e),this.setUserToStateIfNeeded(a))}getTopPeers(){return this.getTopPeersPromise?this.getTopPeersPromise:this.getTopPeersPromise=C.default.getState().then(e=>{var t;return(null===(t=null==e?void 0:e.topPeers)||void 0===t?void 0:t.length)?e.topPeers:l.a.invokeApi("contacts.getTopPeers",{correspondents:!0,offset:0,limit:15,hash:0}).then(e=>{let t=[];return"contacts.topPeers"===e._&&(this.saveApiUsers(e.users),v.a.saveApiChats(e.chats),e.categories.length&&(t=e.categories[0].peers.map(e=>{const t=b.a.getPeerId(e.peer);return C.default.requestPeer(t,"topPeer"),t}))),C.default.pushToState("topPeers",t),t})})}getBlocked(e=0,t=0){return l.a.invokeApiSingle("contacts.getBlocked",{offset:e,limit:t}).then(e=>{this.saveApiUsers(e.users),v.a.saveApiChats(e.chats);return{count:"contacts.blocked"===e._?e.users.length+e.chats.length:e.count,peerIds:e.users.map(e=>e.id).concat(e.chats.map(e=>-e.id))}})}searchContacts(e,t=20){return l.a.invokeApiCacheable("contacts.search",{q:e,limit:t},{cacheSeconds:60}).then(e=>{this.saveApiUsers(e.users),v.a.saveApiChats(e.chats);return{my_results:Object(i.b)(e.my_results.map(e=>b.a.getPeerId(e))),results:e.results.map(e=>b.a.getPeerId(e))}})}onContactUpdated(e,t){t!==this.isContact(e)&&(t?this.pushContact(e):this.contactsList.delete(e),this.onContactsModified(),f.default.dispatchEvent("contacts_update",e))}updateUsername(e){return l.a.invokeApi("account.updateUsername",{username:e}).then(e=>{this.saveApiUser(e)})}setUserStatus(e,t){if(this.isBot(e))return;const s=this.users[e];if(s){const a=t?{_:"userStatusOffline",was_online:Object(d.h)(!0)}:{_:"userStatusOnline",expires:Object(d.h)(!0)+500};s.status=a,f.default.dispatchEvent("user_update",e)}}addContact(e,t,s,a,n){return l.a.invokeApi("contacts.addContact",{id:this.getUserInput(e),first_name:t,last_name:s,phone:a,add_phone_privacy_exception:n}).then(t=>{_.a.processUpdateMessage(t,{override:!0}),this.onContactUpdated(e,!0)})}deleteContacts(e){return l.a.invokeApi("contacts.deleteContacts",{id:e.map(e=>this.getUserInput(e))}).then(t=>{_.a.processUpdateMessage(t,{override:!0}),e.forEach(e=>{this.onContactUpdated(e,!1)})})}};n.a.appUsersManager=P;t.a=P},36:function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));var a=s(66),n=s(44),i=s(67),r=s(32),o=s(12),d=s(28);let h=()=>{document.addEventListener("paste",e=>{if(!Object(a.a)(e.target,'contenteditable="true"'))return;e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain"),s=d.b.parseEntities(t);s=s.filter(e=>"messageEntityEmoji"===e._||"messageEntityLinebreak"===e._),t=d.b.wrapRichText(t,{entities:s,noLinks:!0,wrappingDraft:!0}),window.document.execCommand("insertHTML",!1,t)}),h=null};var c;!function(e){e[e.Neutral=0]="Neutral",e[e.Valid=1]="Valid",e[e.Error=2]="Error"}(c||(c={}));t.b=class{constructor(e={}){this.options=e,this.container=document.createElement("div"),this.container.classList.add("input-field"),e.maxLength&&(e.showLengthOn=Math.round(e.maxLength/3));const{placeholder:t,maxLength:s,showLengthOn:a,name:d,plainText:c}=e;let l,u,p=e.label||e.labelText;if(c)this.container.innerHTML=`\n <input type="text" ${d?`name="${d}"`:""} autocomplete="off" ${p?'required=""':""} class="input-field-input">\n `,l=this.container.firstElementChild;else{h&&h(),this.container.innerHTML='\n <div contenteditable="true" class="input-field-input"></div>\n ',l=this.container.firstElementChild;const t=new MutationObserver(()=>{u&&u()});l.addEventListener("input",()=>{Object(i.a)(l)&&(l.innerHTML=""),this.inputFake&&(this.inputFake.innerHTML=l.innerHTML,this.onFakeInput())}),t.observe(l,{characterData:!0,childList:!0,subtree:!0}),e.animate&&(l.classList.add("scrollable","scrollable-y"),this.wasInputFakeClientHeight=0,this.showScrollDebounced=Object(r.a)(()=>this.input.classList.remove("no-scrollbar"),150,!1,!0),this.inputFake=document.createElement("div"),this.inputFake.setAttribute("contenteditable","true"),this.inputFake.className=l.className+" input-field-input-fake")}if(l.setAttribute("dir","auto"),t&&(Object(o._i18n)(l,t,void 0,"placeholder"),this.inputFake&&Object(o._i18n)(this.inputFake,t,void 0,"placeholder")),p||t){const e=document.createElement("div");e.classList.add("input-field-border"),this.container.append(e)}if(p&&(this.label=document.createElement("label"),this.setLabel(),this.container.append(this.label)),s){const e=this.container.lastElementChild;let t=!1;u=()=>{const i=l.classList.contains("error"),r=c?l.value.length:[...Object(n.a)(l,!1).value].length,o=s-r,d=o<0;l.classList.toggle("error",d),d||o<=a?(this.setLabel(),e.append(` (${s-r})`),t||(t=!0)):(i&&!d||t)&&(this.setLabel(),t=!1)},l.addEventListener("input",u)}this.input=l}select(){this.input.value&&this.input.select()}setLabel(){this.label.textContent="",this.options.labelText?this.label.innerHTML=this.options.labelText:this.label.append(Object(o.i18n)(this.options.label,this.options.labelOptions))}onFakeInput(){const{scrollHeight:e,clientHeight:t}=this.inputFake;this.wasInputFakeClientHeight&&this.wasInputFakeClientHeight!==t&&(this.input.classList.add("no-scrollbar"),this.showScrollDebounced()),this.wasInputFakeClientHeight=t,this.input.style.height=e?e+"px":""}get value(){return this.options.plainText?this.input.value:Object(n.a)(this.input,!1).value}set value(e){this.setValueSilently(e,!1);const t=new Event("input",{bubbles:!0,cancelable:!0});this.input.dispatchEvent(t)}setValueSilently(e,t=!0){this.options.plainText?this.input.value=e:(this.input.innerHTML=e,this.inputFake&&(this.inputFake.innerHTML=e,t&&this.onFakeInput()))}isValid(){return!this.input.classList.contains("error")&&this.value!==this.originalValue}setOriginalValue(e="",t=!1){this.originalValue=e,this.options.plainText||(e=d.b.wrapDraftText(e)),t?this.setValueSilently(e,!1):this.value=e}setState(e,t){t&&(this.label.textContent="",this.label.append(Object(o.i18n)(t,this.options.labelOptions))),this.input.classList.toggle("error",!!(e&c.Error)),this.input.classList.toggle("valid",!!(e&c.Valid))}setError(e){this.setState(c.Error,e)}}},37:function(e,t,s){"use strict";var a=s(26),n=s(30),i=s(27),r=s(28),o=s(13),d=s(58),h=s(38),c=s(14),l=s(34);const u=new class{constructor(){this.storage=c.default.storages.chats,this.onChatUpdated=(e,t)=>{d.a.processUpdateMessage(t),t&&this.isChannel(e)&&o.default.dispatchEvent("invalidate_participants",e)},this.clear(!0),o.default.addMultipleEventsListeners({updateChannelParticipant:e=>{i.a.clearCache("channels.getParticipants",t=>t.channel.channel_id===e.channel_id)},updateChatDefaultBannedRights:e=>{const t=-h.a.getPeerId(e.peer),s=this.chats[t];s&&(s.default_banned_rights=e.default_banned_rights,o.default.dispatchEvent("chat_update",t))}}),c.default.getState().then(e=>{const t=c.default.storagesResults.chats;if(t.length)for(let e=0,s=t.length;e<s;++e){const s=t[e];s&&(this.chats[s.id]=s)}c.default.addEventListener("peerNeeded",e=>{e>0||this.storage.getFromCache(-e)||this.storage.set({[-e]:this.getChat(-e)})}),c.default.addEventListener("peerUnneeded",e=>{e>0||!this.storage.getFromCache(-e)||this.storage.delete(-e)})})}clear(e=!1){if(e)this.chats={};else{const e=c.default.storagesResults.chats;for(const t in this.chats){const s=+t;s&&(c.default.isPeerNeeded(-s)||(e.findAndSplice(e=>e.id===s),this.storage.delete(s),delete this.chats[s]))}}}saveApiChats(e,t){e.forEach(e=>this.saveApiChat(e,t))}saveApiChat(e,t){var s,a;if("chatEmpty"===e._)return;const i=this.chats[e.id];if(void 0===e.pFlags&&(e.pFlags={}),e.pFlags.min&&void 0!==i)return;e.initials=r.a.getAbbreviation(e.title),"channel"===e._&&void 0===e.participants_count&&void 0!==i&&i.participants_count&&(e.participants_count=i.participants_count);let d=!1,h=!1;if(void 0===i)this.chats[e.id]=e;else{(null===(s=i.photo)||void 0===s?void 0:s.photo_id)!==(null===(a=e.photo)||void 0===a?void 0:a.photo_id)&&(d=!0),i.title!==e.title&&(h=!0),Object(n.i)(i,e),o.default.dispatchEvent("chat_update",e.id)}d&&o.default.dispatchEvent("avatar_update",-e.id),h&&o.default.dispatchEvent("peer_title_edit",-e.id),c.default.isPeerNeeded(-e.id)&&this.storage.set({[e.id]:e})}getChat(e){return e<0&&(e=-e),this.chats[e]||{_:"chatEmpty",id:e,deleted:!0,access_hash:"",pFlags:{}}}combineParticipantBannedRights(e,t){const s=this.getChat(e);if(s.default_banned_rights){t=Object(n.a)(t);const e=s.default_banned_rights.pFlags;for(let s in e)t.pFlags[s]=e[s]}return t}hasRights(e,t,s,a){const n=this.getChat(e);if("chatEmpty"===n._)return!1;if("chatForbidden"===n._||"channelForbidden"===n._||n.pFlags.kicked||n.pFlags.left&&!n.pFlags.megagroup)return!1;if(n.pFlags.deactivated&&"view_messages"!==t)return!1;if(n.pFlags.creator&&void 0===s)return!0;if(!s&&!(s=n.admin_rights||n.banned_rights||n.default_banned_rights))return!1;let i={};switch(s&&(i=s.pFlags),t){case"embed_links":case"send_games":case"send_gifs":case"send_inline":case"send_media":case"send_messages":case"send_polls":case"send_stickers":if(!a&&n.pFlags.left)return!1;if("chatBannedRights"===s._&&i[t])return!1;if("channel"===n._&&!n.pFlags.megagroup&&!i.post_messages)return!1;break;case"delete_messages":return!!i.delete_messages;case"pin_messages":return"chatAdminRights"===s._?i[t]||!!i.post_messages:!i[t];case"invite_users":case"change_info":return"chatAdminRights"===s._?i[t]:!i[t];case"change_type":case"delete_chat":return!1;case"change_permissions":return"chatAdminRights"===s._&&i.ban_users;case"view_participants":return!("chat"!==n._&&n.pFlags.broadcast&&!n.pFlags.creator&&!n.admin_rights)}return!0}editChatDefaultBannedRights(e,t){const s=this.getChat(e);return s.default_banned_rights&&s.default_banned_rights.until_date===t.until_date&&Object(n.b)(s.default_banned_rights.pFlags,t.pFlags)?Promise.resolve():i.a.invokeApi("messages.editChatDefaultBannedRights",{peer:h.a.getInputPeerById(-e),banned_rights:t}).then(this.onChatUpdated.bind(this,e))}isChannel(e){const t=this.chats[e];return t&&("channel"===t._||"channelForbidden"===t._)}isMegagroup(e){const t=this.chats[e];return t&&"channel"===t._&&t.pFlags.megagroup}isBroadcast(e){return this.isChannel(e)&&!this.isMegagroup(e)}isInChat(e){let t=!0;const s=this.getChat(e);return("channelForbidden"===s._||"chatForbidden"===s._||"chatEmpty"===s._||s.pFlags.left||s.pFlags.kicked||s.pFlags.deactivated)&&(t=!1),t}getChannelInput(e){const t=this.getChat(e);return"chatEmpty"!==t._&&t.access_hash?{_:"inputChannel",channel_id:e,access_hash:t.access_hash||"0"}:{_:"inputChannelEmpty"}}getChatInputPeer(e){return{_:"inputPeerChat",chat_id:e}}getChannelInputPeer(e){return{_:"inputPeerChannel",channel_id:e,access_hash:this.getChat(e).access_hash||0}}hasChat(e,t){const s=this.chats[e];return Object(n.f)(s)&&(t||!s.pFlags.min)}getChatPhoto(e){const t=this.getChat(e);return t&&t.photo||{_:"chatPhotoEmpty"}}getChatString(e){const t=this.getChat(e);return this.isChannel(e)?(this.isMegagroup(e)?"s":"c")+e+"_"+t.access_hash:"g"+e}createChannel(e,t){return i.a.invokeApi("channels.createChannel",{broadcast:!0,title:e,about:t}).then(e=>{d.a.processUpdateMessage(e);const t=e.chats[0].id;return o.default.dispatchEvent("history_focus",{peerId:-t}),t})}inviteToChannel(e,t){const s=this.getChannelInput(e),a=t.map(e=>l.a.getUserInput(e));return i.a.invokeApi("channels.inviteToChannel",{channel:s,users:a}).then(e=>{d.a.processUpdateMessage(e)})}createChat(e,t){return i.a.invokeApi("messages.createChat",{users:t.map(e=>l.a.getUserInput(e)),title:e}).then(e=>{d.a.processUpdateMessage(e);const t=e.chats[0].id;return o.default.dispatchEvent("history_focus",{peerId:-t}),t})}leaveChannel(e){return i.a.invokeApi("channels.leaveChannel",{channel:this.getChannelInput(e)}).then(this.onChatUpdated.bind(this,e))}joinChannel(e){return i.a.invokeApi("channels.joinChannel",{channel:this.getChannelInput(e)}).then(this.onChatUpdated.bind(this,e))}addChatUser(e,t,s=100){return i.a.invokeApi("messages.addChatUser",{chat_id:e,user_id:l.a.getUserInput(t),fwd_limit:s}).then(this.onChatUpdated.bind(this,e))}deleteChatUser(e,t){return i.a.invokeApi("messages.deleteChatUser",{chat_id:e,user_id:l.a.getUserInput(t)}).then(this.onChatUpdated.bind(this,e))}leaveChat(e){return this.deleteChatUser(e,l.a.getSelf().id)}leave(e){return this.isChannel(e)?this.leaveChannel(e):this.leaveChat(e)}delete(e){return this.isChannel(e)?this.deleteChannel(e):this.deleteChat(e)}deleteChannel(e){return i.a.invokeApi("channels.deleteChannel",{channel:this.getChannelInput(e)}).then(this.onChatUpdated.bind(this,e))}deleteChat(e){return i.a.invokeApi("messages.deleteChat",{chat_id:e})}migrateChat(e){const t=this.getChat(e);return"channel"===t._?Promise.resolve(t.id):i.a.invokeApi("messages.migrateChat",{chat_id:e}).then(t=>{this.onChatUpdated(e,t);return t.updates.find(e=>"updateChannel"===e._).channel_id})}updateUsername(e,t){return i.a.invokeApi("channels.updateUsername",{channel:this.getChannelInput(e),username:t}).then(s=>{if(s){this.getChat(e).username=t}return s})}editPhoto(e,t){const s={_:"inputChatUploadedPhoto",file:t};let a;return a=this.isChannel(e)?i.a.invokeApi("channels.editPhoto",{channel:this.getChannelInput(e),photo:s}):i.a.invokeApi("messages.editChatPhoto",{chat_id:e,photo:s}),a.then(e=>{d.a.processUpdateMessage(e)})}editTitle(e,t){let s;return s=this.isChannel(e)?i.a.invokeApi("channels.editTitle",{channel:this.getChannelInput(e),title:t}):i.a.invokeApi("messages.editChatTitle",{chat_id:e,title:t}),s.then(e=>{d.a.processUpdateMessage(e)})}editAbout(e,t){return i.a.invokeApi("messages.editChatAbout",{peer:h.a.getInputPeerById(-e),about:t}).then(t=>{o.default.dispatchEvent("peer_bio_edit",-e)})}getParticipantPeerId(e){return e.peer?h.a.getPeerId(e.peer):e.user_id}editBanned(e,t,s){const a="number"==typeof t?t:this.getParticipantPeerId(t);return i.a.invokeApi("channels.editBanned",{channel:this.getChannelInput(e),participant:h.a.getInputPeerById(a),banned_rights:s}).then(n=>{if(this.onChatUpdated(e,n),"number"!=typeof t){const n=Date.now()/1e3|0;d.a.processLocalUpdate({_:"updateChannelParticipant",channel_id:e,date:n,actor_id:void 0,qts:void 0,user_id:a,prev_participant:t,new_participant:Object.keys(s.pFlags).length?{_:"channelParticipantBanned",date:n,banned_rights:s,kicked_by:l.a.getSelf().id,peer:h.a.getOutputPeer(a),pFlags:{}}:void 0})}})}clearChannelParticipantBannedRights(e,t){return this.editBanned(e,t,{_:"chatBannedRights",until_date:0,pFlags:{}})}kickFromChannel(e,t){return this.editBanned(e,t,{_:"chatBannedRights",until_date:0,pFlags:{view_messages:!0}})}};a.a.appChatsManager=u,t.a=u},38:function(e,t,s){"use strict";var a=s(26),n=s(30),i=s(28),r=s(13),o=s(37),d=s(34),h=s(12);const c=["#fc5c51","#0fb297","#d09306","#3d72ed","#895dd5","#cd4073","#00c1a6","#fa790f"],l=["red","green","yellow","blue","violet","pink","cyan","orange"],u=[0,7,4,1,6,3,5];const p=new class{constructor(){r.default.addMultipleEventsListeners({updatePeerBlocked:e=>{r.default.dispatchEvent("peer_block",{peerId:this.getPeerId(e.peer_id),blocked:e.blocked})}})}canPinMessage(e){return e>0||o.a.hasRights(-e,"pin_messages")}getPeerPhoto(e){const t=e>0?d.a.getUserPhoto(e):o.a.getChatPhoto(-e);return"chatPhotoEmpty"!==t._&&"userProfilePhotoEmpty"!==t._?t:null}getPeerMigratedTo(e){if(e>=0)return!1;let t=o.a.getChat(-e);return!!(t&&t.migrated_to&&t.pFlags.deactivated)&&this.getPeerId(t.migrated_to)}getPeerTitle(e,t=!1,s=!1){e||(e=r.default.myId);let a={};a=Object(n.f)(e)?e:this.getPeer(e);let o="";return e>0?(a.first_name&&(o+=a.first_name),a.last_name&&(o+=" "+a.last_name),o=o?o.trim():a.pFlags.deleted?h.default.format("HiddenName",!0):a.username):o=a.title,s&&(o=o.split(" ")[0]),t?o:i.a.wrapEmojiText(o)}getOutputPeer(e){if(e>0)return{_:"peerUser",user_id:e};let t=-e;return o.a.isChannel(t)?{_:"peerChannel",channel_id:t}:{_:"peerChat",chat_id:t}}getPeerString(e){return e>0?d.a.getUserString(e):o.a.getChatString(-e)}getPeerUsername(e){return e>0?d.a.getUser(e).username||"":o.a.getChat(-e).username||""}getPeer(e){return e>0?d.a.getUser(e):o.a.getChat(-e)}getPeerId(e){if("number"==typeof e)return e;if(Object(n.f)(e))return e.user_id||-(e.channel_id||e.chat_id);if(!e)return 0;const t="u"===e.charAt(0),s=e.substr(1).split("_");return t?+s[0]:-s[0]||0}getDialogPeer(e){return{_:"dialogPeer",peer:this.getOutputPeer(e)}}isChannel(e){return e<0&&o.a.isChannel(-e)}isMegagroup(e){return e<0&&o.a.isMegagroup(-e)}isAnyGroup(e){return e<0&&!o.a.isBroadcast(-e)}isBroadcast(e){return this.isChannel(e)&&!this.isMegagroup(e)}isBot(e){return e>0&&d.a.isBot(e)}getInputNotifyPeerById(e,t){return t?e>0?{_:"inputNotifyUsers"}:p.isBroadcast(e)?{_:"inputNotifyBroadcasts"}:{_:"inputNotifyChats"}:{_:"inputNotifyPeer",peer:this.getInputPeerById(e)}}getInputPeerById(e){if(!e)return{_:"inputPeerEmpty"};if(e<0){const t=-e;return o.a.isChannel(t)?o.a.getChannelInputPeer(t):o.a.getChatInputPeer(t)}return{_:"inputPeerUser",user_id:e,access_hash:d.a.getUser(e).access_hash}}getInputDialogPeerById(e){return{_:"inputDialogPeer",peer:this.getInputPeerById(e)}}getPeerColorById(e,t=!0){if(!e)return"";return(t?l:c)[u[(e<0?-e:e)%7]]}getPeerSearchText(e){let t;if(e>0)t="%pu "+d.a.getUserSearchText(e);else if(e<0){t="%pg "+(o.a.getChat(-e).title||"")}return t}getDialogType(e){return p.isMegagroup(e)?"megagroup":p.isChannel(e)?"channel":e<0?"group":e===r.default.myId?"saved":"chat"}getDeleteButtonText(e){switch(this.getDialogType(e)){case"channel":return"ChatList.Context.LeaveChannel";case"megagroup":return"ChatList.Context.LeaveGroup";case"group":return"ChatList.Context.DeleteAndExit";default:return"ChatList.Context.DeleteChat"}}};a.a.appPeersManager=p,t.a=p},44:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var a=s(26),n=s(28),i=s(63);function r(e,t=!0){const s=[],a=[],r=t?[]:void 0;Object(i.a)(e,s,a,void 0,void 0,r),a.length&&s.push(a.join(""));let o=s.join("\n");return o=o.replace(/\u00A0/g," "),r&&n.b.combineSameEntities(r),{value:o,entities:r}}a.a.getRichValue=r},48:function(e,t,s){"use strict";function a(e,t){return t?e.forEach(e=>e.setAttribute("disabled","true")):e.forEach(e=>e.removeAttribute("disabled")),()=>a(e,!t)}s.d(t,"a",(function(){return a}))},55:function(e,t,s){"use strict";var a=s(26),n=s(59),i=s(27);const r=new class{constructor(){this.serverTimeOffset=0,n.a.get("server_time_offset").then(e=>{e&&(this.serverTimeOffset=e)}),i.a.addTaskListener("applyServerTimeOffset",e=>{this.serverTimeOffset=e.payload})}};a.a&&(a.a.serverTimeManager=r),t.a=r},57:function(e,t,s){"use strict";s.d(t,"a",(function(){return a})),s.d(t,"c",(function(){return n})),s.d(t,"d",(function(){return i})),s.d(t,"e",(function(){return r})),s.d(t,"b",(function(){return o}));const a=(e,t)=>e.reduce((e,t)=>e+t,t);function n(e,t){const s=[];let a=-1;for(;-1!==(a=e.findIndex(t));)s.push(e.splice(a,1)[0]);return s}function i(e,t){for(let s=e.length-1;s>=0;--s)t(e[s],s,e)}function r(e,t,s,a){void 0===a&&-1!==(a=e.indexOf(t))&&e.splice(a,1);const n=t[s],i=e.length;if(!i||n<=e[i-1][s])return e.push(t)-1;if(n>=e[0][s])return e.unshift(t),0;for(let a=0;a<i;a++)if(n>e[a][s])return e.splice(a,0,t),a;return console.error("wtf",e,t),e.indexOf(t)}function o(e){return[...new Set(e)]}},58:function(e,t,s){"use strict";var a=s(26),n=s(41),i=s(27),r=s(13),o=s(34),d=s(37),h=s(38),c=s(14),l=s(55);const u=new class{constructor(){this.updatesState={pendingPtsUpdates:[],pendingSeqUpdates:{},syncPending:null,syncLoading:null},this.channelStates={},this.attached=!1,this.log=Object(n.b)("UPDATES",n.a.Error|n.a.Warn|n.a.Log),this.debug=a.b,this.processUpdateMessage=(e,t={})=>{const s={date:e.date,seq:e.seq,seqStart:e.seq_start};switch(this.debug&&this.log.debug("processUpdateMessage",e),e._){case"updatesTooLong":case"new_session_created":this.forceGetDifference();break;case"updateShort":this.processUpdate(e.update,s);break;case"updateShortMessage":case"updateShortChatMessage":{this.debug&&this.log.debug("updateShortMessage | updateShortChatMessage",Object.assign({},e));const t=e.pFlags.out,a=e.from_id||(t?r.default.myId:e.user_id),n=e.chat_id?-e.chat_id:e.user_id||r.default.myId;this.processUpdate({_:"updateNewMessage",message:{_:"message",pFlags:e.pFlags,id:e.id,from_id:h.a.getOutputPeer(a),peer_id:h.a.getOutputPeer(n),date:e.date,message:e.message,fwd_from:e.fwd_from,reply_to:e.reply_to,entities:e.entities},pts:e.pts,pts_count:e.pts_count},s);break}case"updatesCombined":case"updates":o.a.saveApiUsers(e.users,t.override),d.a.saveApiChats(e.chats,t.override),e.updates.forEach(e=>{this.processUpdate(e,s)});break;default:this.log.warn("Unknown update message",e)}}}setProxy(){const e=this;this.updatesState=new Proxy(this.updatesState,{set:function(t,s,a){return t[s]=a,e.saveUpdatesState(),!0}})}saveUpdatesState(){const e=this.updatesState;c.default.pushToState("updates",{seq:e.seq,pts:e.pts,date:e.date})}popPendingSeqUpdate(){const e=this.updatesState,t=e.seq+1,s=e.pendingSeqUpdates[t];if(!s)return!1;const a=s.updates;for(let e=0,t=a.length;e<t;++e)this.saveUpdate(a[e]);return e.seq=s.seq,s.date&&e.date<s.date&&(e.date=s.date),delete e.pendingSeqUpdates[t],!this.popPendingSeqUpdate()&&e.syncPending&&e.syncPending.seqAwaiting&&e.seq>=e.syncPending.seqAwaiting&&(e.syncPending.ptsAwaiting?delete e.syncPending.seqAwaiting:(clearTimeout(e.syncPending.timeout),e.syncPending=null)),!0}popPendingPtsUpdate(e){const t=e?this.getChannelState(e):this.updatesState;if(!t.pendingPtsUpdates.length)return!1;t.pendingPtsUpdates.sort((e,t)=>e.pts-t.pts);let s=t.pts,a=0,n=0;for(let e=0,i=t.pendingPtsUpdates.length;e<i;++e){const i=t.pendingPtsUpdates[e];s+=i.pts_count,s>=i.pts&&(a=i.pts,n=e)}if(!a)return!1;this.debug&&this.log.debug("pop pending pts updates",a,t.pendingPtsUpdates.slice(0,n+1)),t.pts=a;for(let e=0;e<=n;++e){const s=t.pendingPtsUpdates[e];this.saveUpdate(s)}return t.pendingPtsUpdates.splice(0,n+1),!t.pendingPtsUpdates.length&&t.syncPending&&(t.syncPending.seqAwaiting?delete t.syncPending.ptsAwaiting:(clearTimeout(t.syncPending.timeout),t.syncPending=null)),!0}forceGetDifference(){this.updatesState.syncLoading||this.getDifference()}processLocalUpdate(e){this.processUpdateMessage({_:"updateShort",update:e})}getDifference(e=!1){const t=this.updatesState;let s=t.syncLoading;s||(t.pendingSeqUpdates={},t.pendingPtsUpdates=[]),t.syncPending&&(clearTimeout(t.syncPending.timeout),t.syncPending=null);const a=i.a.invokeApi("updates.getDifference",{pts:t.pts,pts_total_limit:e?1200:void 0,date:t.date,qts:-1},{timeout:2147483647}).then(s=>{if(this.debug&&this.log.debug("Get diff result",s),"updates.differenceEmpty"===s._)return this.debug&&this.log.debug("apply empty diff",s.seq),t.date=s.date,void(t.seq=s.seq);if(e&&r.default.dispatchEvent("state_synchronizing"),"updates.differenceTooLong"!==s._){o.a.saveApiUsers(s.users),d.a.saveApiChats(s.chats),s.other_updates.forEach(e=>{switch(e._){case"updateChannelTooLong":case"updateNewChannelMessage":case"updateEditChannelMessage":return void this.processUpdate(e)}this.saveUpdate(e)}),s.new_messages.forEach(e=>{this.saveUpdate({_:"updateNewMessage",message:e,pts:t.pts,pts_count:0})});const e="updates.difference"===s._?s.state:s.intermediate_state;t.seq=e.seq,t.pts=e.pts,t.date=e.date}else t.pts=s.pts,t.date=(Date.now()/1e3|0)+l.a.serverTimeOffset,delete t.seq,this.channelStates={},this.log.warn("getDifference:",s._),r.default.dispatchEvent("state_cleared");if("updates.differenceSlice"===s._)return this.getDifference();this.debug&&this.log.debug("finished get diff")});return s||this.justAName(t,a),a}getChannelDifference(e){const t=this.getChannelState(e),s=t.syncLoading;s||(t.pendingPtsUpdates=[]),t.syncPending&&(clearTimeout(t.syncPending.timeout),t.syncPending=null);const a=i.a.invokeApi("updates.getChannelDifference",{channel:d.a.getChannelInput(e),filter:{_:"channelMessagesFilterEmpty"},pts:t.pts,limit:30},{timeout:2147483647}).then(s=>{if(this.debug&&this.log.debug("Get channel diff result",s),t.pts="pts"in s?s.pts:void 0,"updates.channelDifferenceEmpty"!==s._){if("updates.channelDifferenceTooLong"===s._)return this.debug&&this.log.debug("channel diff too long",s),delete this.channelStates[e],void this.saveUpdate({_:"updateChannelReload",channel_id:e});if(o.a.saveApiUsers(s.users),d.a.saveApiChats(s.chats),this.debug&&this.log.debug("applying",s.other_updates.length,"channel other updates"),s.other_updates.forEach(e=>{this.saveUpdate(e)}),this.debug&&this.log.debug("applying",s.new_messages.length,"channel new messages"),s.new_messages.forEach(e=>{this.saveUpdate({_:"updateNewChannelMessage",message:e,pts:t.pts,pts_count:0})}),this.debug&&this.log.debug("apply channel diff",t.pts),"updates.channelDifference"===s._&&!s.pFlags.final)return this.getChannelDifference(e);this.debug&&this.log.debug("finished channel get diff")}else this.debug&&this.log.debug("apply channel empty diff",s)});return s||this.justAName(t,a,e),a}justAName(e,t,s){e.syncLoading=t,r.default.dispatchEvent("state_synchronizing",s),t.then(()=>{e.syncLoading=null,r.default.dispatchEvent("state_synchronized",s)},()=>{e.syncLoading=null})}addChannelState(e,t){if(!t)throw new Error("Add channel state without pts "+e);return!(e in this.channelStates)&&(this.channelStates[e]={pts:t,pendingPtsUpdates:[],syncPending:null,syncLoading:null},!0)}getChannelState(e,t){return void 0===this.channelStates[e]&&this.addChannelState(e,t),this.channelStates[e]}processUpdate(e,t={}){var s;let a=0;switch(e._){case"updateNewChannelMessage":case"updateEditChannelMessage":a=-h.a.getPeerId(e.message.peer_id);break;case"updateChannelTooLong":if(a=e.channel_id,!(a in this.channelStates))return!1;break;default:"channel_id"in e&&(a=e.channel_id)}const{pts:n,pts_count:i}=e,r=a?this.getChannelState(a,n):this.updatesState;if(r.syncLoading)return!1;if("updateChannelTooLong"===e._)return(!r.lastPtsUpdateTime||r.lastPtsUpdateTime<Date.now()-6)&&this.getChannelDifference(a),!1;if("updateNewMessage"===e._||"updateEditMessage"===e._||"updateNewChannelMessage"===e._||"updateEditChannelMessage"===e._){const t=e.message,n=h.a.getPeerId(t.peer_id),i=t.fwd_from||{};let r;if(t.from_id&&!o.a.hasUser(h.a.getPeerId(t.from_id),t.pFlags.post)&&(r="author")||i.from_id&&!o.a.hasUser(h.a.getPeerId(i.from_id),!!i.from_id.channel_id)&&(r="fwdAuthor")||(null===(s=i.from_id)||void 0===s?void 0:s.channel_id)&&!d.a.hasChat(i.from_id.channel_id,!0)&&(r="fwdChannel")||n>0&&!o.a.hasUser(n)&&(r="toPeer User")||n<0&&!d.a.hasChat(-n)&&(r="toPeer Chat"))return this.log.warn("Not enough data for message update",n,r,t),a&&d.a.hasChat(a)?this.getChannelDifference(a):this.forceGetDifference(),!1}else if(a&&!d.a.hasChat(a))return!1;let c,l;if(n){if(r.pts+(i||0)<n)return this.debug&&this.log.warn("Pts hole",r,e,a&&d.a.getChat(a)),r.pendingPtsUpdates.push(e),r.syncPending||r.syncLoading||(r.syncPending={timeout:window.setTimeout(()=>{r.syncPending=null,r.syncLoading||(a?this.getChannelDifference(a):this.getDifference())},6)}),r.syncPending.ptsAwaiting=!0,!1;if(n>r.pts)r.pts=n,c=!0,r.lastPtsUpdateTime=Date.now();else if(i)return!1;a&&t.date&&this.updatesState.date<t.date&&(this.updatesState.date=t.date)}else if(!a&&t.seq>0){const s=t.seq,a=t.seqStart||s;if(a!==r.seq+1&&a>r.seq)return this.debug&&this.log.warn("Seq hole",r,r.syncPending&&r.syncPending.seqAwaiting),void 0===r.pendingSeqUpdates[a]&&(r.pendingSeqUpdates[a]={seq:s,date:t.date,updates:[]}),r.pendingSeqUpdates[a].updates.push(e),r.syncPending||(r.syncPending={timeout:window.setTimeout(()=>{r.syncPending=null,r.syncLoading||this.getDifference()},6)}),(!r.syncPending.seqAwaiting||r.syncPending.seqAwaiting<a)&&(r.syncPending.seqAwaiting=a),!1;r.seq!==s&&(r.seq=s,t.date&&r.date<t.date&&(r.date=t.date),l=!0)}this.saveUpdate(e),c?this.popPendingPtsUpdate(a):l&&this.popPendingSeqUpdate()}saveUpdate(e){r.default.dispatchEvent(e._,e)}attach(){this.attached||(this.log("attach"),this.attached=!0,c.default.getState().then(e=>{const t=e.updates;t&&t.pts&&t.date&&t.seq?(Object.assign(this.updatesState,t),this.log("will get difference",Object.assign({},t)),this.getDifference(!0)):(this.log("will get new state"),this.updatesState.syncLoading=new Promise(e=>{i.a.invokeApi("updates.getState",{},{noErrorBox:!0}).then(t=>{this.updatesState.seq=t.seq,this.updatesState.pts=t.pts,this.updatesState.date=t.date,this.saveUpdatesState(),this.updatesState.syncLoading=null,e()})})),i.a.setUpdatesProcessor(this.processUpdateMessage),this.setProxy()}))}};a.a.apiUpdatesManager=u,t.a=u},63:function(e,t,s){"use strict";s.d(t,"b",(function(){return a})),s.d(t,"a",(function(){return n}));const a={bold:{match:'[style*="font-weight"], b',entityName:"messageEntityBold"},underline:{match:'[style*="underline"], u',entityName:"messageEntityUnderline"},italic:{match:'[style*="italic"], i',entityName:"messageEntityItalic"},monospace:{match:'[style*="monospace"], [face="monospace"]',entityName:"messageEntityPre"},strikethrough:{match:'[style*="line-through"], strike',entityName:"messageEntityStrike"},link:{match:"A:not(.follow)",entityName:"messageEntityTextUrl"},mentionName:{match:"A.follow",entityName:"messageEntityMentionName"}};function n(e,t,s,i,r,o,d={offset:0}){if(3===e.nodeType){const t=e.nodeValue;if(i===e?s.push(t.substr(0,r)+""+t.substr(r)):s.push(t),o&&t.trim()&&e.parentNode){const s=e.parentElement;for(const e in a){const n=a[e],i=s.closest(n.match+", [contenteditable]");i&&null===i.getAttribute("contenteditable")&&("messageEntityTextUrl"===n.entityName?o.push({_:n.entityName,url:s.href,offset:d.offset,length:t.length}):"messageEntityMentionName"===n.entityName?o.push({_:n.entityName,offset:d.offset,length:t.length,user_id:+s.dataset.follow}):o.push({_:n.entityName,offset:d.offset,length:t.length}))}}return void(d.offset+=t.length)}if(1!==e.nodeType)return;const h=i===e,c="DIV"===e.tagName||"P"===e.tagName;if(c&&s.length||"BR"===e.tagName)t.push(s.join("")),s.splice(0,s.length);else if("IMG"===e.tagName){const t=e.alt;t&&(s.push(t),d.offset+=t.length)}h&&!r&&s.push("");let l=e.firstChild;for(;l;)n(l,t,s,i,r,o,d),l=l.nextSibling;h&&r&&s.push(""),c&&s.length&&(t.push(s.join("")),s.splice(0,s.length))}},66:function(e,t,s){"use strict";function a(e,t){return e.closest(`[${t}]`)}s.d(t,"a",(function(){return a}))},67:function(e,t,s){"use strict";s.d(t,"a",(function(){return n}));var a=s(44);function n(e){return e.hasAttribute("contenteditable")||"INPUT"!==e.tagName?!Object(a.a)(e,!1).value.trim():!e.value.trim()}},74:function(e,t,s){"use strict";var a=s(26),n=s(34),i=s(27);const r=new class{getState(){return i.a.invokeApi("account.getPassword").then(e=>e)}updateSettings(e={}){return this.getState().then(t=>{let s,a;const n={password:null,new_settings:{_:"account.passwordInputSettings",hint:e.hint,email:e.email}};s=e.currentPassword?i.a.invokeCrypto("computeSRP",e.currentPassword,t,!1):Promise.resolve({_:"inputCheckPasswordEmpty"});const r=t.new_algo,o=new Uint8Array(r.salt1.length+32);return o.randomize(),o.set(r.salt1,0),r.salt1=o,a=e.newPassword?i.a.invokeCrypto("computeSRP",e.newPassword,t,!0):Promise.resolve(new Uint8Array),Promise.all([s,a]).then(e=>(n.password=e[0],n.new_settings.new_algo=r,n.new_settings.new_password_hash=e[1],i.a.invokeApi("account.updatePasswordSettings",n)))})}check(e,t,s={}){return i.a.invokeCrypto("computeSRP",e,t,!1).then(e=>i.a.invokeApi("auth.checkPassword",{password:e},s).then(e=>("auth.authorization"===e._&&(n.a.saveApiUser(e.user),i.a.setUserAuth(e.user.id)),e)))}confirmPasswordEmail(e){return i.a.invokeApi("account.confirmPasswordEmail",{code:e})}resendPasswordEmail(){return i.a.invokeApi("account.resendPasswordEmail")}cancelPasswordEmail(){return i.a.invokeApi("account.cancelPasswordEmail")}};a.a.passwordManager=r,t.a=r},79:function(e,t,s){"use strict";s.d(t,"a",(function(){return n}));var a=s(12);class n{constructor(e){this.element=document.body.querySelector("."+e.className),this.container=document.createElement("div"),this.container.className="container center-align",this.imageDiv=document.createElement("div"),this.imageDiv.className="auth-image",this.title=document.createElement("h4"),e.titleLangKey&&this.title.append(Object(a.i18n)(e.titleLangKey)),this.subtitle=document.createElement("p"),this.subtitle.className="subtitle",e.subtitleLangKey&&this.subtitle.append(Object(a.i18n)(e.subtitleLangKey)),this.container.append(this.imageDiv,this.title,this.subtitle),e.withInputWrapper&&(this.inputWrapper=document.createElement("div"),this.inputWrapper.className="input-wrapper",this.container.append(this.inputWrapper)),this.element.append(this.container)}}},83:function(e,t,s){"use strict";s.d(t,"a",(function(){return i}));var a=s(2),n=s(36);class i extends n.b{constructor(e={}){super(Object.assign({plainText:!0},e)),this.passwordVisible=!1,this.onVisibilityClick=e=>{Object(a.a)(e),this.passwordVisible=!this.passwordVisible,this.toggleVisible.classList.toggle("eye-hidden",this.passwordVisible),this.input.type=this.passwordVisible?"text":"password",this.onVisibilityClickAdditional&&this.onVisibilityClickAdditional()};const t=this.input;t.type="password",t.setAttribute("required",""),t.autocomplete="off";const s=document.createElement("input");s.classList.add("stealthy"),s.tabIndex=-1,s.type="password",t.parentElement.prepend(s),t.parentElement.insertBefore(s.cloneNode(),t.nextSibling);const n=this.toggleVisible=document.createElement("span");n.classList.add("toggle-visible","tgico"),this.container.classList.add("input-field-password"),this.container.append(n),n.addEventListener("click",this.onVisibilityClick),n.addEventListener("touchend",this.onVisibilityClick)}}},89:function(e,t,s){"use strict";s.d(t,"a",(function(){return n}));var a=s(93);class n{constructor(e=!0,t=!0,s=0){this.cleanText=e,this.latinize=t,this.minChars=s,this.fullTexts=new Map}indexObject(e,t){if(t.trim()&&this.cleanText&&(t=Object(a.a)(t,this.latinize)),!t)return this.fullTexts.delete(e),!1;this.fullTexts.set(e,t)}search(e){const t=this.fullTexts;this.cleanText&&(e=Object(a.a)(e,this.latinize));const s=[],n=e.split(" "),i=n.length;t.forEach((e,t)=>{let a=!0,r=0;for(let t=0;t<i;++t){const s=n[t],i=e.indexOf(s);if(-1===i||0!==i&&" "!==e[i-1]){a=!1;break}r+=s.length}if(a){r+=i-1;const a=e.length;(this.minChars<=r||a<=r)&&s.push({fullText:e,fullTextLength:a,what:t,foundChars:r})}}),s.sort((e,t)=>e.fullTextLength-t.fullTextLength||t.foundChars-e.foundChars);return new Set(s.map(e=>e.what))}}},90:function(e,t,s){"use strict";s.d(t,"a",(function(){return n}));var a=s(46);class n{constructor(e,t){this.passwordInputField=e,this.size=t,this.needFrame=0,this.container=document.createElement("div"),this.container.classList.add("media-sticker-wrapper")}load(){return this.loadPromise?this.loadPromise:this.loadPromise=a.b.loadAnimationFromURL({container:this.container,loop:!1,autoplay:!1,width:this.size,height:this.size,noCache:!0},"assets/img/TwoFactorSetupMonkeyPeek.tgs").then(e=>(this.animation=e,this.animation.addEventListener("enterFrame",e=>{(1===this.animation.direction&&e>=this.needFrame||-1===this.animation.direction&&e<=this.needFrame)&&(this.animation.setSpeed(1),this.animation.pause())}),this.passwordInputField.onVisibilityClickAdditional=()=>{this.passwordInputField.passwordVisible?(this.animation.setDirection(1),this.animation.curFrame=0,this.needFrame=16,this.animation.play()):(this.animation.setDirection(-1),this.animation.curFrame=16,this.needFrame=0,this.animation.play())},a.b.waitForFirstFrame(e)))}remove(){this.animation&&this.animation.remove()}}},93:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var a=s(102);const n=/[`~!@#$%^&*()\-_=+\[\]\\|{}'";:\/?.>,<]+/g,i=/^\s+|\s$/g;function r(e,t=!0){const s="%"===e.charAt(0);return e=e.replace(n,"").replace(i,""),t&&(e=e.replace(/[^A-Za-z0-9]/g,e=>{const t=a.a.LatinizeMap[e];return void 0!==t?t:e})),e=e.toLowerCase(),s&&(e="%"+e),e}},94:function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));const a=1271266957},98:function(e,t,s){"use strict";function a(e){const t=document.createElement("span");return t.innerHTML=e,t}s.d(t,"a",(function(){return a}))}}]);
//# sourceMappingURL=12.5fb212a201f60bc4a935.chunk.js.map