mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-03 10:07:55 +01:00
2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[1989],{70172:(e,t,n)=>{n.d(t,{Z:()=>h});var r=n(14050),o=n(33555),c=n(6137),l=n(83716),s=n(83158),i=n(2155),a=n(46752),d=n(32340),u=n(6202),m=n(31212),v=n(59107),f=n(3657),p=n(21747);const g=(0,a.y)("Avatar");g.media=g("media"),g.icon=g("icon");const h=(0,r.X$)((e=>{var t,n,h;let{className:Z,size:E="large",chat:P,user:b,photo:y,userStatus:I,text:w,isSavedMessages:A,noVideo:C,noLoop:T,lastSyncTime:N,observeIntersection:k,onClick:B}=e;const{loadFullUser:S}=(0,o.Sv)(),L=(0,r.sO)(null),U=(0,r.sO)(null),O=(0,f.Op)(L,k),R=b&&(0,s.NB)(b),q=b&&(0,s.pK)(b.id);let x,F;const D=null===(t=b||P)||void 0===t?void 0:t.hasVideoAvatar,V=(null==b||null===(n=b.fullInfo)||void 0===n?void 0:n.profilePhoto)||(null==P||null===(h=P.fullInfo)||void 0===h?void 0:h.profilePhoto),H=!C&&Boolean((null==b?void 0:b.isPremium)&&(null==V?void 0:V.isVideo)),M=O&&H,j="jumbo"===E;A||R||(H&&(F=(0,s.RT)(b,void 0,"video")),b?x=(0,s.RT)(b,j?"big":void 0):P?x=(0,s.RT)(P,j?"big":void 0):y&&(x=`photo${y.id}?size=m`)),(0,p.Z)(U,M),(0,r.d4)((()=>{const e=U.current;if(!e||!T)return;const t=()=>{e.currentTime=0};return e.addEventListener("ended",t),()=>e.removeEventListener("ended",t)}),[T]),(0,r.d4)((()=>{O&&!C&&b&&D&&!V&&S({userId:b.id})}),[D,V,S,b,C,O]);const z=(0,u.Z)(x,!1,c.IU.BlobUrl,N),J=(0,u.Z)(F,!1,c.IU.BlobUrl,N),$=Boolean(z||J),{transitionClassNames:K}=(0,m.Z)($,void 0,$,"slow"),X=(0,v.Z)();let Y;const _=b?(0,s.Js)(b):P?(0,s.U)(X,P):w;if(A)Y=r.ZP.createElement("i",{className:(0,a.Z)(g.icon,"icon-avatar-saved-messages"),"aria-label":_});else if(R)Y=r.ZP.createElement("i",{className:(0,a.Z)(g.icon,"icon-avatar-deleted-account"),"aria-label":_});else if(q)Y=r.ZP.createElement("i",{className:(0,a.Z)(g.icon,"icon-reply-filled"),"aria-label":_});else if($)Y=r.ZP.createElement(r.ZP.Fragment,null,r.ZP.createElement("img",{src:z,className:(0,a.Z)(g.media,"avatar-media",K,J&&"poster"),alt:_,decoding:"async"}),J&&r.ZP.createElement("video",{ref:U,src:J,className:(0,a.Z)(g.media,"avatar-media",K),muted:!0,autoPlay:!0,disablePictureInPicture:!0,loop:!T,playsInline:!0}));else if(b){const e=(0,s.Js)(b);Y=e?(0,i.Xv)(e,2):void 0}else if(P){const e=(0,s.U)(X,P);Y=e&&(0,i.Xv)(e,(0,s.YC)(P.id)?2:1)}else w&&(Y=(0,i.Xv)(w,2));const W=!A&&b&&I&&(0,s.kM)(b,I),G=(0,a.Z)(`Avatar size-${E}`,Z,`color-bg-${(0,s.Rs)(b||P)}`,A&&"saved-messages",R&&"deleted-account",q&&"replies-bot-account",W&&"online",B&&"interactive",!A&&!z&&"no-photo"),Q=Boolean(A||z),ee=(0,r.I4)((e=>{B&&B(e,Q)}),[B,Q]),te=(b||P)&&(b||P).id;return r.ZP.createElement("div",{ref:L,className:G,onClick:ee,"data-test-sender-id":l.Cg?te:void 0,"aria-label":"string"==typeof Y?_:void 0},"string"==typeof Y?(0,d.Z)(Y,["jumbo"===E?"hq_emoji":"emoji"]):Y)}))},21747:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(14050),o=n(69118),c=n(74753),l=n(45332),s=n(18674);function i(e,t){var n;const i=(0,r.sO)(null===(n=e.current)||void 0===n?void 0:n.paused),a=(0,r.sO)();a.current=t;const d=(0,r.I4)((()=>{e.current&&(i.current=!e.current.paused,i.current&&e.current.pause())}),[e]),u=(0,r.I4)((()=>{e.current&&i.current&&a.current&&document.body.contains(e.current)&&(0,c.Z)(e.current)}),[e]),m=(0,r.I4)((()=>{(0,o.T2)(u)}),[u]);(0,l.Z)(d,m),(0,s.ZP)(d,u)}},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),i=n(80036);const a=".ListItem",d=20,u=800,m=e=>{let{ref:t,className:n,items:m,itemSelector:v=a,preloadBackwards:f=d,sensitiveArea:p=u,withAbsolutePositioning:g,maxHeight:h,noScrollRestore:Z=!1,noScrollRestoreOnTop:E=!1,noFastList:P,cacheBuster:b,children:y,onLoadMore:I,onScroll:w,onKeyDown:A,onDragOver:C,onDragLeave:T}=e,N=(0,o.sO)(null);t&&(N=t);const k=(0,o.sO)({}),[B,S]=(0,o.Ye)((()=>I?[(0,c.Ds)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];I({direction:r.Uq.Backwards,noScroll:e})}),1e3,!0,!1),(0,c.Ds)((()=>{I({direction:r.Uq.Forwards})}),1e3,!0,!1)]:[]),[I,m]);(0,o.d4)((()=>{if(!B)return;if(f>0&&(!m||m.length<f))return void B(!0);const{scrollHeight:e,clientHeight:t}=N.current;t&&e<=t&&B()}),[m,B,f]),(0,o.bt)((()=>{const e=N.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||E&&0===e.scrollTop||((0,l.Z)(e,n),t.isScrollTopJustUpdated=!0)}),[m,v,Z,E,b,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=N.current,{scrollTop:l,scrollHeight:s,offsetHeight:i}=c,a=l<=(o?r[0].offsetTop:0)+p,d=(o?r[o-1].offsetTop+r[o-1].offsetHeight:s)-(l+i)<=p;let u=!1;if(a){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)}}w&&w(e)}),[B,S,w,p]);return o.ZP.createElement("div",{ref:N,className:n,onScroll:L,teactFastList:!P&&!g,onKeyDown:A,onDragOver:C,onDragLeave:T},g&&null!=m&&m.length?o.ZP.createElement("div",{teactFastList:!P,style:(0,i.Z)("position: relative",s.wZ&&`height: ${h}px`)},y):y)}},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),i=n(274),a=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:E,onClose:P,onCloseAnimationEnd:b,onEnter:y,shouldSkipHistoryAnimations:I}=e;const{shouldRender:w,transitionClassNames:A}=(0,s.Z)(f,b,I,void 0,I),C=(0,r.sO)(null);(0,r.d4)((()=>f?(0,o.Z)({onEsc:P,onEnter:y}):void 0),[f,P,y]),(0,r.d4)((()=>f&&C.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)}}(C.current):void 0),[f]),(0,d.Z)({isActive:f,onBack:P}),(0,i.Z)((e=>{let[t]=e;return document.body.classList.toggle("has-open-dialog",f),(f||!f&&void 0!==t)&&(0,l.YW)(200),()=>{document.body.classList.remove("has-open-dialog")}}),[f]);const T=(0,a.Z)();if(!w)return;const N=(0,c.Z)("Modal",v,A,h&&"transparent-backdrop");return r.ZP.createElement(m.Z,null,r.ZP.createElement("div",{ref:C,className:N,tabIndex:-1,role:"dialog"},r.ZP.createElement("div",{className:"modal-container"},r.ZP.createElement("div",{className:"modal-backdrop",onClick:P}),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:T("Close"),onClick:P},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:E},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,i=null!==(n=s[t][l?1:0])&&void 0!==n?n:o.pr[t][l?1:0];return"dialogFilters"===t?i+1:i}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:()=>a});var r=n(14050),o=n(91713),c=n(60782),l=n(65326),s=n(87204);function i(e,t,n,r){const{length:c}=e,l=r?e.indexOf(r):0,s=t===o.Uq.Forwards?l:l+1||c,i=Math.max(0,s-n),a=s+n-1,d=e.slice(Math.max(0,i),a+1);let u,m;switch(t){case o.Uq.Forwards:u=s>0,m=i>=0;break;case o.Uq.Backwards:u=s<c,m=a<=c-1}return{newViewportIds:d,areSomeLocal:u,areAllLocal:m}}const a=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=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}=i(t,o.Uq.Forwards,a,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}=i(t,n,a,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}=i(t,r,a,v);!p||s&&(0,c.et)(s,f)||(u.current=f,m()),!g&&e&&e({offsetId:v})}),[t,a,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])}},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=1989.305756fa8222a2171db5.js.map
|