mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-12 00:59:52 +01:00
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[2305],{70172:(e,t,n)=>{n.d(t,{Z:()=>P});var r=n(14050),o=n(33555),c=n(6137),l=n(83716),s=n(77361),a=n(83158),i=n(2155),d=n(46752),u=n(32340),m=n(6202),v=n(31212),f=n(59107),p=n(3657),g=n(21747),h=n(46898);const Z=(0,d.y)("Avatar");Z.media=Z("media"),Z.icon=Z("icon");const P=(0,r.X$)((e=>{var t;let{className:n,size:P="large",chat:y,user:E,photo:I,userStatus:b,text:C,isSavedMessages:w,withVideo:A,noLoop:N,lastSyncTime:T,animationLevel:k,observeIntersection:B,onClick:S}=e;const{loadFullUser:L}=(0,o.Sv)(),O=(0,r.sO)(null),R=(0,r.sO)(null),U=(0,r.sO)(0),x=(0,p.Op)(O,B),q=E&&(0,a.NB)(E),F=E&&(0,a.pK)(E.id);let D,V;const M=!s.as&&k===l.zy&&x&&A&&(null==E?void 0:E.isPremium)&&(null==E?void 0:E.hasVideoAvatar),j=null==E||null===(t=E.fullInfo)||void 0===t?void 0:t.profilePhoto,H=M&&(null==j?void 0:j.isVideo),$="jumbo"===P;w||q||(E?D=(0,a.RT)(E,$?"big":void 0):y?D=(0,a.RT)(y,$?"big":void 0):I&&(D=`photo${I.id}?size=m`),H&&(V=(0,a.RT)(E,void 0,"video")));const z=(0,m.Z)(D,!1,c.IU.BlobUrl,T),J=(0,m.Z)(V,!H,c.IU.BlobUrl,T),X=Boolean(z||J),_=Boolean(x&&J),{transitionClassNames:K}=(0,v.Z)(X,void 0,X,"slow"),{handlePlaying:Y}=(0,g.Z)(R,_);(0,h.Z)(R,[_]),(0,r.d4)((()=>{const e=R.current;if(!e||!J)return;const t=()=>{U.current+=1,U.current>=3||N?e.style.display="none":e.play()};return e.addEventListener("ended",t),()=>e.removeEventListener("ended",t)}),[N,J]);const G=null==E?void 0:E.id;(0,r.d4)((()=>{M&&!j&&L({userId:G})}),[L,j,G,M]);const W=(0,f.Z)();let Q;const ee=E?(0,a.Js)(E):y?(0,a.U)(W,y):C;if(w)Q=r.ZP.createElement("i",{className:(0,d.Z)(Z.icon,"icon-avatar-saved-messages"),role:"img","aria-label":ee});else if(q)Q=r.ZP.createElement("i",{className:(0,d.Z)(Z.icon,"icon-avatar-deleted-account"),role:"img","aria-label":ee});else if(F)Q=r.ZP.createElement("i",{className:(0,d.Z)(Z.icon,"icon-reply-filled"),role:"img","aria-label":ee});else if(X)Q=r.ZP.createElement(r.ZP.Fragment,null,r.ZP.createElement("img",{src:z,className:(0,d.Z)(Z.media,"avatar-media",K,J&&"poster"),alt:ee,decoding:"async"}),_&&r.ZP.createElement("video",{ref:R,src:J,className:(0,d.Z)(Z.media,"avatar-media"),muted:!0,autoPlay:!0,disablePictureInPicture:!0,playsInline:!0,onPlaying:Y}));else if(E){const e=(0,a.Js)(E);Q=e?(0,i.Xv)(e,2):void 0}else if(y){const e=(0,a.U)(W,y);Q=e&&(0,i.Xv)(e,(0,a.YC)(y.id)?2:1)}else C&&(Q=(0,i.Xv)(C,2));const te=!w&&E&&b&&(0,a.kM)(E,b),ne=(0,d.Z)(`Avatar size-${P}`,n,`color-bg-${(0,a.Rs)(E||y)}`,w&&"saved-messages",q&&"deleted-account",F&&"replies-bot-account",te&&"online",S&&"interactive",!w&&!z&&"no-photo"),re=Boolean(w||z),oe=(0,r.I4)((e=>{S&&S(e,re)}),[S,re]),ce=(E||y)&&(E||y).id;return r.ZP.createElement("div",{ref:O,className:ne,onClick:oe,"data-test-sender-id":l.Cg?ce:void 0,"aria-label":"string"==typeof Q?ee:void 0},"string"==typeof Q?(0,u.Z)(Q,["jumbo"===P?"hq_emoji":"emoji"]):Q)}))},21747:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(14050),o=n(69118),c=n(74753),l=n(45332),s=n(18674);function a(e,t){var n;const a=(0,r.sO)(null===(n=e.current)||void 0===n?void 0:n.paused),i=(0,r.sO)();i.current=t;const d=(0,r.sO)(),u=(0,r.I4)((()=>{d.current=!0,e.current&&(a.current=!e.current.paused,a.current&&e.current.pause())}),[e]),m=(0,r.I4)((()=>{d.current=!1,e.current&&a.current&&i.current&&document.body.contains(e.current)&&(0,c.Z)(e.current)}),[e]),v=(0,r.I4)((()=>{(0,o.T2)(m)}),[m]);return(0,l.Z)(u,v),(0,s.ZP)(u,m),{handlePlaying:(0,r.I4)((()=>{d.current&&(a.current=!0,e.current.pause())}),[e])}}},22275:(e,t,n)=>{n.d(t,{Z:()=>u});var r=n(14050),o=n(33555),c=n(11192),l=n(83158),s=n(32340),a=n(59107),i=n(13103),d=n(231);const u=(0,r.X$)((0,o.c$)(((e,t)=>{let{userId:n}=t;const r=(0,c.jr)(e),o=n&&(0,c.dy)(e,n);return{chat:r,contactName:o?(0,l.Vl)(o):void 0}}))((e=>{let{isOpen:t,chat:n,userId:c,contactName:l,onClose:u}=e;const{deleteChatMember:m}=(0,o.Sv)(),v=(0,a.Z)(),f=(0,r.I4)((()=>{m({chatId:n.id,userId:c}),u()}),[n,m,u,c]);if(n&&c)return r.ZP.createElement(i.Z,{isOpen:t,onClose:u,onEnter:f,className:"delete",title:v("GroupRemoved.Remove")},r.ZP.createElement("p",null,(0,s.Z)(v("PeerInfo.Confirm.RemovePeer",l))),r.ZP.createElement(d.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:f},v("lng_box_remove")),r.ZP.createElement(d.Z,{className:"confirm-dialog-button",isText:!0,onClick:u},v("Cancel")))})))},21273:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(91713),o=n(14050),c=n(69118),l=n(87675),s=n(77361),a=n(80036);const i=".ListItem",d=20,u=800,m=e=>{let{ref:t,className:n,items:m,itemSelector:v=i,preloadBackwards:f=d,sensitiveArea:p=u,withAbsolutePositioning:g,maxHeight:h,noScrollRestore:Z=!1,noScrollRestoreOnTop:P=!1,noFastList:y,cacheBuster:E,children:I,onLoadMore:b,onScroll:C,onKeyDown:w,onDragOver:A,onDragLeave:N}=e,T=(0,o.sO)(null);t&&(T=t);const k=(0,o.sO)({}),[B,S]=(0,o.Ye)((()=>b?[(0,c.Ds)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];b({direction:r.Uq.Backwards,noScroll:e})}),1e3,!0,!1),(0,c.Ds)((()=>{b({direction:r.Uq.Forwards})}),1e3,!0,!1)]:[]),[b,m]);(0,o.d4)((()=>{if(!B)return;if(f>0&&(!m||m.length<f))return void B(!0);const{scrollHeight:e,clientHeight:t}=T.current;t&&e<=t&&B()}),[m,B,f]),(0,o.bt)((()=>{const e=T.current,t=k.current;let n;if(t.listItemElements=e.querySelectorAll(v),t.currentAnchor&&Array.from(t.listItemElements).includes(t.currentAnchor)){const{scrollTop:r}=e;n=r+(t.currentAnchor.getBoundingClientRect().top-t.currentAnchorTop)}else{const e=t.listItemElements[0];e&&(t.currentAnchor=e,t.currentAnchorTop=e.getBoundingClientRect().top)}g||Z||P&&0===e.scrollTop||((0,l.Z)(e,n),t.isScrollTopJustUpdated=!0)}),[m,v,Z,P,E,g]);const L=(0,o.I4)((e=>{if(S&&B){const{isScrollTopJustUpdated:e,currentAnchor:t,currentAnchorTop:n}=k.current,r=k.current.listItemElements;if(e)return void(k.current.isScrollTopJustUpdated=!1);const o=r.length,c=T.current,{scrollTop:l,scrollHeight:s,offsetHeight:a}=c,i=l<=(o?r[0].offsetTop:0)+p,d=(o?r[o-1].offsetTop+r[o-1].offsetHeight:s)-(l+a)<=p;let u=!1;if(i){const e=r[0];if(e){const r=e.getBoundingClientRect().top,o=null!=t&&t.offsetParent&&t!==e?t.getBoundingClientRect().top:r;t&&void 0!==n&&o>n&&(k.current.currentAnchor=e,k.current.currentAnchorTop=r,u=!0,S())}}if(d){const e=r[o-1];if(e){const r=e.getBoundingClientRect().top,o=null!=t&&t.offsetParent&&t!==e?t.getBoundingClientRect().top:r;t&&void 0!==n&&o<n&&(k.current.currentAnchor=e,k.current.currentAnchorTop=r,u=!0,B())}}if(!u)if(null!=t&&t.offsetParent)k.current.currentAnchorTop=t.getBoundingClientRect().top;else{const e=r[0];e&&(k.current.currentAnchor=e,k.current.currentAnchorTop=e.getBoundingClientRect().top)}}C&&C(e)}),[B,S,C,p]);return o.ZP.createElement("div",{ref:T,className:n,onScroll:L,teactFastList:!y&&!g,onKeyDown:w,onDragOver:A,onDragLeave:N},g&&null!=m&&m.length?o.ZP.createElement("div",{teactFastList:!y,style:(0,a.Z)("position: relative",s.wZ&&`height: ${h}px`)},I):I)}},13103:(e,t,n)=>{n.d(t,{Z:()=>v});var r=n(14050),o=n(517),c=n(46752),l=n(18674),s=n(31212),a=n(274),i=n(59107),d=n(46590),u=n(231),m=n(62898);const v=e=>{let{dialogRef:t,title:n,className:v,isOpen:f,header:p,hasCloseButton:g,noBackdrop:h,children:Z,style:P,onClose:y,onCloseAnimationEnd:E,onEnter:I,shouldSkipHistoryAnimations:b}=e;const{shouldRender:C,transitionClassNames:w}=(0,s.Z)(f,E,b,void 0,b),A=(0,r.sO)(null);(0,r.d4)((()=>f?(0,o.Z)({onEsc:y,onEnter:I}):void 0),[f,y,I]),(0,r.d4)((()=>f&&A.current?function(e){function t(t){if("Tab"!==t.key)return;t.preventDefault(),t.stopPropagation();const n=Array.from(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(!n.length)return;const r=n.findIndex((e=>e.isSameNode(document.activeElement)));let o=0;r>=0&&(o=t.shiftKey?r>0?r-1:n.length-1:r<n.length-1?r+1:0),n[o].focus()}return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}}(A.current):void 0),[f]),(0,d.Z)({isActive:f,onBack:y}),(0,a.Z)((e=>{let[t]=e;return document.body.classList.toggle("has-open-dialog",Boolean(f)),(f||!f&&void 0!==t)&&(0,l.YW)(200),()=>{document.body.classList.remove("has-open-dialog")}}),[f]);const N=(0,i.Z)();if(!C)return;const T=(0,c.Z)("Modal",v,w,h&&"transparent-backdrop");return r.ZP.createElement(m.Z,null,r.ZP.createElement("div",{ref:A,className:T,tabIndex:-1,role:"dialog"},r.ZP.createElement("div",{className:"modal-container"},r.ZP.createElement("div",{className:"modal-backdrop",onClick:y}),r.ZP.createElement("div",{className:"modal-dialog",ref:t},p||(n?r.ZP.createElement("div",{className:"modal-header"},g&&r.ZP.createElement(u.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:N("Close"),onClick:y},r.ZP.createElement("i",{className:"icon-close"})),r.ZP.createElement("div",{className:"modal-title"},n)):void 0),r.ZP.createElement("div",{className:"modal-content custom-scroll",style:P},Z)))))}},62898:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(14050),o=n(31664);const c=e=>{let{containerId:t,className:n,children:c}=e;const l=(0,r.sO)();return l.current||(l.current=document.createElement("div")),(0,r.bt)((()=>{const e=document.querySelector(t||"#portals");if(!e)return;const r=l.current;return n&&r.classList.add(n),e.appendChild(r),()=>{o.Z.render(void 0,r),e.removeChild(r)}}),[n,t]),o.Z.render(c,l.current)}},9211:(e,t,n)=>{n.d(t,{M:()=>c,P:()=>l});var r=n(86087),o=n(83716);function c(e,t){var n;const{appConfig:c}=e;if(!c)return o.pr[t][0];const l=(0,r.wV)(e),{limits:s}=c,a=null!==(n=s[t][l?1:0])&&void 0!==n?n:o.pr[t][l?1:0];return"dialogFilters"===t?a+1:a}function l(e,t){const{appConfig:n}=e;if(!n)return o.pr[t][1];const{limits:r}=n;return r[t][1]}},27407:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(14050),o=n(91713),c=n(60782),l=n(65326),s=n(87204);function a(e,t,n,r){const{length:c}=e,l=r?e.indexOf(r):0,s=t===o.Uq.Forwards?l:l+1||c,a=Math.max(0,s-n),i=s+n-1,d=e.slice(Math.max(0,a),i+1);let u,m;switch(t){case o.Uq.Forwards:u=s>0,m=a>=0;break;case o.Uq.Backwards:u=s<c,m=i<=c-1}return{newViewportIds:d,areSomeLocal:u,areAllLocal:m}}const i=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;const d=(0,r.sO)(),u=(0,r.sO)((()=>{if(!t||d.current)return;const{newViewportIds:e}=a(t,o.Uq.Forwards,i,t[0]);return e})()),m=(0,l.Z)();n&&(d.current={});const v=(0,s.Z)(t),f=(0,s.Z)(n);if(!t||n||t===v&&n===f)t||(u.current=void 0);else{const{offsetId:e=t[0],direction:n=o.Uq.Forwards}=d.current||{},{newViewportIds:r}=a(t,n,i,e);u.current&&(0,c.et)(u.current,r)||(u.current=r)}const p=(0,r.I4)((n=>{let{direction:r,noScroll:l}=n;const s=u.current,v=s?r===o.Uq.Backwards?s[s.length-1]:s[0]:void 0;if(!t)return void(e&&e({offsetId:v}));l||(d.current={...d.current,direction:r,offsetId:v});const{newViewportIds:f,areSomeLocal:p,areAllLocal:g}=a(t,r,i,v);!p||s&&(0,c.et)(s,f)||(u.current=f,m()),!g&&e&&e({offsetId:v})}),[t,i,e,m]);return n?[t]:[u.current,p]}},62357:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(14050);const o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=(0,r.sO)(e);(0,r.bt)((()=>{o.current=e}),[e]),(0,r.d4)((()=>{if(void 0===t)return;const e=setInterval((()=>o.current()),t);return n||o.current(),()=>clearInterval(e)}),[t,n])}},46898:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(14050),o=n(69118);function c(e,t){(0,r.d4)((()=>{const t=e.current;return()=>{t&&(0,o.T2)((()=>{t.pause(),t.src="",t.load()}))}}),t)}},87675:(e,t,n)=>{n.d(t,{Z:()=>l,z:()=>c});var r=n(77361),o=n(82972);function c(e){e.style.display="none",(0,o.Z)(e),e.style.display=""}const l=(e,t)=>{r.cj&&(e.style.overflow="hidden"),void 0!==t&&(e.scrollTop=t),r.cj&&(e.style.overflow="")}}}]);
|
|
//# sourceMappingURL=2305.c31559f1364c234c62a5.js.map
|