mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-14 18:27:10 +01:00
2 lines
316 KiB
JavaScript
2 lines
316 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[126],{9126:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>ts,AttachMenu:()=>Er,AttachmentModal:()=>zs,BotCommandMenu:()=>br,BotCommandTooltip:()=>fr,CalendarModal:()=>je,ChatFolderModal:()=>as,ContactList:()=>Va,ContextMenuContainer:()=>Is,CustomSendMenu:()=>yr,DeleteMessageModal:()=>We,Dialogs:()=>Oe,DropArea:()=>Nr.Z,EmojiInteractionAnimation:()=>ut,EmojiTooltip:()=>wr,ForwardPicker:()=>$e,GifSearch:()=>Xr,HeaderMenuContainer:()=>ks,HistoryCalendar:()=>Ke,InlineBotTooltip:()=>Br,LeftSearch:()=>tn,Management:()=>bl,MediaViewer:()=>be,MentionTooltip:()=>Js,MessageSelectToolbar:()=>rt,MobileSearch:()=>Ms,NewChat:()=>Qa,NewChatStep1:()=>ja,NewChatStep2:()=>Ka,Notifications:()=>Ge,PaymentModal:()=>Vl,PinMessageModal:()=>Qe,PollModal:()=>Ys,PollResults:()=>_r,ReactorListModal:()=>ct,ReceiptModal:()=>Kl,RightSearch:()=>Dr,SafeLinkModal:()=>ze,SeenByModal:()=>lt,SendAsMenu:()=>$r,Settings:()=>Ya,StickerSearch:()=>Jr,StickerSetModal:()=>ys,StickerTooltip:()=>Ir,SymbolMenu:()=>pr,TextFormatter:()=>kr.Z,UnpinAllMessagesModal:()=>et});var a=n(4050),s=n(5116),r=n(6137),l=n(1713),o=n(3716),i=n(7361),c=n(2937),d=n(5326),m=n(8674),u=n(6590),h=n(9107),Z=n(6202),v=n(2566),P=n(7204),g=n(8415),p=n(9066),E=n(396),C=n(3989),f=n(1174),b=n(3858),I=n(4399),y=n(996),N=n(3227);function k(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if(a.draggable=!1,a.oncontextmenu=N.Z,"string"==typeof e?a.src=e:e instanceof HTMLVideoElement?a.src=e.poster:a.src=e.src,n.appendChild(a),t===l.bZ.ProfileAvatar||t===l.bZ.SettingsAvatar){n.classList.add("ProfileInfo"),t===l.bZ.SettingsAvatar&&n.classList.add("self");const e=document.querySelector(t===l.bZ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&n.appendChild(e.cloneNode(!0))}return n}function S(e,t){const n=document.querySelector(".Transition__slide--active > .MessageList");let a=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(a+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),a>n.scrollTop&&a+t.offsetHeight<n.scrollTop+n.offsetHeight}function w(e,t){Object.assign(e.style,t)}function M(e,t){let n,a;switch(e){case l.bZ.Album:case l.bZ.ScheduledAlbum:n=`.Transition__slide--active > .MessageList #album-media-${t.id}`,a=".full-media";break;case l.bZ.SharedMedia:n=`#shared-media${t.id}`,a="img";break;case l.bZ.SearchResult:n=`#search-media${t.id}`,a="img";break;case l.bZ.MiddleHeaderAvatar:n=".MiddleHeader .Transition__slide--active .ChatInfo .Avatar",a="img.avatar-media";break;case l.bZ.SettingsAvatar:n="#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto",a="img.avatar-media";break;case l.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto",a="img.avatar-media";break;case l.bZ.ScheduledInline:case l.bZ.Inline:default:n=`.Transition__slide--active > .MessageList #message${t.id}`,a=".message-content .full-media, .message-content .thumbnail"}const s=document.querySelector(n),r=s&&s.querySelectorAll(a);return{container:s,mediaEl:null==r?void 0:r[r.length-1]}}function T(e,t){switch(t){case l.bZ.Album:case l.bZ.ScheduledAlbum:case l.bZ.Inline:case l.bZ.ScheduledInline:e.classList.add("rounded-corners");break;case l.bZ.SharedMedia:case l.bZ.SettingsAvatar:case l.bZ.ProfileAvatar:case l.bZ.SearchResult:e.firstChild.style.objectFit="cover";break;case l.bZ.MiddleHeaderAvatar:e.classList.add("circle")}}var R=n(231),A=n(126),L=n(2255),F=n(3106),B=n(8964),$=n(9196);const x=(0,a.X$)((0,s.c$)(((e,t)=>{let{message:n}=t;return{isDownloading:!!n&&(0,p.te)(e,n),isProtected:(0,p.EV)(e,n)}}))((e=>{let{mediaData:t,isVideo:n,isZoomed:r,message:l,fileName:o,isAvatar:c,isDownloading:d,isProtected:m,onCloseMediaViewer:u,onForward:Z,onZoomToggle:P}=e;const{downloadMessageMedia:p,cancelMessageMediaDownload:E}=(0,s.uC)(),{loadProgress:C}=(0,v.Z)(l&&(0,g.Ti)(l,"download"),!d),f=(0,a.I4)((()=>{d?E({message:l}):p({message:l})}),[E,p,d,l]),b=(0,h.Z)(),I=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",className:n?"active":void 0,onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);if(i.wB){if(m)return;return a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(F.Z,{trigger:I,positionX:"right"},!c&&a.ZP.createElement(B.Z,{icon:"forward",onClick:Z},b("Forward")),n?a.ZP.createElement(B.Z,{icon:d?"close":"download",onClick:f},d?`${Math.round(100*C)}% Downloading...`:"Download"):a.ZP.createElement(B.Z,{icon:"download",href:t,download:o},b("AccActionDownload"))),d&&a.ZP.createElement($.Z,{progress:C,size:"s",noCross:!0}))}return a.ZP.createElement("div",{className:"MediaViewerActions"},!c&&!m&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:b("Forward"),onClick:Z},a.ZP.createElement("i",{className:"icon-forward"}))),function(){if(!m)return n?a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:b("AccActionDownload"),onClick:f},d?a.ZP.createElement($.Z,{progress:C,size:"s",onClick:f}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(R.Z,{href:t,download:o,round:!0,size:"smaller",color:"translucent-white",ariaLabel:b("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"}))}(),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:r?"Zoom Out":"Zoom In",onClick:P},a.ZP.createElement("i",{className:r?"icon-zoom-out":"icon-zoom-in"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:b("Close"),onClick:u},a.ZP.createElement("i",{className:"icon-close"})))})));var D=n(2202),O=n(9933),U=n(275),G=n(9118),J=n(9204),X=n(6752);const z=e=>{let{text:t="",isHidden:n,isForVideo:s,onClick:r}=e;const[l,o]=(0,a.eJ)(!1);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;o(t>2*I.Gw)};t();const n=(0,G.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const c=(0,X.Z)("MediaViewerFooter",s&&"is-for-video",n&&"is-hidden");return a.ZP.createElement("div",{className:c,onClick:function(e){t&&e.stopPropagation()}},t&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:i.wB?void 0:r},a.ZP.createElement("p",{className:"media-text custom-scroll "+(l?"multiline":""),dir:"auto"},t)))};var _=n(2019);const Y=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var H=n(1212),V=n(6898),q=n(4753),j=n(790);const K=["bytes","kB","MB","GB","TB","PB"],W=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${K[t]}`},Q=e=>{e.stopPropagation()},ee=e=>{let{bufferedProgress:t,currentTime:n,duration:s,fileSize:r,isForceMobileVersion:l,isPlayed:o,isFullscreenSupported:c,isFullscreen:d,onChangeFullscreen:m,onPlayPause:u,isVisible:Z,setVisibility:v,onSeek:P}=e;const g=(0,a.sO)(null),p=(0,a.sO)(!1);(0,a.d4)((()=>{let e;if(Z&&o)return e=window.setTimeout((()=>{v(!1)}),1500),()=>{e&&window.clearTimeout(e)};e&&window.clearTimeout(e)}),[o,Z,v]),(0,a.d4)((()=>(Z?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[Z]);const E=(0,h.Z)(),C=(0,a.I4)((e=>{if(p.current&&g.current){const{width:t,left:n}=g.current.getBoundingClientRect(),a=e instanceof MouseEvent?e.clientX:e.targetTouches[0].clientX;P(Math.max(Math.min(s*((a-n)/t),s),0))}}),[s,P]),b=(0,a.I4)((e=>{p.current=!0,C(e)}),[C]),I=(0,a.I4)((()=>{p.current=!1}),[]);return(0,a.d4)((()=>{if(g.current&&Z)return(0,f.sf)(g.current,{onCapture:b,onRelease:I,onClick:I,onDrag:C})}),[Z,b,C,I]),a.ZP.createElement("div",{className:(0,X.Z)("VideoPlayerControls",l&&"mobile",Z&&"active"),onClick:Q},function(e,t,n,s){const r=e/t*100,l=100*n;return a.ZP.createElement("div",{className:"player-seekline",ref:s},a.ZP.createElement("div",{className:"player-seekline-track"},a.ZP.createElement("div",{className:"player-seekline-buffered",style:`width: ${l||0}%`}),a.ZP.createElement("div",{className:"player-seekline-played",style:`width: ${r||0}%`})))}(n,s,t,g),a.ZP.createElement(R.Z,{ariaLabel:E("AccActionPlay"),size:"tiny",ripple:!i.wB,color:"translucent-white",className:"play",onClick:u},a.ZP.createElement("i",{className:o?"icon-pause":"icon-play"})),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,j.k9)(e)} / ${(0,j.k9)(t)}`)}(n,s),t<1&&(y=t,N=r,a.ZP.createElement("div",{className:"player-file-size"},`${W(N*y)} / ${W(N)}`)),c&&a.ZP.createElement(R.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:m},a.ZP.createElement("i",{className:d?"icon-smallscreen":"icon-fullscreen"})));var y,N};function te(){return te=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},te.apply(this,arguments)}const ne=(0,a.X$)((e=>{let{url:t,isGif:n,posterData:s,posterSize:r,loadProgress:l,fileSize:o,isMediaViewerOpen:c,noPlay:d,onClose:m,toggleControls:u,areControlsVisible:h}=e;const Z=(0,a.sO)(null),[v,P]=(0,a.eJ)(!i.$b||!i.cj),[g,p]=(0,a.eJ)(0),[E,C,f]=function(e,t){const[n,s]=(0,a.eJ)(Boolean(Y&&document[Y]));return(0,a.bt)((()=>{const n=()=>{s(Boolean(Y&&document[Y]))},a=()=>{s(!0)},r=()=>{s(!1),t(!1)},l=e.current;return document.addEventListener("fullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),l&&(l.addEventListener("webkitbeginfullscreen",a,!1),l.addEventListener("webkitendfullscreen",r,!1)),()=>{document.removeEventListener("fullscreenchange",n,!1),document.removeEventListener("webkitfullscreenchange",n,!1),document.removeEventListener("mozfullscreenchange",n,!1),l&&(l.removeEventListener("webkitbeginfullscreen",a,!1),l.removeEventListener("webkitendfullscreen",r,!1))}}),[]),Y||"iOS"===i.Lt?[n,()=>{e.current&&(Y||"iOS"===i.Lt)&&(e.current.requestFullscreen?e.current.requestFullscreen():e.current.webkitRequestFullscreen?e.current.webkitRequestFullscreen():e.current.webkitEnterFullscreen?e.current.webkitEnterFullscreen():e.current.mozRequestFullScreen&&e.current.mozRequestFullScreen(),s(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),s(!1))}]:[!1]}(Z,P),{isBuffered:b,bufferedProgress:I,bufferingHandlers:y}=(0,_.Z)(),{shouldRender:N,transitionClassNames:k}=(0,H.Z)(!b,void 0,void 0,"slow"),{shouldRender:S,transitionClassNames:w}=(0,H.Z)(i.cj&&!v&&!N,void 0,void 0,"slow");(0,a.d4)((()=>{d||!c?Z.current.pause():t&&!i.$b&&(0,q.Z)(Z.current)}),[d,c,t]),(0,a.d4)((()=>{Z.current.currentTime===Z.current.duration?(p(0),P(!1)):p(Z.current.currentTime)}),[g]);const M=(0,a.I4)((e=>{e.stopPropagation(),v?(Z.current.pause(),P(!1)):((0,q.Z)(Z.current),P(!0))}),[v]);(0,V.Z)(Z,[]);const T=(0,a.I4)((()=>{u(!0)}),[u]),A=(0,a.I4)((e=>{e.target===Z.current&&u(!1)}),[u]),L=(0,a.I4)((e=>{p(e.currentTarget.currentTime)}),[]),F=(0,a.I4)((()=>{p(0),P(!1),u(!0)}),[u]),B=(0,a.I4)((()=>{E&&f?f():!E&&C&&C()}),[f,E,C]),x=(0,a.I4)((e=>{Z.current.currentTime=e}),[]);(0,a.d4)((()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),M(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[M]);const D=r&&`width: ${r.width}px; height: ${r.height}px`,O=`background-image: url(${s})`;return a.ZP.createElement("div",{className:"VideoPlayer",onMouseMove:n||i.$b?void 0:T,onMouseOut:n||i.$b?void 0:A},a.ZP.createElement("div",{style:D},a.ZP.createElement("video",te({ref:Z,autoPlay:i.$b,playsInline:!0,loop:n,muted:n,id:"media-viewer-video",style:O,onPlay:i.cj?()=>P(!0):void 0,onEnded:F,onClick:i.wB?void 0:M,onDoubleClick:i.$b?void 0:B},y,{onTimeUpdate:L}),t&&a.ZP.createElement("source",{src:t}))),S&&a.ZP.createElement(R.Z,{round:!0,className:`play-button ${w}`,onClick:M},a.ZP.createElement("i",{className:"icon-play"})),N&&a.ZP.createElement("div",{className:["spinner-container",k].join(" ")},!b&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement($.Z,{size:"xl",progress:b?1:l,square:!0,onClick:m})),!n&&!N&&a.ZP.createElement(ee,{isPlayed:v,bufferedProgress:I,currentTime:g,isFullscreenSupported:Boolean(C),isFullscreen:E,fileSize:o,duration:Z.current&&Z.current.duration||0,isVisible:h,setVisibility:u,isForceMobileVersion:r&&r.width<400,onSeek:x,onChangeFullscreen:B,onPlayPause:M}))})),ae=(0,a.X$)((0,s.c$)(((e,t)=>{const{chatId:n,threadId:a,messageId:s,avatarOwnerId:r,profilePhotoIndex:o,origin:i}=t;if(i===l.bZ.SearchResult){if(!n||!s)return{};const t=(0,p.hj)(e,n,s);return t?{chatId:n,messageId:s,senderId:t.senderId,origin:i,message:t,isProtected:(0,p.EV)(e,t)}:{}}if(r)return{messageId:-1,senderId:r,avatarOwner:(0,p.dy)(e,r)||(0,p.Z1)(e,r),profilePhotoIndex:o||0,origin:i};if(!(n&&a&&s))return{};let c;return c=i&&[l.bZ.ScheduledAlbum,l.bZ.ScheduledInline].includes(i)?(0,p.Tm)(e,n,s):(0,p.hj)(e,n,s),c?{chatId:n,threadId:a,messageId:s,senderId:c.senderId,origin:i,message:c,isProtected:(0,p.EV)(e,c)}:{}}))((e=>{const{messageId:t,isActive:n,avatarOwner:s,chatId:o,message:d,profilePhotoIndex:m,origin:u,animationLevel:h,onClose:P,onFooterClick:p,isFooterHidden:E,isProtected:C,setIsFooterHidden:f}=e,b=d?(0,g.O$)(d):void 0,k=d?(0,g.b7)(d):void 0,S=d?(0,g.F$)(d):void 0,w=d?(0,g.Cg)(d):void 0,M=!!d&&(0,g.rl)(d),T=!!d&&(0,g.hC)(d),R=Boolean(k||w||T),A=Boolean(!R&&(b||S||M)),{isGif:L}=k||w||{},F=Boolean(s||t),B=Boolean(s),$=u===l.bZ.SharedMedia,x=u===l.bZ.SearchResult,D=2===h;function O(e){if(B&&void 0!==m){const{photos:t}=s;return t&&t[m]?`photo${t[m].id}?size=c`:(0,g.RT)(s,e?"big":"normal")}return d&&(0,g.Ti)(d,e?"viewerFull":"viewerPreview")}const U=(0,Z.Z)(d&&($||x)&&(0,g.Ti)(d,"pictogram"),void 0,r.IU.BlobUrl,void 0,D&&350),G=O(),X=(0,Z.Z)(G,void 0,r.IU.BlobUrl,void 0,D&&350),{mediaData:_,loadProgress:Y}=(0,v.Z)(O(!0),void 0,d&&(0,g.kG)(d,"viewerFull"),void 0,D&&350),H=(0,a.I4)((e=>{null==f||f(!e)}),[f]),V=b||k?(b||k).blobUrl:void 0;let q=!R&&(V||_)||X||U;const j=(0,c.Z)(!q&&d&&(0,g.DH)(d));q||u===l.bZ.SearchResult||(q=j);const K=d?(0,g.c0)(d):void 0;let W;if(d?M||T?W=(0,g.aE)(d).mediaSize:b||S?W=(0,g.bV)(b||S):(k||w)&&(W=(0,g.jC)(k||w)):W=I.vY,B)return a.ZP.createElement("div",{key:o,className:"MediaViewerContent"},se(_||X,(0,I.PA)(I.vY,!1),!i.wB&&!C));if(!d)return;const Q=(0,y.X)(d),ee=Boolean(Q);return a.ZP.createElement("div",{className:"MediaViewerContent "+(ee?"has-footer":"")},C&&a.ZP.createElement("div",{onContextMenu:N.Z,className:"protector"}),A&&se(V||_||X||U,d&&(0,I.PA)(W,ee),!i.wB&&!C),R&&(!n&&i.$b?function(e,t,n){const s=t&&`width: ${t.width}px; height: ${t.height}px`,r=`background-image: url(${e})`;return e?a.ZP.createElement("div",{className:"VideoPlayer"},a.ZP.createElement("div",{style:s},a.ZP.createElement("video",{style:r,draggable:Boolean(n)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(J.Z,{color:"white"}))}(q,d&&(0,I.PA)(W,ee,!0),!i.wB&&!C):a.ZP.createElement(ne,{key:t,url:V||_,isGif:L,posterData:q,posterSize:d&&(0,I.PA)(W,ee,!0),loadProgress:Y,fileSize:K,isMediaViewerOpen:F&&n,areControlsVisible:!E,toggleControls:H,noPlay:!n,onClose:P})),Q&&a.ZP.createElement(z,{text:Q,onClick:p,isHidden:E&&i.$b,isForVideo:R&&!L}))})));function se(e,t,n){return e?a.ZP.createElement("img",{src:e,alt:"",style:t?`width: ${t.width}px`:"",draggable:Boolean(n)}):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(J.Z,{color:"white"}))}function re(){return re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},re.apply(this,arguments)}const le=350;let oe;var ie;!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(ie||(ie={}));const ce=(0,a.X$)((e=>{let{messageId:t,getMessageId:n,selectMessage:s,isVideo:r,isGif:l,isPhoto:o,isOpen:c,isActive:m,hasFooter:u,...h}=e;const Z=(0,a.sO)(null),v=(0,a.sO)(null),P=(0,a.sO)({x:0,y:0,scale:1}),g=(0,a.sO)(void 0),p=(0,a.sO)(!0),[E,C]=(0,a.eJ)(t),b=(0,d.Z)(),[I,y]=(0,a.eJ)(!0),{isZoomed:N,onClose:k}=h,S=(0,a.I4)((e=>{P.current=e,b()}),[b]),w=(0,a.I4)((e=>{p.current=e,b()}),[b]),M=(0,D.Z)(350,!0),T=(0,D.Z)(500,!0),R=(0,D.Z)(800,!0),A=(0,a.I4)((e=>{if(!i.$b)return;const t=window.innerHeight-e.pageY<80;!t&&e.pageX<40||!t&&e.pageX>window.innerWidth-40||y(!I)}),[I]);if(function(e,t){const n=(0,a.sO)(e);(0,a.bt)((()=>{n.current=e}),[e]),(0,a.d4)((()=>{if("number"!=typeof t)return;const e=setTimeout((()=>n.current()),t);return()=>clearTimeout(e)}),[t])}((()=>y(!1)),200),(0,a.d4)((()=>{if(!i.$b||!Z.current||N||!E)return;let e={x:0,y:0,scale:1};const t={x:0,y:0},a={x:0,y:0},r={x:0,y:0};let l,o,c=Date.now();const d=(0,G.Ds)((()=>{c=Date.now()}),500,!1,!0),m=t=>{if(1!==P.current.scale)return!1;let a=0;if(window.innerHeight-t.pageY<80)return!1;t.pageX<40?a=-1:t.pageX>window.innerWidth-40&&(a=1);const r=n(E,a);if(r){const t=(window.innerWidth+40)*a;P.current.x+=t,p.current=!1,C(r),M((()=>s(r))),R((()=>{w(!0)})),e={x:0,y:0,scale:1},oe=(0,O.vr)({from:P.current.x,to:0,duration:le,timing:O.M8.easeOutCubic,onUpdate:e=>S({y:0,x:e,scale:1})})}return 0!==a};return(0,f.sf)(Z.current,{isNotPassive:!0,excludedClosestSelector:".VideoPlayerControls, .MediaViewerFooter",onCapture:()=>{if(c=Date.now(),(0,U.Z)(P.current,{x:0,y:0,scale:1})){if(!v.current)return;if(o=v.current.querySelector("img, video"),!o)return;l=o.getBoundingClientRect()}},onDrag:(n,a,s)=>{let{dragOffsetX:l,dragOffsetY:o}=s;if(i.cj){const{pageX:e}=a.touches[0];if(e<=f.vJ||e>=window.innerWidth-f.vJ)return}oe&&(oe(),oe=void 0),r.x=t.x-l,r.y=t.y-o,t.x=l,t.y=o;const c=Math.abs(l),m=Math.abs(o),{scale:u,x:h,y:Z}=P.current,v=10;if(d(),1===u)return g.current!==ie.Vertical&&(g.current===ie.Horizontal||Math.abs(h)>v||c>v&&m<v)?(g.current=ie.Horizontal,p.current=!1,void S({x:l,y:0,scale:u})):void((g.current===ie.Vertical||Math.abs(Z)>v||m>v&&c<v)&&(g.current=ie.Vertical,S({x:0,y:o,scale:u})));"touches"in n&&1===n.touches.length&&S({x:e.x+l,y:e.y+o,scale:u})},onZoom:(t,n)=>{let{zoomFactor:s,initialCenterX:r,initialCenterY:l,dragOffsetX:o,dragOffsetY:i,currentCenterX:c,currentCenterY:d}=n;const m=Math.min(12,Math.max(e.scale*s,.6)),u=m/e.scale,h=Math.abs(Math.min(e.x,0))+r,Z=Math.abs(Math.min(e.y,0))+l;a.x=c,a.y=d;const v=h-u*h,P=Z-u*Z;S({x:e.x+v+o,y:e.y+P+i,scale:m})},onClick(e){m(e)&&(e.preventDefault(),e.stopPropagation())},onDoubleClick(t,n){let{centerX:a,centerY:s}=n;if(m(t))return t.preventDefault(),void t.stopPropagation();const r=a-3*a,l=s-3*s,{scale:o,x:i,y:c}=P.current;if(1===o){if(0!==i||0!==c)return;e={x:r,y:l,scale:3}}else e={x:0,y:0,scale:1};return(0,O.vr)({from:[i,c,o],to:[e.x,e.y,e.scale],duration:le,timing:O.M8.easeOutCubic,onUpdate:e=>S({x:e[0],y:e[1],scale:e[2]})})},onRelease:()=>{const i=Math.abs(P.current.x),d=Math.abs(P.current.y),{scale:m,x:u,y:h}=P.current;if(T((()=>{g.current=void 0})),R((()=>{w(!0)})),m<1)return e={x:0,y:0,scale:1},(0,O.vr)({from:[u,h,m],to:[0,0,1],duration:le,timing:O.M8.easeOutCubic,onUpdate:e=>S({x:e[0],y:e[1],scale:e[2]})});if(m>1){if(!o||!l)return void(e={x:u,y:h,scale:m});const n=o.getBoundingClientRect(),s=Math.min(m,4),i=s/m;let d=u*i+(a.x-i*a.x),Z=h*i+(a.y-i*a.y);const v=.15;if(e.scale===m){const e=Math.abs(t.x)/(Date.now()-c),n=Math.abs(t.y)/(Date.now()-c);d-=Math.abs(t.x)*e*v*r.x,Z-=Math.abs(t.y)*n*v*r.y}if(n.width>window.innerWidth){const e=-l.left*s,t=window.innerWidth-l.right*s;d=Math.min(e,Math.max(t,d))}else d=(window.innerWidth-window.innerWidth*s)/2;if(n.height>window.innerHeight){const e=-l.top*s,t=window.innerHeight-l.bottom*s;Z=Math.min(e,Math.max(t,Z))}else Z=(window.innerHeight-window.innerHeight*s)/2;return e={x:d,y:Z,scale:s},void(oe=(0,O.vr)({from:[u,h,m],to:[d,Z,s],duration:le,timing:O.M8.easeOutCubic,onUpdate:e=>S({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:u,y:h,scale:m},d>=50)return k();if(d>0)return(0,O.vr)({from:h,to:0,duration:le,timing:O.M8.easeOutCubic,onUpdate:e=>S({x:0,y:e,scale:m})});const Z=u<0?1:-1,v=n(E,u<0?1:-1),p=r.x<0?-1:1;if(v&&i>=50&&Z===p){const e=(window.innerWidth+40)*Z;P.current.x+=e,C(v),M((()=>s(v)))}oe=(0,O.vr)({from:P.current.x,to:0,duration:le,timing:O.M8.easeOutCubic,onUpdate:e=>S({y:0,x:e,scale:P.current.scale})})}})}),[N,k,S,n,E,w]),!E)return;const L=n(E,1),F=n(E,-1),B=P.current.x,$=P.current.y,{scale:x}=P.current;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:Z},F&&1===x&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:de(-window.innerWidth+B-40)},a.ZP.createElement(ae,re({},h,{messageId:F}))),E&&a.ZP.createElement("div",{className:"MediaViewerSlide "+(m?"MediaViewerSlide--active":""),onClick:A,ref:v,style:de(B,$,x)},a.ZP.createElement(ae,re({},h,{messageId:E,isActive:m&&p.current,setIsFooterHidden:y,isFooterHidden:I||N||1!==x}))),L&&1===x&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:de(window.innerWidth+B+40)},a.ZP.createElement(ae,re({},h,{messageId:L}))))}));function de(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return`transform: translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${n.toFixed(3)});`}var me=n(782);const ue=[1,0,0,1,0,0],he={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5},Ze=150,ve=(0,a.X$)((e=>{let{children:t,className:n,noWrap:s,canPan:r,zoomLevel:l,panDeltaX:o,panDeltaY:i,onPan:c}=e;const d=he[l]||l,[m,u]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)({dx:o,dy:i,x:0,y:0}),[v,P]=(0,a.eJ)(ue),g=(0,a.sO)(null),p=(0,a.sO)(null);return(0,a.d4)((()=>{const e=d||v[0],t=o||v[4],n=i||v[5],a=[...v];v[0]!==e&&(a[0]=e||a[0],a[3]=e||a[3]),v[4]!==t&&(a[4]=t),v[5]!==n&&(a[5]=n),(0,me.et)(v,a)||P(function(e,t,n){const a=n&&n.querySelector(".Transition__slide--active img");if(!n||!a)return t;const s=n.getBoundingClientRect(),r=a.getBoundingClientRect(),l=r.width/e*t[0],o=r.height/e*t[3],i=(s.width-l)/2+t[4],c=(s.height-o)/2+t[5];return s.width&&s.width-Ze<i?t[4]-=i+s.width-Ze:l&&l+i<Ze&&(t[4]-=l+i-Ze),s.height&&s.height-Ze<c?t[5]-=c+s.height-Ze:o&&o+c<Ze&&(t[5]-=o+c-Ze),t}(v[0],a,g.current))}),[o,i,d]),(0,a.d4)((()=>{r||P(ue)}),[r]),(0,a.d4)((()=>{p.current&&(p.current.style.transform=`matrix(${v.toString()})`)}),[s,v]),s?t:a.ZP.createElement("div",{ref:g,className:`pan-wrapper ${n||""}`,onMouseDown:e=>{if(!r)return;e.stopPropagation(),e.preventDefault();const t={dx:v[4],dy:v[5],x:e.pageX,y:e.pageY};Z(t),u(!0),g.current&&g.current.classList.add("move")},onMouseUp:()=>{u(!1),g.current&&g.current.classList.remove("move"),c&&c(v[4],v[5])},onMouseMove:e=>{if(m){const t=function(e,t){const n=[...v],a=h.x-e,s=h.y-t;return n[4]=h.dx-a,n[5]=h.dy-s,n}(e.pageX,e.pageY);P(t),p.current&&(p.current.style.transform=`matrix(${v.toString()})`)}}},a.ZP.createElement("div",{ref:p,className:"pan-container"},t))}));var Pe=n(2340),ge=n(172);const pe=(0,s.c$)(((e,t)=>{let{chatId:n,messageId:a,isAvatar:s}=t;if(s&&n)return{sender:(0,g.YC)(n)?(0,p.dy)(e,n):(0,p.Z1)(e,n)};if(!a||!n)return{};const r=(0,p.hj)(e,n,a);return{message:r,sender:r&&(0,p.Ur)(e,r)}}))((e=>{let{chatId:t,messageId:n,sender:r,isAvatar:l,message:o}=e;const{closeMediaViewer:c,focusMessage:d,toggleChatInfo:m}=(0,s.uC)(),u=(0,a.I4)((()=>{c(),i.wB?setTimeout((()=>{m(!1,{forceSyncOnIOs:!0}),d({chatId:t,messageId:n})}),350):d({chatId:t,messageId:n})}),[t,d,m,n,c]),Z=(0,h.Z)();if(!r||!o&&!l)return;const v=(0,g.OU)(Z,r);return a.ZP.createElement("div",{className:"SenderInfo",onClick:u},(0,g.YC)(r.id)?a.ZP.createElement(ge.Z,{key:r.id,size:"medium",user:r}):a.ZP.createElement(ge.Z,{key:r.id,size:"medium",chat:r}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},v&&(0,Pe.Z)(v)),a.ZP.createElement("div",{className:"date",dir:"auto"},l?Z("lng_mediaview_profile_photo"):(0,j.ZK)(Z,1e3*o.date,!0))))})),Ee=e=>{let{children:t,...n}=e;return i.$b?t(!0,!0,1):a.ZP.createElement(L.Z,n,t)},Ce=(0,a.X$)((e=>{let{isShown:t,onChangeZoom:n}=e;const{transitionClassNames:s}=(0,H.Z)(t),r=(0,P.Z)(t),l=(0,a.sO)(null),[o,c]=(0,a.eJ)(1),d=(0,a.sO)(!1);(0,a.d4)((()=>{t&&!r&&c(1.5)}),[t,r]);const m=(0,a.I4)((()=>{d.current=!0}),[]),u=(0,a.I4)((()=>{d.current=!1,1===o&&n(o,!d.current)}),[n,o]);(0,a.d4)((()=>{n(o,!d.current)}),[o,n]);const Z=(0,h.Z)(),v=(0,X.Z)("ZoomControls",s);return a.ZP.createElement("div",{className:v},a.ZP.createElement(R.Z,{disabled:1===o,size:"tiny",color:"translucent-white",ariaLabel:Z("ZoomOut"),className:"zoom-out",ripple:!i.wB,onClick:()=>{l.current&&c(Math.max(1,o-.5))}},a.ZP.createElement("i",{className:"icon-zoom-out"})),a.ZP.createElement(R.Z,{disabled:3===o,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!i.wB,onClick:()=>{l.current&&c(Math.min(3,o+.5))}},a.ZP.createElement("i",{className:"icon-zoom-in"})),a.ZP.createElement("div",{className:"seekline"},a.ZP.createElement("div",{className:"seekline-track"},a.ZP.createElement("div",{className:"seekline-played",style:`width: ${50*(o-1)}%`}),a.ZP.createElement("input",{ref:l,min:1,max:3,step:"0.5",value:o,type:"range",className:"seekline-input",onChange:e=>{c(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:m,onMouseUp:u}))))})),fe=350,be=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n,messageId:a,avatarOwnerId:s,profilePhotoIndex:r,origin:o}=e.mediaViewer,{animationLevel:i}=e.settings.byKey;if(o===l.bZ.SearchResult){if(!t||!a)return{animationLevel:i};const n=(0,p.hj)(e,t,a);return n?{chatId:t,messageId:a,senderId:n.senderId,origin:o,message:n,animationLevel:i}:{animationLevel:i}}if(s)return{messageId:-1,senderId:s,avatarOwner:(0,p.dy)(e,s)||(0,p.Z1)(e,s),profilePhotoIndex:r||0,animationLevel:i,origin:o};if(!(t&&n&&a))return{animationLevel:i};let c,d,m;if(c=o&&[l.bZ.ScheduledAlbum,l.bZ.ScheduledInline].includes(o)?(0,p.Tm)(e,t,a):(0,p.hj)(e,t,a),!c)return{animationLevel:i};if(d=o&&[l.bZ.ScheduledAlbum,l.bZ.ScheduledInline].includes(o)?(0,p.Fn)(e,t):(0,p.Zw)(e,t),o===l.bZ.Inline||o===l.bZ.Album)m=(0,p.qC)(e,t,n)||(0,p.gb)(e,t,n);else if(o===l.bZ.SharedMedia){const t=(0,p.we)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};m=n}return{chatId:t,threadId:n,messageId:a,senderId:c.senderId,origin:o,message:c,chatMessages:d,collectionIds:m,animationLevel:i}}))((e=>{let{chatId:t,threadId:n,messageId:p,senderId:N,origin:F,avatarOwner:B,profilePhotoIndex:$,message:D,chatMessages:O,collectionIds:U,animationLevel:G}=e;const{openMediaViewer:J,closeMediaViewer:X,openForwardMenu:z,focusMessage:_,toggleChatInfo:Y}=(0,s.uC)(),H=Boolean(B||p),V=F===l.bZ.SharedMedia,q=F===l.bZ.SearchResult,j=D?(0,g.O$)(D):void 0,K=D?(0,g.b7)(D):void 0,W=D?(0,g.F$)(D):void 0,Q=D?(0,g.Cg)(D):void 0,ee=!!D&&(0,g.rl)(D),te=!!D&&(0,g.hC)(D),ne=Boolean(K||Q||te),{isGif:ae}=K||Q||{},se=Boolean(!ne&&(j||W||ee)),re=Boolean(B),le=W||Q?p:void 0,oe=(0,a.Ye)((()=>le?[le]:(0,g.N0)(O||{},U||[],V)),[le,O,U,V]),ie=p?oe.indexOf(p):-1,de=0===ie||-1===ie,me=ie===oe.length-1||-1===ie,ue=(0,a.sO)(),he=(0,P.Z)(N);!H||he&&he===N&&ue.current||(ue.current=ie);const Ze=G>=1&&!i.$b?"mv-slide":"none",Pe=2===G?"slide-fade":"none",ge=2===G,[be,Ie]=(0,a.eJ)(!1),[ye,Ne]=(0,a.eJ)(!1),[ke,Se]=(0,a.eJ)(1),[we,Me]=(0,a.eJ)({x:0,y:0});function Te(e){if(re&&void 0!==$){const{photos:t}=B;return t&&t[$]?`photo${t[$].id}?size=c`:(0,g.RT)(B,e?"big":"normal")}return D&&(0,g.Ti)(D,e?"viewerFull":"viewerPreview")}const Re=(0,Z.Z)(D&&(V||q)&&(0,g.Ti)(D,"pictogram"),void 0,r.IU.BlobUrl,void 0,ge&&fe),Ae=Te(),Le=(0,Z.Z)(Ae,void 0,r.IU.BlobUrl,void 0,ge&&fe),{mediaData:Fe}=(0,v.Z)(Te(!0),void 0,D&&(0,g.kG)(D,"viewerFull"),void 0,ge&&fe),Be=j||K?(j||K).blobUrl:void 0;let $e=!ne&&(Be||Fe)||Le||Re;const xe=(0,c.Z)(!$e&&D&&(0,g.DH)(D));$e||F===l.bZ.SearchResult||($e=xe);const De=D?(0,g.ep)(D):re?`avatar${B.id}-${$}.jpg`:void 0;let Oe;D?ee||te?Oe=(0,g.aE)(D).mediaSize:j||W?Oe=(0,g.bV)(j||W):(K||Q)&&(Oe=(0,g.jC)(K||Q)):Oe=I.vY,(0,a.d4)((()=>{i.wB&&document.body.classList.toggle("is-media-viewer-open",H)}),[H]);const Ue=(0,d.Z)();(0,a.d4)((()=>{const e=window.matchMedia(I.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",Ue):"function"==typeof e.addListener&&e.addListener(Ue),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",Ue):"function"==typeof e.removeListener&&e.removeListener(Ue)}}),[Ue]);const Ge=(0,P.Z)(D),Je=(0,P.Z)(F),Xe=(0,P.Z)(B),ze=(0,P.Z)($e),_e=D?(0,y.X)(D):void 0,Ye=Boolean(_e);(0,a.d4)((()=>{ge&&H&&!Ge&&!Xe&&((0,m.YW)(fe+o.fK),function(e,t,n,a,s,r){const{mediaEl:c}=M(t,r);if(!c)return;const{width:d}=b.Z.get(),{width:m,height:u}=(0,I.fM)(e,s),{width:h,height:Z}=(0,I.jg)(m,u,a.width,a.height),v=(d-h)/2,P=function(e){const t=window.matchMedia(I.L6);let n=4.125;return e&&!i.$b&&(n+=t.matches?.875:2.125),n*I.Gw}(e)+(u-Z)/2;let{top:g,left:p,width:E,height:C}=c.getBoundingClientRect();if([l.bZ.SharedMedia,l.bZ.Album,l.bZ.ScheduledAlbum,l.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,r){if(e===t){const l=Math.max(s,r)*(e/t);a-=(l-s)/2,n-=(l-r)/2,s=l,r=l}else if(e>t){const n=s;a-=((s=r*(e/t))-n)/2}else if(t>e){const a=r;n-=((r=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:r}}(h,Z,g,p,E,C);g=e.top,p=e.left,E=e.width,C=e.height}const f=p+E/2-(v+h/2),y=g+C/2-(P+Z/2),N=E/h,S=C/Z,R=k(n||c);w(R,{top:`${P}px`,left:`${v}px`,width:`${h}px`,height:`${Z}px`,transform:`translate3d(${f}px, ${y}px, 0) scale(${N}, ${S})`}),T(R,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(R),requestAnimationFrame((()=>{R.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(R),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(R)&&document.body.removeChild(R),document.body.classList.remove("ghost-animating")}))}),200+o.fK)}))}))}(Ye,F,$e,Oe,ne,D)),ge&&!H&&(Ge||Xe)&&((0,m.YW)(fe+o.fK),function(e,t,n){const{container:a,mediaEl:s}=M(e,n);if(!s)return;const r=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!r||!s)return;const{top:i,left:c,width:d,height:m}=r.getBoundingClientRect(),{top:u,left:h,width:Z,height:v}=s.getBoundingClientRect();let P=u;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:n}=b.Z.get();return t.top<=n&&t.top+t.height>=0}(a)){const{height:e}=b.Z.get();P=u<i?-v:e}const g=c+d/2-(h+Z/2),p=i+m/2-(P+v/2);let E=d/Z,C=m/v;const f=[l.bZ.Inline,l.bZ.ScheduledInline].includes(e)&&!S(a,s)||[l.bZ.Album,l.bZ.ScheduledAlbum].includes(e)&&!S(a,s);[l.bZ.SharedMedia,l.bZ.Album,l.bZ.ScheduledAlbum,l.bZ.SearchResult].includes(e)&&(E>C?E=C:C>E&&(C=E));const I=document.getElementsByClassName("ghost")[0],y=I||k(t||s,e);I||w(y,{top:`${P}px`,left:`${h}px`,width:`${Z}px`,height:`${v}px`,transform:`translate3d(${g}px, ${p}px, 0) scale(${E}, ${C})`}),requestAnimationFrame((()=>{if(I){const{top:e,left:t,width:n,height:a}=I.getBoundingClientRect();w(y,{transition:"none",top:`${P}px`,left:`${h}px`,transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-P}px, 0) scale(${n/Z}, ${a/v})`,width:`${Z}px`,height:`${v}px`})}document.body.classList.add("ghost-animating"),I||document.body.appendChild(y),requestAnimationFrame((()=>{I&&(I.style.transition=""),y.style.transform="",f&&(y.style.opacity="0"),T(y,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(y)&&document.body.removeChild(y),document.body.classList.remove("ghost-animating")}))}),200+o.fK)}))}))}(Je,ze,Ge||void 0))}),[ge,H,F,Je,D,Ge,Xe,$e,ze,Oe,ne,Ye]),(0,a.d4)((()=>{let e;return ye?Ie(!0):e=window.setTimeout((()=>{Ie(!1)}),fe),()=>{e&&window.clearTimeout(e)}}),[ye]);const He=()=>{Ne(!1),Se(1),Me({x:0,y:0})},Ve=(0,a.I4)((()=>{Ne(!ye),Se(ye?1:1.5),ye&&Me({x:0,y:0})}),[ye]),qe=(0,a.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Se(e),1===e&&t&&He()}),[]),je=(0,a.I4)((()=>{X(),He()}),[X]),Ke=(0,a.I4)((()=>{je(),i.wB?setTimeout((()=>{Y(!1,{forceSyncOnIOs:!0}),_({chatId:t,threadId:n,messageId:p})}),fe):_({chatId:t,threadId:n,messageId:p})}),[je,t,n,_,Y,p]),We=(0,a.I4)((()=>{z({fromChatId:t,messageIds:[p]}),He()}),[z,t,p]),Qe=(0,a.I4)((e=>J({chatId:t,threadId:n,messageId:e,origin:F},{forceOnHeavyAnimation:!0})),[t,J,F,n]);(0,a.d4)((()=>H?(0,C.Z)((()=>{ye?He():je()})):void 0),[je,H,ye]),(0,a.d4)((()=>{ne&&!ae&&(0,E.Es)()}),[ae,ne]),(0,a.d4)((()=>{if(H)return b.Z.disableRefresh(),()=>{b.Z.enableRefresh()}}),[H]);const et=(0,a.I4)(((e,t)=>{if(!e)return;const n=oe.indexOf(e);return-1===t&&n>0||1===t&&n<oe.length-1?oe[n+t]:void 0}),[oe]),tt=et(p,1),nt=et(p,-1),at=(0,a.I4)(((e,t)=>{Me({x:e,y:t})}),[]),st=(0,h.Z)();function rt(){return re?a.ZP.createElement(pe,{key:B.id,chatId:B.id,isAvatar:!0}):a.ZP.createElement(pe,{key:p,chatId:t,messageId:p})}return(0,u.ZP)(H,X,J,{chatId:t,threadId:n,messageId:p,origin:F,avatarOwnerId:B&&B.id}),(0,a.d4)((()=>{if(H)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){switch(e.key){case"Left":case"ArrowLeft":Qe(nt);break;case"Right":case"ArrowRight":Qe(tt)}}}),[H,tt,nt,Qe]),(0,a.d4)((()=>{if(ye||i.$b)return;const e=document.querySelector(".MediaViewerSlide--active");if(!e)return;const t=ae&&!i.cj;return(0,f.sf)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .Spoiler, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:je})}),[je,ae,ye,p]),a.ZP.createElement(A.Z,{id:"MediaViewer",className:ye?"zoomed":"",isOpen:H},(()=>a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"media-viewer-head",dir:st.isRtl?"rtl":void 0},i.wB&&a.ZP.createElement(R.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:st("Close"),onClick:je},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(L.Z,{activeKey:ue.current,name:Pe},rt),a.ZP.createElement(x,{mediaData:Fe||Le,isVideo:ne,isZoomed:ye,message:D,fileName:De,onCloseMediaViewer:je,onForward:We,onZoomToggle:Ve,isAvatar:re})),a.ZP.createElement(ve,{noWrap:!be,canPan:ye,panDeltaX:we.x,panDeltaY:we.y,zoomLevel:ke,onPan:at},a.ZP.createElement(Ee,{activeKey:ie,name:Ze},(e=>a.ZP.createElement(ce,{messageId:p,getMessageId:et,chatId:t,isPhoto:se,isGif:ae,threadId:n,avatarOwnerId:B&&B.id,profilePhotoIndex:$,origin:F,isOpen:H,hasFooter:Ye,isZoomed:ye,isActive:e,isVideo:ne,animationLevel:G,onClose:je,selectMessage:Qe,onFooterClick:Ke})))),!de&&!i.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${ne&&!ae&&"inline"}`,"aria-label":st("AccDescrPrevious"),dir:st.isRtl?"rtl":void 0,onClick:()=>Qe(nt)}),!me&&!i.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${ne&&!ae&&"inline"}`,"aria-label":st("Next"),dir:st.isRtl?"rtl":void 0,onClick:()=>Qe(tt)}),a.ZP.createElement(Ce,{isShown:ye,onChangeZoom:qe}))))})));var Ie=n(8360),ye=n(706),Ne=n(7407),ke=n(2313),Se=n(2515),we=n(4288),Me=n(3103),Te=n(7687),Re=n(1273),Ae=n(1876),Le=n(8799),Fe=n(6058);const Be=(0,a.X$)((e=>{let{isOpen:t,currentUserId:n,chatOrUserIds:s,filterRef:r,filter:l,filterPlaceholder:i,loadMore:c,onFilterChange:d,onSelectChatOrUser:m,onClose:u,onCloseAnimationEnd:Z}=e;const v=(0,h.Z)(),[P,p]=(0,Ne.Z)(c,s,Boolean(l)),E=(0,a.I4)((()=>{d("")}),[d]);(0,Se.Z)(r,t,E);const C=(0,a.sO)(null),f=(0,a.I4)((e=>{d(e.currentTarget.value)}),[d]),b=(0,ke.Z)(C,t,(e=>{P&&P.length>0&&m(P[-1===e?0:e])}),".ListItem-button",!0),I=a.ZP.createElement("div",{className:"modal-header",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:v("Close"),onClick:u},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Te.Z,{ref:r,value:l,onChange:f,onKeyDown:b,placeholder:i})),y=s.indexOf(P[0]);return a.ZP.createElement(Me.Z,{isOpen:t,className:"ChatOrUserPicker",header:I,onClose:u,onCloseAnimationEnd:Z},null!=P&&P.length?a.ZP.createElement(Re.Z,{ref:C,className:"picker-list custom-scroll",items:P,onLoadMore:p,withAbsolutePositioning:!0,maxHeight:s.length*o.rS,onKeyDown:b},P.map(((e,t)=>a.ZP.createElement(Ae.Z,{key:e,className:"chat-item-clickable force-rounded-corners",style:`top: ${(y+t)*o.rS}px;`,onClick:()=>m(e)},(0,g.YC)(e)?a.ZP.createElement(Fe.Z,{status:e===n?v("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Le.Z,{chatId:e}))))):P&&!P.length?a.ZP.createElement("p",{className:"no-results"},v("lng_blocked_list_not_found")):a.ZP.createElement(we.Z,null))})),$e=(0,a.X$)((0,s.c$)((e=>{var t;const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:r}=e;return{chatsById:n,activeListIds:a.active,archivedListIds:a.archived,pinnedIds:s.active,contactIds:null===(t=e.contactList)||void 0===t?void 0:t.userIds,currentUserId:r}}))((e=>{let{chatsById:t,activeListIds:n,archivedListIds:l,pinnedIds:o,contactIds:i,currentUserId:c,isOpen:d}=e;const{setForwardChatId:m,exitForwardMode:u}=(0,s.uC)(),Z=(0,h.Z)(),[v,P]=(0,a.eJ)(""),p=(0,a.sO)(null),[E,C,f]=(0,ye.Z)();(0,a.d4)((()=>{d&&C()}),[d,C]);const b=(0,a.Ye)((()=>{if(!d)return;let e=o||[];c&&(e=(0,me.Tw)([c,...e]));const a=[...n||[],...l||[]].filter((e=>{const n=t[e];return n&&(0,g.Qm)(n,r._f)})),m=(0,s.Rd)().users.byId;return(0,g.ih)((0,me.Tw)([...(0,g.$l)(Z,a,t,v,c),...i?(0,g.kK)(i,m,v):[]]),t,void 0,e)}),[n,l,t,i,c,v,d,Z,o]),I=(0,a.I4)((e=>{m({id:e})}),[m]),y=(0,Ie.Z)(b,!0);if(d||E)return a.ZP.createElement(Be,{currentUserId:c,isOpen:d,chatOrUserIds:y,filterRef:p,filterPlaceholder:Z("ForwardTo"),filter:v,onFilterChange:P,onSelectChatOrUser:I,onClose:u,onCloseAnimationEnd:f})})));var xe=n(1947);function De(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Oe=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["dialogs"])))((e=>{let{dialogs:t}=e;const{dismissDialog:n,acceptInviteConfirmation:r,sendMessage:l,showNotification:o}=(0,s.uC)(),[i,c,d]=(0,ye.Z)(),m=(0,h.Z)();var u,Z,v;if((0,a.d4)((()=>{t.length>0&&c()}),[t,c]),t.length)return a.ZP.createElement("div",{id:"Dialogs"},Boolean(t.length)&&("hash"in(u=t[t.length-1])?(e=>{const{hash:t,title:s,about:l,participantsCount:c,isChannel:u,photo:h,isRequestNeeded:Z}=e,v=m(u?"Subscribers":"Members",c,"i"),g=m(u?"ChannelJoin":"JoinGroup"),p=m(u?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup");return a.ZP.createElement(Me.Z,{isOpen:i,onClose:d,className:"error",header:P(s,h),onCloseAnimationEnd:n},void 0!==c&&a.ZP.createElement("p",{className:"modal-help"},v),l&&a.ZP.createElement("p",{className:"modal-about"},(0,Pe.Z)(l,["br"])),Z&&a.ZP.createElement("p",{className:"modal-help"},m(u?"MemberRequests.RequestToJoinDescriptionChannel":"MemberRequests.RequestToJoinDescriptionGroup")),a.ZP.createElement(R.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{r({hash:t}),o({message:m(u?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),d()}},Z?p:g),a.ZP.createElement(R.Z,{isText:!0,className:"confirm-dialog-button",onClick:d},m("Cancel")))})(u):"phoneNumber"in u?(Z=u,a.ZP.createElement(Me.Z,{isOpen:i,onClose:d,className:"confirm",title:m("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:n},m("AreYouSureShareMyContactInfoBot"),a.ZP.createElement("div",null,a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:()=>{l({contact:(0,me.ei)(Z,["firstName","lastName","phoneNumber"])}),d()}},m("OK")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},m("Cancel"))))):(v=u,a.ZP.createElement(Me.Z,{isOpen:i,onClose:d,onCloseAnimationEnd:n,className:"error",title:De(v)},v.hasErrorKey?(0,xe.ZP)(v):(0,Pe.Z)(v.message,["emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(R.Z,{isText:!0,onClick:d},m("OK")))))));function P(e,t){return a.ZP.createElement("div",{className:"modal-header"},t&&a.ZP.createElement(ge.Z,{size:"small",photo:t}),a.ZP.createElement("div",{className:"modal-title"},(0,Pe.Z)(e)),a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:d},a.ZP.createElement("i",{className:"icon-close"})))}})));var Ue=n(6937);const Ge=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["notifications"])))((e=>{let{notifications:t}=e;const{dismissNotification:n}=(0,s.uC)();if(t.length)return a.ZP.createElement("div",{id:"Notifications"},t.map((e=>{let{message:t,localId:s}=e;return a.ZP.createElement(Ue.Z,{message:(0,Pe.Z)(t,["emoji","br","links","simple_markdown"]),onDismiss:()=>n({localId:s})})})))})));var Je=n(1396),Xe=n(7551);const ze=(0,a.X$)((e=>{let{url:t}=e;const{toggleSafeLinkModal:n}=(0,s.uC)(),r=(0,h.Z)(),l=(0,a.I4)((()=>{window.open((0,Je.X)(t)),n({url:void 0})}),[n,t]),o=(0,a.I4)((()=>{n({url:void 0})}),[n]),i=(0,Ie.Z)(t);return a.ZP.createElement(Xe.Z,{isOpen:Boolean(t),onClose:o,title:r("OpenUrlTitle"),textParts:(0,Pe.Z)(r("OpenUrlAlert2",i),["links"]),confirmLabel:r("OpenUrlTitle"),confirmHandler:l})})),_e=2147483647e3,Ye=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function He(e,t,n,a,s){const r=new Date(e,t,n),l=a&&(0,j.$Y)(a),o=s&&(0,j.$Y)(s);return!!(o&&r>o)||!!(l&&r<l)}function Ve(e){return String(e).padStart(2,"0")}function qe(e,t,n){return`${e}-${t+1}-${n}`}const je=(0,a.X$)((e=>{let{selectedAt:t,minAt:n,maxAt:s,isFutureMode:r,isPastMode:l,isOpen:o,withTimePicker:i,submitButtonLabel:c,secondButtonLabel:d,onClose:m,onSubmit:u,onSecondButtonClick:Z}=e;const v=(0,h.Z)(),g=new Date,p=(0,a.Ye)((()=>r&&!n?new Date:new Date(Math.max(n||0,0))),[r,n]),E=(0,a.Ye)((()=>l&&!s?new Date:new Date(Math.min(s||_e,_e))),[l,s]),C=(0,a.Ye)((()=>t?new Date(t):new Date),[t]),f=(0,P.Z)(o),[b,I,y]=(0,ye.Z)(!1),[N,k]=(0,a.eJ)(C),[S,w]=(0,a.eJ)(new Date(N.getFullYear(),N.getMonth(),1)),[M,T]=(0,a.eJ)(Ve(C.getHours())),[A,L]=(0,a.eJ)(Ve(C.getMinutes())),F=qe(N.getFullYear(),N.getMonth(),N.getDate()),B=S.getFullYear(),$=S.getMonth();(0,a.d4)((()=>{!f&&o&&(k(C),w(new Date(C.getFullYear(),C.getMonth(),1)),i&&(T(Ve(C.getHours())),L(Ve(C.getMinutes()))))}),[C,o,f,i]),(0,a.d4)((()=>{r&&!b&&N.getTime()<p.getTime()&&(k(p),T(Ve(p.getHours())),L(Ve(p.getMinutes())))}),[r,b,p,N]),(0,a.d4)((()=>{l&&!b&&N.getTime()>E.getTime()&&(k(E),T(Ve(E.getHours())),L(Ve(E.getMinutes())))}),[r,l,b,E,p,N]),(0,a.d4)((()=>{if(t){const e=new Date(t);k(e),T(Ve(e.getHours())),L(Ve(e.getMinutes()))}}),[t]);const x=l&&B>=g.getFullYear()&&$>=g.getMonth()||E&&B>=E.getFullYear()&&$>=E.getMonth(),D=r&&B<=g.getFullYear()&&$<=g.getMonth(),{prevMonthGrid:O,currentMonthGrid:U,nextMonthGrid:G}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],r=new Date;r.setDate(1),r.setMonth(t),r.setFullYear(e);const l=r.getDay(),o=new Date(e,t,0).getDate();for(let e=1;e<l;e++)n.push(o-l+e+1);for(;r.getMonth()===t;){const e=r.getDate();a.push(e),r.setDate(e+1)}const i=(a.length+n.length)%7;if(i>0)for(let e=1;e<=7-i;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(B,$)),[$,B]),J=(0,a.Ye)((()=>c||function(e,t){const n=(0,j.xH)(t,e.code);return n===(0,j.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,j.mr)(e,t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,j.mr)(e,t)])}(v,N)),[v,N,c]),z=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return T(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(N.getTime());a.setHours(n),k(a);const s=Ve(n);T(s),e.target.value=s}),[N]),_=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return L(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),59)),a=new Date(N.getTime());a.setMinutes(n),k(a);const s=Ve(n);L(s),e.target.value=s}),[N]);return a.ZP.createElement(Me.Z,{isOpen:o,onClose:m,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:m},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,v(`lng_month${$+1}`)," ",B),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",disabled:D,onClick:D?void 0:function(){w((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",disabled:x,onClick:x?void 0:function(){w((e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t}))}},a.ZP.createElement("i",{className:"icon-next"})))),a.ZP.createElement("div",{className:"calendar-wrapper"},a.ZP.createElement("div",{className:"calendar-grid"},Ye.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,v(e))))),O.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),U.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void k((e=>{const n=new Date(e);return n.setDate(t),n.setMonth($),n.setFullYear(B),n}));var t},className:(0,X.Z)("day-button",He(B,$,e,p,E)?"disabled":e?"clickable":"",F===qe(B,$,e)&&"selected")},Boolean(e)&&a.ZP.createElement("span",null,e)))),G.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),i&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:M,onChange:z,onFocus:I,onBlur:y}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:A,onChange:_,onFocus:I,onBlur:y})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(R.Z,{onClick:function(){u(N)}},J),d&&a.ZP.createElement(R.Z,{onClick:Z,isText:!0},d)))})),Ke=(0,a.X$)((0,s.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})))((e=>{let{isOpen:t,selectedAt:n}=e;const{searchMessagesByDate:r,closeHistoryCalendar:l}=(0,s.uC)(),o=(0,a.I4)((e=>{r({timestamp:e.valueOf()/1e3}),l()}),[l,r]),i=(0,h.Z)();return a.ZP.createElement(je,{isOpen:t,selectedAt:n,isPastMode:!0,submitButtonLabel:i("JumpToDate"),onClose:l,onSubmit:o})}))),We=(0,a.X$)((0,s.c$)(((e,t)=>{let{message:n,isSchedule:a}=t;const{threadId:s}=(0,p.Bt)(e)||{},{canDeleteForAll:r}=s&&(0,p._k)(e,n,s)||{},l=(0,p.Z1)(e,n.chatId);return{canDeleteForAll:!a&&r,contactName:l&&(0,g.YC)(l.id)?(0,g.Vl)((0,p.dy)(e,(0,g.zX)(l))):void 0,willDeleteForCurrentUserOnly:l&&(0,g.G9)(l)&&!r,willDeleteForAll:l&&(0,g.ZV)(l)}}))((e=>{let{isOpen:t,isSchedule:n,message:r,album:l,canDeleteForAll:o,contactName:i,willDeleteForCurrentUserOnly:c,willDeleteForAll:d,onClose:m}=e;const{deleteMessages:u,deleteScheduledMessages:Z}=(0,s.uC)(),v=(0,a.I4)((()=>{const e=null!=l&&l.messages?l.messages.map((e=>{let{id:t}=e;return t})):[r.id];u({messageIds:e,shouldDeleteForAll:!0}),m()}),[u,r.id,m,l]),P=(0,a.I4)((()=>{const e=null!=l&&l.messages?l.messages.map((e=>{let{id:t}=e;return t})):[r.id];n?Z({messageIds:e}):u({messageIds:e,shouldDeleteForAll:!1}),m()}),[l,r.id,n,m,Z,u]),g=(0,h.Z)();return a.ZP.createElement(Me.Z,{isOpen:t,onClose:m,onEnter:t&&!o?P:void 0,className:"delete",title:g("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,g("AreYouSureDeleteSingleMessage")),c&&a.ZP.createElement("p",null,g("lng_delete_for_me_chat_hint",1,"i")),d&&a.ZP.createElement("p",null,g("lng_delete_for_everyone_hint",1,"i")),o&&a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:v},i&&(0,Pe.Z)(g("Conversation.DeleteMessagesFor",i)),!i&&g("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},g(o?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},g("Cancel")))}))),Qe=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,g.YC)(n),s=(0,p.FM)(e,n),r=(0,p.Z1)(e,n),l=Boolean(r)&&(0,g.eA)(r),o=Boolean(r)&&(0,g.G9)(r),i=Boolean(r)&&(0,g.ZV)(r);return{isPrivateChat:a,isChatWithSelf:s,isChannel:l,isGroup:o,isSuperGroup:i,canPinForAll:a&&!s||i||o,contactName:r&&(0,g.YC)(r.id)?(0,g.Vl)((0,p.dy)(e,(0,g.zX)(r))):void 0}}))((e=>{let{isOpen:t,messageId:n,chatId:r,isChannel:l,isGroup:o,isSuperGroup:i,canPinForAll:c,contactName:d,onClose:m}=e;const{pinMessage:u}=(0,s.uC)(),Z=(0,a.I4)((()=>{u({chatId:r,messageId:n,isUnpin:!1}),m()}),[u,r,n,m]),v=(0,a.I4)((()=>{u({chatId:r,messageId:n,isUnpin:!1,isOneSide:!0,isSilent:!0}),m()}),[r,n,m,u]),P=(0,h.Z)();return a.ZP.createElement(Me.Z,{isOpen:t,onClose:m,className:"pin",title:P("PinMessageAlertTitle")},a.ZP.createElement("p",null,P(l?"PinMessageAlertChannel":o||i?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:v},P("DialogPin")),c&&a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:Z},d?(0,Pe.Z)(P("Conversation.PinMessagesFor",d)):P("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},P("Cancel")))}))),et=(0,a.X$)((e=>{let{isOpen:t,pinnedMessagesCount:n=0,onClose:s,onUnpin:r}=e;const l=(0,h.Z)();return a.ZP.createElement(Me.Z,{isOpen:t,onClose:s,className:"unpin-all",title:l("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,l("Chat.UnpinAllMessagesConfirmation",n,"i")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},l("DialogUnpin")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},l("Cancel")))}));var tt=n(517);const nt=(0,a.X$)((0,s.c$)(((e,t)=>{let{isSchedule:n}=t;const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:s}=(0,p.xl)(e),r=(0,p.jr)(e);return{selectedMessageIds:a,canDeleteForAll:!n&&s,contactName:r&&(0,g.YC)(r.id)?(0,g.Vl)((0,p.dy)(e,(0,g.zX)(r))):void 0,willDeleteForCurrentUserOnly:r&&(0,g.G9)(r)&&!s,willDeleteForAll:r&&(0,g.ZV)(r)}}))((e=>{let{isOpen:t,isSchedule:n,selectedMessageIds:r,canDeleteForAll:l,contactName:o,willDeleteForCurrentUserOnly:i,willDeleteForAll:c,onClose:d}=e;const{deleteMessages:m,deleteScheduledMessages:u,exitMessageSelectMode:Z}=(0,s.uC)(),v=(0,P.Z)(t),g=(0,a.I4)((()=>{d(),m({messageIds:r,shouldDeleteForAll:!0})}),[m,r,d]),p=(0,a.I4)((()=>{n?u({messageIds:r}):m({messageIds:r,shouldDeleteForAll:!1}),d()}),[n,d,u,r,m]),E=(0,h.Z)();if((0,a.d4)((()=>{!t&&v&&Z()}),[Z,t,v]),r)return a.ZP.createElement(Me.Z,{isOpen:t,onClose:d,onEnter:l?void 0:p,className:"delete",title:E("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,E("AreYouSureDeleteFewMessages")),i&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),c&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),l&&a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:g},o?(0,Pe.Z)(E("ChatList.DeleteForEveryone",o)):E("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:p},E(l?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},E("Cancel")))})));var at=n(4434);const st=(0,a.X$)((e=>{let{isOpen:t,messageIds:n,onClose:r}=e;const{reportMessages:l,exitMessageSelectMode:o}=(0,s.uC)(),[i,c]=(0,a.eJ)("spam"),[d,m]=(0,a.eJ)(""),u=()=>{l({messageIds:n,reason:i,description:d}),o(),r()},Z=(0,a.I4)((e=>{c(e)}),[]),v=(0,a.I4)((e=>{m(e.target.value)}),[]),P=(0,h.Z)(),g=[{value:"spam",label:P("lng_report_reason_spam")},{value:"violence",label:P("lng_report_reason_violence")},{value:"pornography",label:P("lng_report_reason_pornography")},{value:"childAbuse",label:P("lng_report_reason_child_abuse")},{value:"copyright",label:P("ReportPeer.ReasonCopyright")},{value:"other",label:P("lng_report_reason_other")}];if(n)return a.ZP.createElement(Me.Z,{isOpen:t,onClose:r,onEnter:t?u:void 0,className:"report",title:P("lng_report_message_title")},a.ZP.createElement(at.Z,{name:"report-message",options:g,onChange:Z,selected:i}),a.ZP.createElement(Te.Z,{label:P("lng_report_reason_description"),value:d,onChange:v}),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},P("lng_report_button")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},P("Cancel")))})),rt=(0,a.X$)((0,s.c$)((e=>{const{type:t,chatId:n}=(0,p.Bt)(e)||{},{canDelete:a}=(0,p.xl)(e),s=(0,p.nB)(e),r=(0,p.Nu)(e),{messageIds:l}=e.selectedMessages||{},o=!!n&&(0,p.ku)(e,n,l);return{isSchedule:"scheduled"===t,selectedMessagesCount:(0,p.D7)(e),canDeleteMessages:a,canReportMessages:s,canDownloadMessages:r,selectedMessageIds:l,hasProtectedMessage:o}}))((e=>{let{canPost:t,isActive:n,messageListType:r,isSchedule:l,selectedMessagesCount:o,canDeleteMessages:i,canReportMessages:c,canDownloadMessages:d,hasProtectedMessage:m,selectedMessageIds:u}=e;const{exitMessageSelectMode:Z,openForwardMenuForSelectedMessages:v,downloadSelectedMessages:g}=(0,s.uC)(),[p,E,C]=(0,ye.Z)(),[f,b,I]=(0,ye.Z)();(0,a.d4)((()=>!n||p||f?void 0:(0,tt.Z)({onBackspace:E,onDelete:E,onEsc:Z})),[n,p,f,E,Z]);const y=(0,a.I4)((()=>{g(),Z()}),[g,Z]),N=(0,P.Z)(o||void 0,!0),k=n?o:N,S=(0,h.Z)(),w=S("VoiceOver.Chat.MessagesSelected",k,"i"),M=(0,X.Z)("MessageSelectToolbar",t&&"with-composer",n&&"shown"),T=(e,t,n,s,r)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,X.Z)("item",s&&"disabled",r&&"destructive"),onClick:s?void 0:n,title:t},a.ZP.createElement("i",{className:`icon-${e}`}));return a.ZP.createElement("div",{className:M},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(R.Z,{color:"translucent",round:!0,onClick:Z,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:w},w),Boolean(o)&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==r&&T("forward",S("Chat.ForwardActionHeader"),v,m),c&&T("flag",S("Conversation.ReportMessages"),b),d&&T("download",S("lng_media_download"),y,m),T("delete",S("EditAdminGroupDeleteMessages"),E,!i,!0))),a.ZP.createElement(nt,{isOpen:p,isSchedule:l,onClose:C}),a.ZP.createElement(st,{isOpen:f,onClose:I,messageIds:u}))}))),lt=(0,a.X$)((0,s.c$)((e=>{var t;const{chatId:n,messageId:a}=e.seenByModal||{};return n&&a?{memberIds:null===(t=(0,p.hj)(e,n,a))||void 0===t?void 0:t.seenByUserIds}:{}}))((e=>{let{isOpen:t,memberIds:n}=e;const{openChat:r,closeSeenByModal:l}=(0,s.uC)(),o=(0,h.Z)(),i=(0,a.I4)((e=>{l(),setTimeout((()=>{r({id:e})}),100)}),[l,r]),c=(0,Ie.Z)(n,!0);return a.ZP.createElement(Me.Z,{isOpen:t,onClose:l,className:"narrow",title:"Which users read the message"},a.ZP.createElement("div",{dir:o.isRtl?"rtl":void 0},c&&c.map((e=>a.ZP.createElement(Ae.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>i(e)},a.ZP.createElement(Fe.Z,{userId:e,noStatusOrTyping:!0}))))),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:l},o("Close")))})));var ot=n(2155),it=n(8198);const ct=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,messageId:n}=e.reactorModal||{},a=t&&n?(0,p.hj)(e,t,n):void 0;return{chatId:t,messageId:n,reactions:null==a?void 0:a.reactions,reactors:null==a?void 0:a.reactors,seenByUserIds:null==a?void 0:a.seenByUserIds}}))((e=>{let{isOpen:t,reactors:n,reactions:r,chatId:o,messageId:i,seenByUserIds:c}=e;const{loadReactors:d,closeReactorListModal:m,openChat:u}=(0,s.uC)(),Z=(0,s.Rd)().users.byId,v=(0,h.Z)(),[P,p,E]=(0,ye.Z)(!1),[C,f]=(0,a.eJ)(void 0),b=n&&r&&n.count>=10&&r.results.length>1,I=(0,a.sO)();(0,a.d4)((()=>{P&&!t&&(E(),f(void 0))}),[P,t,E]);const y=(0,a.I4)((()=>{I.current&&u({id:I.current}),m()}),[m,u]),N=(0,a.I4)((()=>{p()}),[p]),k=(0,a.I4)((e=>{I.current=e,N()}),[N]),S=(0,a.I4)((()=>{d({chatId:o,messageId:i})}),[o,d,i]),w=(0,a.Ye)((()=>null!=n&&n.reactions?(0,me.Tw)(n.reactions.map((e=>e.reaction))):[]),[null==n?void 0:n.reactions]),M=(0,a.Ye)((()=>C?null==n?void 0:n.reactions.filter((e=>e.reaction===C)).map((e=>e.userId)):(0,me.Tw)((null==n?void 0:n.reactions.map((e=>e.userId)).concat(c||[]))||[])),[C,null==n?void 0:n.reactions,c]),[T,A]=(0,Ne.Z)(S,M,n&&void 0===n.nextOffset);return(0,a.d4)((()=>{null==A||A({direction:l.Uq.Backwards})}),[A]),a.ZP.createElement(Me.Z,{isOpen:t&&!P,onClose:N,className:"ReactorListModal narrow",title:v("Reactions"),onCloseAnimationEnd:y},b&&a.ZP.createElement("div",{className:"Reactions"},a.ZP.createElement(R.Z,{className:(0,X.Z)(!C&&"chosen"),size:"tiny",ripple:!0,onClick:()=>f(void 0)},a.ZP.createElement("i",{className:"icon-reaction-filled"}),(null==n?void 0:n.count)&&(0,ot.bi)(n.count)),w.map((e=>{var t;const n=null==r||null===(t=r.results.find((t=>t.reaction===e)))||void 0===t?void 0:t.count;return a.ZP.createElement(R.Z,{className:(0,X.Z)(C===e&&"chosen"),size:"tiny",ripple:!0,onClick:()=>f(e)},a.ZP.createElement(it.Z,{reaction:e,className:"reaction-filter-emoji"}),n&&(0,ot.bi)(n))}))),a.ZP.createElement("div",{dir:v.isRtl?"rtl":void 0},null!=T&&T.length?a.ZP.createElement(Re.Z,{className:"reactor-list custom-scroll",items:T,onLoadMore:A},null==T?void 0:T.map((e=>{var t;const s=Z[e],r=(0,g.Js)(s),l=null==n||null===(t=n.reactions.find((t=>t.userId===e)))||void 0===t?void 0:t.reaction;return a.ZP.createElement(Ae.Z,{key:e,className:"chat-item-clickable reactors-list-item",onClick:()=>k(e)},a.ZP.createElement(ge.Z,{user:s,size:"medium"}),a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,Pe.Z)(r))),l&&a.ZP.createElement(it.Z,{className:"reactors-list-emoji",reaction:l}))}))):a.ZP.createElement(we.Z,null)),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},v("Close")))})));var dt=n(7324),mt=n(7799);const ut=(0,a.X$)((0,s.c$)(((e,t)=>{let{activeEmojiInteraction:n}=t;const a=void 0!==n.animatedEffect&&(0,p.tH)(e,n.animatedEffect);return{effectAnimationId:a?a.id:void 0,localEffectAnimation:!a&&n.animatedEffect&&Object.keys(dt.x).includes(n.animatedEffect)?n.animatedEffect:void 0}}))((e=>{let{effectAnimationId:t,localEffectAnimation:n,activeEmojiInteraction:l}=e;const{stopActiveEmojiInteraction:o}=(0,s.uC)(),[c,d]=(0,ye.Z)(!1),[u,h]=(0,ye.Z)(!1),v=(0,a.sO)(),P=(0,a.I4)((()=>{d(),v.current&&clearTimeout(v.current),setTimeout((()=>{o({id:l.id})}),250)}),[l.id,d,o]),g=(0,a.I4)((e=>{var t;null!==(t=e.target)&&void 0!==t&&t.closest(".AnimatedEmoji")||P()}),[P]);(0,a.d4)((()=>(document.addEventListener("touchstart",g),document.addEventListener("touchmove",g),document.addEventListener("mousedown",g),document.addEventListener("wheel",g),()=>{document.removeEventListener("touchstart",g),document.removeEventListener("touchmove",g),document.removeEventListener("mousedown",g),document.removeEventListener("wheel",g)})),[g]),(0,a.bt)((()=>{const e=(0,m.YW)();v.current=setTimeout((()=>{P(),e()}),3e3)}),[P]);const p=(0,Z.Z)(`sticker${t}`,!t,r.IU.Lottie),[E,C]=(0,a.eJ)();if((0,a.d4)((()=>{n&&(0,dt.Z)(n).then((e=>{C(e)}))}),[n]),!l.startSize)return;const f=(l.startSize||0)/240;return a.ZP.createElement("div",{className:(0,X.Z)("EmojiInteractionAnimation",c&&"hiding",u&&"playing",l.isReversed&&"reversed"),style:`--scale: ${f}; --start-x: ${l.x}px; --start-y: ${l.y}px;`},a.ZP.createElement(mt.Z,{key:`effect_${t}`,id:`effect_${t}`,size:240,animationData:E||p,play:u,quality:i.wZ?.5:void 0,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:h}))})));var ht=n(3133),Zt=n(735),vt=n(1470);const Pt=e=>{const t=(0,a.sO)(null),n=(0,a.I4)((n=>{"Enter"===n.key&&t.current===document.activeElement&&e()}),[e]);return(0,a.d4)((()=>(window.addEventListener("keydown",n,!1),()=>window.removeEventListener("keydown",n,!1))),[n]),t};var gt=n(329),pt=n(742);const Et=(0,a.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,p.Z1)(e,a),r=s&&(0,g.zX)(s);return{chat:s,user:r?(0,p.dy)(e,r):void 0,isPinned:(0,p.ep)(e,a),isMuted:s?(0,g.i4)(s,(0,p.dZ)(e),(0,p.NJ)(e)):void 0,canChangeFolder:Boolean(null===(n=e.chatFolders.orderedIds)||void 0===n?void 0:n.length)}}))((e=>{let{chatId:t,withUsername:n,onClick:s,chat:r,user:l,isPinned:o,isMuted:i,canChangeFolder:c}=e;const[d,m,u]=(0,ye.Z)(),[h,Z,v]=(0,ye.Z)(),P=(0,vt.Z)({chat:r,user:l,isPinned:o,isMuted:i,canChangeFolder:c,handleDelete:m,handleChatFolderChange:Z},!0),p=()=>{s(t)},E=Pt(p);if(r)return a.ZP.createElement(Ae.Z,{className:"chat-item-clickable search-result",onClick:p,contextActions:P,buttonRef:E},(0,g.YC)(t)?a.ZP.createElement(Fe.Z,{userId:t,withUsername:n,avatarSize:"large"}):a.ZP.createElement(Le.Z,{chatId:t,withUsername:n,avatarSize:"large"}),a.ZP.createElement(gt.Z,{isOpen:d,onClose:u,chat:r}),a.ZP.createElement(pt.Z,{isOpen:h,onClose:v,chatId:t}))})));var Ct=n(8781);const ft=(0,G.P2)((e=>e()),6e4,!0),bt=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e.globalSearch;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a}}))((e=>{let{topUserIds:t,usersById:n,recentlyFoundChatIds:r,onReset:l}=e;const{loadTopUsers:o,loadContactList:i,openChat:c,addRecentlyFoundChatId:d,clearRecentlyFoundChats:m}=(0,s.uC)(),u=(0,a.sO)(null);(0,a.d4)((()=>{ft((()=>{o(),i()}))}),[o,i]),(0,Ct.Z)(u.current,!t);const Z=(0,a.I4)((e=>{c({id:e,shouldReplaceHistory:!0}),l(),setTimeout((()=>{d({id:e})}),250)}),[c,d,l]),v=(0,h.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},t&&a.ZP.createElement("div",{className:"top-peers-section",dir:v.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:u,className:"top-peers no-selection"},t.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>Z(e),dir:v.isRtl?"rtl":void 0},a.ZP.createElement(ge.Z,{user:n[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,Pe.Z)((0,g.Vl)(n[e])||" "))))))),r&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:v.isRtl?"rtl":void 0},v("Recent"),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:m,isRtl:v.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),r.map((e=>a.ZP.createElement(Et,{chatId:e,onClick:Z})))))})));var It=n(9411),yt=n(8033);const Nt=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,p.Z1)(e,n);if(!a)return{};const s=(0,g.zX)(a);return{chat:a,lastSyncTime:e.lastSyncTime,...s&&{privateChatUser:(0,p.dy)(e,s)}}}))((e=>{let{message:t,searchQuery:n,chatId:r,chat:l,privateChatUser:o,lastSyncTime:c}=e;const{focusMessage:d}=(0,s.uC)(),m=(0,g.DH)(t),u=(0,Z.Z)((0,g.Ti)(t,"micro")),v=Boolean((0,g.Y5)(t)),P=(0,a.I4)((()=>{d({chatId:r,messageId:t.id})}),[r,d,t.id]),p=(0,h.Z)(),E=Pt(P);if(l)return a.ZP.createElement(Ae.Z,{className:"ChatMessage chat-item-clickable",ripple:!i.wB,onClick:P,buttonRef:E},a.ZP.createElement(ge.Z,{chat:l,user:o,isSavedMessages:null==o?void 0:o.isSelf,lastSyncTime:c}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"info-row"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},(0,Pe.Z)((0,g.U)(p,l,o))),l.isVerified&&a.ZP.createElement(It.Z,null)),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(yt.Z,{className:"date"},(0,j.VX)(p,1e3*t.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,r){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:r?"round":void 0}),(0,g.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,y.e)(e,t,!0,s)):(0,y.e)(e,t,void 0,s)}(p,t,u||m,n,v)))))}))),kt=(0,a.X$)((e=>{let{searchDate:t,onSelect:n}=e;const s=(0,a.Ye)((()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,j.xH)(t)}]}const t=[],n=new Date,a=n.getFullYear(),s=n.getTime()>new Date(`${a}-${e}`).getTime()?a:a-1;for(let n=0;n<8;n++){const a=new Date(`${s-n}-${e}`);t.push({date:a,text:(0,j.xH)(a)})}return t}(t)),[t]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},s.map((e=>{let{date:t,text:s}=e;return a.ZP.createElement("div",{onClick:()=>n(t),className:"date-item",key:s},a.ZP.createElement("i",{className:"icon-calendar"}),a.ZP.createElement("span",null,s))})))}));var St=n(7262),wt=n(9187);const Mt=(0,G.P2)((e=>e()),500,!0),Tt=(0,a.X$)((0,s.c$)((e=>{var t;const{byId:n}=e.chats,{userIds:a}=e.contactList||{};if(!a)return{chatsById:n};const{currentUserId:s,messages:r,lastSyncTime:l}=e,{fetchingStatus:o,globalResults:i,localResults:c,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=i||{},{chatIds:h,userIds:Z}=c||{},{byChatId:v}=r;return{currentUserId:s,localContactIds:a,localChatIds:h,localUserIds:Z,globalChatIds:m,globalUserIds:u,foundIds:null==d||null===(t=d.text)||void 0===t?void 0:t.foundIds,globalMessagesByChatId:v,chatsById:n,fetchingStatus:o,lastSyncTime:l}}))((e=>{let{searchQuery:t,searchDate:n,dateSearchQuery:r,currentUserId:o,localContactIds:c,localChatIds:d,localUserIds:m,globalChatIds:u,globalUserIds:Z,foundIds:v,globalMessagesByChatId:P,chatsById:p,fetchingStatus:E,lastSyncTime:C,onReset:f,onSearchDateSelect:b}=e;const{openChat:I,addRecentlyFoundChatId:N,searchMessagesGlobal:k,setGlobalSearchChatId:S}=(0,s.uC)(),w=(0,h.Z)(),[M,T]=(0,a.eJ)(!1),[R,A]=(0,a.eJ)(!1),L=(0,a.I4)((e=>{let{direction:n}=e;C&&n===l.Uq.Backwards&&Mt((()=>{k({type:"text",query:t})}))}),[C,k,t]),F=(0,a.I4)((e=>{I({id:e,shouldReplaceHistory:!0}),e!==o&&N({id:e}),i.wB||f()}),[o,I,N,f]),B=(0,a.I4)((e=>{S({id:e})}),[S]),$=(0,a.Ye)((()=>{if(!t||t.startsWith("@")&&t.length<2)return Zt.D;const e=[...o?[o]:[],...c||[]],n=(0,s.Rd)().users.byId,a=(0,g.kK)(e,n,t,o,w("SavedMessages"));return[...(0,g.ih)((0,me.Tw)([...a||[],...d||[],...m||[]]),p,void 0,o?[o]:void 0)]}),[t,o,c,w,d,m,p]),x=(0,a.Ye)((()=>!t||t.length<4||!u||!Z?Zt.D:(0,g.ih)((0,me.Tw)([...u,...Z]),p,!0)),[p,u,Z,t]),D=(0,a.Ye)((()=>(t||n)&&v&&0!==v.length?v.map((e=>{var t;const[n,a]=e.split("_");return null==P||null===(t=P[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Zt.D),[v,P,t,n]),O=(0,a.I4)((()=>{T(!M)}),[M]),U=(0,a.I4)((()=>{A(!R)}),[R]),G=E&&!E.chats&&!E.messages&&!$.length&&!x.length&&!D.length;return t||n?a.ZP.createElement(Re.Z,{className:"LeftSearch custom-scroll",items:D,onLoadMore:L,noScrollRestoreOnTop:!0,noFastList:!0},r&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(kt,{searchDate:r,onSelect:b})),G&&a.ZP.createElement(St.Z,{text:w("ChatList.Search.NoResults"),description:w("ChatList.Search.NoResultsDescription")}),Boolean($.length)&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:w.isRtl?"rtl":void 0},$.map((e=>a.ZP.createElement(wt.Z,{chatOrUserId:e,onClick:B,clickArg:e})))),Boolean($.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},$.length>5&&a.ZP.createElement(yt.Z,{onClick:O},w(M?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionDialogs")),$.map(((e,t)=>{if(M||!(t>=5))return a.ZP.createElement(Et,{chatId:e,onClick:F})}))),Boolean(x.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},x.length>5&&a.ZP.createElement(yt.Z,{onClick:U},w(R?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionGlobal")),x.map(((e,t)=>{if(R||!(t>=5))return a.ZP.createElement(Et,{chatId:e,withUsername:!0,onClick:F})}))),Boolean(D.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},w("SearchMessages")),D.map((function(e){const n=(0,y.e)(w,e),s=p[e.chatId];if(n&&s)return a.ZP.createElement(Nt,{chatId:e.chatId,message:e,searchQuery:t})})))):a.ZP.createElement(bt,{onReset:f})}))),Rt=(0,G.P2)((e=>e()),500,!0),At=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:r,resultsByType:l}=e.globalSearch,{foundIds:o}=(null==l?void 0:l.text)||{};return{currentUserId:n,foundIds:o,globalMessagesByChatId:a,chatsById:t,fetchingStatus:r,lastSyncTime:s}}))((e=>{let{searchQuery:t,currentUserId:n,dateSearchQuery:r,foundIds:o,globalMessagesByChatId:i,chatsById:c,fetchingStatus:d,lastSyncTime:m,onSearchDateSelect:u}=e;const{searchMessagesGlobal:Z}=(0,s.uC)(),v=(0,h.Z)(),P=(0,a.I4)((e=>{let{direction:a}=e;m&&a===l.Uq.Backwards&&Rt((()=>{Z({type:"text",query:t,chatId:n})}))}),[n,m,Z,t]),g=(0,a.Ye)((()=>o&&0!==o.length?o.map((e=>{var t;const[n,a]=e.split("_");return null==i||null===(t=i[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Zt.D),[o,i]),p=d&&!d.chats&&!d.messages&&!g.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Re.Z,{className:"search-content custom-scroll chat-list",items:g,onLoadMore:P,noFastList:!0},r&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(kt,{searchDate:r,onSelect:u})),p&&a.ZP.createElement(St.Z,{text:v("ChatList.Search.NoResults"),description:v("ChatList.Search.NoResultsDescription")}),g.map((function(e){const n=(0,y.e)(v,e),s=c[e.chatId];if(n&&s)return a.ZP.createElement(Nt,{chatId:e.chatId,message:e,searchQuery:t})}))))})));function Lt(e){return(t,n)=>{var a,s;const{byId:r}=t.chats,{byId:l}=t.users,{fetchingStatus:o,resultsByType:i,chatId:c}=t.globalSearch,d="audio"!==e?e:null!=n&&n.isVoice?"voice":"audio",{byChatId:m}=t.messages,u=null==i||null===(a=i[d])||void 0===a?void 0:a.foundIds,h=t.activeDownloads.byChatId;return{theme:(0,p.Pu)(t),isLoading:void 0===u||!!o&&Boolean(o.chats||o.messages),chatsById:r,usersById:l,globalMessagesByChatId:m,foundIds:u,searchChatId:c,activeDownloads:h,isChatProtected:c?null===(s=(0,p.Z1)(t,c))||void 0===s?void 0:s.isProtected:void 0,lastSyncTime:t.lastSyncTime}}}var Ft=n(7891),Bt=n(3657),$t=n(3709);const xt="media",Dt=(0,G.P2)((e=>e()),500,!0),Ot=(0,a.X$)((0,s.c$)(Lt(xt))((e=>{let{searchQuery:t,searchChatId:n,isLoading:r,globalMessagesByChatId:i,foundIds:c,lastSyncTime:d,isChatProtected:m}=e;const{searchMessagesGlobal:u,openMediaViewer:Z}=(0,s.uC)(),v=(0,a.sO)(null),P=(0,h.Z)(),{observe:g}=(0,Bt.S1)({rootRef:v,throttleMs:500}),p=(0,a.I4)((e=>{let{direction:a}=e;d&&a===l.Uq.Backwards&&Dt((()=>{u({type:xt,query:t,chatId:n})}))}),[d,u,t,n]),E=(0,a.Ye)((()=>c&&i?c.map((e=>{var t;const[n,a]=e.split("_");return null===(t=i[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):Zt.D),[i,c]),C=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e,origin:l.bZ.SearchResult})}),[Z]),f=(0,Ft.Z)([t],o.Y)&&!r,b=f&&c&&c.length>0&&!t,I=f&&c&&c.length>0&&t,y=(0,X.Z)("search-content custom-scroll",I&&"chat-list");return a.ZP.createElement("div",{ref:v,className:"LeftSearch"},a.ZP.createElement(Re.Z,{className:y,items:E,itemSelector:t?".ListItem":".Media",onLoadMore:p,noFastList:!0},!f&&a.ZP.createElement(we.Z,null),f&&(!c||0===c.length)&&a.ZP.createElement(St.Z,{text:P("ChatList.Search.NoResults"),description:P("ChatList.Search.NoResultsDescription")}),b&&a.ZP.createElement("div",{className:"media-list",dir:P.isRtl?"rtl":void 0},E.map((e=>a.ZP.createElement($t.Z,{key:e.id,idPrefix:"search-media",message:e,isProtected:m||e.isProtected,observeIntersection:g,onClick:C})))),I&&E.map((e=>a.ZP.createElement(Nt,{key:e.id,chatId:e.chatId,message:e})))))})));var Ut=n(91),Gt=n(5418);const Jt="links",Xt=(0,G.P2)((e=>e()),500,!0),zt=(0,a.X$)((0,s.c$)(Lt(Jt))((e=>{let{searchQuery:t,searchChatId:n,isLoading:r,chatsById:i,usersById:c,globalMessagesByChatId:d,foundIds:m,lastSyncTime:u,isChatProtected:Z}=e;const{searchMessagesGlobal:v,focusMessage:P}=(0,s.uC)(),g=(0,a.sO)(null),p=(0,h.Z)(),{observe:E}=(0,Bt.S1)({rootRef:g,throttleMs:500}),C=(0,a.I4)((e=>{let{direction:a}=e;u&&a===l.Uq.Backwards&&Xt((()=>{v({type:Jt,query:t,chatId:n})}))}),[u,v,t,n]),f=(0,a.Ye)((()=>m&&d?m.map((e=>{var t;const[n,a]=e.split("_");return null===(t=d[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):Zt.D),[d,m]),b=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),I=(0,Ft.Z)([t],o.Y)&&!r;return a.ZP.createElement("div",{ref:g,className:"LeftSearch"},a.ZP.createElement(Re.Z,{className:"search-content documents-list custom-scroll",items:f,onLoadMore:C,noFastList:!0},!I&&a.ZP.createElement(we.Z,null),I&&(!m||0===m.length)&&a.ZP.createElement(St.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),I&&m&&m.length>0&&f.map(((e,t)=>{const n=0===t||(0,j.kj)(e.date)!==(0,j.kj)(f[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:p.isRtl?"rtl":void 0,key:e.id},n&&a.ZP.createElement("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0},(0,j.np)(p,new Date(1e3*e.date))),a.ZP.createElement(Gt.Z,{key:e.id,message:e,senderTitle:(0,Ut.F)(p,e,i,c),isProtected:Z||e.isProtected,observeIntersection:E,onMessageClick:b}))}))))})));var _t=n(2535);const Yt="documents",Ht=(0,G.P2)((e=>e()),500,!0),Vt=(0,a.X$)((0,s.c$)(Lt(Yt))((e=>{let{searchQuery:t,searchChatId:n,isLoading:r,chatsById:i,usersById:c,globalMessagesByChatId:d,foundIds:m,activeDownloads:u,lastSyncTime:Z}=e;const{searchMessagesGlobal:v,focusMessage:P}=(0,s.uC)(),p=(0,a.sO)(null),E=(0,h.Z)(),{observe:C}=(0,Bt.S1)({rootRef:p,throttleMs:500}),f=(0,a.I4)((e=>{let{direction:a}=e;Z&&a===l.Uq.Backwards&&Ht((()=>{v({type:Yt,query:t,chatId:n})}))}),[Z,v,t,n]),b=(0,a.Ye)((()=>m&&d?m.map((e=>{var t;const[n,a]=e.split("_"),s=null===(t=d[n])||void 0===t?void 0:t.byId[Number(a)];return s&&(0,g.aE)(s)?s:void 0})).filter(Boolean):Zt.D),[d,m]),I=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),y=(0,Ft.Z)([t],o.Y)&&!r;return a.ZP.createElement("div",{ref:p,className:"LeftSearch"},a.ZP.createElement(Re.Z,{className:"search-content documents-list custom-scroll",items:b,onLoadMore:f,noFastList:!0},!y&&a.ZP.createElement(we.Z,null),y&&(!m||0===m.length)&&a.ZP.createElement(St.Z,{text:E("ChatList.Search.NoResults"),description:E("ChatList.Search.NoResultsDescription")}),y&&m&&m.length>0&&b.map(((e,t)=>{var n;const s=0===t||(0,j.kj)(e.date)!==(0,j.kj)(b[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},s&&a.ZP.createElement("p",{className:"section-heading"},(0,j.np)(E,new Date(1e3*e.date))),a.ZP.createElement(_t.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,Ut.F)(E,e,i,c),className:"scroll-item",isDownloading:null===(n=u[e.chatId])||void 0===n?void 0:n.includes(e.id),observeIntersection:C,onDateClick:I}))}))))})));var qt=n(4752);const jt=(0,G.P2)((e=>e()),500,!0),Kt=(0,a.X$)((0,s.c$)(Lt("audio"))((e=>{let{theme:t,isVoice:n,searchQuery:r,searchChatId:i,isLoading:c,chatsById:d,usersById:m,globalMessagesByChatId:u,foundIds:Z,lastSyncTime:v,activeDownloads:P}=e;const{searchMessagesGlobal:g,focusMessage:p,openAudioPlayer:E}=(0,s.uC)(),C=(0,h.Z)(),f=n?"voice":"audio",b=(0,a.I4)((e=>{let{direction:t}=e;v&&t===l.Uq.Backwards&&jt((()=>{g({type:f,query:r,chatId:i})}))}),[f,v,g,r,i]),I=(0,a.Ye)((()=>Z&&u?Z.map((e=>{var t;const[n,a]=e.split("_");return null===(t=u[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):Zt.D),[u,Z]),y=(0,a.I4)(((e,t)=>{p({chatId:t,messageId:e})}),[p]),N=(0,a.I4)(((e,t)=>{E({chatId:t,messageId:e})}),[E]),k=(0,Ft.Z)([r],o.Y)&&!c;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Re.Z,{className:"search-content documents-list custom-scroll",items:I,onLoadMore:b,noFastList:!0},!k&&a.ZP.createElement(we.Z,null),k&&(!Z||0===Z.length)&&a.ZP.createElement(St.Z,{text:C("ChatList.Search.NoResults"),description:C("ChatList.Search.NoResultsDescription")}),k&&Z&&Z.length>0&&I.map(((e,n)=>{var s;const r=0===n||(0,j.kj)(e.date)!==(0,j.kj)(I[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},r&&a.ZP.createElement("p",{className:"section-heading",dir:C.isRtl?"rtl":void 0},(0,j.np)(C,new Date(1e3*e.date))),a.ZP.createElement(qt.Z,{key:e.id,theme:t,message:e,origin:l.Cr.Search,senderTitle:(0,Ut.F)(C,e,d,m),date:e.date,lastSyncTime:v,className:"scroll-item",onPlay:N,onDateClick:y,isDownloading:null===(s=P[e.chatId])||void 0===s?void 0:s.includes(e.id)}))}))))}))),Wt=[{type:l.nJ.ChatList,title:"SearchAllChatsShort"},{type:l.nJ.Media,title:"SharedMediaTab2"},{type:l.nJ.Links,title:"SharedLinksTab2"},{type:l.nJ.Files,title:"SharedFilesTab2"},{type:l.nJ.Music,title:"SharedMusicTab2"},{type:l.nJ.Voice,title:"SharedVoiceTab2"}],Qt=[{type:l.nJ.ChatList,title:"All Messages"},...Wt.slice(1)],en=Object.keys(l.nJ).length/2,tn=(0,a.X$)((0,s.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}))((e=>{let{searchQuery:t,searchDate:n,isActive:r,currentContent:o=l.nJ.ChatList,chatId:i,onReset:c}=e;const{setGlobalSearchContent:d,setGlobalSearchDate:m}=(0,s.uC)(),Z=(0,h.Z)(),[v,P]=(0,a.eJ)(o),g=(0,a.Ye)((()=>(0,j.xk)(t)),[t]),p=(0,a.I4)((e=>{const t=Wt[e];d({content:t.type}),P(e)}),[d]),E=(0,a.I4)((e=>{m({date:e.getTime()/1e3})}),[m]);(0,u.ZP)(r,c,void 0,void 0,!0);const C=(0,a.sO)(null),f=(0,ke.Z)(C,r,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:C,onKeyDown:f},a.ZP.createElement(ht.Z,{activeTab:v,tabs:i?Qt:Wt,onSwitchTab:p}),a.ZP.createElement(L.Z,{name:Z.isRtl?"slide-optimized-rtl":"slide-optimized",renderCount:en,activeKey:o},(()=>{switch(o){case l.nJ.ChatList:return i?a.ZP.createElement(At,{searchQuery:t,dateSearchQuery:g,onReset:c,onSearchDateSelect:E}):a.ZP.createElement(Tt,{searchQuery:t,searchDate:n,dateSearchQuery:g,onReset:c,onSearchDateSelect:E});case l.nJ.Media:return a.ZP.createElement(Ot,{searchQuery:t});case l.nJ.Links:return a.ZP.createElement(zt,{searchQuery:t});case l.nJ.Files:return a.ZP.createElement(Vt,{searchQuery:t});case l.nJ.Music:return a.ZP.createElement(Kt,{key:"audio",searchQuery:t});case l.nJ.Voice:return a.ZP.createElement(Kt,{key:"voice",isVoice:!0,searchQuery:t});default:return}})))})));var nn=n(1090);const an={currentPassword:"",password:"",hint:"",email:""},sn=(e,t)=>{switch(t.type){case"setCurrentPassword":return{...e,currentPassword:t.payload};case"setPassword":return{...e,password:t.payload};case"setHint":return{...e,hint:t.payload};case"setEmail":return{...e,email:t.payload};case"reset":return an;default:return e}},rn=(0,a.X$)((e=>{let{currentScreen:t,editedFolderId:n,onReset:r,onSaveFilter:o,onScreenSelect:c}=e;const{signOut:d,deleteChatFolder:m}=(0,s.uC)(),[u,Z]=(0,a.eJ)(!1),[v,P]=(0,a.eJ)(!1),g=(0,a.I4)((()=>{Z(!0)}),[]),p=(0,a.I4)((()=>{Z(!1)}),[]),E=(0,a.I4)((()=>{P(!0)}),[]),C=(0,a.I4)((()=>{P(!1)}),[]),f=(0,a.I4)((()=>{p(),d()}),[p,d]),b=(0,a.I4)((()=>{C(),m({id:n}),r()}),[n,C,m,r]),I=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(R.Z,{round:!0,ripple:!i.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]),y=(0,h.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:r,ariaLabel:y("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(t){case l.MT.EditProfile:return a.ZP.createElement("h3",null,y("lng_settings_information"));case l.MT.General:return a.ZP.createElement("h3",null,y("General"));case l.MT.QuickReaction:return a.ZP.createElement("h3",null,y("DoubleTapSetting"));case l.MT.Notifications:return a.ZP.createElement("h3",null,y("Notifications"));case l.MT.DataStorage:return a.ZP.createElement("h3",null,y("DataSettings"));case l.MT.Privacy:return a.ZP.createElement("h3",null,y("PrivacySettings"));case l.MT.Language:return a.ZP.createElement("h3",null,y("Language"));case l.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,y("ChatBackground"));case l.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,y("SetColor"));case l.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,y("PrivacyPhone"));case l.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,y("PrivacyLastSeen"));case l.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,y("Privacy.ProfilePhoto"));case l.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,y("PrivacyForwards"));case l.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,y("AutodownloadGroupChats"));case l.MT.PrivacyPhoneNumberAllowedContacts:case l.MT.PrivacyLastSeenAllowedContacts:case l.MT.PrivacyProfilePhotoAllowedContacts:case l.MT.PrivacyForwardingAllowedContacts:case l.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement("h3",null,y("AlwaysShareWith"));case l.MT.PrivacyPhoneNumberDeniedContacts:case l.MT.PrivacyLastSeenDeniedContacts:case l.MT.PrivacyProfilePhotoDeniedContacts:case l.MT.PrivacyForwardingDeniedContacts:case l.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement("h3",null,y("NeverShareWith"));case l.MT.PrivacyActiveSessions:return a.ZP.createElement("h3",null,y("SessionsTitle"));case l.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,y("BlockedUsers"));case l.MT.TwoFaDisabled:case l.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,y("TwoStepVerification"));case l.MT.TwoFaNewPassword:case l.MT.TwoFaChangePasswordNew:case l.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,y("PleaseEnterCurrentPassword"));case l.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,y("PleaseReEnterPassword"));case l.MT.TwoFaNewPasswordHint:case l.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,y("PasswordHint"));case l.MT.TwoFaNewPasswordEmail:case l.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,y("RecoveryEmailTitle"));case l.MT.TwoFaNewPasswordEmailCode:case l.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement("h3",null,"Recovery Email Code");case l.MT.TwoFaCongratulations:return a.ZP.createElement("h3",null,y("TwoStepVerificationPasswordSet"));case l.MT.TwoFaChangePasswordCurrent:case l.MT.TwoFaTurnOff:case l.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,y("PleaseEnterCurrentPassword"));case l.MT.Folders:return a.ZP.createElement("h3",null,y("Filters"));case l.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,y("FilterNew"));case l.MT.FoldersEditFolder:case l.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,y("FilterEdit")),n&&a.ZP.createElement(F.Z,{className:"settings-more-menu",trigger:I,positionX:"right"},a.ZP.createElement(B.Z,{icon:"delete",destructive:!0,onClick:E},y("Delete"))));case l.MT.FoldersIncludedChats:case l.MT.FoldersIncludedChatsFromChatList:case l.MT.FoldersExcludedChats:case l.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},t===l.MT.FoldersIncludedChats||t===l.MT.FoldersIncludedChatsFromChatList?a.ZP.createElement("h3",null,y("FilterInclude")):a.ZP.createElement("h3",null,y("FilterExclude")),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:o,ariaLabel:y("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,y("SETTINGS")),a.ZP.createElement(R.Z,{round:!0,ripple:!i.wB,size:"smaller",color:"translucent",onClick:()=>c(l.MT.EditProfile),ariaLabel:y("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(F.Z,{className:"settings-more-menu",trigger:I,positionX:"right"},a.ZP.createElement(B.Z,{icon:"logout",onClick:g},y("LogOutTitle"))))}}(),a.ZP.createElement(Xe.Z,{isOpen:u,onClose:p,text:y("lng_sure_logout"),confirmLabel:y("AccountSettings.Logout"),confirmHandler:f,confirmIsDestructive:!0}),a.ZP.createElement(Xe.Z,{isOpen:v,onClose:C,text:y("FilterDeleteAlert"),confirmLabel:y("Delete"),confirmHandler:b,confirmIsDestructive:!0}))}));var ln=n(787),on=n(180);const cn=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{currentUser:t?(0,p.dy)(e,t):void 0,lastSyncTime:n}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,currentUser:o,lastSyncTime:i}=e;const{loadProfilePhotos:c}=(0,s.uC)(),d=(0,h.Z)(),m=null==o?void 0:o.id;return(0,a.d4)((()=>{m&&i&&c({profileId:m})}),[i,m,c]),(0,u.ZP)(t,r,n,l.MT.Main),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},o&&a.ZP.createElement(ln.Z,{userId:o.id,forceShowSelf:!0}),o&&a.ZP.createElement(on.Z,{chatOrUserId:o.id,forceShowSelf:!0}),a.ZP.createElement(Ae.Z,{icon:"settings",onClick:()=>n(l.MT.General)},d("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Ae.Z,{icon:"unmute",onClick:()=>n(l.MT.Notifications)},d("Notifications")),a.ZP.createElement(Ae.Z,{icon:"lock",onClick:()=>n(l.MT.Privacy)},d("PrivacySettings")),a.ZP.createElement(Ae.Z,{icon:"data",onClick:()=>n(l.MT.DataStorage)},d("DataSettings")),a.ZP.createElement(Ae.Z,{icon:"folder",onClick:()=>n(l.MT.Folders)},d("Filters")),a.ZP.createElement(Ae.Z,{icon:"language",onClick:()=>n(l.MT.Language)},d("Language"))))})));var dn=n(710),mn=n(1151);const un="https://t.me/",hn=/https:\/\/t\.me\/?/i,Zn=/^([a-zA-Z0-9_]+)$/,vn=(0,G.Ds)((e=>e()),250,!1),Pn=(0,a.X$)((e=>{let{currentUsername:t,asLink:n,isLoading:s,isUsernameAvailable:r,checkUsername:l,onChange:o}=e;const[i,c]=(0,a.eJ)(t||""),d=(0,h.Z)(),m=n?"SetUrl":"Username",u=d(n?"SetUrlPlaceholder":"Username"),[Z,v]=(0,a.Ye)((()=>i.length?i.length<5?[void 0,`${u} is too short`]:i.length>32?[void 0,`${u} is too long`]:Zn.test(i)?void 0===r?[]:[r?d(`${m}Available`,"Username"):void 0,!1===r?d(`${m}InUse`):void 0]:[void 0,`${u} contains invalid characters`]:[]),[i,r,d,m,u]);(0,a.d4)((()=>{c(t||"")}),[n,t]);const P=(0,a.I4)((e=>{const t=e.target.value.trim().replace(hn,"");c(t),e.target.value=`${n?un:""}${t}`;const a=function(e){return e.length>=5&&e.length<=32&&Zn.test(e)}(t);a&&vn((()=>{l({username:t})})),o&&o(!!a&&t)}),[n,l,o]);return a.ZP.createElement(Te.Z,{value:`${n?un:""}${i}`,onChange:P,label:u,error:v,success:Z,readOnly:s})})),gn=(0,G.P2)((e=>e()),6e4,!0),pn="Please provide your first name",En="Bio can' be longer than 70 characters",Cn=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a}=e.profileEdit||{},s=t?(0,p.dy)(e,t):void 0;if(!s)return{progress:n,isUsernameAvailable:a};const{firstName:r,lastName:l,username:o,fullInfo:i}=s,{bio:c}=i||{};return{currentAvatarHash:(0,g.RT)(s),currentFirstName:r,currentLastName:l,currentBio:c,currentUsername:o,progress:n,isUsernameAvailable:a}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:o,currentAvatarHash:i,currentFirstName:c,currentLastName:d,currentBio:m,currentUsername:v,progress:P,isUsernameAvailable:g}=e;const{loadCurrentUser:p,updateProfile:E,checkUsername:C}=(0,s.uC)(),f=(0,h.Z)(),[b,I]=(0,a.eJ)(!1),[y,N]=(0,a.eJ)(!1),[k,S]=(0,a.eJ)(),[w,M]=(0,a.eJ)(),[T,R]=(0,a.eJ)(c||""),[A,L]=(0,a.eJ)(d||""),[F,B]=(0,a.eJ)(m||""),[$,x]=(0,a.eJ)(v||""),D=(0,Z.Z)(i,!1,r.IU.BlobUrl),O=P===l.rN.InProgress,U=!1===$,G=(0,a.Ye)((()=>!U&&(Boolean(w)||y||!0===g)),[w,y,U,g]);(0,u.ZP)(t,o,n,l.MT.EditProfile),(0,a.d4)((()=>{gn((()=>{p()}))}),[p]),(0,a.d4)((()=>{M(void 0)}),[D]),(0,a.d4)((()=>{R(c||""),L(d||""),B(m||"")}),[c,d,m]),(0,a.d4)((()=>{x(v||"")}),[v]),(0,a.d4)((()=>{P===l.rN.Complete&&(N(!1),I(!1),S(void 0))}),[P]);const X=(0,a.I4)((e=>{M(e)}),[]),z=(0,a.I4)((e=>{R(e.target.value),N(!0)}),[]),_=(0,a.I4)((e=>{L(e.target.value),N(!0)}),[]),Y=(0,a.I4)((e=>{B(e.target.value),N(!0)}),[]),H=(0,a.I4)((e=>{x(e),I(!0)}),[]),V=(0,a.I4)((()=>{const e=T.trim(),t=A.trim(),n=F.trim();e.length?n.length>70?S(En):E({photo:w,...y&&{firstName:e,lastName:t,bio:n},...b&&{username:$}}):S(pn)}),[w,T,A,F,y,$,b,E]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-edit-profile"},a.ZP.createElement(dn.Z,{currentAvatarBlobUrl:D,onChange:X,title:"Edit your profile photo",disabled:O}),a.ZP.createElement(Te.Z,{value:T,onChange:z,label:f("FirstName"),disabled:O,error:k===pn?k:void 0}),a.ZP.createElement(Te.Z,{value:A,onChange:_,label:f("LastName"),disabled:O}),a.ZP.createElement(Te.Z,{value:F,onChange:Y,label:f("UserBio"),disabled:O,error:k===En?k:void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:f.isRtl?"rtl":void 0},(0,Pe.Z)(f("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},f("Username")),a.ZP.createElement(Pn,{currentUsername:$||"",isLoading:O,isUsernameAvailable:g,checkUsername:C,onChange:H}),a.ZP.createElement("p",{className:"settings-item-description",dir:f.isRtl?"rtl":void 0},(0,Pe.Z)(f("UsernameHelp"),["br","simple_markdown"])),$&&a.ZP.createElement("p",{className:"settings-item-description",dir:f.isRtl?"rtl":void 0},f("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},"https://t.me/",$)))),a.ZP.createElement(mn.Z,{isShown:G,onClick:V,disabled:O,ariaLabel:"Save changes"},O?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var fn=n(4605),bn=n(8051);const In=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,canAutoLoadPhotoFromContacts:i,canAutoLoadPhotoInPrivateChats:c,canAutoLoadPhotoInGroups:d,canAutoLoadPhotoInChannels:m,canAutoLoadVideoFromContacts:Z,canAutoLoadVideoInPrivateChats:v,canAutoLoadVideoInGroups:P,canAutoLoadVideoInChannels:g,canAutoLoadFileFromContacts:p,canAutoLoadFileInPrivateChats:E,canAutoLoadFileInGroups:C,canAutoLoadFileInChannels:f,canAutoPlayGifs:b,canAutoPlayVideos:I,autoLoadFileMaxSizeMb:y}=e;const{setSettingOption:N}=(0,s.uC)(),k=(0,h.Z)();(0,u.ZP)(t,r,n,l.MT.General);const S=(0,a.I4)((e=>k("AutodownloadSizeLimitUpTo",k("FileSize.MB",String(o.by[e]),"i"))),[k]),w=(0,a.I4)((e=>{N({autoLoadFileMaxSizeMb:o.by[e]})}),[N]);function M(e,t,n,s,r,l){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},e),a.ZP.createElement(fn.Z,{label:k("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>N({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(fn.Z,{label:k("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>N({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(fn.Z,{label:k("AutoDownloadSettings.GroupChats"),checked:r,onCheck:e=>N({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(fn.Z,{label:k("AutoDownloadSettings.Channels"),checked:l,onCheck:e=>N({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=o.by.indexOf(y);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(bn.Z,{label:k("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:S,onChange:w}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},M(k("AutoDownloadPhotosTitle"),"Photo",i,c,d,m),M(k("AutoDownloadVideosTitle"),"Video",Z,v,P,g),M("Auto-download files","File",p,E,C,f),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},k("AutoplayMedia")),a.ZP.createElement(fn.Z,{label:k("GifsTab2"),checked:b,onCheck:e=>N({canAutoPlayGifs:e})}),a.ZP.createElement(fn.Z,{label:k("DataAndStorage.Autoplay.Videos"),checked:I,onCheck:e=>N({canAutoPlayVideos:e})})))})));var yn=n(5616);const Nn=(0,G.P2)((e=>e()),6e4,!0),kn=(0,a.X$)((0,s.c$)((e=>{const{orderedIds:t,byId:n,recommended:a}=e.chatFolders;return{orderedFolderIds:t,foldersById:n,recommendedChatFolders:a}}))((e=>{let{isActive:t,onCreateFolder:n,onEditFolder:r,onScreenSelect:i,onReset:c,orderedFolderIds:d,foldersById:m,recommendedChatFolders:Z}=e;const{loadRecommendedChatFolders:v,addChatFolder:P,showDialog:p}=(0,s.uC)(),[E,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(!1),I=(0,a.I4)((()=>b(!0)),[]);(0,a.d4)((()=>{E||(0,dt.Z)("FoldersAll").then(C)}),[E]),(0,a.d4)((()=>{Nn((()=>{v()}))}),[v]);const y=(0,a.I4)((()=>{Object.keys(m).length>=10?p({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):n()}),[m,p,n]),N=(0,h.Z)();(0,u.ZP)(t,c,i,l.MT.Folders);const k=(0,yn.mE)(),S=(0,a.Ye)((()=>{if(d)return d.map((e=>{const t=m[e];return{id:t.id,title:t.title,subtitle:(0,g.SB)(N,t,k[t.id])}}))}),[d,m,N,k]),w=(0,a.I4)((e=>{Object.keys(m).length>=10?p({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):P({folder:e})}),[m,P,p]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},E&&a.ZP.createElement(mt.Z,{id:"settingsFoldersMain",size:o.ku,animationData:E,play:f,noLoop:!0,onLoad:I})),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},N("CreateNewFilterInfo")),a.ZP.createElement(R.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:y,isRtl:N.isRtl},a.ZP.createElement("i",{className:"icon-add"}),N("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("Filters")),null!=S&&S.length?S.map((e=>a.ZP.createElement(Ae.Z,{className:"mb-2 no-icon",narrow:!0,multiline:!0,onClick:()=>r(m[e.id])},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))):S&&!S.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(we.Z,null)),Z&&Boolean(Z.length)&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterRecommended")),Z.map((e=>a.ZP.createElement(Ae.Z,{className:"mb-2",narrow:!0,onClick:()=>w(e)},a.ZP.createElement("div",{className:"settings-folders-recommended-item"},a.ZP.createElement("div",{className:"multiline-item"},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.description)),a.ZP.createElement(R.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:N.isRtl},N("Add"))))))))})));var Sn=n(3455);const wn=e=>{let{count:t,itemName:n,itemPluralName:s,isLoading:r,onClick:l}=e;const o=(0,h.Z)();return a.ZP.createElement(R.Z,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:r,isRtl:o.isRtl,onClick:l},a.ZP.createElement("i",{className:"icon-down"}),"Show ",t," more ",t>1?s||`${n}s`:n)},Mn="Please provide a title for this folder.",Tn="ChatList.Filter.Error.Empty",Rn=(0,a.X$)((0,s.c$)((e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}}))((e=>{let{state:t,dispatch:n,onAddIncludedChats:r,onAddExcludedChats:i,isActive:c,onScreenSelect:d,onReset:m,onBack:Z,loadedActiveChatIds:v,loadedArchivedChatIds:P}=e;const{editChatFolder:p,addChatFolder:E}=(0,s.uC)(),[C,f]=(0,a.eJ)(),[b,I]=(0,a.eJ)(!1),y=(0,a.I4)((()=>I(!0)),[]),[N,k]=(0,a.eJ)(!1),[S,w]=(0,a.eJ)(!1),{selectedChatIds:M,selectedChatTypes:T}=(0,Sn.vb)(t,"included"),{selectedChatIds:R,selectedChatTypes:A}=(0,Sn.vb)(t,"excluded");(0,a.d4)((()=>{C||(0,dt.Z)("FoldersNew").then(f)}),[C]),(0,a.d4)((()=>{k(!1),w(!1)}),[t.folderId]);const[L,F]=(0,a.Ye)((()=>{const e=new Set([...v||[],...P||[]]),t=(0,me.eL)(M,e),n=(0,me.eL)(R,e);return[N?t:t.slice(0,5-T.length),S?n:n.slice(0,5-A.length)]}),[R,M,T,A,S,N,v,P]),B=(0,h.Z)();function $(e){const t="included"===e?T:A,n="included"===e?L:F,s="included"===e?N:S,r=("included"===e?M:R).length-t.length-n.length,l="included"===e?()=>k(!0):()=>w(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?Sn.fi.find((t=>{let{key:n}=t;return n===e})):Sn.Yy.find((t=>{let{key:n}=t;return n===e}));if(n)return a.ZP.createElement(Ae.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},B(n.title))}(t,e))),n.map((e=>a.ZP.createElement(Ae.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,g.YC)(e)?a.ZP.createElement(Fe.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Le.Z,{avatarSize:"small",chatId:e})))),!s&&r>0&&a.ZP.createElement(wn,{count:r,itemName:"chat",onClick:l}))}return(0,u.ZP)(c,Z,d,"edit"===t.mode?l.MT.FoldersEditFolder:l.MT.FoldersCreateFolder),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},C&&a.ZP.createElement(mt.Z,{id:"settingsFoldersEdit",size:o.ku,animationData:C,play:b&&String(t.folderId),noLoop:!0,onLoad:y})),"create"===t.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:B.isRtl?"rtl":void 0},B("FilterIncludeInfo")),a.ZP.createElement(Te.Z,{className:"mb-0",label:B("FilterNameHint"),value:t.folder.title,onChange:function(e){const{currentTarget:t}=e;n({type:"setTitle",payload:t.value.trim()})},error:t.error&&t.error===Mn?Mn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},t.error&&t.error===Tn&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:B.isRtl?"rtl":void 0},B(t.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:B.isRtl?"rtl":void 0},B("FilterInclude")),a.ZP.createElement(Ae.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:r},B("FilterAddChats")),$("included")),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:B.isRtl?"rtl":void 0},B("FilterExclude")),a.ZP.createElement(Ae.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:i},B("FilterAddChats")),$("excluded"))),a.ZP.createElement(mn.Z,{isShown:Boolean(t.isTouched),disabled:t.isLoading,onClick:function(){const{title:e}=t.folder;e?M.length||Object.keys(T).length?(n({type:"setIsLoading",payload:!0}),"edit"===t.mode?p({id:t.folderId,folderUpdate:t.folder}):E({folder:t.folder}),setTimeout((()=>{m()}),500)):n({type:"setError",payload:Tn}):n({type:"setError",payload:Mn})},ariaLabel:"edit"===t.mode?"Save changes":"Create folder"},t.isLoading?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),An=(0,a.X$)((e=>{let{mode:t,chatIds:n,selectedIds:s,selectedChatTypes:r,filterValue:l,onSelectedIdsChange:o,onSelectedChatTypesChange:i,onFilterChange:c}=e;const d=(0,a.sO)(null),m="included"===t?Sn.fi:Sn.Yy,u=s.length+r.length>10,Z=s.length>=100;(0,a.d4)((()=>{setTimeout((()=>{requestAnimationFrame((()=>{d.current.focus()}))}),500)}),[]);const v=(0,a.I4)((e=>{const t=[...s];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),o(t)}),[s,o]),P=(0,a.I4)((e=>{const t=[...r];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),i(t)}),[r,i]),p=(0,a.I4)((e=>{const{value:t}=e.currentTarget;c(t)}),[c]),E=(0,h.Z)(),[C,f]=(0,Ne.Z)(void 0,n,Boolean(l));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},r.map((function(e){const t=m.find((t=>{let{key:n}=t;return e===n}));if(t)return a.ZP.createElement(wt.Z,{icon:t.icon,title:E(t.title),isMinimized:u,canClose:!0,onClick:P,clickArg:t.key})})),s.map(((e,t)=>a.ZP.createElement(wt.Z,{chatOrUserId:e,isMinimized:u&&t<s.length-5,canClose:!0,onClick:v,clickArg:e}))),Z?a.ZP.createElement("p",{className:"max-items-reached",dir:"auto"},"Sorry, you can't add more than 100 chats."):a.ZP.createElement(Te.Z,{ref:d,value:l,onChange:p,placeholder:E("Search")})),a.ZP.createElement(Re.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:C,onLoadMore:f},(!C||!C.length||C.includes(n[0]))&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h4",{key:"header1",className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("FilterChatTypes")),m.map((function(e){return a.ZP.createElement(Ae.Z,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>P(e.key),ripple:!0},a.ZP.createElement("i",{className:`icon-${e.icon}`}),a.ZP.createElement("h3",{className:"chat-type",dir:"auto"},E(e.title)),a.ZP.createElement(fn.Z,{label:"",checked:r.includes(e.key),round:!0}))})),a.ZP.createElement("div",{key:"divider",className:"picker-list-divider"}),a.ZP.createElement("h4",{key:"header2",className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("FilterChats"))),null!=C&&C.length?C.map((function(e){const t=s.includes(e);return a.ZP.createElement(Ae.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>v(e),ripple:!0,disabled:!t&&Z},(0,g.YC)(e)?a.ZP.createElement(Fe.Z,{userId:e}):a.ZP.createElement(Le.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(fn.Z,{label:"",checked:t,round:!0}))})):C&&!C.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(we.Z,{key:"loading"})))})),Ln=(0,a.X$)((e=>{let{mode:t,state:n,dispatch:r,isActive:i,onScreenSelect:c,onReset:d}=e;const{chatFilter:m}=n,{selectedChatIds:Z,selectedChatTypes:v}=(0,Sn.vb)(n,t,!0),P=(0,h.Z)(),p=(0,yn.d7)(o.Nf),E=(0,yn.d7)(o.WS),C=(0,a.Ye)((()=>{const e=(0,s.Rd)().chats.byId,t=[...p||[],...E||[]];return(0,me.Tw)([...Z,...(0,g.$l)(P,t,e,m)])}),[p,E,Z,P,m]),f=(0,a.I4)((e=>{r({type:"setChatFilter",payload:e})}),[r]),b=(0,a.I4)((e=>{r("included"===t?{type:"setIncludeFilters",payload:{...n.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...n.excludeFilters,excludedChatIds:e}})}),[t,n,r]),I=(0,a.I4)((e=>{const n={};e.forEach((e=>{n[e]=!0})),r("included"===t?{type:"setIncludeFilters",payload:{includedChatIds:Z,...n}}:{type:"setExcludeFilters",payload:{excludedChatIds:Z,...n}})}),[t,Z,r]);return(0,u.ZP)(i,d,c,"included"===t?l.MT.FoldersIncludedChats:l.MT.FoldersExcludedChats),C?a.ZP.createElement(An,{mode:t,chatIds:C,selectedIds:Z,selectedChatTypes:v,filterValue:m,onSelectedIdsChange:b,onSelectedChatTypesChange:I,onFilterChange:f}):a.ZP.createElement(we.Z,null)})),Fn=(0,a.X$)((e=>{let{currentScreen:t,shownScreen:n,state:s,dispatch:r,isActive:o,onScreenSelect:i,onReset:c}=e;const d=(0,a.I4)((()=>{t!==l.MT.FoldersCreateFolder&&t!==l.MT.FoldersEditFolder&&t!==l.MT.FoldersEditFolderFromChatList||setTimeout((()=>{r({type:"reset"})}),200),t!==l.MT.FoldersIncludedChats&&t!==l.MT.FoldersExcludedChats?c():"create"===s.mode?i(l.MT.FoldersCreateFolder):i(l.MT.FoldersEditFolder)}),[s.mode,r,t,c,i]),m=(0,a.I4)((()=>{r({type:"reset"}),i(l.MT.FoldersCreateFolder)}),[i,r]),u=(0,a.I4)((e=>{r({type:"editFolder",payload:e}),i(l.MT.FoldersEditFolder)}),[r,i]),h=(0,a.I4)((()=>{r({type:"editIncludeFilters"}),i(t===l.MT.FoldersEditFolderFromChatList?l.MT.FoldersIncludedChatsFromChatList:l.MT.FoldersIncludedChats)}),[t,r,i]),Z=(0,a.I4)((()=>{r({type:"editExcludeFilters"}),i(t===l.MT.FoldersEditFolderFromChatList?l.MT.FoldersExcludedChatsFromChatList:l.MT.FoldersExcludedChats)}),[t,r,i]);switch(t){case l.MT.Folders:return a.ZP.createElement(kn,{onCreateFolder:m,onEditFolder:u,onScreenSelect:i,isActive:o||[l.MT.FoldersCreateFolder,l.MT.FoldersEditFolder,l.MT.FoldersIncludedChats,l.MT.FoldersExcludedChats].includes(n),onReset:c});case l.MT.FoldersCreateFolder:case l.MT.FoldersEditFolder:case l.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(Rn,{state:s,dispatch:r,onAddIncludedChats:h,onAddExcludedChats:Z,onReset:d,onScreenSelect:i,isActive:o||[l.MT.FoldersIncludedChats,l.MT.FoldersExcludedChats].includes(n),onBack:c});case l.MT.FoldersIncludedChats:case l.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(Ln,{mode:"included",state:s,dispatch:r,onReset:d,onScreenSelect:i,isActive:o});case l.MT.FoldersExcludedChats:case l.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Ln,{mode:"excluded",state:s,dispatch:r,onReset:d,onScreenSelect:i,isActive:o});default:return}}));var Bn=n(711),$n=n(692);const xn=(0,a.X$)((e=>{let{size:t=o.DC,stickerSet:n,observeIntersection:s}=e;const l=(0,a.sO)(null),i=(0,Bt.Op)(l,s),c=`stickerSet${n.id}`,d=(0,Z.Z)(c,!i,r.IU.Lottie),m=(0,$n.Z)(d),u=(0,a.Ye)((()=>{if(!d)return(0,ot.Xv)(n.title,2)}),[d,n.title]);return a.ZP.createElement("div",{ref:l,className:"sticker-set-cover"},u,d&&a.ZP.createElement(mt.Z,{id:c,size:t,animationData:d,className:m}))})),Dn=(0,a.X$)((e=>{let{stickerSet:t,observeIntersection:n}=e;const s=(0,a.sO)(null),r=(0,Bt.Op)(s,n),l=(0,Z.Z)(t.hasThumbnail&&`stickerSet${t.id}`,!r),o=(0,$n.Z)(l),c=t.isGifs,d=(0,a.Ye)((()=>{if(c&&!i.Hh||!l)return(0,ot.Xv)(t.title,2)}),[c,l,t.title]);return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},d,c?a.ZP.createElement("video",{src:l,className:o,loop:!0,autoPlay:!0}):a.ZP.createElement("img",{src:l,className:o,alt:""}))}));var On=n(3547);const Un=(0,a.X$)((e=>{var t;let{stickerSet:n,observeIntersection:s,onClick:r}=e;const l=(0,h.Z)();if(!n||!n.stickers)return;const i=null===(t=n.stickers)||void 0===t?void 0:t[0];return n.hasThumbnail||!i?a.ZP.createElement(Ae.Z,{narrow:!0,className:"SettingsStickerSet",inactive:!i,onClick:()=>i&&r(i)},a.ZP.createElement(R.Z,{ariaLabel:n.title,color:"translucent",isRtl:l.isRtl},n.isLottie?a.ZP.createElement(xn,{size:o.Mw,stickerSet:n,observeIntersection:s}):a.ZP.createElement(Dn,{stickerSet:n,observeIntersection:s})),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},n.title),a.ZP.createElement("div",{className:"subtitle"},l("StickerPack.StickerCount",n.count,"i")))):a.ZP.createElement(Ae.Z,{narrow:!0,className:"SettingsStickerSet",onClick:()=>r(i)},a.ZP.createElement(On.Z,{sticker:i,size:o.Mw,title:n.title,observeIntersection:s}),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},n.title),a.ZP.createElement("div",{className:"subtitle"},l("StickerPack.StickerCount",n.count,"i"))))}));var Gn=n(4851);const Jn=["Solid and Steady","Nice and Fast","Lots of Stuff"],Xn=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],zn=(0,a.X$)((0,s.c$)((e=>{var t;return{...(0,me.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive","timeFormat"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:null===(t=e.appConfig)||void 0===t?void 0:t.defaultReaction}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,stickerSetIds:o,stickerSetsById:c,defaultReaction:d,messageTextSize:m,animationLevel:Z,messageSendKeyCombo:v,shouldSuggestStickers:P,shouldLoopStickers:g,timeFormat:p}=e;const{setSettingOption:E}=(0,s.uC)(),C=(0,a.sO)(null),{observe:f}=(0,Bt.S1)({rootRef:C}),[b,I,y]=(0,ye.Z)(),[N,k]=(0,a.eJ)(),S=(0,h.Z)(),w=i.$b?void 0:[{value:"enter",label:S("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:S(i.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}],M=(0,a.I4)((e=>{Jn.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),E({animationLevel:e})}),[E]),T=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,i.cj?16:15)}px`),document.documentElement.style.setProperty("--message-meta-height",`${Math.floor(1.3125*e)}px`),document.documentElement.style.setProperty("--message-text-size",`${e}px`),document.documentElement.setAttribute("data-message-text-size",e.toString()),E({messageTextSize:e})}),[E]),R=(0,a.I4)((e=>{E({timeFormat:e}),E({wasTimeFormatSetManually:!0}),(0,Bn.qf)(e)}),[E]),A=(0,a.I4)((e=>{k(e),I()}),[I]),L=o&&o.map((e=>{var t;return!(null==c||null===(t=c[e])||void 0===t||!t.installedDate)&&c[e]})).filter(Boolean);return(0,u.ZP)(t,r,n,l.MT.General),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("SETTINGS")),a.ZP.createElement(bn.Z,{label:S("TextSize"),min:12,max:20,value:m,onChange:T}),a.ZP.createElement(Ae.Z,{icon:"photo",onClick:()=>n(l.MT.GeneralChatBackground)},S("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(at.Z,{name:"timeformat",options:Xn,selected:p,onChange:R})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:S.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(bn.Z,{options:Jn,value:Z,onChange:M})),w&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("VoiceOver.Keyboard")),a.ZP.createElement(at.Z,{name:"keyboard-send-settings",options:w,onChange:e=>E({messageSendKeyCombo:e}),selected:v})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("AccDescrStickers")),d&&a.ZP.createElement(Ae.Z,{className:"SettingsDefaultReaction",onClick:()=>n(l.MT.QuickReaction)},a.ZP.createElement(it.Z,{reaction:d}),a.ZP.createElement("div",{className:"title"},S("DoubleTapSetting"))),a.ZP.createElement(fn.Z,{label:S("SuggestStickers"),checked:P,onCheck:e=>E({shouldSuggestStickers:e})}),a.ZP.createElement(fn.Z,{label:S("LoopAnimatedStickers"),checked:g,onCheck:e=>E({shouldLoopStickers:e})}),a.ZP.createElement("div",{className:"mt-4",ref:C},L&&L.map((e=>a.ZP.createElement(Un,{key:e.id,stickerSet:e,observeIntersection:f,onClick:A})))),N&&a.ZP.createElement(Gn.Z,{isOpen:b,fromSticker:N,onClose:y})))})));let _n;function Yn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];_n||(_n=document.createElement("input"),_n.setAttribute("type","file")),_n.setAttribute("accept",e),n?_n.removeAttribute("multiple"):_n.setAttribute("multiple","multiple"),_n.onchange=null,_n.value="",_n.onchange=t,_n.click()}var Hn=n(1394);function Vn(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function qn(e){const t=e[0].toString(16),n=e[1].toString(16),a=e[2].toString(16);return(1==t.length?"0"+t:t)+(1==n.length?"0"+n:n)+(1==a.length?"0"+a:a)}function jn(e){let[t,n,a]=e;t/=255,n/=255,a/=255;let s,r,l=Math.max(t,n,a),o=Math.min(t,n,a),i=l,c=l-o;if(r=0==l?0:c/l,l==o)s=0;else{switch(l){case t:s=(n-a)/c+(n<a?6:0);break;case n:s=(a-t)/c+2;break;case a:s=(t-n)/c+4}s/=6}return[s,r,i]}function Kn(e){let t,n,a,[s,r,l]=e,o=Math.floor(6*s),i=6*s-o,c=l*(1-r),d=l*(1-i*r),m=l*(1-(1-i)*r);switch(o%6){case 0:t=l,n=m,a=c;break;case 1:t=d,n=l,a=c;break;case 2:t=c,n=l,a=m;break;case 3:t=c,n=d,a=l;break;case 4:t=m,n=c,a=l;break;case 5:t=l,n=c,a=d}return[Math.round(255*t),Math.round(255*n),Math.round(255*a)]}function Wn(e){let[t,n,a]=jn(e);return n=Math.min(1,n+.05+.1*(1-n)),a=a>.5?Math.max(0,.65*a):Math.max(0,Math.min(1,1-.65*a)),`hsla(${360*t}, ${100*n}%, ${100*a}%, .4)`}var Qn=n(9524),ea=n(5866);const ta=(0,a.X$)((e=>{var t;let{wallpaper:n,theme:s,isSelected:r,onClick:i}=e;const{slug:c,document:d}=n,m=`wallpaper${d.id}`,u=d.previewBlobUrl,h=(0,Z.Z)(`${m}?size=m`),g=(0,ea.Z)(null===(t=d.thumbnail)||void 0===t?void 0:t.dataUri,Boolean(h),!0),{transitionClassNames:p}=(0,H.Z)(Boolean(h||u),void 0,void 0,"slow"),[E,C]=(0,a.eJ)(!1),{mediaData:f,loadProgress:b}=(0,v.Z)(m,!E),I=!1===(0,P.Z)(E),{shouldRender:y,transitionClassNames:N}=(0,H.Z)(E&&!f||c===l.mp,void 0,I,"slow"),k=(0,a.sO)();k.current=s;const S=(0,a.I4)((()=>{(async()=>{const e=await(0,Hn.gm)(f);await Qn.save(o.fo,k.current,e),i(c)})()}),[f,i,c]);(0,a.d4)((()=>{f&&S()}),[f,S]);const w=(0,a.I4)((()=>{f?S():C((e=>!e))}),[f,S]),M=(0,X.Z)("WallpaperTile",r&&"selected");return a.ZP.createElement("div",{className:M,onClick:w},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:g,className:"thumbnail"}),a.ZP.createElement("img",{src:h||u,className:(0,X.Z)("full-media",p),alt:""}),y&&a.ZP.createElement("div",{className:(0,X.Z)("spinner-container",N)},a.ZP.createElement($.Z,{progress:b,onClick:w}))))})),na=(0,G.P2)((e=>e()),6e4,!0),aa=(0,a.X$)((0,s.c$)((e=>{const t=(0,p.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,background:i,isBlurred:c,loadedWallpapers:d,theme:m}=e;const{loadWallpapers:Z,uploadWallpaper:v,setThemeSettings:P}=(0,s.uC)(),g=(0,a.sO)();g.current=m,(0,a.d4)((()=>{na((()=>{Z()}))}),[Z]);const p=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&v(t[0])}),[v]),E=(0,a.I4)((()=>{Yn("image/jpeg",p,!0)}),[p]),C=(0,a.I4)((()=>{n(l.MT.GeneralChatBackgroundColor)}),[n]),f=(0,a.I4)((()=>{P({theme:m,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===m?o.Vv:o.g})}),[P,m]),b=(0,a.I4)((e=>{P({theme:g.current,background:e});const t=d&&d.find((t=>t.slug===e));null!=t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let n,a,s,r,l=-4,o=[0,0,0],i=0;const c=document.createElement("canvas"),d=c.getContext&&c.getContext("2d");if(!d)return t;const m=await(0,Hn.pt)(e);s=m.naturalHeight||m.offsetHeight||m.height,a=m.naturalWidth||m.offsetWidth||m.width,c.height=s,c.width=a,d.drawImage(m,0,0);try{n=d.getImageData(0,0,a,s)}catch(e){return t}for(r=n.data.length;(l+=20)<r;)++i,o[0]+=n.data[l],o[1]+=n.data[l+1],o[2]+=n.data[l+2];return o[0]=Math.floor(o[0]/i),o[1]=Math.floor(o[1]/i),o[2]=Math.floor(o[2]/i),o}(t.document.thumbnail.dataUri).then((e=>{const t=Wn(e),n=`#${qn(e)}`;P({theme:g.current,backgroundColor:n,patternColor:t})}))}),[d,P]),I=(0,a.I4)((e=>{P({theme:g.current,isBlurred:e.target.checked})}),[P]),y=(0,h.Z)();(0,u.ZP)(t,r,n,l.MT.GeneralChatBackground);const N=(null==d?void 0:d[0])&&d[0].slug===l.mp;return a.ZP.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Ae.Z,{icon:"camera-add",className:"mb-0",disabled:N,onClick:E},y("UploadImage")),a.ZP.createElement(Ae.Z,{icon:"colorize",className:"mb-0",onClick:C},y("SetColor")),a.ZP.createElement(Ae.Z,{icon:"favorite",onClick:f},y("ThemeResetToDefaults")),a.ZP.createElement(fn.Z,{label:y("BackgroundBlurred"),checked:Boolean(c),onChange:I})),d?a.ZP.createElement("div",{className:"settings-wallpapers"},d.map((e=>a.ZP.createElement(ta,{wallpaper:e,theme:m,isSelected:i===e.slug,onClick:b})))):a.ZP.createElement(we.Z,null))}))),sa=jn(Vn("e6ebee")),ra=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function la(e,t){return{colorPosition:[Math.round(e[1]*(t.colorRect.width-1)),Math.round((1-e[2])*(t.colorRect.height-1))],huePosition:Math.round(e[0]*(t.hueRect.width-1))}}function oa(e,t){let{colorPosition:n,huePosition:a}=e;return[a/(t.hueRect.width-1),n[0]/(t.colorRect.width-1),1-n[1]/(t.colorRect.height-1)]}const ia=(0,a.X$)((0,s.c$)((e=>{const t=(0,p.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,theme:o,backgroundColor:i}=e;const{setThemeSettings:c}=(0,s.uC)(),d=(0,a.sO)();d.current=o;const m=(0,a.sO)(null),h=(0,a.sO)(null),Z=(0,a.sO)(null),v=(0,a.sO)(!0),[P,g]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?jn(Vn(e.replace("#",""))):sa}(i)),p=(0,a.sO)(P);(0,a.d4)((()=>{p.current=P}),[P]);const[E,C,b]=(0,ye.Z)(),[I,y]=(0,a.eJ)(""),[N,k]=(0,a.eJ)(""),S=(0,a.sO)(),w=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:h.current.offsetLeft,...(0,me.ei)(h.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:Z.current.offsetLeft,...(0,me.ei)(Z.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+m.current.scrollTop),e.height-1)],{huePosition:a}=la(p.current,S.current);return g(oa({colorPosition:n,huePosition:a},S.current)),C(),!0}function a(e){const{colorPosition:n}=la(p.current,S.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return g(oa({colorPosition:n,huePosition:a},S.current)),C(),!0}S.current={colorRect:e,hueRect:t},(0,f.sf)(h.current,{onCapture:n,onDrag:n,onRelease:b,onClick:b,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,f.sf)(Z.current,{onCapture:a,onDrag:a,onRelease:b,onClick:b,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[C,b]);const{colorPosition:M=[0,0],huePosition:T=0}=S.current?la(P,S.current):{},R=qn(Kn(P)),A=P[0],L=qn(Kn([A,1,1]));(0,a.d4)((()=>{const e=Kn(P),t=`#${qn(e)}`;if(y(e.join(", ")),k(t),!v.current){const n=Wn(e);c({theme:d.current,background:void 0,backgroundColor:t,patternColor:n})}v.current=!1}),[P,c]),(0,a.d4)((()=>{!function(e,t,n,a){let s,r,l;n.current&&a.current?(s=a.current.colorRect.width,r=a.current.colorRect.height,l=n.current):(s=e.offsetWidth,r=e.offsetHeight,l=e.getContext("2d"),e.width=s,e.height=r,n.current=l);const o=l.createImageData(s,r),i=o.data,c=Kn([t,1,1]);let d=0;for(let e=0;e<r;e++){const t=1-e/(r-1),n=[255*t,255*t,255*t],a=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);i[d++]=n[0]+(a[0]-n[0])*t,i[d++]=n[1]+(a[1]-n[1])*t,i[d++]=n[2]+(a[2]-n[2])*t,i[d++]=255}}l.putImageData(o,0,0)}(h.current.firstChild,A,w,S)}),[A]),(0,a.d4)((()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const n=e.getContext("2d"),a=n.createImageData(t,1),s=a.data;let r=0;for(let e=0;e<t;e++){const n=Kn([e/(t-1),1,1]);s[r++]=n[0],s[r++]=n[1],s[r++]=n[2],s[r++]=255}n.putImageData(a,0,0)}(Z.current.firstChild)}),[]);const F=(0,a.I4)((e=>{const t=e.currentTarget.value.replace(/[^\d, ]/g,"").slice(0,13);if(t.match(/^\d{1,3},\s?\d{1,3},\s?\d{1,3}$/)){const e=t.split(",").map((e=>Number(e.trim())));g(jn(e))}e.currentTarget.value=t}),[]),B=(0,a.I4)((e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&g(jn(Vn(t.replace("#","")))),e.currentTarget.value=t}),[]),$=(0,a.I4)((e=>{g(jn(Vn(e.currentTarget.dataset.color.replace("#",""))))}),[]),x=(0,X.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",E&&"is-dragging");return(0,u.ZP)(t,r,n,l.MT.GeneralChatBackgroundColor),a.ZP.createElement("div",{ref:m,className:x},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:h,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${M[0]}px, ${M[1]}px); background-color: #${R};`})),a.ZP.createElement("div",{ref:Z,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${T}px); background-color: #${L};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(Te.Z,{value:N,label:"HEX",onChange:B}),a.ZP.createElement(Te.Z,{value:I,label:"RGB",onChange:F}))),a.ZP.createElement("div",{className:"predefined-colors"},ra.map((e=>a.ZP.createElement("div",{className:e===`#${R}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:$})))))})));var ca=n(8406);const da=(0,a.X$)((0,s.c$)((e=>({hasPrivateChatsNotifications:Boolean(e.settings.byKey.hasPrivateChatsNotifications),hasPrivateChatsMessagePreview:Boolean(e.settings.byKey.hasPrivateChatsMessagePreview),hasGroupNotifications:Boolean(e.settings.byKey.hasGroupNotifications),hasGroupMessagePreview:Boolean(e.settings.byKey.hasGroupMessagePreview),hasBroadcastNotifications:Boolean(e.settings.byKey.hasBroadcastNotifications),hasBroadcastMessagePreview:Boolean(e.settings.byKey.hasBroadcastMessagePreview),hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume})))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,hasPrivateChatsNotifications:o,hasPrivateChatsMessagePreview:i,hasGroupNotifications:c,hasGroupMessagePreview:d,hasBroadcastNotifications:m,hasBroadcastMessagePreview:Z,hasContactJoinedNotifications:v,hasPushNotifications:P,hasWebNotifications:g,notificationSoundVolume:p}=e;const{loadNotificationSettings:E,updateContactSignUpNotification:C,updateNotificationSettings:f,updateWebNotificationSettings:b}=(0,s.uC)();(0,a.d4)((()=>{E()}),[E]);const I=(0,D.Z)(500,!0),y=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!o:!("group"===t?c:m),s="contact"===t?i:"group"===t?d:Z;f({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:s},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[Z,m,d,c,i,o,f]),N=(0,a.I4)((e=>{C({isSilent:!e.target.checked})}),[C]),k=(0,h.Z)();return(0,u.ZP)(t,r,n,l.MT.Notifications),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(fn.Z,{label:"Web notifications",subLabel:k(g?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:g,onChange:e=>{b({hasWebNotifications:e.target.checked})}}),a.ZP.createElement(fn.Z,{label:"Offline notifications",disabled:!g,subLabel:k(P?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:P,onChange:e=>{b({hasPushNotifications:e.target.checked})}}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(bn.Z,{label:"Sound",min:0,max:10,value:p,onChange:e=>{b({notificationSoundVolume:e}),I((()=>(0,ca.q3)(void 0,e)))}}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},k("AutodownloadPrivateChats")),a.ZP.createElement(fn.Z,{label:k("NotificationsForPrivateChats"),subLabel:k(o?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:o,onChange:e=>{y(e,"contact","silent")}}),a.ZP.createElement(fn.Z,{label:k("MessagePreview"),disabled:!o,subLabel:k(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{y(e,"contact","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},k("FilterGroups")),a.ZP.createElement(fn.Z,{label:k("NotificationsForGroups"),subLabel:k(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{y(e,"group","silent")}}),a.ZP.createElement(fn.Z,{label:k("MessagePreview"),disabled:!c,subLabel:k(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:e=>{y(e,"group","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},k("FilterChannels")),a.ZP.createElement(fn.Z,{label:k("NotificationsForChannels"),subLabel:k(m?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:m,onChange:e=>{y(e,"broadcast","silent")}}),a.ZP.createElement(fn.Z,{label:k("MessagePreview"),disabled:!m,subLabel:k(Z?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:Z,onChange:e=>{y(e,"broadcast","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},k("PhoneOther")),a.ZP.createElement(fn.Z,{label:k("ContactJoined"),checked:v,onChange:N})))}))),ma=(0,a.X$)((0,s.c$)((e=>{var t,n,a,s,r;const{settings:{byKey:{hasPassword:l,isSensitiveEnabled:o,canChangeSensitive:i},privacy:c},blocked:d,activeSessions:m}=e;return{hasPassword:l,blockedCount:d.totalCount,sessionsCount:m.length,isSensitiveEnabled:o,canChangeSensitive:i,visibilityPrivacyPhoneNumber:null===(t=c.phoneNumber)||void 0===t?void 0:t.visibility,visibilityPrivacyLastSeen:null===(n=c.lastSeen)||void 0===n?void 0:n.visibility,visibilityPrivacyProfilePhoto:null===(a=c.profilePhoto)||void 0===a?void 0:a.visibility,visibilityPrivacyForwarding:null===(s=c.forwards)||void 0===s?void 0:s.visibility,visibilityPrivacyGroupChats:null===(r=c.chatInvite)||void 0===r?void 0:r.visibility}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,hasPassword:o,blockedCount:i,sessionsCount:c,isSensitiveEnabled:d,canChangeSensitive:m,visibilityPrivacyPhoneNumber:Z,visibilityPrivacyLastSeen:v,visibilityPrivacyProfilePhoto:P,visibilityPrivacyForwarding:g,visibilityPrivacyGroupChats:p}=e;const{loadPrivacySettings:E,loadBlockedContacts:C,loadAuthorizations:f,loadContentSettings:b,updateContentSettings:I}=(0,s.uC)();(0,a.d4)((()=>{C(),f(),E(),b()}),[C,f,E,b]);const y=(0,h.Z)();function N(e){switch(e){case"everybody":return y("P2PEverybody");case"contacts":return y("P2PContacts");case"nobody":return y("P2PNobody")}}return(0,u.ZP)(t,r,n,l.MT.Privacy),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Ae.Z,{icon:"delete-user",narrow:!0,onClick:()=>n(l.MT.PrivacyBlockedUsers)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("BlockedUsers")),i>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y("Users",i)))),a.ZP.createElement(Ae.Z,{icon:"lock",narrow:!0,onClick:()=>n(o?l.MT.TwoFaEnabled:l.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(o?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Ae.Z,{icon:"active-sessions",narrow:!0,onClick:()=>n(l.MT.PrivacyActiveSessions)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("SessionsTitle")),c>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},1===c?"1 session":`${c} sessions`)))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:y.isRtl?"rtl":void 0},y("PrivacyTitle")),a.ZP.createElement(Ae.Z,{narrow:!0,className:"no-icon",onClick:()=>n(l.MT.PrivacyPhoneNumber)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},N(Z)))),a.ZP.createElement(Ae.Z,{narrow:!0,className:"no-icon",onClick:()=>n(l.MT.PrivacyLastSeen)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},N(v)))),a.ZP.createElement(Ae.Z,{narrow:!0,className:"no-icon",onClick:()=>n(l.MT.PrivacyProfilePhoto)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},N(P)))),a.ZP.createElement(Ae.Z,{narrow:!0,className:"no-icon",onClick:()=>n(l.MT.PrivacyForwarding)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},N(g)))),a.ZP.createElement(Ae.Z,{narrow:!0,className:"no-icon",onClick:()=>n(l.MT.PrivacyGroupChats)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},N(p))))),m&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("lng_settings_sensitive_title")),a.ZP.createElement(fn.Z,{label:y("lng_settings_sensitive_disable_filtering"),subLabel:y("lng_settings_sensitive_about"),checked:Boolean(d),disabled:!m,onCheck:I})))}))),ua=(0,a.X$)((0,s.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,languages:o,language:i}=e;const{loadLanguages:c,setSettingOption:d}=(0,s.uC)(),[m,h]=(0,a.eJ)(i),[Z,v,P]=(0,ye.Z)();(0,a.d4)((()=>{c()}),[c]);const g=(0,a.I4)((e=>{h(e),v(),(0,Bn.m0)(e,(()=>{P(),d({language:e})}))}),[v,P,d]),p=(0,a.Ye)((()=>o?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((e=>{let{langCode:t,nativeName:n,name:a}=e;return{value:t,label:n,subLabel:a}})).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(o):void 0),[o]);return(0,u.ZP)(t,r,n,l.MT.Language),a.ZP.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},p?a.ZP.createElement(at.Z,{name:"keyboard-send-settings",options:p,selected:m,loadingOption:Z?m:void 0,onChange:g}):a.ZP.createElement(we.Z,null))})));function ha(e){switch(e){case l.MT.PrivacyPhoneNumber:case l.MT.PrivacyPhoneNumberAllowedContacts:case l.MT.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case l.MT.PrivacyLastSeen:case l.MT.PrivacyLastSeenAllowedContacts:case l.MT.PrivacyLastSeenDeniedContacts:return"lastSeen";case l.MT.PrivacyProfilePhoto:case l.MT.PrivacyProfilePhotoAllowedContacts:case l.MT.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case l.MT.PrivacyForwarding:case l.MT.PrivacyForwardingAllowedContacts:case l.MT.PrivacyForwardingDeniedContacts:return"forwards";case l.MT.PrivacyGroupChats:case l.MT.PrivacyGroupChatsAllowedContacts:case l.MT.PrivacyGroupChatsDeniedContacts:return"chatInvite"}}const Za=(0,a.X$)((0,s.c$)(((e,t)=>{let n,{screen:a}=t;const{chats:{byId:s},settings:{privacy:r}}=e;switch(a){case l.MT.PrivacyPhoneNumber:n=r.phoneNumber;break;case l.MT.PrivacyLastSeen:n=r.lastSeen;break;case l.MT.PrivacyProfilePhoto:n=r.profilePhoto;break;case l.MT.PrivacyForwarding:n=r.forwards;break;case l.MT.PrivacyGroupChats:n=r.chatInvite}return n?{...n,chatsById:s}:{}}))((e=>{let{screen:t,isActive:n,onScreenSelect:r,onReset:o,visibility:i,allowUserIds:c,allowChatIds:d,blockUserIds:m,blockChatIds:Z,chatsById:v}=e;const{setPrivacyVisibility:P}=(0,s.uC)(),g=(0,h.Z)(),p=(0,a.Ye)((()=>{switch(t){case l.MT.PrivacyProfilePhoto:case l.MT.PrivacyGroupChats:return[{value:"everybody",label:g("P2PEverybody")},{value:"contacts",label:g("P2PContacts")}];default:return[{value:"everybody",label:g("P2PEverybody")},{value:"contacts",label:g("P2PContacts")},{value:"nobody",label:g("P2PNobody")}]}}),[g,t]),E={shouldShowDenied:"nobody"!==i,shouldShowAllowed:"everybody"!==i},C=ha(t),f=(0,a.Ye)((()=>{switch(t){case l.MT.PrivacyPhoneNumber:return g("PrivacyPhoneTitle");case l.MT.PrivacyLastSeen:return g("LastSeenTitle");case l.MT.PrivacyProfilePhoto:return g("PrivacyProfilePhotoTitle");case l.MT.PrivacyForwarding:return g("PrivacyForwardsTitle");case l.MT.PrivacyGroupChats:return g("WhoCanAddMe");default:return}}),[g,t]);(0,u.ZP)(n,o,r,t);const b=(0,a.Ye)((()=>{if(t===l.MT.PrivacyLastSeen)return g("CustomHelp")}),[g,t]),I=(()=>{switch(t){case l.MT.PrivacyPhoneNumber:return l.MT.PrivacyPhoneNumberAllowedContacts;case l.MT.PrivacyLastSeen:return l.MT.PrivacyLastSeenAllowedContacts;case l.MT.PrivacyProfilePhoto:return l.MT.PrivacyProfilePhotoAllowedContacts;case l.MT.PrivacyForwarding:return l.MT.PrivacyForwardingAllowedContacts;default:return l.MT.PrivacyGroupChatsAllowedContacts}})(),y=(()=>{switch(t){case l.MT.PrivacyPhoneNumber:return l.MT.PrivacyPhoneNumberDeniedContacts;case l.MT.PrivacyLastSeen:return l.MT.PrivacyLastSeenDeniedContacts;case l.MT.PrivacyProfilePhoto:return l.MT.PrivacyProfilePhotoDeniedContacts;case l.MT.PrivacyForwarding:return l.MT.PrivacyForwardingDeniedContacts;default:return l.MT.PrivacyGroupChatsDeniedContacts}})(),N=(0,a.Ye)((()=>c&&d&&v?d.reduce(((e,t)=>e+(v[t]?v[t].membersCount:0)),c.length):0),[d,c,v]),k=(0,a.Ye)((()=>m&&Z&&v?Z.reduce(((e,t)=>e+(v[t]?v[t].membersCount:0)),m.length):0),[Z,m,v]),S=(0,a.I4)((e=>{P({privacyKey:C,visibility:e})}),[C,P]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0},f),a.ZP.createElement(at.Z,{name:`visibility-${C}`,options:p,onChange:S,selected:i}),b&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:g.isRtl?"rtl":void 0},b)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:g.isRtl?"rtl":void 0},g("PrivacyExceptions")),E.shouldShowAllowed&&a.ZP.createElement(Ae.Z,{narrow:!0,icon:"add-user",onClick:()=>{r(I)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},N>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"+",N),a.ZP.createElement("span",{className:"title"},g("AlwaysShareWith")),a.ZP.createElement("span",{className:"subtitle"},g("EditAdminAddUsers")))),E.shouldShowDenied&&a.ZP.createElement(Ae.Z,{narrow:!0,icon:"delete-user",onClick:()=>{r(y)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},k>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"−",k),a.ZP.createElement("span",{className:"title"},g("NeverShareWith")),a.ZP.createElement("span",{className:"subtitle"},g("EditAdminAddUsers"))))))})));function va(e){return[e.region,e.country].filter(Boolean).join(", ")}function Pa(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}const ga=(0,a.X$)((0,s.c$)((e=>({activeSessions:e.activeSessions})))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,activeSessions:o}=e;const{loadAuthorizations:i,terminateAuthorization:c,terminateAllAuthorizations:d}=(0,s.uC)(),[m,Z,v]=(0,ye.Z)();(0,a.d4)((()=>{i()}),[i]);const P=(0,a.I4)((e=>{c({hash:e})}),[c]),g=(0,a.I4)((()=>{v(),d()}),[v,d]),p=(0,a.Ye)((()=>o.find((e=>e.isCurrent))),[o]),E=(0,a.Ye)((()=>o.filter((e=>!e.isCurrent))),[o]),C=(0,h.Z)();return(0,u.ZP)(t,r,n,l.MT.PrivacyActiveSessions),a.ZP.createElement("div",{className:"settings-content custom-scroll"},p&&(b=p,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:C.isRtl?"rtl":void 0},C("AuthSessions.CurrentSession")),a.ZP.createElement(Ae.Z,{narrow:!0,inactive:!0,className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},b.appName),a.ZP.createElement("span",{className:"subtitle black tight"},Pa(b)),a.ZP.createElement("span",{className:"subtitle"},b.ip," - ",va(b)))),a.ZP.createElement(Ae.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:Z},C("TerminateAllSessions")))),E&&(f=E,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:C.isRtl?"rtl":void 0},C("OtherSessions")),f.map((function(e){return a.ZP.createElement(Ae.Z,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{P(e.hash)}}],className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,j.VX)(C,1e3*e.dateActive)),a.ZP.createElement("span",{className:"title"},e.appName),a.ZP.createElement("span",{className:"subtitle black tight"},Pa(e)),a.ZP.createElement("span",{className:"subtitle"},e.ip," - ",va(e))))})))),E&&a.ZP.createElement(Xe.Z,{isOpen:m,onClose:v,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:g,confirmIsDestructive:!0}));var f,b})));var pa=n(6272);const Ea=(0,a.X$)((0,s.c$)((e=>{const{users:{byId:t},blocked:{ids:n},contactList:a,currentUserId:s}=e;return{usersById:t,blockedIds:n,contactIds:null==a?void 0:a.userIds,localContactIds:e.userSearch.localUserIds,currentUserId:s}}))((e=>{let{usersById:t,blockedIds:n,contactIds:r,localContactIds:l,currentUserId:o,isOpen:i,onClose:c}=e;const{loadContactList:d,setUserSearchQuery:m,blockContact:u}=(0,s.uC)(),Z=(0,h.Z)(),[v,P]=(0,a.eJ)(""),p=(0,a.sO)(null);(0,a.d4)((()=>{m({query:v})}),[v,m]);const E=(0,a.Ye)((()=>{const e=(0,me.Tw)([...r||[],...l||[]].filter((e=>e!==o&&!n.includes(e))));return(0,g.kK)(e,t,v).sort(((e,n)=>{const a=(0,g.Js)(t[e])||"",s=(0,g.Js)(t[n])||"";return a.localeCompare(s)}))}),[n,r,o,v,l,t]),C=(0,a.I4)((e=>{const{id:n,accessHash:a}=t[e]||{};n&&a&&(u({contactId:n,accessHash:a}),c())}),[u,c,t]);return a.ZP.createElement(Be,{isOpen:i,chatOrUserIds:E,filterRef:p,filterPlaceholder:Z("BlockedUsers.BlockUser"),filter:v,onFilterChange:P,loadMore:d,onSelectChatOrUser:C,onClose:c})}))),Ca=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t},users:{byId:n},blocked:{ids:a},countryList:{phoneCodes:s}}=e;return{chatsByIds:t,usersByIds:n,blockedIds:a,phoneCodeList:s}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,chatsByIds:i,usersByIds:c,blockedIds:d,phoneCodeList:m}=e;const{unblockContact:Z}=(0,s.uC)(),v=(0,h.Z)(),[P,p,E]=(0,ye.Z)(),C=(0,a.I4)((e=>{Z({contactId:e})}),[Z]);return(0,u.ZP)(t,r,n,l.MT.PrivacyBlockedUsers),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content infinite-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:v.isRtl?"rtl":void 0},v("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},null!=d&&d.length?a.ZP.createElement("div",{className:"scroll-container"},d.map(((e,t)=>function(e,t,n){const s=(0,g.YC)(e),r=s?c[e]:void 0,l=s?void 0:i[e],d=(0,X.Z)("Chat chat-item-clickable blocked-list-item small-icon",s?"private":"group");return a.ZP.createElement(Ae.Z,{key:e,className:d,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{C(e)}}],style:`top: ${(0+t)*o.rS}px;`},a.ZP.createElement(ge.Z,{size:"medium",user:r,chat:l}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,Pe.Z)((s?(0,g.Js)(r):(0,g.U)(v,l))||"")),(null==r?void 0:r.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,pa.WZ)(m,r.phoneNumber)),r&&!r.phoneNumber&&r.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",r.username)))}(e,t)))):d&&!d.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},v("NoBlocked")):a.ZP.createElement(we.Z,{key:"loading"}))),a.ZP.createElement(mn.Z,{isShown:!0,onClick:p,ariaLabel:v("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(Ea,{isOpen:P,onClose:E}))})));var fa=n(7854);const ba=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,p.zB)(e,"🔐")})))((e=>{let{isActive:t,onReset:n,animatedEmoji:s,onScreenSelect:r}=e;const o=(0,h.Z)();return(0,u.ZP)(t,n,r,l.MT.TwoFaEnabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:s,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,Pe.Z)(o("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Ae.Z,{icon:"edit",onClick:()=>r(l.MT.TwoFaChangePasswordCurrent)},o("ChangePassword")),a.ZP.createElement(Ae.Z,{icon:"password-off",onClick:()=>r(l.MT.TwoFaTurnOff)},o("TurnPasswordOff")),a.ZP.createElement(Ae.Z,{icon:"email",onClick:()=>r(l.MT.TwoFaRecoveryEmailCurrentPassword)},o("SetRecoveryEmail"))))})));var Ia=n(3490),ya=n(9364);const Na=(0,a.X$)((e=>{let{screen:t,isActive:n,onScreenSelect:s,onReset:r,error:l,isLoading:o,expectedPassword:i,placeholder:c="Current Password",hint:d,submitLabel:m,clearError:Z,onSubmit:v}=e;const[P,g]=(0,a.eJ)(""),[p,E]=(0,a.eJ)(!1),C=(0,a.I4)((e=>{i&&e!==i?g("Passwords Should Be Equal"):v(e)}),[v,i]),f=(0,a.I4)((()=>{Z&&Z(),g("")}),[Z]),b=(0,h.Z)();return(0,u.ZP)(n,r,s,t),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(Ia.Z,{isBig:!0,isPasswordVisible:p})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(ya.Z,{error:P||l,hint:d,placeholder:c,submitLabel:m||b("Next"),clearError:f,isLoading:o,isPasswordVisible:p,onChangePasswordVisibility:E,onSubmit:C})))})),ka=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,p.zB)(e,"🔐")})))((e=>{let{isActive:t,onScreenSelect:n,onReset:s,animatedEmoji:r,onStart:o}=e;const i=(0,h.Z)();return(0,u.ZP)(t,s,n,l.MT.TwoFaDisabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:r,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},i("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(R.Z,{onClick:o},i("EditAdminTransferSetPassword"))))}))),Sa=i.wB?550:400,wa=(0,a.X$)((0,s.c$)(((e,t)=>{let{icon:n}=t;return{animatedEmoji:(0,p.zB)(e,"email"===n?"💌":"💡")}}))((e=>{let{animatedEmoji:t,type:n="text",isLoading:s,error:r,placeholder:l,shouldConfirm:o,clearError:c,onSubmit:d,isActive:m,onScreenSelect:Z,onReset:v,screen:P}=e;const g=(0,a.sO)(null),[p,E]=(0,a.eJ)(""),[C,f,b]=(0,ye.Z)(!1);(0,a.d4)((()=>{i.$b||setTimeout((()=>{g.current.focus()}),Sa)}),[]);const I=(0,h.Z)();return(0,u.ZP)(m,v,Z,P),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:t,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),g.current&&d(p)}},a.ZP.createElement(Te.Z,{ref:g,value:p,inputMode:n,label:l,error:r,onChange:e=>{r&&c&&c(),E(e.target.value)}}),p?a.ZP.createElement(R.Z,{type:"submit",isLoading:s,ripple:!0},I("Continue")):a.ZP.createElement(R.Z,{isText:!0,isLoading:s,ripple:!0,onClick:o?f:()=>{d()}},I("YourEmailSkip"))),o&&a.ZP.createElement(Me.Z,{className:"narrow",isOpen:C,title:I("YourEmailSkipWarning"),onClose:b},(0,Pe.Z)(I("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(R.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{b(),d()}},I("YourEmailSkip")),a.ZP.createElement(R.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:b},I("Cancel"))))))}))),Ma=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,p.zB)(e,"🥳")})))((e=>{let{isActive:t,onReset:n,animatedEmoji:s,onScreenSelect:r}=e;const o=(0,h.Z)();return(0,u.ZP)(t,n,r,l.MT.TwoFaCongratulations),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:s,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},o("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(R.Z,{onClick:()=>{r(l.MT.Privacy)}},o("TwoStepVerificationPasswordReturnSettings"))))}))),Ta=i.wB?550:400,Ra=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,p.zB)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((e=>{let{animatedEmoji:t,codeLength:n,isLoading:s,error:r,clearError:l,onSubmit:o,isActive:c,onScreenSelect:d,onReset:m,screen:Z}=e;const v=(0,a.sO)(null),[P,g]=(0,a.eJ)("");(0,a.d4)((()=>{i.$b||setTimeout((()=>{v.current.focus()}),Ta)}),[]);const p=(0,h.Z)();return(0,u.ZP)(c,m,d,Z),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:t,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Te.Z,{value:P,ref:v,inputMode:"decimal",label:p("YourEmailCode"),error:r,onChange:e=>{r&&l&&l();const t=e.target.value.slice(0,n);t.length===n&&o(t),g(t),e.target.value=t}}),s&&a.ZP.createElement(we.Z,null)))}))),Aa=(0,a.X$)((0,s.c$)((e=>({...e.twoFaSettings})))((e=>{let{currentScreen:t,shownScreen:n,state:r,hint:o,isLoading:i,error:c,waitingEmailCodeLength:d,dispatch:m,isActive:u,onScreenSelect:Z,onReset:v}=e;const{updatePassword:P,checkPassword:g,clearTwoFaError:p,updateRecoveryEmail:E,provideTwoFaEmailCode:C,clearPassword:f}=(0,s.uC)();(0,a.d4)((()=>{d&&(t===l.MT.TwoFaNewPasswordEmail?Z(l.MT.TwoFaNewPasswordEmailCode):t===l.MT.TwoFaRecoveryEmail&&Z(l.MT.TwoFaRecoveryEmailCode))}),[t,Z,d]);const b=(0,a.I4)((()=>{m({type:"reset"}),Z(l.MT.TwoFaNewPassword)}),[m,Z]),I=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),Z(l.MT.TwoFaNewPasswordConfirm)}),[m,Z]),y=(0,a.I4)((()=>{Z(l.MT.TwoFaNewPasswordHint)}),[Z]),N=(0,a.I4)((e=>{m({type:"setHint",payload:e}),Z(l.MT.TwoFaNewPasswordEmail)}),[m,Z]),k=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),P({...r,email:e,onSuccess:()=>{Z(l.MT.TwoFaCongratulations)}})}),[m,Z,r,P]),S=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),g({currentPassword:e,onSuccess:()=>{Z(l.MT.TwoFaChangePasswordNew)}})}),[g,m,Z]),w=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),Z(l.MT.TwoFaChangePasswordConfirm)}),[m,Z]),M=(0,a.I4)((()=>{Z(l.MT.TwoFaChangePasswordHint)}),[Z]),T=(0,a.I4)((e=>{m({type:"setHint",payload:e}),P({...r,hint:e,onSuccess:()=>{Z(l.MT.TwoFaCongratulations)}})}),[m,Z,r,P]),R=(0,a.I4)((e=>{f({currentPassword:e,onSuccess:()=>{Z(l.MT.Privacy)}})}),[f,Z]),A=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),g({currentPassword:e,onSuccess:()=>{Z(l.MT.TwoFaRecoveryEmail)}})}),[g,m,Z]),L=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),E({...r,email:e,onSuccess:()=>{Z(l.MT.TwoFaCongratulations)}})}),[m,Z,r,E]),F=(0,a.I4)((e=>{C({code:e})}),[C]),B=(0,h.Z)();switch(t){case l.MT.TwoFaDisabled:return a.ZP.createElement(ka,{onStart:b,onScreenSelect:Z,isActive:u||[l.MT.TwoFaNewPassword,l.MT.TwoFaNewPasswordConfirm,l.MT.TwoFaNewPasswordHint,l.MT.TwoFaNewPasswordEmail,l.MT.TwoFaNewPasswordEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaNewPassword:return a.ZP.createElement(Na,{screen:t,placeholder:B("PleaseEnterPassword"),submitLabel:B("Continue"),onSubmit:I,onScreenSelect:Z,isActive:u||[l.MT.TwoFaNewPasswordConfirm,l.MT.TwoFaNewPasswordHint,l.MT.TwoFaNewPasswordEmail,l.MT.TwoFaNewPasswordEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(Na,{screen:t,expectedPassword:r.password,placeholder:B("PleaseReEnterPassword"),submitLabel:B("Continue"),onSubmit:y,onScreenSelect:Z,isActive:u||[l.MT.TwoFaNewPasswordHint,l.MT.TwoFaNewPasswordEmail,l.MT.TwoFaNewPasswordEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaNewPasswordHint:return a.ZP.createElement(wa,{icon:"hint",placeholder:B("PasswordHintPlaceholder"),onSubmit:N,screen:t,onScreenSelect:Z,isActive:u||[l.MT.TwoFaNewPasswordEmail,l.MT.TwoFaNewPasswordEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(wa,{icon:"email",type:"email",isLoading:i,error:c,clearError:p,placeholder:B("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:k,screen:t,onScreenSelect:Z,isActive:u||[l.MT.TwoFaNewPasswordEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(Ra,{isLoading:i,error:c,clearError:p,onSubmit:F,screen:t,onScreenSelect:Z,isActive:u||n===l.MT.TwoFaCongratulations,onReset:v});case l.MT.TwoFaCongratulations:return a.ZP.createElement(Ma,{onScreenSelect:Z,isActive:u,onReset:v});case l.MT.TwoFaEnabled:return a.ZP.createElement(ba,{onScreenSelect:Z,isActive:u||[l.MT.TwoFaChangePasswordCurrent,l.MT.TwoFaChangePasswordNew,l.MT.TwoFaChangePasswordConfirm,l.MT.TwoFaChangePasswordHint,l.MT.TwoFaTurnOff,l.MT.TwoFaRecoveryEmailCurrentPassword,l.MT.TwoFaRecoveryEmail,l.MT.TwoFaRecoveryEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(Na,{screen:t,isLoading:i,error:c,clearError:p,hint:o,onSubmit:S,onScreenSelect:Z,isActive:u||[l.MT.TwoFaChangePasswordNew,l.MT.TwoFaChangePasswordConfirm,l.MT.TwoFaChangePasswordHint,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaChangePasswordNew:return a.ZP.createElement(Na,{screen:t,placeholder:B("PleaseEnterNewFirstPassword"),onSubmit:w,onScreenSelect:Z,isActive:u||[l.MT.TwoFaChangePasswordConfirm,l.MT.TwoFaChangePasswordHint,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(Na,{screen:t,expectedPassword:r.password,placeholder:B("PleaseReEnterPassword"),onSubmit:M,onScreenSelect:Z,isActive:u||[l.MT.TwoFaChangePasswordHint,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaChangePasswordHint:return a.ZP.createElement(wa,{isLoading:i,error:c,clearError:p,icon:"hint",placeholder:B("PasswordHintPlaceholder"),onSubmit:T,onScreenSelect:Z,isActive:u||n===l.MT.TwoFaCongratulations,onReset:v,screen:t});case l.MT.TwoFaTurnOff:return a.ZP.createElement(Na,{isLoading:i,error:c,clearError:p,hint:o,onSubmit:R,onScreenSelect:Z,isActive:u,onReset:v,screen:t});case l.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(Na,{screen:t,isLoading:i,error:c,clearError:p,hint:o,onSubmit:A,onScreenSelect:Z,isActive:u||[l.MT.TwoFaRecoveryEmail,l.MT.TwoFaRecoveryEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaRecoveryEmail:return a.ZP.createElement(wa,{screen:t,icon:"email",type:"email",placeholder:B("RecoveryEmailTitle"),onSubmit:L,onScreenSelect:Z,isActive:u||[l.MT.TwoFaRecoveryEmailCode,l.MT.TwoFaCongratulations].includes(n),onReset:v});case l.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(Ra,{screen:t,isLoading:i,error:c,clearError:p,onSubmit:F,onScreenSelect:Z,isActive:u||n===l.MT.TwoFaCongratulations,onReset:v});default:return}})));var La=n(1820);function Fa(e,t){const{privacy:n}=e.settings;switch(t){case l.MT.PrivacyPhoneNumberAllowedContacts:case l.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case l.MT.PrivacyLastSeenAllowedContacts:case l.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case l.MT.PrivacyProfilePhotoAllowedContacts:case l.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case l.MT.PrivacyForwardingAllowedContacts:case l.MT.PrivacyForwardingDeniedContacts:return n.forwards;case l.MT.PrivacyGroupChatsDeniedContacts:case l.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const Ba=(0,a.X$)((0,s.c$)(((e,t)=>{let{screen:n}=t;return{currentUserId:e.currentUserId,settings:Fa(e,n)}}))((e=>{let{isAllowList:t,screen:n,isActive:r,onScreenSelect:i,onReset:c,currentUserId:d,settings:m}=e;const{setPrivacySettings:Z}=(0,s.uC)(),v=(0,h.Z)(),P=(0,a.Ye)((()=>m?t?[...m.allowUserIds,...m.allowChatIds]:[...m.blockUserIds,...m.blockChatIds]:[]),[t,m]),[p,E]=(0,a.eJ)(""),[C,f]=(0,a.eJ)(!1),[b,I]=(0,a.eJ)(P),y=(0,yn.d7)(o.Nf),N=(0,yn.d7)(o.WS),k=(0,a.Ye)((()=>{const e=(0,s.Rd)().chats.byId,t=(0,me.Tw)([...y||[],...N||[]]).filter((t=>{const n=e[t];return n&&((0,g.YC)(n.id)&&n.id!==d||(0,g.Bf)(n))}));return(0,me.Tw)([...P,...(0,g.$l)(v,t,e,p)])}),[y,N,P,v,p,d]),S=(0,a.I4)((e=>{I(e),f(!0)}),[]),w=(0,a.I4)((()=>{Z({privacyKey:ha(n),isAllowList:Boolean(t),contactsIds:b}),i(l.MT.Privacy)}),[t,b,i,n,Z]);return(0,u.ZP)(r,c,i,n),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(La.Z,{itemIds:k||[],selectedIds:b,filterValue:p,filterPlaceholder:v(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:S,onFilterChange:E}),a.ZP.createElement(mn.Z,{isShown:C,onClick:w,ariaLabel:v(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),$a=(0,a.X$)((0,s.c$)((e=>{const{availableReactions:t,appConfig:n}=e;return{availableReactions:t,selectedReaction:null==n?void 0:n.defaultReaction}}))((e=>{let{isActive:t,onReset:n,onScreenSelect:r,availableReactions:o,selectedReaction:i}=e;const{setDefaultReaction:c}=(0,s.uC)();(0,u.ZP)(t,n,r,l.MT.General);const d=(null==o?void 0:o.filter((e=>!e.isInactive)).map((e=>({label:a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(it.Z,{reaction:e.reaction}),e.title),value:e.reaction}))))||[],m=(0,a.I4)((e=>{c({reaction:e})}),[c]);return a.ZP.createElement("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction"},a.ZP.createElement(at.Z,{name:"quick-reaction-settings",options:d,selected:i,onChange:m}))}))),xa=Object.keys(l.MT).length/2,Da=[l.MT.TwoFaDisabled,l.MT.TwoFaNewPassword,l.MT.TwoFaNewPasswordConfirm,l.MT.TwoFaNewPasswordHint,l.MT.TwoFaNewPasswordEmail,l.MT.TwoFaNewPasswordEmailCode,l.MT.TwoFaCongratulations,l.MT.TwoFaEnabled,l.MT.TwoFaChangePasswordCurrent,l.MT.TwoFaChangePasswordNew,l.MT.TwoFaChangePasswordConfirm,l.MT.TwoFaChangePasswordHint,l.MT.TwoFaTurnOff,l.MT.TwoFaRecoveryEmailCurrentPassword,l.MT.TwoFaRecoveryEmail,l.MT.TwoFaRecoveryEmailCode],Oa=[l.MT.Folders,l.MT.FoldersCreateFolder,l.MT.FoldersEditFolder,l.MT.FoldersEditFolderFromChatList,l.MT.FoldersIncludedChats,l.MT.FoldersIncludedChatsFromChatList,l.MT.FoldersExcludedChats,l.MT.FoldersExcludedChatsFromChatList],Ua=[l.MT.PrivacyBlockedUsers,l.MT.PrivacyActiveSessions],Ga=[l.MT.PrivacyPhoneNumberAllowedContacts,l.MT.PrivacyPhoneNumberDeniedContacts],Ja=[l.MT.PrivacyLastSeenAllowedContacts,l.MT.PrivacyLastSeenDeniedContacts],Xa=[l.MT.PrivacyProfilePhotoAllowedContacts,l.MT.PrivacyProfilePhotoDeniedContacts],za=[l.MT.PrivacyForwardingAllowedContacts,l.MT.PrivacyForwardingDeniedContacts],_a=[l.MT.PrivacyGroupChatsAllowedContacts,l.MT.PrivacyGroupChatsDeniedContacts],Ya=(0,a.X$)((e=>{let{isActive:t,currentScreen:n,foldersState:s,foldersDispatch:r,onScreenSelect:o,onReset:c,shouldSkipTransition:d}=e;const[m,u]=(0,nn.Z)(sn,an),h=(0,a.I4)((()=>{n!==l.MT.FoldersCreateFolder&&n!==l.MT.FoldersEditFolder&&n!==l.MT.FoldersEditFolderFromChatList||setTimeout((()=>{r({type:"reset"})}),200),n!==l.MT.FoldersIncludedChats&&n!==l.MT.FoldersExcludedChats?c():"create"===s.mode?o(l.MT.FoldersCreateFolder):o(l.MT.FoldersEditFolder)}),[s.mode,r,n,c,o]),Z=(0,a.I4)((()=>{r({type:"saveFilters"}),h()}),[r,h]);function v(e,i,c){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(rn,{currentScreen:n,onReset:h,onSaveFilter:Z,onScreenSelect:o,editedFolderId:s.folderId}),function(e,i){const c={[l.MT.PrivacyPhoneNumber]:Ga.includes(i),[l.MT.PrivacyLastSeen]:Ja.includes(i),[l.MT.PrivacyProfilePhoto]:Xa.includes(i),[l.MT.PrivacyForwarding]:za.includes(i),[l.MT.PrivacyGroupChats]:_a.includes(i)},d=Da.includes(i),Z=Oa.includes(i),v=Ua.includes(i)||d||Object.keys(c).includes(i.toString())||Object.values(c).find((e=>!0===e));switch(n){case l.MT.Main:return a.ZP.createElement(cn,{onScreenSelect:o,isActive:t,onReset:h});case l.MT.EditProfile:return a.ZP.createElement(Cn,{onScreenSelect:o,isActive:t&&e,onReset:h});case l.MT.General:return a.ZP.createElement(zn,{onScreenSelect:o,isActive:e||i===l.MT.GeneralChatBackgroundColor||i===l.MT.GeneralChatBackground||i===l.MT.QuickReaction||v||Z,onReset:h});case l.MT.QuickReaction:return a.ZP.createElement($a,{onScreenSelect:o,isActive:e,onReset:h});case l.MT.Notifications:return a.ZP.createElement(da,{onScreenSelect:o,isActive:e,onReset:h});case l.MT.DataStorage:return a.ZP.createElement(In,{onScreenSelect:o,isActive:e,onReset:h});case l.MT.Privacy:return a.ZP.createElement(ma,{onScreenSelect:o,isActive:e||v||d,onReset:h});case l.MT.Language:return a.ZP.createElement(ua,{onScreenSelect:o,isActive:e,onReset:h});case l.MT.GeneralChatBackground:return a.ZP.createElement(aa,{onScreenSelect:o,isActive:e||i===l.MT.GeneralChatBackgroundColor,onReset:h});case l.MT.GeneralChatBackgroundColor:return a.ZP.createElement(ia,{onScreenSelect:o,isActive:e,onReset:h});case l.MT.PrivacyActiveSessions:return a.ZP.createElement(ga,{onScreenSelect:o,isActive:e,onReset:h});case l.MT.PrivacyBlockedUsers:return a.ZP.createElement(Ca,{onScreenSelect:o,isActive:e,onReset:h});case l.MT.PrivacyPhoneNumber:case l.MT.PrivacyLastSeen:case l.MT.PrivacyProfilePhoto:case l.MT.PrivacyForwarding:case l.MT.PrivacyGroupChats:return a.ZP.createElement(Za,{screen:n,onScreenSelect:o,isActive:e||c[n],onReset:h});case l.MT.PrivacyPhoneNumberAllowedContacts:case l.MT.PrivacyLastSeenAllowedContacts:case l.MT.PrivacyProfilePhotoAllowedContacts:case l.MT.PrivacyForwardingAllowedContacts:case l.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(Ba,{isAllowList:!0,screen:n,onScreenSelect:o,isActive:e||c[n],onReset:h});case l.MT.PrivacyPhoneNumberDeniedContacts:case l.MT.PrivacyLastSeenDeniedContacts:case l.MT.PrivacyProfilePhotoDeniedContacts:case l.MT.PrivacyForwardingDeniedContacts:case l.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(Ba,{screen:n,onScreenSelect:o,isActive:e,onReset:h});case l.MT.Folders:case l.MT.FoldersCreateFolder:case l.MT.FoldersEditFolder:case l.MT.FoldersEditFolderFromChatList:case l.MT.FoldersIncludedChats:case l.MT.FoldersIncludedChatsFromChatList:case l.MT.FoldersExcludedChats:case l.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Fn,{currentScreen:n,shownScreen:i,state:s,dispatch:r,isActive:e,onScreenSelect:o,onReset:h});case l.MT.TwoFaDisabled:case l.MT.TwoFaNewPassword:case l.MT.TwoFaNewPasswordConfirm:case l.MT.TwoFaNewPasswordHint:case l.MT.TwoFaNewPasswordEmail:case l.MT.TwoFaNewPasswordEmailCode:case l.MT.TwoFaCongratulations:case l.MT.TwoFaEnabled:case l.MT.TwoFaChangePasswordCurrent:case l.MT.TwoFaChangePasswordNew:case l.MT.TwoFaChangePasswordConfirm:case l.MT.TwoFaChangePasswordHint:case l.MT.TwoFaTurnOff:case l.MT.TwoFaRecoveryEmailCurrentPassword:case l.MT.TwoFaRecoveryEmail:case l.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(Aa,{currentScreen:n,state:m,dispatch:u,shownScreen:i,isActive:e,onScreenSelect:o,onReset:h});default:return}}(e,c))}return a.ZP.createElement(L.Z,{id:"Settings",name:d?"none":i.s0,activeKey:n,renderCount:xa},v)})),Ha=(0,G.P2)((e=>e()),6e4,!0),Va=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n,statusesById:a}=e.users;return{usersById:n,userStatusesById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{isActive:t,filter:n,usersById:r,userStatusesById:l,contactIds:o,serverTimeOffset:c,onReset:d}=e;const{loadContactList:m,openChat:h}=(0,s.uC)();(0,a.d4)((()=>{Ha((()=>{m()}))})),(0,u.ZP)(t,d);const Z=(0,a.I4)((e=>{h({id:e,shouldReplaceHistory:!0})}),[h]),v=(0,a.Ye)((()=>{if(!o)return;const e=(0,g.kK)(o,r,n);return(0,g.Z0)(e,r,l,void 0,c)}),[o,n,r,l,c]),[P,p]=(0,Ne.Z)(void 0,v,Boolean(n));return a.ZP.createElement(Re.Z,{items:P,onLoadMore:p,className:"chat-list custom-scroll"},null!=P&&P.length?P.map((e=>a.ZP.createElement(Ae.Z,{key:e,className:"chat-item-clickable",onClick:()=>Z(e),ripple:!i.wB},a.ZP.createElement(Fe.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):P&&!P.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},n.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(we.Z,{key:"loading"}))}))),qa=(0,G.P2)((e=>e()),6e4,!0),ja=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.chats,{query:a,fetchingStatus:s,globalResults:r,localResults:l}=e.globalSearch,{userIds:o}=r||{},{userIds:i}=l||{};return{chatsById:n,localContactIds:t,searchQuery:a,isSearching:null==s?void 0:s.chats,globalUserIds:o,localUserIds:i}}))((e=>{let{isChannel:t,isActive:n,selectedMemberIds:r,onSelectedMemberIdsChange:l,onNextStep:o,onReset:i,chatsById:c,localContactIds:d,searchQuery:m,isSearching:Z,localUserIds:v,globalUserIds:P}=e;const{loadContactList:p,setGlobalSearchQuery:E}=(0,s.uC)();(0,a.d4)((()=>{qa((()=>{p()}))}));const C=(0,h.Z)();(0,u.ZP)(n,i);const f=(0,a.I4)((e=>{E({query:e})}),[E]),b=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId,t=d?(0,g.kK)(d,e,m):[];return(0,g.ih)((0,me.Tw)([...t,...v||[],...P||[]]).filter((t=>{const n=e[t];return!n||!n.isSelf&&(n.canBeInvitedToGroup||!(0,g.cS)(n))})),c,!1,r)}),[d,c,m,v,P,r]),I=(0,a.I4)((()=>{(r.length||t)&&(E({query:""}),o())}),[r.length,t,E,o]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:i,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,C("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(La.Z,{itemIds:b,selectedIds:r,filterValue:m,filterPlaceholder:C("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:Z,onSelectedIdsChange:l,onFilterChange:f}),a.ZP.createElement(mn.Z,{isShown:Boolean(r.length||t),onClick:I,ariaLabel:t?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Ka=(0,a.X$)((0,s.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n}}))((e=>{let{isChannel:t,isActive:n,memberIds:r,onReset:o,creationProgress:i,creationError:c}=e;const{createGroupChat:d,createChannel:m}=(0,s.uC)(),Z=(0,h.Z)();(0,u.ZP)(n,o);const[v,P]=(0,a.eJ)(""),[g,p]=(0,a.eJ)(""),[E,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(),I="Chat title can't be empty",y="Channel title can't be empty",N="Sorry, creating supergroups is not yet supported",k=i===l.Nh.InProgress,S=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");P(n),n!==t&&(e.currentTarget.value=n)}),[]),w=(0,a.I4)((e=>{p(e.currentTarget.value)}),[]),M=(0,a.I4)((()=>{v.length?r.length>199?b(N):d({title:v,photo:E,memberIds:r}):b(I)}),[v,r,d,E,I,N]),T=(0,a.I4)((()=>{v.length?m({title:v,about:g,photo:E,memberIds:r}):b(y)}),[v,m,g,E,r,y]);(0,a.d4)((()=>{i===l.Nh.Complete&&o(!0)}),[i,o]);const A=c&&Z(c)||(f!==I&&f!==y?f:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>o(),ariaLabel:"Return to member selection"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,Z(t?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(dn.Z,{onChange:C,title:Z("AddPhoto")}),a.ZP.createElement(Te.Z,{value:v,onChange:S,label:Z(t?"EnterChannelName":"GroupName"),error:f===I||f===y?f:void 0}),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Te.Z,{value:g,onChange:w,label:Z("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},Z("DescriptionInfo"))),A&&a.ZP.createElement("p",{className:"error"},A),r.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},Z("GroupInfo.ParticipantCount",r.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},r.map((e=>a.ZP.createElement(Ae.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Fe.Z,{userId:e}))))))),a.ZP.createElement(mn.Z,{isShown:0!==v.length,onClick:t?T:M,disabled:k,ariaLabel:t?Z("ChannelIntro.CreateChannel"):"Create Group"},k?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Wa=Object.keys(l.du).length/2,Qa=(0,a.X$)((e=>{let{isActive:t,isChannel:n=!1,content:s,onContentChange:r,onReset:o}=e;const[c,d]=(0,a.eJ)([]),m=(0,a.I4)((()=>{r(n?l.du.NewChannelStep2:l.du.NewGroupStep2)}),[n,r]);return a.ZP.createElement(L.Z,{id:"NewChat",name:i.s0,renderCount:Wa,activeKey:s},(e=>{switch(s){case l.du.NewChannelStep1:case l.du.NewGroupStep1:return a.ZP.createElement(ja,{isChannel:n,isActive:t,selectedMemberIds:c,onSelectedMemberIdsChange:d,onNextStep:m,onReset:o});case l.du.NewChannelStep2:case l.du.NewGroupStep2:return a.ZP.createElement(Ka,{isChannel:n,isActive:e&&t,memberIds:c,onReset:o});default:return}}))}));var es=n(1080);const ts=(0,a.X$)((e=>{let{isActive:t,onReset:n,onContentChange:s}=e;const r=(0,h.Z)();return(0,u.ZP)(t,n,s,l.du.Archived),a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:"Return to chat list"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,r("ArchivedChats"))),a.ZP.createElement(es.Z,{folderType:"archived",isActive:t}))}));var ns=n(1218);const as=(0,a.X$)((0,s.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}))((e=>{let{isOpen:t,chatId:n,foldersById:r,folderOrderedIds:l,onClose:o,onCloseAnimationEnd:i}=e;const{editChatFolders:c}=(0,s.uC)(),d=(0,h.Z)(),m=(0,a.Ye)((()=>r?Object.keys(r).reduce(((e,t)=>{const{includedChatIds:a,pinnedChatIds:s}=r[Number(t)];return(a.includes(n)||null!=s&&s.includes(n))&&e.push(t),e}),[]):[]),[n,r]),[u,Z]=(0,a.eJ)(m),v=(0,a.Ye)((()=>(null==l?void 0:l.map((e=>({label:r?r[e].title:"",value:String(e)}))))||[]),[l,r]),P=(0,a.I4)((()=>{const e=m.filter((e=>!u.includes(e))).map(Number),t=u.filter((e=>!m.includes(e))).map(Number);c({chatId:n,idsToRemove:e,idsToAdd:t}),o()}),[n,c,m,o,u]);if(r&&l)return a.ZP.createElement(Me.Z,{isOpen:t,onClose:o,onCloseAnimationEnd:i,onEnter:P,className:"delete",title:d("FilterAddTo")},a.ZP.createElement(ns.Z,{options:v,selected:u,onChange:Z,round:!0}),a.ZP.createElement(R.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:P},d("FilterAddTo")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:o},d("Cancel")))})));var ss=n(4319),rs=n(647);function ls(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let os,is;const cs={Down:!0,ArrowDown:!0,Up:!0,ArrowUp:!0,Left:!0,ArrowLeft:!0,Right:!0,ArrowRight:!0," ":!0,PageUp:!0,PageDown:!0,End:!0,Home:!0,Tab:!0},ds=e=>"changedTouches"in e?e.changedTouches[0].clientY:0,ms=e=>{const t="deltaY"in e?e.deltaY:ds(e);if(!os||!os.contains(e.target)||os.scrollTop<=0&&t<=0||os.scrollTop>=os.scrollHeight-os.offsetHeight&&t>=0){if(is&&e.target.closest(is))return;e.preventDefault()}};function us(e){cs[e.key]&&!function(e){if(!(e&&e instanceof HTMLElement))return!1;const t=e,n=t.tagName.toLowerCase();if("textarea"===n)return!0;if("input"!==n)return!1;const a=t.getAttribute("type");return!!a&&["text","password","number","email","tel","url","search","date","datetime","datetime-local","time","month","week"].indexOf(a.toLowerCase())>-1}(e.target)&&e.preventDefault()}function hs(e,t){os=e,is=t,document.addEventListener("wheel",ms,{passive:!1}),document.addEventListener("touchmove",ms,{passive:!1}),document.onkeydown=us}function Zs(){os=void 0,is=void 0,document.removeEventListener("wheel",ms),document.removeEventListener("touchmove",ms),document.onkeydown=null}var vs=n(3394),Ps=n(2328);const gs=(0,X.y)("ReactionSelectorReaction"),ps=(0,a.X$)((e=>{var t;let{reaction:n,previewIndex:s,onSendReaction:l,isReady:o}=e;const i=(0,a.sO)(null),c=(0,Z.Z)(`document${null===(t=n.selectAnimation)||void 0===t?void 0:t.id}`,!o,r.IU.Lottie),[d,m,u]=(0,ye.Z)(),[h,v]=(0,ye.Z)(),P=Boolean(o&&c),{transitionClassNames:g}=(0,H.Z)(P),{shouldRender:p,transitionClassNames:E}=(0,H.Z)(!o||!h,void 0,!0);return a.ZP.createElement("div",{className:gs("&"),onClick:function(){if(!i.current)return;const{x:e,y:t}=i.current.getBoundingClientRect();l(n.reaction,e,t)},ref:i,onMouseEnter:o?m:void 0},p&&a.ZP.createElement("div",{className:gs("static",o?[E]:void 0),style:`background-position-x: ${-32*s}px;`}),P&&a.ZP.createElement(mt.Z,{id:`select_${n.reaction}`,className:gs("animated",[g]),animationData:c,play:d,noLoop:!0,size:32,onLoad:v,onEnded:u}))})),Es=(0,X.y)("ReactionSelector"),Cs=(0,a.X$)((e=>{let{availableReactions:t,enabledReactions:n,onSendReaction:s,isPrivate:r,isReady:l}=e;const o=(0,a.sO)(null),[i,c]=(0,ye.Z)(!1);(0,Ct.Z)(o.current,!i),(0,a.bt)((()=>{c()}),[c]);const d=e=>{o&&("deltaY"in e?e.deltaY:ds(e))&&e.preventDefault()};if((r||null!=n&&n.length)&&t)return a.ZP.createElement("div",{className:Es("&"),onWheelCapture:d,onTouchMove:d},a.ZP.createElement("div",{className:Es("bubble-big")}),a.ZP.createElement("div",{className:Es("bubble-small")}),a.ZP.createElement("div",{className:Es("items-wrapper")},a.ZP.createElement("div",{className:Es("items",["no-scrollbar"]),ref:o},null==t?void 0:t.map(((e,t)=>{if(!e.isInactive&&(r||n&&n.includes(e.reaction)))return a.ZP.createElement(ps,{key:e.reaction,previewIndex:t,isReady:l,onSendReaction:s,reaction:e})})))))})),fs=(0,a.X$)((e=>{var t,n,s,l;let{availableReactions:o,isOpen:c,message:d,isPrivate:m,enabledReactions:u,anchor:Z,canSendNow:v,canReschedule:P,canReply:p,canEdit:E,canPin:C,canUnpin:f,canDelete:b,canReport:I,canForward:y,canFaveSticker:N,canUnfaveSticker:k,canCopy:S,canCopyLink:w,canSelect:M,canDownload:T,isDownloading:R,canShowSeenBy:A,canShowReactionsCount:L,canRemoveReaction:F,canShowReactionList:$,seenByRecentUsers:x,onReply:D,onEdit:O,onPin:U,onUnpin:G,onForward:J,onDelete:z,onReport:_,onFaveSticker:Y,onUnfaveSticker:H,onSelect:V,onSend:q,onReschedule:j,onClose:K,onCloseAnimationEnd:W,onCopyLink:Q,onDownload:ee,onShowSeenBy:te,onShowReactors:ne,onSendReaction:ae}=e;const se=(0,a.sO)(null),re=(0,a.sO)(null),le=function(e,t,n){const a=[],s=(0,g.UD)(e),l=(0,g.O$)(e)||((0,g.Cg)(e)?void 0:(0,g.F$)(e)),o=(0,g.Ti)(e,"inline"),i=l&&(o||(0,g.BM)(e))&&ss.yl,c=window.getSelection();if(i&&a.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(o?rs.he(o,r.IU.BlobUrl):l.blobUrl).then(ss.VP),t&&t()}}),s){var d;const n=Boolean((null==c||null===(d=c.anchorNode)||void 0===d?void 0:d.parentNode)&&c.anchorNode.parentNode.closest(".Message .content-inner")&&""!==c.toString().replace(/(?:\r\n|\r|\n)/g,""));a.push({label:ls(n),handler:()=>{const a=n&&c?c.toString():(0,g.EU)(e);(0,ss.TE)(a),t&&t()}})}return n&&a.push({label:"lng_context_copy_message_link",handler:()=>{n(),t&&t()}}),a}(d,K,w?Q:void 0),oe=!(m||null!=u&&u.length),ie=$&&!oe,[ce,de,me]=(0,ye.Z)(),ue=(0,a.I4)((()=>document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id="${d.id}"]`)),[d.id]),he=(0,a.I4)((()=>document.querySelector(".Transition__slide--active > .MessageList")),[]),Ze=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),ve=(0,a.I4)((()=>{var e;const t=i.wB&&(null===(e=document.querySelector(".AudioPlayer-content"))||void 0===e?void 0:e.offsetHeight)||0,n=document.querySelector(".HeaderPinnedMessage-wrapper"),a=(i.wB&&!t||!i.wB&&(null==n?void 0:n.classList.contains("full-width")))&&(null==n?void 0:n.offsetHeight)||0;return{extraPaddingX:10,extraTopPadding:document.querySelector(".MiddleHeader").offsetHeight,marginSides:ie?32:void 0,extraMarginTop:a+t}}),[ie]),Pe=(0,a.I4)((()=>{ae(void 0,0,0)}),[ae]);(0,a.d4)((()=>{c?setTimeout((()=>{de()}),200):me()}),[c,de,me]);const{positionX:pe,positionY:Ee,transformOriginX:Ce,transformOriginY:fe,style:be,menuStyle:Ie,withScroll:Ne}=(0,vs.Z)(Z,ue,he,Ze,ve);(0,a.d4)((()=>(hs(Ne?re.current:void 0,".ReactionSelector"),Zs)),[Ne]);const ke=(0,h.Z)();return a.ZP.createElement(Ps.Z,{ref:se,isOpen:c,transformOriginX:Ce,transformOriginY:fe,positionX:pe,positionY:Ee,style:be,bubbleStyle:Ie,className:(0,X.Z)("MessageContextMenu","fluid",ie&&"with-reactions"),onClose:K,onCloseAnimationEnd:W},$&&a.ZP.createElement(Cs,{enabledReactions:u,onSendReaction:ae,isPrivate:m,availableReactions:o,isReady:ce}),a.ZP.createElement("div",{className:"scrollable-content custom-scroll",style:Ie,ref:re},F&&a.ZP.createElement(B.Z,{icon:"reactions",onClick:Pe},"Remove Reaction"),v&&a.ZP.createElement(B.Z,{icon:"send-outline",onClick:q},ke("MessageScheduleSend")),P&&a.ZP.createElement(B.Z,{icon:"schedule",onClick:j},ke("MessageScheduleEditTime")),p&&a.ZP.createElement(B.Z,{icon:"reply",onClick:D},ke("Reply")),E&&a.ZP.createElement(B.Z,{icon:"edit",onClick:O},ke("Edit")),N&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:Y},ke("AddToFavorites")),k&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:H},ke("Stickers.RemoveFromFavorites")),S&&le.map((e=>a.ZP.createElement(B.Z,{key:e.label,icon:"copy",onClick:e.handler},ke(e.label)))),C&&a.ZP.createElement(B.Z,{icon:"pin",onClick:U},ke("DialogPin")),f&&a.ZP.createElement(B.Z,{icon:"unpin",onClick:G},ke("DialogUnpin")),T&&a.ZP.createElement(B.Z,{icon:"download",onClick:ee},ke(R?"lng_context_cancel_download":"lng_media_download")),y&&a.ZP.createElement(B.Z,{icon:"forward",onClick:J},ke("Forward")),M&&a.ZP.createElement(B.Z,{icon:"select",onClick:V},ke("Common.Select")),I&&a.ZP.createElement(B.Z,{icon:"flag",onClick:_},ke("lng_context_report_msg")),(A||L)&&a.ZP.createElement(B.Z,{icon:L?"reactions":"group",onClick:L?ne:te,disabled:!(L||null!==(t=d.seenByUserIds)&&void 0!==t&&t.length)},L&&null!==(n=d.reactors)&&void 0!==n&&n.count?A&&null!==(s=d.seenByUserIds)&&void 0!==s&&s.length?ke("Chat.OutgoingContextMixedReactionCount",[d.reactors.count,d.seenByUserIds.length]):ke("Chat.ContextReactionCount",d.reactors.count,"i"):null!==(l=d.seenByUserIds)&&void 0!==l&&l.length?ke("Conversation.ContextMenuSeen",d.seenByUserIds.length,"i"):ke("Conversation.ContextMenuNoViews"),a.ZP.createElement("div",{className:"avatars"},null==x?void 0:x.map((e=>a.ZP.createElement(ge.Z,{size:"micro",user:e}))))),b&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:z},ke("Delete"))))})),bs=2*I.Gw,Is=(0,a.X$)((0,s.c$)(((e,t)=>{var n,a,s;let{message:r,messageListType:l}=t;const{threadId:i}=(0,p.Bt)(e)||{},c=(0,p.xs)(e,r.chatId),d=(0,p.Z1)(e,r.chatId),{seenByExpiresAt:m,seenByMaxChatMembers:u}=e.appConfig||{},{noOptions:h,canReply:Z,canPin:v,canUnpin:P,canDelete:E,canReport:C,canEdit:f,canForward:b,canFaveSticker:I,canUnfaveSticker:y,canCopy:N,canCopyLink:k,canSelect:S,canDownload:w}=i&&(0,p._k)(e,r,i)||{},M="pinned"===l,T="scheduled"===l,R=d&&(0,g.eA)(d),A=(0,g.CI)(r),L=Boolean(d&&u&&m&&(0,g.Bf)(d)&&(0,g.B4)(r)&&!T&&d.membersCount&&d.membersCount<u&&r.date>Date.now()/1e3-m),F=d&&(0,g.YC)(d.id),B=(0,g.Lo)(r),$=!A&&!R&&!T&&!B&&!F&&r.reactions&&!(0,g.JE)(r.reactions)&&r.reactions.canSeeList,x=F&&(null===(n=r.reactions)||void 0===n||null===(a=n.results)||void 0===a?void 0:a.some((e=>e.isChosen))),D=(0,p.EV)(e,r);return{availableReactions:e.availableReactions,noOptions:h,canSendNow:T,canReschedule:T,canReply:!M&&!T&&Z,canPin:!T&&v,canUnpin:!T&&P,canDelete:E,canReport:C,canEdit:!M&&f,canForward:!D&&!T&&b,canFaveSticker:!T&&I,canUnfaveSticker:!T&&y,canCopy:!D&&N,canCopyLink:!D&&!T&&k,canSelect:S,canDownload:!D&&w,activeDownloads:c,canShowSeenBy:L,enabledReactions:null==d||null===(s=d.fullInfo)||void 0===s?void 0:s.enabledReactions,isPrivate:F,hasFullInfo:Boolean(null==d?void 0:d.fullInfo),canShowReactionsCount:$,canShowReactionList:!A&&!B&&!T&&(null==d?void 0:d.id)!==o.aw,canRemoveReaction:x}}))((e=>{var t;let{availableReactions:n,isOpen:r,messageListType:l,chatUsername:o,message:i,album:c,anchor:d,onClose:m,onCloseAnimationEnd:u,noOptions:h,canSendNow:Z,hasFullInfo:v,canReschedule:P,canReply:g,canPin:p,canUnpin:E,canDelete:C,canReport:f,canShowReactionsCount:b,canShowReactionList:I,canRemoveReaction:y,canEdit:N,enabledReactions:k,isPrivate:S,canForward:w,canFaveSticker:M,canUnfaveSticker:T,canCopy:R,canCopyLink:A,canSelect:L,canDownload:F,activeDownloads:B,canShowSeenBy:$}=e;const{setReplyingToId:x,setEditingId:D,pinMessage:O,openForwardMenu:U,faveSticker:G,unfaveSticker:J,toggleMessageSelection:z,sendScheduledMessages:_,rescheduleMessage:Y,downloadMessageMedia:V,cancelMessageMediaDownload:q,loadSeenBy:K,openSeenByModal:W,sendReaction:Q,openReactorListModal:ee,loadFullChat:te,loadReactors:ne}=(0,s.uC)(),{transitionClassNames:ae}=(0,H.Z)(r,u,void 0,!1),[se,re]=(0,a.eJ)(!0),[le,oe]=(0,a.eJ)(!1),[ie,ce]=(0,a.eJ)(!1),[de,me]=(0,a.eJ)(!1),[ue,he,Ze]=(0,ye.Z)();(0,a.d4)((()=>{$&&r&&K({chatId:i.chatId,messageId:i.id})}),[K,r,i.chatId,i.id,$]),(0,a.d4)((()=>{b&&r&&ne({chatId:i.chatId,messageId:i.id})}),[b,r,ne,i.chatId,i.id]),(0,a.d4)((()=>{v||S||!r||te({chatId:i.chatId})}),[v,r,S,te,i.chatId]);const ve=(0,a.Ye)((()=>{var e,t,n;if(null!==(e=i.reactions)&&void 0!==e&&null!==(t=e.recentReactions)&&void 0!==t&&t.length){var a,r;const e=(0,s.Rd)().users.byId;return null===(a=i.reactions)||void 0===a||null===(r=a.recentReactions)||void 0===r?void 0:r.slice(0,3).map((t=>{let{userId:n}=t;return e[n]})).filter(Boolean)}if(!i.seenByUserIds)return;const l=(0,s.Rd)().users.byId;return null===(n=i.seenByUserIds)||void 0===n?void 0:n.slice(0,3).map((e=>l[e])).filter(Boolean)}),[null===(t=i.reactions)||void 0===t?void 0:t.recentReactions,i.seenByUserIds]),Pe=c?c.messages.some((e=>B.includes(e.id))):B.includes(i.id),ge=(0,a.I4)((()=>{re(!1),oe(!0)}),[]),pe=(0,a.I4)((()=>{re(!1),ce(!0)}),[]),Ee=(0,a.I4)((()=>{re(!1),m()}),[m]),Ce=(0,a.I4)((()=>{oe(!1),m()}),[m]),fe=(0,a.I4)((()=>{ce(!1),m()}),[m]),be=(0,a.I4)((()=>{me(!1),m()}),[m]),Ie=(0,a.I4)((()=>{Ze(),m()}),[Ze,m]),Ne=(0,a.I4)((()=>{x({messageId:i.id}),Ee()}),[x,i.id,Ee]),ke=(0,a.I4)((()=>{D({messageId:i.id}),Ee()}),[D,i.id,Ee]),Se=(0,a.I4)((()=>{re(!1),me(!0)}),[]),we=(0,a.I4)((()=>{O({messageId:i.id,isUnpin:!0}),Ee()}),[O,i.id,Ee]),Me=(0,a.I4)((()=>{if(Ee(),null!=c&&c.messages){const e=c.messages.map((e=>{let{id:t}=e;return t}));U({fromChatId:i.chatId,messageIds:e})}else U({fromChatId:i.chatId,messageIds:[i.id]})}),[U,i,Ee,c]),Te=(0,a.I4)((()=>{Ee(),G({sticker:i.content.sticker})}),[Ee,i.content.sticker,G]),Re=(0,a.I4)((()=>{Ee(),J({sticker:i.content.sticker})}),[Ee,i.content.sticker,J]),Ae=(0,a.I4)((()=>{const e=null!=c&&c.messages?{messageId:i.id,childMessageIds:c.messages.map((e=>{let{id:t}=e;return t})),withShift:!1}:{messageId:i.id,withShift:!1};z(e),Ee()}),[Ee,i.id,z,c]),Le=(0,a.I4)((()=>{_({chatId:i.chatId,id:i.id}),Ee()}),[Ee,i.chatId,i.id,_]),Fe=(0,a.I4)((()=>{re(!1),he()}),[he]),Be=(0,a.I4)((()=>{Ee(),W({chatId:i.chatId,messageId:i.id})}),[Ee,i.chatId,i.id,W]),$e=(0,a.I4)((()=>{Ee(),ee({chatId:i.chatId,messageId:i.id})}),[Ee,ee,i.chatId,i.id]),xe=(0,a.I4)((e=>{Y({chatId:i.chatId,messageId:i.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[i.chatId,i.id,Y]),De=(0,a.I4)((()=>{(0,ss.TE)(`https://t.me/${o||`c/${i.chatId.replace("-","")}`}/${i.id}`),Ee()}),[o,Ee,i.chatId,i.id]),Oe=(0,a.I4)((()=>{((null==c?void 0:c.messages)||[i]).forEach((e=>{Pe?q({message:e}):V({message:e})})),Ee()}),[c,i,Ee,Pe,q,V]),Ue=(0,a.I4)(((e,t,n)=>{Q({chatId:i.chatId,messageId:i.id,reaction:e,x:t,y:n,startSize:bs}),Ee()}),[Ee,i.chatId,i.id,Q]),Ge=(0,a.Ye)((()=>(c?c.messages:[i]).map((e=>{let{id:t}=e;return t}))),[c,i]);if(h)return void Ee();const Je=new Date;return Je.setFullYear(Je.getFullYear()+1),a.ZP.createElement("div",{className:(0,X.Z)("ContextMenuContainer",ae)},a.ZP.createElement(fs,{availableReactions:n,message:i,isPrivate:S,isOpen:se,enabledReactions:k,anchor:d,canShowReactionsCount:b,canShowReactionList:I,canRemoveReaction:y,canSendNow:Z,canReschedule:P,canReply:g,canDelete:C,canReport:f,canPin:p,canUnpin:E,canEdit:N,canForward:w,canFaveSticker:M,canUnfaveSticker:T,canCopy:R,canCopyLink:A,canSelect:L,canDownload:F,canShowSeenBy:$,isDownloading:Pe,seenByRecentUsers:ve,onReply:Ne,onEdit:ke,onPin:Se,onUnpin:we,onForward:Me,onDelete:ge,onReport:pe,onFaveSticker:Te,onUnfaveSticker:Re,onSelect:Ae,onSend:Le,onReschedule:Fe,onClose:Ee,onCopyLink:De,onDownload:Oe,onShowSeenBy:Be,onSendReaction:Ue,onShowReactors:$e}),a.ZP.createElement(We,{isOpen:le,isSchedule:"scheduled"===l,onClose:Ce,album:c,message:i}),a.ZP.createElement(st,{isOpen:ie,onClose:fe,messageIds:Ge}),a.ZP.createElement(Qe,{isOpen:de,messageId:i.id,chatId:i.chatId,onClose:be}),P&&a.ZP.createElement(je,{isOpen:ue,withTimePicker:!0,selectedAt:1e3*i.date,maxAt:(0,j._F)(Je),isFutureMode:!0,onClose:Ie,onSubmit:xe}))}))),ys=(0,a.X$)((0,s.c$)(((e,t)=>{let{fromSticker:n,stickerSetShortName:a}=t;const s=(0,p.Bt)(e),{chatId:r,threadId:l}=s||{},o=r&&(0,p.Z1)(e,r),i=o?(0,g.H5)(o):void 0;return{canSendStickers:Boolean(o&&l&&(0,g.Qm)(o,l)&&(null==i?void 0:i.canSendStickers)),stickerSet:n?(0,p.Ny)(e,n.stickerSetId):a?(0,p.E_)(e,a):void 0}}))((e=>{let{isOpen:t,fromSticker:n,stickerSetShortName:r,stickerSet:l,canSendStickers:i,onClose:c}=e;const{loadStickers:d,toggleStickerSet:m,sendMessage:u}=(0,s.uC)(),Z=(0,a.sO)(null),v=(0,h.Z)(),{observe:P}=(0,Bt.S1)({rootRef:Z,throttleMs:200,isDisabled:!t});(0,a.d4)((()=>{if(t)if(n){const{stickerSetId:e,stickerSetAccessHash:t}=n;d({stickerSetId:e,stickerSetAccessHash:t})}else r&&d({stickerSetShortName:r})}),[t,n,d,r]);const g=(0,a.I4)((e=>{e={...e,isPreloadedGlobally:!0},u({sticker:e}),c()}),[c,u]),p=(0,a.I4)((()=>{l&&(m({stickerSetId:l.id}),c())}),[c,l,m]);return a.ZP.createElement(Me.Z,{className:"StickerSetModal",isOpen:t,onClose:c,hasCloseButton:!0,title:l?(0,Pe.Z)(l.title,["emoji","links"]):v("AccDescrStickerSet")},null!=l&&l.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:Z,className:"stickers custom-scroll"},l.stickers.map((e=>a.ZP.createElement(On.Z,{sticker:e,size:o.yK,observeIntersection:P,onClick:i?g:void 0,clickArg:e})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(R.Z,{size:"smaller",fluid:!0,color:l.installedDate?"danger":"primary",onClick:p},v(l.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",l.count,"i")))):a.ZP.createElement(we.Z,null))})));var Ns=n(2898);const ks=(0,a.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,p.Z1)(e,a);if(!s||s.isRestricted)return{};const r=(0,g.YC)(s.id),l=r?(0,p.dy)(e,a):void 0,o=l&&(0,g.kw)(l);return{chat:s,isMuted:(0,g.i4)(s,(0,p.dZ)(e),(0,p.NJ)(e)),isPrivate:r,canAddContact:o,canDeleteChat:(0,g.cc)(s),hasLinkedChat:Boolean(null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.linkedChatId)}}))((e=>{let{chatId:t,isOpen:n,withExtraActions:r,anchor:l,isChannel:o,canStartBot:c,canRestartBot:d,canSubscribe:m,canSearch:u,canCall:Z,canMute:v,canLeave:P,canEnterVoiceChat:g,canCreateVoiceChat:p,chat:E,isPrivate:C,isMuted:f,canDeleteChat:b,hasLinkedChat:I,canAddContact:y,onSubscribeChannel:N,onSearchClick:k,onClose:S,onCloseAnimationEnd:w}=e;const{updateChatMutedState:M,enterMessageSelectMode:T,sendBotCommand:R,restartBot:A,joinGroupCall:L,createGroupCall:F,openLinkedChat:$,addContact:x,openCallFallbackConfirm:D}=(0,s.uC)(),[O,U]=(0,a.eJ)(!0),[G,J]=(0,a.eJ)(!1),{x:X,y:z}=l;(0,H.Z)(n,w,void 0,!1);const _=(0,a.I4)((()=>{U(!1),J(!0)}),[]),Y=(0,a.I4)((()=>{U(!1),S()}),[S]),V=(0,a.I4)((()=>{J(!1),S()}),[S]),q=(0,a.I4)((()=>{R({command:"/start"})}),[R]),j=(0,a.I4)((()=>{A({chatId:t})}),[t,A]),K=(0,a.I4)((()=>{M({chatId:t,isMuted:!f}),Y()}),[t,Y,f,M]),W=(0,a.I4)((()=>{p?F({chatId:t}):L({chatId:t}),Y()}),[Y,p,t,L,F]),Q=(0,a.I4)((()=>{$({id:t}),Y()}),[t,Y,$]),ee=(0,a.I4)((()=>{x({userId:t}),Y()}),[x,t,Y]),te=(0,a.I4)((()=>{N(),Y()}),[Y,N]),ne=(0,a.I4)((()=>{D(),Y()}),[Y,D]),ae=(0,a.I4)((()=>{k(),Y()}),[Y,k]),se=(0,a.I4)((()=>{T(),Y()}),[Y,T]);(0,a.d4)((()=>(hs(),Zs)),[]);const re=(0,h.Z)();return a.ZP.createElement(Ns.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(Ps.Z,{isOpen:O,positionX:"right",style:`left: ${X}px;top: ${z}px;`,onClose:Y},r&&c&&a.ZP.createElement(B.Z,{icon:"bots",onClick:q},re("BotStart")),r&&d&&a.ZP.createElement(B.Z,{icon:"bots",onClick:j},re("BotRestart")),r&&m&&a.ZP.createElement(B.Z,{icon:o?"channel":"group",onClick:te},re(o?"ProfileJoinChannel":"ProfileJoinGroup")),y&&a.ZP.createElement(B.Z,{icon:"add-user",onClick:ee},re("AddContact")),i.wB&&Z&&a.ZP.createElement(B.Z,{icon:"phone",onClick:ne},re("Call")),i.wB&&u&&a.ZP.createElement(B.Z,{icon:"search",onClick:ae},re("Search")),v&&a.ZP.createElement(B.Z,{icon:f?"unmute":"mute",onClick:K},re(f?"ChatsUnmute":"ChatsMute")),(g||p)&&a.ZP.createElement(B.Z,{icon:"voice-chat",onClick:W},re(p?"StartVoipChat":"VoipGroupJoinCall")),I&&a.ZP.createElement(B.Z,{icon:o?"comments":"channel",onClick:Q},re(o?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(B.Z,{icon:"select",onClick:se},re("ReportSelectMessages")),P&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:_},re(C?"DeleteChatUser":b?"GroupInfo.DeleteAndExit":o?"LeaveChannel":"Group.LeaveGroup"))),E&&a.ZP.createElement(gt.Z,{isOpen:G,onClose:V,chat:E})))})));var Ss=n(9589);const ws=(0,G.Ds)((e=>e()),200,!1),Ms=(0,a.X$)((0,s.c$)((e=>{const t=(0,p.jr)(e);if(!t)return{};const{query:n,results:a}=(0,p.n5)(e)||{},{totalCount:s,foundIds:r}=a||{};return{chat:t,query:n,totalCount:s,foundIds:r,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}))((e=>{let{isActive:t,chat:n,query:r,totalCount:l,foundIds:o,isHistoryCalendarOpen:i}=e;const{setLocalTextSearchQuery:c,searchTextMessagesLocal:d,focusMessage:m,closeLocalTextSearch:u,openHistoryCalendar:h}=(0,s.uC)(),Z=(0,a.sO)(null),[v,P]=(0,a.eJ)(0);(0,a.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),n=()=>{const{activeElement:n}=document;if(n&&n===Z.current){const{pageTop:n,height:a}=e;t.style.transform=`translateY(${n}px)`,t.style.height=`${a}px`,document.documentElement.scrollTop=n}else t.style.transform="",t.style.height=""};return e.addEventListener("resize",n),()=>{e.removeEventListener("resize",n)}}),[]),(0,a.d4)((()=>{null!=n&&n.id&&null!=o&&o.length?(m({chatId:n.id,messageId:o[0]}),P(0)):P(-1)}),[null==n?void 0:n.id,m,o]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((e=>{e.disabled=Boolean(t&&e!==Z.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((e=>{e.contentEditable=t?"false":"true"}))}),[t]),(0,a.d4)((()=>{t||Z.current.blur()}),[t]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[i]);const g=(0,a.I4)((e=>{c({query:e}),e.length&&ws(d)}),[d,c]),p=(0,a.I4)((()=>{if(n&&o){const e=v+1;m({chatId:n.id,messageId:o[e]}),P(e)}}),[n,v,m,o]),E=(0,a.I4)((()=>{if(n&&o){const e=v-1;m({chatId:n.id,messageId:o[e]}),P(e)}}),[n,v,m,o]);return a.ZP.createElement("div",{id:"MobileSearch",className:t?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(R.Z,{size:"smaller",round:!0,color:"translucent",onClick:u},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(Ss.Z,{ref:Z,value:r,onChange:g})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},r?null!=o&&o.length?`${v+1} of ${l}`:o&&!o.length?"No results":"":a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>h({selectedAt:(0,j._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:p,disabled:!o||!o.length||v===o.length-1},a.ZP.createElement("i",{className:"icon-up"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:E,disabled:!o||!o.length||0===v},a.ZP.createElement("i",{className:"icon-down"}))))})));var Ts=n(5376),Rs=n(9295),As=n(3575),Ls=n(971),Fs=n(7002),Bs=n(3616);function $s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const l=e[r?"scrollLeft":"scrollTop"],o=l+e[r?"offsetWidth":"offsetHeight"],i="string"==typeof t?e.querySelectorAll(t):t,{length:c}=i,d=[];let m=!1;for(let e=0;e<c;e++){const t=i[e],c=t[r?"offsetLeft":"offsetTop"],u=c+t[r?"offsetWidth":"offsetHeight"];if(s?u>=l-n&&u<=o+n:c<=o+n&&u>=l-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:i,visibleIndexes:d}}const xs=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],r=t[n?"offsetLeft":"offsetTop"],l=r+t[n?"offsetWidth":"offsetHeight"];return r>a&&l<s};var Ds=n(539);function Os(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:r}=$s(a,e,8,!0,!0);if(!r.length||!r[t])return;const l=s[0];if(!s.includes(t)||t===l&&!xs(a,r[l])){const e=t>s[s.length-1]?"start":"end";(0,Ds.Z)(a,r[t],e,10)}}var Us=n(3570);function Gs(e){let{isActive:t,isHorizontal:n,shouldSaveSelectionOnUpdateItems:s,shouldRemoveSelectionOnReset:r,noArrowNavigation:l,items:o,shouldSelectOnTab:i,onSelect:c,onClose:d}=e;const[m,u]=(0,a.eJ)(-1),h=(0,a.I4)((e=>o?(0,Us.Z)(o.length,e):-1),[o]),Z=(0,a.I4)(((e,t)=>{t.preventDefault(),u((t=>h(t+e)))}),[u,h]),v=(0,a.I4)((e=>{if(o&&o.length&&m>-1){const t=o[m];t&&(e.preventDefault(),c(t))}}),[o,c,m]),P=!o||m>o.length-1;return(0,a.d4)((()=>{s&&!P||u(r?-1:0)}),[P,r,s]),(0,a.d4)((()=>t?(0,tt.Z)({onEsc:d,onUp:l||n?void 0:e=>Z(-1,e),onDown:l||n?void 0:e=>Z(1,e),onLeft:l||!n?void 0:e=>Z(-1,e),onRight:l||!n?void 0:e=>Z(1,e),onTab:i?v:void 0,onEnter:v}):void 0),[l,Z,v,t,n,d,i]),m}const Js=(0,a.X$)((e=>{let{isOpen:t,onClose:n,onInsertUserName:r,filteredUsers:l}=e;const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:c}=(0,H.Z)(t,void 0,void 0,!1),d=(0,a.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(0,s.Rd)().users.byId,a=n[e];a&&r(a,t)}),[r]),m=(0,a.I4)((e=>{d(e.id,!0)}),[d]),u=Gs({isActive:t,items:l,onSelect:m,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:n});(0,a.d4)((()=>{Os(".chat-item-clickable",u,o)}),[u]),(0,a.d4)((()=>{l&&!l.length&&n()}),[l,n]);const h=(0,P.Z)(null!=l&&l.length?l:void 0,i),Z=l&&!l.length?h:l;if(!i||Z&&!Z.length)return;const v=(0,X.Z)("MentionTooltip composer-tooltip custom-scroll",c);return a.ZP.createElement("div",{className:v,ref:o},null==Z?void 0:Z.map(((e,t)=>{let{id:n}=e;return a.ZP.createElement(Ae.Z,{key:n,className:"chat-item-clickable scroll-item",onClick:()=>d(n),focus:u===t},a.ZP.createElement(Fe.Z,{userId:n,avatarSize:"small",withUsername:!0}))})))}));var Xs=n(9830);const zs=(0,a.X$)((e=>{let{chatId:t,threadId:n,attachments:s,caption:r,isReady:l,currentUserId:i,groupChatMembers:c,recentEmojis:d,baseEmojiKeywords:m,emojiKeywords:u,addRecentEmoji:Z,onCaptionUpdate:v,onSend:g,onFileAppend:p,onClear:E}=e;const f=(0,Ls.Y)(r),b=(0,a.sO)(),I=(0,P.Z)(s),y=s.length?s:I,N=Boolean(s.length),[k,S,w]=(0,ye.Z)(),M=Boolean(y&&y.every((e=>e.quick))),T=(0,h.Z)(),{isMentionTooltipOpen:A,closeMentionTooltip:L,insertMention:F,mentionFilteredUsers:B}=(0,Rs.Z)(N,f,v,o.nY,c,void 0,i),{isEmojiTooltipOpen:$,closeEmojiTooltip:x,filteredEmojis:D,insertEmoji:O}=(0,As.Z)(N,f,d,o.nY,v,m,u,!l);(0,a.d4)((()=>N?(0,C.Z)(E):void 0),[N,E]);const U=(0,a.I4)((()=>{N&&g()}),[N,g]),G=(0,a.I4)((e=>{e.preventDefault(),w();const{dataTransfer:{files:t}}=e;if(null!=t&&t.length){const e=M?Array.from(t).filter((e=>e.type&&o.dI.has(e.type))):Array.from(t);p(e,M)}}),[M,p,w]);if(!y)return;const J=y.every((e=>o.oG.has(e.mimeType))),X=y.every((e=>o.wG.has(e.mimeType))),z=y.every((e=>e.mimeType.startsWith("audio/")));let _="";return _=T(J?"PreviewSender.SendPhoto":X?"PreviewSender.SendVideo":z?"PreviewSender.SendAudio":"PreviewSender.SendFile",y.length,"i"),a.ZP.createElement(Me.Z,{isOpen:N,onClose:E,header:function(){if(y)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:T.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:E},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},_),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:U},T("Send")))}(),className:"AttachmentModal "+(k?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:S,onDrop:G,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),b.current&&(window.clearTimeout(b.current),b.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(b.current=window.setTimeout(w,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),w())},"data-attach-description":T("Preview.Dragging.AddItems",10)},M?a.ZP.createElement("div",{className:"media-wrapper custom-scroll"},y.map((e=>e.mimeType.startsWith("image/")?a.ZP.createElement("img",{src:e.blobUrl,alt:""}):a.ZP.createElement("video",{src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0})))):a.ZP.createElement("div",{className:"document-wrapper custom-scroll"},y.map((e=>a.ZP.createElement(Fs.Z,{name:e.filename,extension:(0,Ts.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(Js,{isOpen:A,onClose:L,onInsertUserName:F,filteredUsers:B}),a.ZP.createElement(Xs.Z,{isOpen:$,emojis:D,onClose:x,onEmojiSelect:O,addRecentEmoji:Z}),a.ZP.createElement(Bs.Z,{id:"caption-input-text",chatId:t,threadId:n,isAttachmentModalInput:!0,html:r,editableInputId:o.nY,placeholder:T("Caption"),onUpdate:v,onSend:g,canAutoFocus:Boolean(l&&s.length)}))))}));var _s=n(3099);const Ys=(0,a.X$)((e=>{let{isOpen:t,onSend:n,onClear:s}=e;const r=(0,a.sO)(null),l=(0,a.sO)(null),o=(0,a.sO)(null),[i,c]=(0,a.eJ)(""),[d,m]=(0,a.eJ)([""]),[u,Z]=(0,a.eJ)(!0),[v,P]=(0,a.eJ)(!1),[g,p]=(0,a.eJ)(!1),[E,f]=(0,a.eJ)(),[b,I]=(0,a.eJ)(),[y,N]=(0,a.eJ)(!1),k=(0,h.Z)(),S=(0,a.I4)((e=>{t&&e.current&&e.current.focus()}),[t]);(0,a.d4)((()=>t?(0,C.Z)(s):void 0),[t,s]),(0,a.d4)((()=>{t||(c(""),m([""]),Z(!0),P(!1),p(!1),f(""),I(""),N(!1))}),[t]),(0,a.d4)((()=>S(r)),[S,t]),(0,a.bt)((()=>{const e=o.current;e&&E!==e.innerHTML&&(e.innerHTML=E)}),[E]);const w=(0,a.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];m([...e,""]),requestAnimationFrame((()=>{const e=l.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),M=(0,a.I4)((()=>{if(N(!1),!t)return;const e=i.trim().substring(0,255),a=d.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!e||a.length<2)return c(e),a.length?a.length<2?w(a):m(a):w(),void N(!0);if(g&&(!b||!a[Number(b)]))return void N(!0);const s={summary:{question:e,answers:a.map(((e,t)=>({text:e.trim(),option:String(t),...String(t)===b&&{correct:!0}}))),...!u&&{isPublic:!0},...v&&{multipleChoice:!0},...g&&{quiz:!0}}};if(g){const{text:e,entities:t}=E&&(0,_s.Z)(E.substring(0,200))||{};s.quiz={correctAnswers:[b],...e&&{solution:e},...t&&{solutionEntities:t}}}n(s)}),[t,i,d,g,b,u,v,n,w,E]),T=(0,a.I4)(((e,t)=>{const n=[...d];n[e]=t,n[n.length-1].trim().length&&n.length<10?w(n):m(n)}),[d,w]),A=(0,a.I4)((e=>{const t=[...d];t.splice(e,1),m(t),requestAnimationFrame((()=>{l.current&&l.current.classList.toggle("overflown",l.current.scrollHeight>320)}))}),[d]),L=(0,a.I4)((e=>{I(e)}),[I]),F=(0,a.I4)((e=>{Z(e.target.checked)}),[]),B=(0,a.I4)((e=>{P(e.target.checked)}),[]),$=(0,a.I4)((e=>{p(e.target.checked)}),[]),x=(0,a.I4)((e=>{13===e.keyCode&&M()}),[M]),D=(0,a.I4)((()=>{if(y&&!i.trim().length)return k("lng_polls_choose_question")}),[y,k,i]),O=(0,a.I4)((e=>{const t=d.map((e=>e.trim())).filter((e=>e.length));if(y&&t.length<2&&!d[e].trim().length)return k("lng_polls_choose_answers")}),[y,k,d]);function U(){return d.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(Te.Z,{label:t!==d.length-1||10===d.length?k("OptionHint"):k("CreatePoll.AddOption"),error:O(t),value:e,onChange:e=>T(t,e.currentTarget.value),onKeyPress:x}),t!==d.length-1&&a.ZP.createElement(R.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:k("Delete"),onClick:()=>A(t)},a.ZP.createElement("i",{className:"icon-close"})))))}return a.ZP.createElement(Me.Z,{isOpen:t,onClose:s,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:s},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},k("NewPoll")),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:M},k("Create"))),className:"PollModal"},a.ZP.createElement(Te.Z,{ref:r,label:k("AskAQuestion"),value:i,error:D(),onChange:e=>c(e.currentTarget.value),onKeyPress:x}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:l},a.ZP.createElement("h3",{className:"options-header"},k("PollOptions")),y&&function(){const e=d.map((e=>e.trim())).filter((e=>e.length));return g&&(!b||!e[Number(b)])&&a.ZP.createElement("p",{className:"error"},k("lng_polls_choose_correct"))}(),g?a.ZP.createElement(at.Z,{name:"correctOption",options:U().map(((e,t)=>({value:String(t),label:e,hidden:t===d.length-1}))),onChange:L}):U()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},a.ZP.createElement(fn.Z,{label:k("PollAnonymous"),checked:u,onChange:F}),a.ZP.createElement(fn.Z,{label:k("PollMultiple"),checked:v,disabled:g,onChange:B}),a.ZP.createElement(fn.Z,{label:k("PollQuiz"),checked:g,disabled:v,onChange:$}),g&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},k("lng_polls_solution_title")),a.ZP.createElement("div",{ref:o,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>f(e.currentTarget.innerHTML)}),a.ZP.createElement("div",{className:"note"},k("CreatePoll.ExplanationInfo")))))}));var Hs=n(6503),Vs=n(4284),qs=n(1367);const js=(0,a.X$)((e=>{let{emoji:t,focus:n,onClick:s}=e;const r=(0,a.I4)((e=>{e.preventDefault(),s(t.native,t.id)}),[t,s]);return a.ZP.createElement("div",{className:"EmojiButton "+(n?"focus":""),onMouseDown:r,title:`:${t.names[0]}:`},i.op?t.native:a.ZP.createElement("img",{src:`./img-apple-64/${t.image}.png`,alt:"",loading:"lazy"}))})),Ks=(0,a.X$)((e=>{let{category:t,index:n,allEmojis:s,observeIntersection:r,shouldRender:l,onEmojiSelect:o}=e;const c=(0,a.sO)(null);(0,Bt._N)(c,r);const d=(0,$n.Z)(l),m=(0,h.Z)(),u=i.wB?Math.floor((b.Z.get().width-8)/44):9,Z=44*Math.ceil(t.emojis.length/u);return a.ZP.createElement("div",{ref:c,key:t.id,id:`emoji-category-${n}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},m("recent"===t.id?"RecentStickers":`Emoji${n}`)),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",d),style:`height: ${Z}px;`,dir:m.isRtl?"rtl":void 0},l&&t.emojis.map((e=>{const t=s[e];if(!t)return;const n="id"in t?t:t[1];return a.ZP.createElement(js,{key:n.id,emoji:n,onClick:o})}))))})),Ws={recent:"icon-recent",people:"icon-smile",nature:"icon-animals",foods:"icon-eats",activity:"icon-sport",places:"icon-car",objects:"icon-lamp",symbols:"icon-language",flags:"icon-flag"},Qs=[];let er,tr,nr;const ar=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["recentEmojis"])))((e=>{let{className:t,onEmojiSelect:s,recentEmojis:r}=e;const l=(0,a.sO)(null),c=(0,a.sO)(null),[d,m]=(0,a.eJ)(),[u,Z]=(0,a.eJ)(),[v,P]=(0,a.eJ)(0),{observe:g}=(0,Bt.S1)({rootRef:l,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const n=Number(t.replace("emoji-category-",""));Qs[n]=e.isIntersecting}));const t=Qs.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&P(t[Math.floor(t.length/2)].index)}));(0,Ct.Z)(c.current,!i.wB),(0,a.d4)((()=>{if(!d)return;const e=c.current;if(!e)return;const t=42*v-e.offsetWidth/2+21;(0,qs.Z)(e,t)}),[d,v]);const p=(0,h.Z)(),E=(0,a.Ye)((()=>{if(!d)return Zt.D;const e=[...d];return null!=r&&r.length&&e.unshift({id:"recent",name:p("RecentStickers"),emojis:r}),e}),[d,p,r]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{m(nr.categories),Z(nr.emojis)};nr?e():async function(){return er||(er=n.e(501).then(n.t.bind(n,7501,19)),tr=(await er).default,nr=(0,Vs.NM)(tr)),er}().then(e)}),200)}),[]);const C=(0,a.I4)((e=>{P(e);const t=document.getElementById(`emoji-category-${e}`);(0,Ds.Z)(l.current,t,"start",50,800)}),[]),f=(0,a.I4)(((e,t)=>{s(e,t)}),[s]),b=(0,Ft.Z)([],o.kU),I=(0,X.Z)("EmojiPicker",t);return u&&b?a.ZP.createElement("div",{className:I},a.ZP.createElement("div",{ref:c,className:"EmojiPicker-header",dir:p.isRtl?"rtl":""},E.map((function(e,t){const n=Ws[e.id];return n&&a.ZP.createElement(R.Z,{className:"symbol-set-button "+(t===v?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>C(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:l,className:(0,X.Z)("EmojiPicker-main no-selection",i.$b?"no-scrollbar":"custom-scroll")},E.map(((e,t)=>a.ZP.createElement(Ks,{category:e,index:t,allEmojis:u,observeIntersection:g,shouldRender:v>=t-1&&v<=t+1,onEmojiSelect:f}))))):a.ZP.createElement("div",{className:I},a.ZP.createElement(we.Z,null))})));var sr=n(6389);const rr=i.wB?8:16,lr=(0,a.X$)((e=>{let{stickerSet:t,loadAndPlay:n,index:s,observeIntersection:r,shouldRender:l,onStickerSelect:c,onStickerUnfave:d}=e;const m=(0,a.sO)(null);(0,Bt._N)(m,r);const u=(0,$n.Z)(l),h=i.wB?Math.floor((b.Z.get().width-8)/(o.Q+rr)):5,Z=Math.ceil(t.count/h)*(o.Q+rr);return a.ZP.createElement("div",{ref:m,key:t.id,id:`sticker-set-${s}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name"},t.title),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",u),style:`height: ${Z}px;`},l&&t.stickers&&t.stickers.map((e=>a.ZP.createElement(On.Z,{key:e.id,sticker:e,size:o.Q,observeIntersection:r,noAnimate:!n,onClick:c,clickArg:e,onUnfaveClick:"favorite"===t.id?d:void 0})))))})),or=[],ir=(0,a.X$)((0,s.c$)((e=>{const{setsById:t,added:n,recent:a,favorite:s}=e.stickers;return{recentStickers:a.stickers,favoriteStickers:s.stickers,stickerSetsById:t,addedSetIds:n.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers}}))((e=>{let{chatId:t,threadId:n,className:r,loadAndPlay:l,canSendStickers:c,recentStickers:d,favoriteStickers:m,addedSetIds:u,stickerSetsById:Z,shouldPlay:v,onStickerSelect:P}=e;const{loadRecentStickers:g,addRecentSticker:p,unfaveSticker:E}=(0,s.uC)(),C=(0,a.sO)(null),f=(0,a.sO)(null),[b,I]=(0,a.eJ)(0),y=(0,sr.Z)(t,n),{observe:N}=(0,Bt.S1)({rootRef:C,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("sticker-set-"))return;const n=Number(t.replace("sticker-set-",""));or[n]=e.isIntersecting}));const t=or.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&I(t[Math.floor(t.length/2)].index)})),{observe:k}=(0,Bt.S1)({rootRef:f}),S=(0,h.Z)(),w=Boolean(u),M=(0,a.Ye)((()=>u?[{id:"recent",title:S("RecentStickers"),stickers:d,count:d.length},{id:"favorite",title:S("FavoriteStickers"),stickers:m,count:m.length},...u.map((e=>Z[e])).filter(Boolean)]:Zt.D),[u,S,d,m,Z]),T=(0,a.Ye)((()=>w&&0===M.filter((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.length})).length),[M,w]);(0,a.d4)((()=>{l&&(g(),y({type:"chooseSticker"}))}),[l,g,y]),(0,Ct.Z)(f.current),(0,a.d4)((()=>{if(!w)return;const e=f.current;if(!e)return;const t=52*b-(e.offsetWidth/2-26);(0,qs.Z)(e,t)}),[w,b]);const A=(0,a.I4)((e=>{I(e);const t=document.getElementById(`sticker-set-${e}`);(0,Ds.Z)(C.current,t,"start",void 0,500)}),[]),L=(0,a.I4)((e=>{P(e),p({sticker:e})}),[p,P]),F=(0,a.I4)((e=>{E({sticker:e})}),[E]),B=(0,a.I4)((()=>{y({type:"chooseSticker"})}),[y]),$=(0,Ft.Z)([],o.Y),x=(0,X.Z)("StickerPicker",r);return w&&$&&!T&&c?a.ZP.createElement("div",{className:x},a.ZP.createElement("div",{ref:f,className:"StickerPicker-header no-selection no-scrollbar"},M.map((function(e,t){var n;const s=null===(n=e.stickers)||void 0===n?void 0:n[0],r=(0,X.Z)("symbol-set-button sticker-set-button",t===b&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!s?a.ZP.createElement(R.Z,{key:e.id,className:r,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>A(t)},"recent"===e.id?a.ZP.createElement("i",{className:"icon-recent"}):"favorite"===e.id?a.ZP.createElement("i",{className:"icon-favorite"}):e.isLottie?a.ZP.createElement(xn,{stickerSet:e,observeIntersection:k}):a.ZP.createElement(Dn,{stickerSet:e,observeIntersection:k})):a.ZP.createElement(On.Z,{key:e.id,sticker:s,size:o.DC,title:e.title,className:r,observeIntersection:k,onClick:A,clickArg:t})}))),a.ZP.createElement("div",{ref:C,onMouseMove:B,className:(0,X.Z)("StickerPicker-main no-selection",i.$b?"no-scrollbar":"custom-scroll")},M.map(((e,t)=>a.ZP.createElement(lr,{key:e.id,stickerSet:e,loadAndPlay:Boolean(v&&l),index:t,observeIntersection:N,shouldRender:b>=t-1&&b<=t+1,onStickerSelect:L,onStickerUnfave:F}))))):a.ZP.createElement("div",{className:x},c?T?a.ZP.createElement("div",{className:"picker-disabled"},S("NoStickers")):a.ZP.createElement(we.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},S("ErrorSendRestrictedStickersAll")))})));var cr=n(386);function dr(){return dr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},dr.apply(this,arguments)}const mr=(0,a.X$)((e=>{var t,n;let{gif:s,observeIntersection:l,isDisabled:o,className:i,onClick:c}=e;const d=(0,a.sO)(null),m=(0,a.sO)(null),u=Boolean(null===(t=s.thumbnail)||void 0===t?void 0:t.dataUri),h=`gif${s.id}`,v=(0,Bt.Op)(d,l)&&!o,P=(0,Z.Z)(`${h}?size=m`,!v,r.IU.BlobUrl),g=(0,ea.Z)(null===(n=s.thumbnail)||void 0===n?void 0:n.dataUri,Boolean(P)),p=(0,Z.Z)(h,!v,r.IU.BlobUrl),E=Boolean(v&&p),{isBuffered:C,bufferingHandlers:f}=(0,_.Z)(!0),b=v&&!C,I=v&&C;(0,V.Z)(m,[E]);const y=(0,a.I4)((()=>c({...s,blobUrl:p})),[c,s,p]),N=(0,X.Z)("GifButton",s.width&&s.height&&s.width<s.height?"vertical":"horizontal",h,i);return a.ZP.createElement("div",{ref:d,className:N,onMouseDown:cr.b,onClick:y},u&&a.ZP.createElement("canvas",{ref:g,className:"thumbnail",style:I?"display: none;":void 0}),P&&!I&&a.ZP.createElement("img",{src:P,alt:"",className:"preview"}),E&&a.ZP.createElement("video",dr({ref:m,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},f),a.ZP.createElement("source",{src:p})),b&&a.ZP.createElement(J.Z,{color:P||u?"white":"black"}))})),ur=(0,a.X$)((0,s.c$)((e=>({savedGifs:e.gifs.saved.gifs})))((e=>{let{className:t,loadAndPlay:n,canSendGifs:r,savedGifs:l,onGifSelect:c}=e;const{loadSavedGifs:d}=(0,s.uC)(),m=(0,a.sO)(null),{observe:u}=(0,Bt.S1)({rootRef:m,debounceMs:300});(0,a.d4)((()=>{n&&d()}),[n,d]);const h=(0,Ft.Z)([],o.Y);return a.ZP.createElement("div",{ref:m,className:(0,X.Z)("GifPicker",t,i.$b?"no-scrollbar":"custom-scroll")},r?h&&l&&l.length?l.map((e=>a.ZP.createElement(mr,{key:e.id,gif:e,observeIntersection:u,isDisabled:!n,onClick:c}))):h&&l?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(we.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))})));let hr;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(hr||(hr={}));const Zr=Object.values(hr).filter((e=>"string"==typeof e)),vr={[hr.Emoji]:"icon-smile",[hr.Stickers]:"icon-stickers",[hr.GIFs]:"icon-gifs"},Pr=(0,a.X$)((e=>{let{activeTab:t,onSwitchTab:n,onRemoveSymbol:s,onSearchOpen:r}=e;const l=(0,h.Z)();function o(e){return a.ZP.createElement(R.Z,{className:"symbol-tab-button "+(t===e?"activated":""),onClick:()=>n(e),ariaLabel:Zr[e],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:vr[e]}))}const i=(0,a.I4)((()=>{r(t===hr.Stickers?"stickers":"gifs")}),[t,r]);return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:l.isRtl?"rtl":void 0},t!==hr.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-search-button",ariaLabel:t===hr.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:i},a.ZP.createElement("i",{className:"icon-search"})),o(hr.Emoji),o(hr.Stickers),o(hr.GIFs),t===hr.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-delete-button",onClick:s,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon-delete-left"})))}));let gr=!1;const pr=(0,a.X$)((0,s.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown})))((e=>{let{chatId:t,threadId:n,isOpen:s,canSendStickers:r,canSendGifs:l,isLeftColumnShown:o,onLoad:c,onClose:d,onEmojiSelect:m,onStickerSelect:u,onGifSelect:Z,onRemoveSymbol:v,onSearchOpen:P,addRecentEmoji:g}=e;const[p,E]=(0,a.eJ)(0),[C,f]=(0,a.eJ)([]),[b,I]=(0,Hs.Z)(s,d,void 0,i.wB),{shouldRender:y,transitionClassNames:N}=(0,H.Z)(s,d,!1,!1);!gr&&s&&(gr=!0),(0,a.d4)((()=>{c()}),[c]),(0,a.bt)((()=>{if(i.wB)return s&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{s&&(0,G.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[s]);const k=(0,a.sO)(C);k.current=C,(0,a.d4)((()=>{k.current.length&&(k.current.forEach((e=>{g({emoji:e})})),f([]))}),[s,p,g]);const S=(0,a.I4)(((e,t)=>{f((e=>[...e,t])),m(e)}),[m]),w=(0,a.I4)((e=>{d(),P(e)}),[d,P]),M=(0,a.I4)((e=>{u(e,!0)}),[u]),T=(0,h.Z)();function A(e,o){switch(p){case hr.Emoji:return a.ZP.createElement(ar,{className:"picker-tab",onEmojiSelect:S});case hr.Stickers:return a.ZP.createElement(ir,{className:"picker-tab",loadAndPlay:!!r&&s&&(e||o),canSendStickers:r,onStickerSelect:M,chatId:t,threadId:n});case hr.GIFs:return a.ZP.createElement(ur,{className:"picker-tab",loadAndPlay:!!l&&s&&(e||o),canSendGifs:l,onGifSelect:Z})}}const F=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},gr&&a.ZP.createElement(L.Z,{name:"slide",activeKey:p,renderCount:Zr.length},A)),i.wB&&a.ZP.createElement(R.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:T("Close"),className:"symbol-close-button",size:"tiny",onClick:d},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Pr,{activeTab:p,onSwitchTab:E,onRemoveSymbol:v,onSearchOpen:w}));if(i.wB){if(!y)return;const e=(0,X.Z)("SymbolMenu mobile-menu",N,!o&&"middle-column-open");return a.ZP.createElement(Ns.Z,null,a.ZP.createElement("div",{className:e},F))}return a.ZP.createElement(Ps.Z,{isOpen:s,positionX:"left",positionY:"bottom",onClose:d,className:"SymbolMenu",onCloseAnimationEnd:d,onMouseEnter:i.$b?void 0:b,onMouseLeave:i.$b?void 0:I,noCloseOnBackdrop:!i.$b},F)}))),Er=(0,a.X$)((e=>{let{isOpen:t,canAttachMedia:n,canAttachPolls:s,onFileSelect:r,onPollCreate:l,onClose:c}=e;const[d,m]=(0,Hs.Z)(t,c),u=(0,a.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&r(Array.from(n),t)}),[r]),Z=(0,a.I4)((()=>{Yn(Array.from(o.dI).join(","),(e=>u(e,!0)))}),[u]),v=(0,a.I4)((()=>{Yn("*",(e=>u(e,!1)))}),[u]),P=(0,h.Z)();return a.ZP.createElement(Ps.Z,{isOpen:t,autoClose:!0,positionX:"right",positionY:"bottom",onClose:c,className:"AttachMenu fluid",onCloseAnimationEnd:c,onMouseEnter:i.$b?void 0:d,onMouseLeave:i.$b?void 0:m,noCloseOnBackdrop:!i.$b},!n&&a.ZP.createElement(B.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),n&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(B.Z,{icon:"photo",onClick:Z},P("AttachmentMenu.PhotoOrVideo")),a.ZP.createElement(B.Z,{icon:"document",onClick:v},P("AttachDocument"))),s&&a.ZP.createElement(B.Z,{icon:"poll",onClick:l},P("Poll")))})),Cr=(0,a.X$)((e=>{let{withAvatar:t,focus:n,botCommand:s,bot:r,onClick:l}=e;return a.ZP.createElement(Ae.Z,{key:s.command,className:(0,X.Z)("BotCommand chat-item-clickable scroll-item",t&&"with-avatar"),multiline:!0,onClick:()=>l(s),focus:n},t&&a.ZP.createElement(ge.Z,{size:"small",user:r}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",s.command),a.ZP.createElement("span",{className:"subtitle"},(0,Pe.Z)(s.description))))})),fr=(0,a.X$)((0,s.c$)((e=>({usersById:e.users.byId})))((e=>{let{usersById:t,isOpen:n,withUsername:r,botCommands:l,onClick:o,onClose:i}=e;const{sendBotCommand:c}=(0,s.uC)(),d=(0,a.sO)(null),{shouldRender:m,transitionClassNames:u}=(0,H.Z)(n,void 0,void 0,!1),h=(0,a.I4)((e=>{let{botId:n,command:a}=e;const s=t[n];c({command:`/${a}${r&&s?`@${s.username}`:""}`,botId:n}),o()}),[o,c,t,r]),Z=Gs({isActive:n,items:l,onSelect:h,onClose:i});(0,a.d4)((()=>{l&&!l.length&&i()}),[l,i]),(0,a.d4)((()=>{Os(".chat-item-clickable",Z,d)}),[Z]);const v=(0,P.Z)(l&&l.length?l:void 0,m),g=l&&!l.length?v:l;if(!m||g&&!g.length)return;const p=(0,X.Z)("BotCommandTooltip composer-tooltip custom-scroll",u);return a.ZP.createElement("div",{className:p,ref:d},g&&g.map(((e,n)=>a.ZP.createElement(Cr,{key:`${e.botId}_${e.command}`,botCommand:e,bot:t[e.botId],withAvatar:!0,onClick:h,focus:Z===n}))))}))),br=(0,a.X$)((e=>{let{isOpen:t,botCommands:n,onClose:r}=e;const{sendBotCommand:l}=(0,s.uC)(),[o,c]=(0,Hs.Z)(t,r,void 0,i.wB),d=(0,a.I4)((e=>{l({command:`/${e.command}`,botId:e.botId}),r()}),[r,l]);return a.ZP.createElement(Ps.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:r,className:"BotCommandMenu",onCloseAnimationEnd:r,onMouseEnter:i.$b?void 0:o,onMouseLeave:i.$b?void 0:c,noCloseOnBackdrop:!i.$b},n.map((e=>a.ZP.createElement(Cr,{key:e.command,botCommand:e,onClick:d}))))})),Ir=(0,a.X$)((0,s.c$)((e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}}))((e=>{let{chatId:t,threadId:n,isOpen:r,onStickerSelect:l,stickers:c}=e;const{clearStickersForEmoji:d}=(0,s.uC)(),m=(0,a.sO)(null),{shouldRender:u,transitionClassNames:h}=(0,H.Z)(r,void 0,void 0,!1),Z=(0,P.Z)(c,!0),v=c||Z,g=(0,sr.Z)(t,n),{observe:p}=(0,Bt.S1)({rootRef:m,throttleMs:200});(0,a.d4)((()=>r?(0,C.Z)(d):void 0),[r,d]);const E=(0,X.Z)("StickerTooltip composer-tooltip custom-scroll",h,!(null!=v&&v.length)&&"hidden");return a.ZP.createElement("div",{ref:m,className:E,onMouseEnter:i.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:i.$b?void 0:()=>{document.body.classList.remove("no-select")},onMouseMove:()=>{g({type:"chooseSticker"})}},u&&v?v.map((e=>a.ZP.createElement(On.Z,{key:e.id,sticker:e,size:o.Q,observeIntersection:p,onClick:l,clickArg:e}))):u?a.ZP.createElement(we.Z,null):void 0)}))),yr=(0,a.X$)((e=>{let{isOpen:t,onSilentSend:n,onScheduleSend:s,onClose:r,onCloseAnimationEnd:l}=e;const[o,c]=(0,Hs.Z)(t,r),d=(0,h.Z)();return a.ZP.createElement(Ps.Z,{isOpen:t,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:r,onCloseAnimationEnd:l,onMouseEnter:i.$b?void 0:o,onMouseLeave:i.$b?void 0:c,noCloseOnBackdrop:!i.$b},n&&a.ZP.createElement(B.Z,{icon:"mute",onClick:n},d("SendWithoutSound")),s&&a.ZP.createElement(B.Z,{icon:"schedule",onClick:s},d("ScheduleMessage")))}));var Nr=n(2420),kr=n(3283),Sr=n(2678);const wr=(0,a.X$)((e=>{let{isOpen:t,emojis:n,onClose:s,onEmojiSelect:r,addRecentEmoji:l}=e;const o=(0,a.sO)(null),{shouldRender:c,transitionClassNames:d}=(0,H.Z)(t,void 0,void 0,!1),m=(0,Sr.Z)(n.length?n:void 0,350)||[],u=(0,a.I4)((e=>{r(e.native),l({emoji:e.id})}),[l,r]),h=(0,a.I4)(((e,t)=>{r(e),l({emoji:t})}),[l,r]),Z=Gs({isActive:t,isHorizontal:!0,items:n,onSelect:u,onClose:s});(0,a.d4)((()=>{!function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=$s(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const r=a[0];if(!a.includes(e)||e===r&&!xs(n,s[r],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,qs.Z)(n,t)}}(Z,o)}),[Z]);const v=(0,X.Z)("EmojiTooltip composer-tooltip custom-scroll-x",d);return a.ZP.createElement("div",{ref:o,className:v,onMouseEnter:i.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:i.$b?void 0:()=>{document.body.classList.remove("no-select")}},c&&m?m.map(((e,t)=>a.ZP.createElement(js,{key:e.id,emoji:e,focus:Z===t,onClick:h}))):c?a.ZP.createElement(we.Z,null):void 0)})),Mr=(0,a.X$)((e=>{let{title:t,description:n,thumbnail:s,thumbUrl:r,focus:l,transitionClassNames:o="",onClick:i}=e,c="";const d=(0,Z.Z)(s?`webDocument:${s.url}`:void 0);return r=r||d,r?c=a.ZP.createElement("img",{src:r,className:o,alt:"",decoding:"async",draggable:"false"}):t&&(c=(0,ot.Xv)(t,1)),a.ZP.createElement(Ae.Z,{focus:l,className:"BaseResult chat-item-clickable",onMouseDown:cr.b,onClick:i},a.ZP.createElement("span",{className:"thumb"},"string"==typeof c?(0,Pe.Z)(c):c),a.ZP.createElement("div",{className:"content-inner"},t&&a.ZP.createElement("div",{className:"title"},t),n&&a.ZP.createElement("div",{className:"description"},n)))})),Tr=(0,a.X$)((e=>{var t;let n,s,r,{focus:l,isForGallery:o,inlineResult:i,onClick:c}=e;"photo"in i&&(n=i.photo),"thumbnail"in i&&(s=i.thumbnail),"webThumbnail"in i&&o&&(r=i.webThumbnail);const d=(0,Z.Z)(r?`webDocument:${r.url}`:void 0),m=(0,Z.Z)(n&&`photo${n.id}?size=m`),u=(0,$n.Z)(m),h=(0,a.I4)((()=>{c(i)}),[i,c]);var v,P;if(o)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:h},a.ZP.createElement("img",{src:(null===(v=n)||void 0===v||null===(P=v.thumbnail)||void 0===P?void 0:P.dataUri)||d,alt:""}),a.ZP.createElement("img",{src:m,className:(0,X.Z)("full-media",u),alt:""}));const{title:g,description:p}=i;return a.ZP.createElement(Mr,{focus:l,thumbUrl:m||(null===(t=s)||void 0===t?void 0:t.dataUri)||d,transitionClassNames:u,title:g,description:p,onClick:h})})),Rr=(0,a.X$)((e=>{let{focus:t,inlineResult:n,onClick:s}=e;const{title:r,url:l,description:o,webThumbnail:i}=n,c=(0,a.I4)((()=>{s(n)}),[n,s]);return a.ZP.createElement(Mr,{focus:t,thumbnail:i,title:r||l,description:o,onClick:c})})),Ar=(0,a.X$)((e=>{let{inlineResult:t,observeIntersection:n,onClick:s}=e;const{gif:r}=t,l=(0,a.I4)((()=>{s(t)}),[t,s]);if(r)return a.ZP.createElement(mr,{gif:r,observeIntersection:n,className:"chat-item-clickable",onClick:l})})),Lr=(0,a.X$)((e=>{let{inlineResult:t,observeIntersection:n,onClick:s}=e;const{sticker:r}=t;if(r)return a.ZP.createElement(On.Z,{sticker:r,size:o.zq,observeIntersection:n,title:r.emoji,className:"chat-item-clickable",onClick:s,clickArg:t})})),Fr=(0,G.P2)((e=>e()),500,!0),Br=(0,a.X$)((e=>{let{isOpen:t,botId:n,isGallery:r,inlineBotResults:o,switchPm:c,loadMore:d,onClose:m,onSelectResult:u}=e;const{openChat:h,startBot:Z}=(0,s.uC)(),v=(0,a.sO)(null),{shouldRender:g,transitionClassNames:p}=(0,H.Z)(t,void 0,void 0,!1),{observe:E}=(0,Bt.S1)({rootRef:v,debounceMs:200,isDisabled:!t}),C=(0,a.I4)((e=>{let{direction:t}=e;t===l.Uq.Backwards&&Fr(d)}),[d]),f=Gs({isActive:t,shouldRemoveSelectionOnReset:r,noArrowNavigation:r,items:o,onSelect:u,onClose:m});(0,a.d4)((()=>{Os(".chat-item-clickable",f,v)}),[f]);const b=(0,a.I4)((()=>{h({id:n}),Z({botId:n,param:c.startParam})}),[n,h,Z,c]),I=(0,P.Z)(null!=o&&o.length?o:void 0,g),y=o&&!o.length?I:o;if(!g||!(null!=y&&y.length||c))return;const N=(0,X.Z)("InlineBotTooltip composer-tooltip",i.$b?"no-scrollbar":"custom-scroll",r&&"gallery",p);return a.ZP.createElement(Re.Z,{ref:v,className:N,items:y,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:C,sensitiveArea:160},c&&a.ZP.createElement(Ae.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:b},a.ZP.createElement("span",{className:"title"},c.text)),(null==y?void 0:y.length)&&y.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(Ar,{key:e.id,inlineResult:e,observeIntersection:E,onClick:u});case"photo":return a.ZP.createElement(Tr,{key:e.id,isForGallery:r,inlineResult:e,onClick:u});case"sticker":return a.ZP.createElement(Lr,{key:e.id,inlineResult:e,observeIntersection:E,onClick:u});case"video":case"file":case"game":return a.ZP.createElement(Tr,{key:e.id,focus:f===t,inlineResult:e,onClick:u});case"article":case"audio":return a.ZP.createElement(Rr,{key:e.id,focus:f===t,inlineResult:e,onClick:u});default:return}})))})),$r=(0,a.X$)((e=>{let{isOpen:t,onClose:n,chatId:r,selectedSendAsId:l,sendAsIds:o}=e;const{saveDefaultSendAs:c}=(0,s.uC)(),d=(0,s.Rd)().users.byId,m=(0,s.Rd)().chats.byId,u=(0,h.Z)(),Z=(0,a.sO)(null),[v,P,p]=(0,Hs.Z)(t,n,void 0);(0,a.d4)((()=>{t&&p()}),[t,p]);const E=(0,a.I4)((e=>{n(),c({chatId:r,sendAsId:e})}),[r,n,c]),C=Gs({isActive:t,items:o,onSelect:E,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:n});return(0,a.d4)((()=>{Os(".chat-item-clickable",C,Z)}),[C]),(0,a.d4)((()=>{o&&!o.length&&n()}),[o,n]),a.ZP.createElement(Ps.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:n,className:"SendAsMenu",onCloseAnimationEnd:n,onMouseEnter:i.$b?void 0:v,onMouseLeave:i.$b?void 0:P,noCloseOnBackdrop:!i.$b},a.ZP.createElement("div",{className:"send-as-title",dir:"auto"},u("SendMessageAsTitle")),d&&m&&(null==o?void 0:o.map(((e,t)=>{const n=(0,g.YC)(e)?d[e]:void 0,s=n?void 0:m[e],r=n?(0,g.Js)(n):null==s?void 0:s.title;return a.ZP.createElement(Ae.Z,{key:e,className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>E(e),focus:C===t},a.ZP.createElement(ge.Z,{size:"small",user:n,chat:s,className:(0,X.Z)(l===e&&"selected")}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,Pe.Z)(r))),a.ZP.createElement("span",{className:"subtitle"},n?u("VoipGroupPersonalAccount"):u("Subscribers",null==s?void 0:s.membersCount,"i"))))}))))}));var xr=n(6844);const Dr=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,p.Z1)(e,n),s=a&&(0,p.Zw)(e,a.id);if(!a||!s)return{};const{query:r,results:l}=(0,p.n5)(e)||{},{totalCount:o,foundIds:i}=l||{};return{chat:a,messagesById:s,query:r,totalCount:o,foundIds:i}}))((e=>{let{chatId:t,threadId:n,onClose:r,isActive:l,chat:o,messagesById:i,query:c,totalCount:d,foundIds:m}=e;const{searchTextMessagesLocal:Z,focusMessage:v}=(0,s.uC)(),P=(0,a.sO)(null),E=(0,h.Z)();(0,u.ZP)(l,r);const[C,f]=(0,Ne.Z)(Z,m),b=(0,a.Ye)((()=>c&&null!=C&&C.length&&i?C.map((e=>{const a=i[e];if(!a)return;const r=a.senderId?(0,p.dy)((0,s.Rd)(),a.senderId):void 0;let l;if(o&&(0,g.eA)(o))l=o;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;l=e&&t?(0,p.Z1)((0,s.Rd)(),t):void 0}else l=a.senderId?(0,p.Z1)((0,s.Rd)(),a.senderId):void 0;return{message:a,senderUser:r,senderChat:l,onClick:()=>v({chatId:t,threadId:n,messageId:e})}})).filter(Boolean):Zt.D),[c,C,i,o,v,t,n]),I=(0,ke.Z)(P,!0,(e=>{const t=null==b?void 0:b[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0),N=(null==C?void 0:C[0])===(null==m?void 0:m[0]);return a.ZP.createElement(Re.Z,{ref:P,className:"RightSearch custom-scroll",items:b,preloadBackwards:0,onLoadMore:f,onKeyDown:I},N&&a.ZP.createElement("p",{key:"helper-text",className:"helper-text",dir:"auto"},c?0!==d&&b.length?1===d?"1 message found":`${b.length&&(d||b.length)} messages found`:E("lng_search_no_results"):E("lng_dlg_search_for_messages")),b.map((e=>{let{message:t,senderUser:n,senderChat:s,onClick:r}=e;const l=s?(0,g.U)(E,s):(0,g.Js)(n),o=(0,y.e)(E,t,void 0,c);return a.ZP.createElement(Ae.Z,{key:t.id,teactOrderKey:-t.date,className:"chat-item-clickable search-result-message m-0",onClick:r},a.ZP.createElement(ge.Z,{chat:s,user:n}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},l&&(0,Pe.Z)(l)),a.ZP.createElement(xr.Z,{message:t})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},o)))})))})));var Or=n(9290);const Ur=(0,a.X$)((0,s.c$)(((e,t)=>{let{stickerSetId:n}=t;return{set:(0,p.Ny)(e,n),shouldPlay:(0,p.yB)(e)}}))((e=>{let{stickerSetId:t,observeIntersection:n,set:r,shouldPlay:l,isSomeModalOpen:i,onModalToggle:c}=e;const{loadStickers:d,toggleStickerSet:m}=(0,s.uC)(),u=(0,h.Z)(),Z=r&&Boolean(r.installedDate),v=Boolean(null==r?void 0:r.stickers),[P,g,p]=(0,ye.Z)();(0,Or.Z)((()=>{c(P)}),[P,c]);const E=(0,a.Ye)((()=>{if(!r)return[];const e=(r.covers||[]).map((e=>{let{id:t}=e;return t})),t=r.stickers?r.stickers.filter((t=>{let{id:n}=t;return!e.includes(n)})):[];return[...r.covers||[],...t].slice(0,5)}),[r]);(0,a.d4)((()=>{!v&&E.length<5&&d({stickerSetId:t})}),[v,E.length,d,t]);const C=(0,a.I4)((()=>{m({stickerSetId:t})}),[m,t]);if(!r)return;const f=E.length>0;return a.ZP.createElement("div",{key:r.id,className:"sticker-set",dir:u.isRtl?"rtl":void 0},a.ZP.createElement("div",{className:"sticker-set-header"},a.ZP.createElement("div",{className:"title-wrapper"},a.ZP.createElement("h3",{className:"title",dir:"auto"},r.title),a.ZP.createElement("p",{className:"count",dir:"auto"},u("Stickers",r.count,"i"))),a.ZP.createElement(R.Z,{className:Z?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:C},u(Z?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main"},!f&&a.ZP.createElement(J.Z,null),f&&E.map((e=>a.ZP.createElement(On.Z,{sticker:e,size:o.Y7,observeIntersection:n,noAnimate:!l||P||i,onClick:g})))),f&&a.ZP.createElement(Gn.Z,{isOpen:P,fromSticker:E[0],onClose:p}))}))),Gr=(0,G.P2)((e=>e()),6e4,!0),Jr=(0,a.X$)((0,s.c$)((e=>{const t=(0,p.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a}}))((e=>{let{onClose:t,isActive:n,query:r,featuredIds:l,resultIds:o}=e;const{loadFeaturedStickers:i}=(0,s.uC)(),c=(0,a.sO)(null),d=(0,h.Z)(),[m,Z]=(0,a.eJ)(!1),{observe:v}=(0,Bt.S1)({rootRef:c,throttleMs:200});return(0,a.d4)((()=>{Gr((()=>{i()}))})),(0,u.ZP)(n,t),a.ZP.createElement("div",{ref:c,className:"StickerSearch custom-scroll",dir:d.isRtl?"rtl":void 0},function(){if(void 0!==r)return!r&&l?l.map((e=>a.ZP.createElement(Ur,{key:e,stickerSetId:e,observeIntersection:v,isSomeModalOpen:m,onModalToggle:Z}))):o?o.length?o.map((e=>a.ZP.createElement(Ur,{key:e,stickerSetId:e,observeIntersection:v,isSomeModalOpen:m,onModalToggle:Z}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(we.Z,null)}())}))),Xr=(0,a.X$)((0,s.c$)((e=>{const t=(0,p.yN)(e),{query:n,results:a}=t||{},{chatId:s}=(0,p.Bt)(e)||{},r=s?(0,p.Z1)(e,s):void 0;return{query:n,results:a,chat:r,isChatWithBot:r?(0,p.xo)(e,r):void 0}}))((e=>{let{onClose:t,isActive:n,query:r,results:l,chat:o,isChatWithBot:c}=e;const{searchMoreGifs:d,sendMessage:m,setGifSearchQuery:Z}=(0,s.uC)(),v=(0,a.sO)(null),{observe:P}=(0,Bt.S1)({rootRef:v,debounceMs:300}),{canSendGifs:p}=(0,g.H5)(o,c),E=(0,a.I4)((e=>{p&&m({gif:e}),i.$b&&Z({query:void 0})}),[p,m,Z]),C=(0,h.Z)();(0,u.ZP)(n,t);const f=Boolean(void 0!==r&&l&&l.length);return a.ZP.createElement("div",{className:"GifSearch",dir:C.isRtl?"rtl":void 0},a.ZP.createElement(Re.Z,{ref:v,className:(0,X.Z)("gif-container custom-scroll",f&&"grid"),items:l,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:d},function(){if(void 0!==r)return l?l.length?l.map((e=>a.ZP.createElement(mr,{key:e.id,gif:e,observeIntersection:P,onClick:E}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},C("NoGIFsFound")):a.ZP.createElement(we.Z,null)}()))}))),zr=(0,a.X$)((0,s.c$)(((e,t)=>{let{answer:n}=t;const{voters:a,offsets:s}=e.pollResults;return{voters:null==a?void 0:a[n.option],offset:(null==s?void 0:s[n.option])||""}}))((e=>{let{chat:t,message:n,answer:r,answerVote:l,totalVoters:o,voters:i,offset:c}=e;const{loadPollOptionResults:d,openChat:m,closePollResults:u}=(0,s.uC)(),Z=(0,P.Z)(l.votersCount),[v,g]=(0,a.eJ)(!0),p=Boolean(i),{option:E,text:C}=r,f=(0,h.Z)();(0,a.d4)((()=>{p&&Z===l.votersCount||d({chat:t,messageId:n.id,option:E,offset:c,limit:4,shouldResetVoters:!0})}),[l.votersCount,p]);const b=(0,a.I4)((()=>{g(!0),d({chat:t,messageId:n.id,option:E,offset:c,limit:50})}),[t,d,n.id,c,E]);(0,a.d4)((()=>{g(!1)}),[i]);const I=(0,a.I4)((e=>{m({id:e}),u()}),[u,m]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},i?i.map((e=>a.ZP.createElement(Ae.Z,{key:e,className:"chat-item-clickable",onClick:()=>I(e)},a.ZP.createElement(Fe.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(we.Z,null),i&&function(){const e=l.votersCount-i.length;return l.votersCount>4&&e>0&&a.ZP.createElement(wn,{count:e,itemName:"voter",isLoading:v,onClick:b})}()),a.ZP.createElement("div",{className:"answer-head",dir:f.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},C),a.ZP.createElement("span",{className:"answer-percent",dir:f.isRtl?"auto":void 0},(y=l.votersCount,(N=o)>0?(y/N*100).toFixed():0),"%")));var y,N}))),_r=(0,a.X$)((0,s.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,p.Z1)(e,t),message:(0,p.hj)(e,t,n),lastSyncTime:a}:{}}))((e=>{let{onClose:t,isActive:n,chat:s,message:r,lastSyncTime:l}=e;const o=(0,h.Z)();if((0,u.ZP)(n,t),!r||!s)return a.ZP.createElement(we.Z,null);const{summary:i,results:c}=(0,g.t9)(r);if(!c.results)return;const d=(0,me.ee)(c.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},(0,Pe.Z)(i.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},l&&i.answers.map((e=>a.ZP.createElement(zr,{key:`${r.id}-${e.option}`,chat:s,message:r,answer:e,answerVote:d[e.option],totalVoters:c.totalVoters}))),!l&&a.ZP.createElement(we.Z,null)))}))),Yr="Please provide first name",Hr=(0,a.X$)((0,s.c$)(((e,t)=>{let{userId:n}=t;const a=(0,p.dy)(e,n),s=(0,p.Z1)(e,n),{progress:r}=e.management;return{user:a,progress:r,isMuted:(0,g.i4)(s,(0,p.dZ)(e),(0,p.NJ)(e))}}))((e=>{let{userId:t,user:n,progress:r,isMuted:o,onClose:i,isActive:c}=e;const{updateContact:d,deleteContact:m,closeManagement:Z}=(0,s.uC)(),[v,P,g]=(0,ye.Z)(),[p,E]=(0,a.eJ)(!1),[C,f]=(0,a.eJ)(),b=(0,h.Z)();(0,u.ZP)(c,i);const I=n&&n.firstName||"",y=n&&n.lastName||"",[N,k]=(0,a.eJ)(I),[S,w]=(0,a.eJ)(y),[M,T]=(0,a.eJ)(!o);(0,a.d4)((()=>{T(!o)}),[o]),(0,a.d4)((()=>{E(!1),g()}),[g,t]),(0,a.d4)((()=>{k(I),w(y)}),[I,y,n]),(0,a.d4)((()=>{r===l.wv.Complete&&(E(!1),f(void 0),g())}),[g,r]);const R=(0,a.I4)((e=>{k(e.target.value),E(!0)}),[]),A=(0,a.I4)((e=>{w(e.target.value),E(!0)}),[]),L=(0,a.I4)((e=>{T(e.target.checked),E(!0)}),[]),F=(0,a.I4)((()=>{const e=N.trim(),n=S.trim();e.length||f(Yr),d({userId:t,isMuted:!M,firstName:e,lastName:n})}),[N,S,d,t,M]),B=(0,a.I4)((()=>{m({userId:t}),g(),Z()}),[g,Z,m,t]);if(!n)return;const $=r===l.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Fe.Z,{userId:n.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(Te.Z,{id:"user-first-name",label:b("UserInfo.FirstNamePlaceholder"),onChange:R,value:N,error:C===Yr?C:void 0}),a.ZP.createElement(Te.Z,{id:"user-last-name",label:b("UserInfo.LastNamePlaceholder"),onChange:A,value:S}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(fn.Z,{checked:M,label:b("Notifications"),subLabel:b(M?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:L}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:P},b("DeleteContact")))),a.ZP.createElement(mn.Z,{isShown:p,onClick:F,disabled:$,ariaLabel:b("Save")},$?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:v,onClose:g,text:b("AreYouSureDeleteContact"),confirmLabel:b("DeleteContact"),confirmHandler:B,confirmIsDestructive:!0}))}))),Vr="Group title can't be empty",qr=(0,a.X$)((0,s.c$)(((e,t)=>{var n,a;let{chatId:s}=t;const r=(0,p.Z1)(e,s),{progress:l}=e.management,o=Boolean(null===(n=r.fullInfo)||void 0===n?void 0:n.linkedChatId),i=(0,g.G9)(r),{invites:c}=e.management.byChatId[s]||{};return{chat:r,progress:l,isBasicGroup:i,hasLinkedChannel:o,canChangeInfo:i?r.isCreator:(0,g.VE)(r,"changeInfo"),canBanUsers:i?r.isCreator:(0,g.VE)(r,"banUsers"),canInvite:i?r.isCreator:(0,g.VE)(r,"inviteUsers"),exportedInvites:c,lastSyncTime:e.lastSyncTime,availableReactionsCount:null===(a=e.availableReactions)||void 0===a?void 0:a.filter((e=>!e.isInactive)).length}}))((e=>{var t,n,o,i,c,d;let{chatId:m,chat:v,progress:P,isBasicGroup:p,hasLinkedChannel:E,canChangeInfo:C,canBanUsers:f,canInvite:b,onScreenSelect:I,onClose:y,isActive:N,exportedInvites:k,lastSyncTime:S,availableReactionsCount:w}=e;const{togglePreHistoryHidden:M,updateChat:T,deleteChat:R,leaveChannel:A,deleteChannel:L,closeManagement:F,openChat:B,loadExportedChatInvites:$,loadChatJoinRequests:x}=(0,s.uC)(),[D,O,U]=(0,ye.Z)(),G=v.title,X=v.fullInfo&&v.fullInfo.about||"",[z,_]=(0,a.eJ)(!1),[Y,H]=(0,a.eJ)(G||""),[V,q]=(0,a.eJ)(X),[j,K]=(0,a.eJ)(),[W,Q]=(0,a.eJ)(),ee=(0,g.RT)(v),te=(0,Z.Z)(ee,!1,r.IU.BlobUrl),ne=v.username||E,ae=(0,h.Z)();(0,u.ZP)(N,y),(0,a.d4)((()=>{S&&b&&($({chatId:m}),$({chatId:m,isRevoked:!0}),x({chatId:m}))}),[m,$,S,b,x]),(0,a.d4)((()=>{P===l.wv.Complete&&(_(!1),Q(void 0))}),[P]);const se=(0,a.I4)((()=>{I(l.u1.ChatPrivacyType)}),[I]),re=(0,a.I4)((()=>{I(l.u1.Discussion)}),[I]),le=(0,a.I4)((()=>{I(l.u1.Reactions)}),[I]),oe=(0,a.I4)((()=>{I(l.u1.GroupPermissions)}),[I]),ie=(0,a.I4)((()=>{I(l.u1.ChatAdministrators)}),[I]),ce=(0,a.I4)((e=>{K(e),_(!0)}),[]),de=(0,a.I4)((e=>{H(e.target.value),_(!0)}),[]),me=(0,a.I4)((e=>{q(e.target.value),_(!0)}),[]),ue=(0,a.I4)((()=>{const e=Y.trim(),t=V.trim();e.length?T({chatId:m,title:e,about:t,photo:j}):Q(Vr)}),[V,m,j,Y,T]),he=(0,a.I4)((()=>{I(l.u1.GroupMembers)}),[I]),Ze=(0,a.I4)((()=>{if(!v.fullInfo)return;const{isPreHistoryHidden:e}=v.fullInfo;M({chatId:v.id,isEnabled:!e})}),[v,M]),ve=(null===(t=v.fullInfo)||void 0===t||null===(n=t.enabledReactions)||void 0===n?void 0:n.length)||0,ge=(0,a.Ye)((()=>{if(!v.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter((e=>!v.defaultBannedRights[e])).length;const{sendStickers:t,sendGifs:n}=v.defaultBannedRights;return t||n||(e+=1),e}),[v]),pe=(null===(o=v.fullInfo)||void 0===o||null===(i=o.adminMembers)||void 0===i?void 0:i.length)||0,Ee=(0,a.I4)((()=>{p?R({chatId:v.id}):v.isCreator?L({chatId:v.id}):A({chatId:v.id}),U(),F(),B({id:void 0})}),[p,v.isCreator,v.id,U,F,A,L,R,B]);if(v.isRestricted)return;const Ce=P===l.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(dn.Z,{currentAvatarBlobUrl:te,onChange:ce,disabled:!C}),a.ZP.createElement(Te.Z,{id:"group-title",label:ae("GroupName"),onChange:de,value:Y,error:W===Vr?W:void 0,disabled:!C}),a.ZP.createElement(Te.Z,{id:"group-about",className:"mb-2",label:ae("DescriptionPlaceholder"),onChange:me,value:V,disabled:!C}),v.isCreator&&a.ZP.createElement(Ae.Z,{icon:"lock",multiline:!0,onClick:se},a.ZP.createElement("span",{className:"title"},ae("GroupType")),a.ZP.createElement("span",{className:"subtitle"},v.username?ae("TypePublic"):ae("TypePrivate"))),E&&a.ZP.createElement(Ae.Z,{icon:"message",multiline:!0,onClick:re},a.ZP.createElement("span",{className:"title"},ae("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},ae("DiscussionUnlink"))),a.ZP.createElement(Ae.Z,{icon:"permissions",multiline:!0,onClick:oe,disabled:!f},a.ZP.createElement("span",{className:"title"},ae("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ge,"/",8)),a.ZP.createElement(Ae.Z,{icon:"reactions",multiline:!0,onClick:le,disabled:!C},a.ZP.createElement("span",{className:"title"},ae("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ve,"/",w)),a.ZP.createElement(Ae.Z,{icon:"admin",multiline:!0,onClick:ie},a.ZP.createElement("span",{className:"title"},ae("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,ot.kh)(pe))),b&&a.ZP.createElement(Ae.Z,{icon:"link",onClick:()=>{I(l.u1.Invites)},multiline:!0,disabled:!k},a.ZP.createElement("span",{className:"title"},ae("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},k?(0,ot.kh)(k.length):ae("Loading"))),Boolean(null===(c=v.joinRequests)||void 0===c?void 0:c.length)&&a.ZP.createElement(Ae.Z,{icon:"add-user-filled",onClick:()=>{I(l.u1.JoinRequests)},multiline:!0},a.ZP.createElement("span",{className:"title"},ae("MemberRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,ot.kh)(v.joinRequests.length)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"group",multiline:!0,onClick:he},a.ZP.createElement("span",{className:"title"},ae("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,ot.kh)(null!==(d=v.membersCount)&&void 0!==d?d:0))),!ne&&v.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(fn.Z,{checked:!v.fullInfo.isPreHistoryHidden,label:ae("ChatHistory"),onChange:Ze,disabled:!f}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:O},ae("DeleteMega")))),a.ZP.createElement(mn.Z,{isShown:z,onClick:ue,disabled:Ce,ariaLabel:ae("Save")},Ce?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:D,onClose:U,textParts:(0,Pe.Z)(p||!v.isCreator?ae("AreYouSureDeleteAndExit"):ae("AreYouSureDeleteThisChatWithGroup",v.title),["br","simple_markdown"]),confirmLabel:p||!v.isCreator?ae("DeleteMega"):ae("DeleteGroupForAll"),confirmHandler:Ee,confirmIsDestructive:!0}))}))),jr=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,p.Z1)(e,n),currentUserId:e.currentUserId}}))((e=>{let{onScreenSelect:t,onChatMemberSelect:n,chat:r,currentUserId:o,onClose:i,isActive:c}=e;const{updateChatDefaultBannedRights:d}=(0,s.uC)(),[m,Z]=(0,a.eJ)({}),[v,P]=(0,a.eJ)(!1),[g,p]=(0,a.eJ)(!1),E=(0,h.Z)();(0,u.ZP)(c,i);const C=(0,a.I4)((()=>{t(l.u1.GroupRemovedUsers)}),[t]),f=(0,a.I4)((()=>{t(l.u1.GroupUserPermissionsCreate)}),[t]),b=(0,a.I4)((e=>{n(e.userId,e.promotedByUserId===o),t(l.u1.GroupUserPermissions)}),[o,n,t]);(0,a.d4)((()=>{Z((null==r?void 0:r.defaultBannedRights)||{}),P(!1),setTimeout((()=>{p(!1)}),250)}),[r]);const I=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}Z((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),P(!0)}),[]),y=(0,a.I4)((()=>{r&&(p(!0),d({chatId:r.id,bannedRights:m}))}),[r,m,d]),N=(0,a.Ye)((()=>r&&r.fullInfo&&r.fullInfo.kickedMembers?r.fullInfo.kickedMembers.length:0),[r]),k=(0,a.Ye)((()=>r&&r.fullInfo&&r.fullInfo.members?r.fullInfo.members.filter((e=>{let{bannedRights:t}=e;return Boolean(t)})):[]),[r]),S=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!r)return;const{defaultBannedRights:n}=r;return Object.keys(t).reduce(((e,a)=>{if(!t[a]||null!=n&&n[a]||"sendInline"===a||"viewMessages"===a||"sendGames"===a)return e;const s=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";default:return}}(a);if(!s)return e;const r=E(s);return`${e}${e.length?`, ${r}`:r}`}),"")}),[r,E]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},E("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendMessages",checked:!m.sendMessages,label:E("UserRestrictionsSend"),blocking:!0,onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendMedia",checked:!m.sendMedia,label:E("UserRestrictionsSendMedia"),blocking:!0,onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:E("UserRestrictionsSendStickers"),blocking:!0,onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendPolls",checked:!m.sendPolls,label:E("UserRestrictionsSendPolls"),blocking:!0,onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"embedLinks",checked:!m.embedLinks,label:E("UserRestrictionsEmbedLinks"),blocking:!0,onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:E("UserRestrictionsInviteUsers"),blocking:!0,onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"pinMessages",checked:!m.pinMessages,label:E("UserRestrictionsPinMessages"),blocking:!0,onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!m.changeInfo,label:E("UserRestrictionsChangeInfo"),blocking:!0,onChange:I}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:C},a.ZP.createElement("span",{className:"title"},E("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},N))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},E("PrivacyExceptions")),a.ZP.createElement(Ae.Z,{icon:"add-user",onClick:f},E("ChannelAddException")),k.map((e=>a.ZP.createElement(Ae.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>b(e)},a.ZP.createElement(Fe.Z,{userId:e.userId,status:S(e)})))))),a.ZP.createElement(mn.Z,{isShown:v,onClick:y,ariaLabel:E("Save"),disabled:g},g?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Kr=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e;return{currentUserId:t}}))((e=>{var t;let{chat:n,currentUserId:r,isOpen:l,onClose:o}=e;const{loadMoreMembers:i,deleteChatMember:c}=(0,s.uC)(),d=(0,h.Z)(),[m,u]=(0,a.eJ)(""),Z=(0,a.sO)(null),v=(0,a.Ye)((()=>{var e;const t=((null===(e=n.fullInfo)||void 0===e?void 0:e.members)||[]).reduce(((e,t)=>(t.isAdmin||t.isOwner||t.userId===r||e.push(t.userId),e)),[]),a=(0,s.Rd)().users.byId;return(0,g.kK)(t,a,m)}),[null===(t=n.fullInfo)||void 0===t?void 0:t.members,r,m]),P=(0,a.I4)((e=>{c({chatId:n.id,userId:e}),o()}),[n.id,c,o]);return a.ZP.createElement(Be,{isOpen:l,chatOrUserIds:v,filterRef:Z,filterPlaceholder:d("ChannelBlockUser"),filter:m,onFilterChange:u,loadMore:i,onSelectChatOrUser:P,onClose:o})}))),Wr=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,p.Z1)(e,n),{byId:s}=e.users;return{chat:a,usersById:s,canDeleteMembers:a&&((0,g.VE)(a,"banUsers")||a.isCreator)}}))((e=>{let{chat:t,usersById:n,canDeleteMembers:r,onClose:l,isActive:o}=e;const{updateChatMemberBannedRights:i}=(0,s.uC)(),c=(0,h.Z)(),[d,m,Z]=(0,ye.Z)();(0,u.ZP)(o,l);const v=(0,a.Ye)((()=>t&&t.fullInfo&&t.fullInfo.kickedMembers?t.fullInfo.kickedMembers:[]),[t]),P=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const t=n[e.kickedByUserId];return t?c("UserRemovedBy",(0,g.Js)(t)):void 0}),[c,n]),p=(0,a.I4)((e=>{if(t)return[{title:c("Unblock"),icon:"delete",destructive:!0,handler:()=>i({chatId:t.id,userId:e.userId,bannedRights:{}})}]}),[c,t,i]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:c.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},c("NoBlockedGroup2")),v.map((e=>a.ZP.createElement(Ae.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:p(e)},a.ZP.createElement(Fe.Z,{userId:e.userId,status:P(e)})))),r&&a.ZP.createElement(mn.Z,{isShown:!0,onClick:m,ariaLabel:c("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),t&&r&&a.ZP.createElement(Kr,{chat:t,isOpen:d,onClose:Z}))))}))),Qr="Channel title can't be empty",el=(0,a.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,p.Z1)(e,a),{progress:r}=e.management,l=Boolean(null==s?void 0:s.isSignaturesShown),{invites:o}=e.management.byChatId[a]||{};return{chat:s,progress:r,isSignaturesShown:l,canChangeInfo:(0,g.VE)(s,"changeInfo"),canInvite:(0,g.VE)(s,"inviteUsers"),lastSyncTime:e.lastSyncTime,exportedInvites:o,availableReactionsCount:null===(n=e.availableReactions)||void 0===n?void 0:n.filter((e=>!e.isInactive)).length}}))((e=>{var t,n,o,i,c,d,m;let{chatId:v,chat:P,progress:p,isSignaturesShown:E,canChangeInfo:C,canInvite:f,exportedInvites:b,lastSyncTime:I,availableReactionsCount:y,onScreenSelect:N,onClose:k,isActive:S}=e;const{updateChat:w,toggleSignatures:M,closeManagement:T,leaveChannel:R,deleteChannel:A,openChat:L,loadExportedChatInvites:F,loadChatJoinRequests:B}=(0,s.uC)(),$=P&&P.title||"",x=null!=P&&P.fullInfo&&P.fullInfo.about||"",D=null==P||null===(t=P.fullInfo)||void 0===t?void 0:t.linkedChatId,[O,U,G]=(0,ye.Z)(),[X,z]=(0,a.eJ)(!1),[_,Y]=(0,a.eJ)($),[H,V]=(0,a.eJ)(x),[q,j]=(0,a.eJ)(),[K,W]=(0,a.eJ)(),Q=P&&(0,g.RT)(P),ee=(0,Z.Z)(Q,!1,r.IU.BlobUrl),te=(0,h.Z)();(0,u.ZP)(S,k),(0,a.d4)((()=>{I&&(F({chatId:v}),F({chatId:v,isRevoked:!0}),B({chatId:v}))}),[v,F,I,B]),(0,a.d4)((()=>{p===l.wv.Complete&&(z(!1),W(void 0))}),[p]);const ne=(null==P||null===(n=P.fullInfo)||void 0===n||null===(o=n.adminMembers)||void 0===o?void 0:o.length)||0,ae=(0,a.I4)((()=>{N(l.u1.ChatPrivacyType)}),[N]),se=(0,a.I4)((()=>{N(l.u1.Discussion)}),[N]),re=(0,a.I4)((()=>{N(l.u1.Reactions)}),[N]),le=(0,a.I4)((()=>{N(l.u1.ChatAdministrators)}),[N]),oe=(0,a.I4)((e=>{j(e),z(!0)}),[]),ie=(0,a.I4)((e=>{Y(e.target.value),z(!0)}),[]),ce=(0,a.I4)((e=>{V(e.target.value),z(!0)}),[]),de=(0,a.I4)((()=>{const e=_.trim(),t=H.trim();e.length?w({chatId:v,title:e,about:t,photo:q}):W(Qr)}),[H,v,q,_,w]),me=(0,a.I4)((()=>{M({chatId:v,isEnabled:!E})}),[v,E,M]),ue=(0,a.I4)((()=>{N(l.u1.ChannelSubscribers)}),[N]),he=(0,a.I4)((()=>{P.isCreator?A({chatId:P.id}):R({chatId:P.id}),G(),T(),L({id:void 0})}),[P.isCreator,P.id,G,T,R,A,L]),Ze=(null===(i=P.fullInfo)||void 0===i||null===(c=i.enabledReactions)||void 0===c?void 0:c.length)||0;if(P.isRestricted)return;const ve=p===l.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(dn.Z,{currentAvatarBlobUrl:ee,onChange:oe,disabled:!C}),a.ZP.createElement(Te.Z,{id:"channel-title",label:te("EnterChannelName"),onChange:ie,value:_,error:K===Qr?K:void 0,disabled:!C}),a.ZP.createElement(Te.Z,{id:"channel-about",className:"mb-2",label:te("DescriptionPlaceholder"),onChange:ce,value:H,disabled:!C}),P.isCreator&&a.ZP.createElement(Ae.Z,{icon:"lock",multiline:!0,onClick:ae},a.ZP.createElement("span",{className:"title"},te("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},P.username?te("TypePublic"):te("TypePrivate"))),a.ZP.createElement(Ae.Z,{icon:"message",multiline:!0,onClick:se,disabled:!C},a.ZP.createElement("span",{className:"title"},te("Discussion")),a.ZP.createElement("span",{className:"subtitle"},te(D?"DiscussionUnlink":"Add"))),a.ZP.createElement(Ae.Z,{icon:"admin",multiline:!0,onClick:le},a.ZP.createElement("span",{className:"title"},te("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},ne)),f&&a.ZP.createElement(Ae.Z,{icon:"link",onClick:()=>{N(l.u1.Invites)},multiline:!0,disabled:!b},a.ZP.createElement("span",{className:"title"},te("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},b?(0,ot.kh)(b.length):te("Loading"))),Boolean(null===(d=P.joinRequests)||void 0===d?void 0:d.length)&&a.ZP.createElement(Ae.Z,{icon:"add-user-filled",onClick:()=>{N(l.u1.JoinRequests)},multiline:!0},a.ZP.createElement("span",{className:"title"},te("SubscribeRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,ot.kh)(P.joinRequests.length))),a.ZP.createElement(Ae.Z,{icon:"reactions",multiline:!0,onClick:re,disabled:!C},a.ZP.createElement("span",{className:"title"},te("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},Ze,"/",y)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(fn.Z,{checked:E,label:te("ChannelSignMessages"),onChange:me}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"group",multiline:!0,onClick:ue},a.ZP.createElement("span",{className:"title",dir:"auto"},te("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},te("Subscribers",null!==(m=P.membersCount)&&void 0!==m?m:0,"i")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:U},P.isCreator?te("ChannelDelete"):te("LeaveChannel")))),a.ZP.createElement(mn.Z,{isShown:X,onClick:de,disabled:ve,ariaLabel:te("Save")},ve?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:O,onClose:G,text:P.isCreator?te("ChannelDeleteAlert"):te("ChannelLeaveAlert"),confirmLabel:P.isCreator?te("ChannelDelete"):te("LeaveChannel"),confirmHandler:he,confirmIsDestructive:!0}))})));var tl=n(88);const nl=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,p.Z1)(e,n),{isUsernameAvailable:s}=(0,p.aW)(e,n);return{chat:a,isChannel:(0,g.eA)(a),progress:e.management.progress,isUsernameAvailable:s,isProtected:null==a?void 0:a.isProtected}}))((e=>{var t;let{chat:n,onClose:r,isActive:o,isChannel:i,progress:c,isUsernameAvailable:d,isProtected:m}=e;const{checkPublicLink:Z,updatePublicLink:v,updatePrivateLink:P,toggleIsProtected:g}=(0,s.uC)(),p=Boolean(n.username),E=null===(t=n.fullInfo)||void 0===t?void 0:t.inviteLink,[C,f]=(0,a.eJ)(p?"public":"private"),[b,I]=(0,a.eJ)(),[y,N,k]=(0,ye.Z)(),S=Boolean("public"===C&&b&&d||"private"===C&&p);(0,u.ZP)(o,r),(0,a.d4)((()=>{C&&!E&&P()}),[C,E,P]);const w=(0,a.I4)((e=>{f(e)}),[]),M=(0,a.I4)((e=>{g({chatId:n.id,isProtected:"protected"===e})}),[n.id,g]),T=(0,a.I4)((()=>{v({username:"public"===C?b:""})}),[C,v,b]),R=(0,a.I4)((()=>{k(),P()}),[k,P]),A=(0,h.Z)(),L=i?"Channel":"Mega",F=i?"Channel":"Group",B=[{value:"private",label:A(`${L}Private`),subLabel:A(`${L}PrivateInfo`)},{value:"public",label:A(`${L}Public`),subLabel:A(`${L}PublicInfo`)}],$=[{value:"allowed",label:A("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:A("ChannelVisibility.Forwarding.Disabled")}],x=c===l.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:A.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},A(`${F}Type`)),a.ZP.createElement(at.Z,{selected:C,name:"channel-type",options:B,onChange:w})),"private"===C?a.ZP.createElement("div",{className:"section",dir:A.isRtl?"rtl":void 0},E?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(tl.Z,{url:E,className:"group-link",text:E}),a.ZP.createElement("p",{className:"section-info",dir:A.isRtl?"rtl":void 0},A(`${L}PrivateLinkHelp`)),a.ZP.createElement(Ae.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:N},A("RevokeLink")),a.ZP.createElement(Xe.Z,{isOpen:y,onClose:k,text:A("RevokeAlert"),confirmLabel:A("RevokeButton"),confirmHandler:R,confirmIsDestructive:!0})):a.ZP.createElement(we.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(Pn,{asLink:!0,currentUsername:n.username,isLoading:x,isUsernameAvailable:d,checkUsername:Z,onChange:I}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},A(`${F}.Username.CreatePublicLinkHelp`))),a.ZP.createElement("div",{className:"section",dir:A.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},A(i?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")),a.ZP.createElement(at.Z,{selected:m?"protected":"allowed",name:"forwarding-type",options:$,onChange:M}),a.ZP.createElement("p",{className:"section-info"},A(i?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")))),a.ZP.createElement(mn.Z,{isShown:S,disabled:x,ariaLabel:A("Save"),onClick:T},x?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),al=(0,a.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,p.Z1)(e,a),{forDiscussionIds:r,byId:l}=e.chats;return{chat:s,chatsByIds:l,forDiscussionIds:r,linkedChat:null!=s&&null!==(n=s.fullInfo)&&void 0!==n&&n.linkedChatId?(0,p.Z1)(e,s.fullInfo.linkedChatId):void 0,isChannel:s&&(0,g.eA)(s)}}))((e=>{let{chat:t,onClose:n,isActive:r,chatId:i,chatsByIds:c,linkedChat:d,forDiscussionIds:m,isChannel:Z,onScreenSelect:v}=e;const{loadGroupsForDiscussion:P,linkDiscussionGroup:g,unlinkDiscussionGroup:p}=(0,s.uC)(),[E,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(),[I,y]=(0,a.eJ)(!1),N=(0,a.I4)((()=>y(!0)),[]),[k,S,w]=(0,ye.Z)(),[M,T,R]=(0,ye.Z)(),A=(0,h.Z)(),L=null==d?void 0:d.id;(0,u.ZP)(r,n),(0,a.d4)((()=>{P()}),[P]),(0,a.d4)((()=>{f||(0,dt.Z)("DiscussionGroups").then(b)}),[f]);const F=(0,a.I4)((()=>{w(),p({channelId:Z?i:L}),Z||v(l.u1.Initial)}),[w,p,Z,i,L,v]),B=(0,a.I4)((()=>{R(),g({channelId:i,chatId:E})}),[R,g,i,E]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-icon"},f&&a.ZP.createElement(mt.Z,{id:"discussionGroupsDucks",size:o.bM,animationData:f,play:I,noLoop:!0,onLoad:N})),d&&a.ZP.createElement("div",null,a.ZP.createElement(Ae.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Le.Z,{chatId:d.id})),a.ZP.createElement(Ae.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:S},A(Z?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Xe.Z,{isOpen:k,onClose:w,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(ge.Z,{size:"tiny",chat:d}),a.ZP.createElement("div",{className:"modal-title"},A(Z?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,Pe.Z)(A(Z?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",d.title),["br","simple_markdown"]),confirmLabel:A(Z?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:F,confirmIsDestructive:!0})),!d&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},A("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Ae.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},A("DiscussionCreateGroup")),m?m.map(((e,t)=>a.ZP.createElement(Ae.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{C(e),T()}},a.ZP.createElement(Le.Z,{chatId:e})))):a.ZP.createElement(St.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},A("DiscussionChannelHelp2")),a.ZP.createElement(Xe.Z,{isOpen:M,onClose:R,header:function(){const e=c[E];if(e)return a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(ge.Z,{size:"tiny",chat:e}),a.ZP.createElement("div",{className:"modal-title"},A("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const e=c[E];if(e)return e.hasPrivateLink?(0,Pe.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?`,["br","simple_markdown"]):(0,Pe.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}(),confirmLabel:A("DiscussionLinkGroup"),confirmHandler:B,isButtonsInOneRow:!0})))))}))),sl=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,p.Z1)(e,n);return{chat:s,isFormFullyDisabled:!(s.isCreator||a)}}))((e=>{let{chat:t,selectedChatMemberId:n,onScreenSelect:r,isFormFullyDisabled:o,onClose:i,isActive:c}=e;const{updateChatMemberBannedRights:d}=(0,s.uC)(),[m,Z]=(0,a.eJ)({}),[v,P]=(0,a.eJ)(!1),[g,p]=(0,a.eJ)(!1),[E,C,f]=(0,ye.Z)(),b=(0,h.Z)();(0,u.ZP)(c,i);const I=(0,a.Ye)((()=>{if(t&&t.fullInfo&&t.fullInfo.members)return t.fullInfo.members.find((e=>{let{userId:t}=e;return t===n}))}),[t,n]);(0,a.d4)((()=>{null!=t&&t.fullInfo&&n&&!I&&r(l.u1.GroupPermissions)}),[t,r,I,n]),(0,a.d4)((()=>{Z((null==I?void 0:I.bannedRights)||(null==t?void 0:t.defaultBannedRights)||{}),P(!1),p(!1)}),[t,I]);const y=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}Z((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),P(!0)}),[]),N=(0,a.I4)((()=>{t&&n&&(p(!0),d({chatId:t.id,userId:n,bannedRights:m}))}),[t,n,m,d]),k=(0,a.I4)((()=>{t&&n&&d({chatId:t.id,userId:n,bannedRights:{viewMessages:!0}})}),[t,n,d]),S=(0,a.I4)((e=>!!o||!(!t||!t.defaultBannedRights)&&t.defaultBannedRights[e]),[t,o]);if(I)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Fe.Z,{userId:I.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},b("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendMessages",checked:!m.sendMessages,label:b("UserRestrictionsSend"),blocking:!0,disabled:S("sendMessages"),onChange:y})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendMedia",checked:!m.sendMedia,label:b("UserRestrictionsSendMedia"),blocking:!0,disabled:S("sendMedia"),onChange:y})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:b("UserRestrictionsSendStickers"),blocking:!0,disabled:S("sendStickers"),onChange:y})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"sendPolls",checked:!m.sendPolls,label:b("UserRestrictionsSendPolls"),blocking:!0,disabled:S("sendPolls"),onChange:y})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"embedLinks",checked:!m.embedLinks,label:b("UserRestrictionsEmbedLinks"),blocking:!0,disabled:S("embedLinks"),onChange:y})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:b("UserRestrictionsInviteUsers"),blocking:!0,disabled:S("inviteUsers"),onChange:y})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"pinMessages",checked:!m.pinMessages,label:b("UserRestrictionsPinMessages"),blocking:!0,disabled:S("pinMessages"),onChange:y})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!m.changeInfo,label:b("UserRestrictionsChangeInfo"),blocking:!0,disabled:S("changeInfo"),onChange:y}))),!o&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:C},b("UserRestrictionsBlock")))),a.ZP.createElement(mn.Z,{isShown:v,onClick:N,ariaLabel:b("Save"),disabled:g},g?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:E,onClose:f,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:k,confirmIsDestructive:!0}))}))),rl=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,p.Z1)(e,n);return{chat:a,currentUserId:e.currentUserId,isChannel:(0,g.eA)(a)}}))((e=>{let{chat:t,isChannel:n,currentUserId:r,onScreenSelect:o,onChatMemberSelect:i,onClose:c,isActive:d}=e;const m=(0,h.Z)();(0,u.ZP)(d,c);const Z=(0,a.Ye)((()=>t.fullInfo&&t.fullInfo.adminMembers?t.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),v=(0,a.I4)((e=>{i(e.userId,e.promotedByUserId===r),o(l.u1.ChatAdminRights)}),[r,i,o]),P=(0,a.I4)((()=>{o(l.u1.GroupAddAdmins)}),[o]),p=(0,a.I4)((e=>{if(e.isOwner)return m("ChannelCreator");const t=(0,s.Rd)().users.byId,n=e.promotedByUserId?t[e.promotedByUserId]:void 0;return n?m("EditAdminPromotedBy",(0,g.Js)(n)):m("ChannelAdmin")}),[m]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{icon:"recent",multiline:!0,onClick:function(){o(l.u1.GroupRecentActions)}},a.ZP.createElement("span",{className:"title"},m("EventLog")),a.ZP.createElement("span",{className:"subtitle"},m(n?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:m.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},n?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),Z.map((e=>a.ZP.createElement(Ae.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>v(e)},a.ZP.createElement(Fe.Z,{userId:e.userId,status:p(e),forceShowSelf:!0})))),a.ZP.createElement(mn.Z,{isShown:!0,onClick:P,ariaLabel:m("Channel.Management.AddModerator")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))))}))),ll=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,p.Z1)(e,n)}}))((e=>{let{chat:t,onClose:n,isActive:s}=e;const r=(0,h.Z)();(0,u.ZP)(s,n);const l=(0,a.Ye)((()=>t&&t.fullInfo&&t.fullInfo.adminMembers?t.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),o=(0,a.I4)((e=>e.isOwner?r("ChannelCreator"):r("ChannelAdmin")),[r]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section not-implemented",dir:r.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},"Actions"),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogFilterLeavingMembers"),onChange:void 0}))),a.ZP.createElement("div",{className:"section not-implemented",dir:r.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},r("Channel.Management.Title")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:!0,label:r("EventLogAllAdmins"),onChange:void 0})),l.map((e=>a.ZP.createElement(Ae.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(fn.Z,{label:"",checked:!0}),a.ZP.createElement(Fe.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),ol=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,p.Z1)(e,n),{byId:r}=e.users,{currentUserId:l}=e;return{chat:s,usersById:r,currentUserId:l,isChannel:(0,g.eA)(s),isFormFullyDisabled:!(s.isCreator||a),defaultRights:s.adminRights}}))((e=>{var t;let{isNewAdmin:n,selectedUserId:r,defaultRights:o,onScreenSelect:i,chat:c,usersById:d,currentUserId:m,isChannel:Z,isFormFullyDisabled:v,onClose:P,isActive:p}=e;const{updateChatAdmin:E}=(0,s.uC)(),[C,f]=(0,a.eJ)({}),[b,I]=(0,a.eJ)(Boolean(n)),[y,N]=(0,a.eJ)(!1),[k,S,w]=(0,ye.Z)(),[M,T]=(0,a.eJ)(""),R=(0,h.Z)();(0,u.ZP)(p,P);const A=(0,a.Ye)((()=>{var e,t;const a=null===(e=c.fullInfo)||void 0===e||null===(t=e.adminMembers)||void 0===t?void 0:t.find((e=>{let{userId:t}=e;return t===r}));if(!n||!a&&r){if(n){const e=(0,s.Rd)().users.byId[r];return e?{userId:e.id,adminRights:o,customTitle:R("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return a}}),[null===(t=c.fullInfo)||void 0===t?void 0:t.adminMembers,o,n,R,r]);(0,a.d4)((()=>{null!=c&&c.fullInfo&&r&&!A&&i(l.u1.ChatAdministrators)}),[c,i,A,r]),(0,a.d4)((()=>{f((null==A?void 0:A.adminRights)||{}),T(((null==A?void 0:A.customTitle)||"").substr(0,16)),I(Boolean(n)),N(!1)}),[o,n,A]);const L=(0,a.I4)((e=>{const{name:t}=e.target;f((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),I(!0)}),[]),F=(0,a.I4)((()=>{r&&(N(!0),E({chatId:c.id,userId:r,adminRights:C,customTitle:M}))}),[r,E,c.id,C,M]),B=(0,a.I4)((()=>{r&&(E({chatId:c.id,userId:r,adminRights:{}}),w())}),[c.id,w,r,E]),$=(0,a.I4)((e=>!((0,g.G9)(c)||!v&&c.adminRights&&c.adminRights[e])),[c,v]),x=(0,a.Ye)((()=>{if(n||!A)return;if(A.isOwner)return R("ChannelCreator");const e=A.promotedByUserId?d[A.promotedByUserId]:void 0;return e?R("EditAdminPromotedBy",(0,g.Js)(e)):R("ChannelAdmin")}),[n,A,d,R]),D=(0,a.I4)((e=>{const{value:t}=e.target;T(t),I(!0)}),[]);if(A)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ae.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Fe.Z,{userId:A.userId,status:x,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},R("EditAdminWhatCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"changeInfo",checked:Boolean(C.changeInfo),label:R(Z?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:$("changeInfo"),onChange:L})),Z&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"postMessages",checked:Boolean(C.postMessages),label:R("EditAdminPostMessages"),blocking:!0,disabled:$("postMessages"),onChange:L})),Z&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"editMessages",checked:Boolean(C.editMessages),label:R("EditAdminEditMessages"),blocking:!0,disabled:$("editMessages"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"deleteMessages",checked:Boolean(C.deleteMessages),label:R(Z?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:$("deleteMessages"),onChange:L})),!Z&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"banUsers",checked:Boolean(C.banUsers),label:R("EditAdminBanUsers"),blocking:!0,disabled:$("banUsers"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"inviteUsers",checked:Boolean(C.inviteUsers),label:R("EditAdminAddUsers"),blocking:!0,disabled:$("inviteUsers"),onChange:L})),!Z&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"pinMessages",checked:Boolean(C.pinMessages),label:R("EditAdminPinMessages"),blocking:!0,disabled:$("pinMessages"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"addAdmins",checked:Boolean(C.addAdmins),label:R("EditAdminAddAdmins"),blocking:!0,disabled:$("addAdmins"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"manageCall",checked:Boolean(C.manageCall),label:R("StartVoipChatPermission"),blocking:!0,disabled:$("manageCall"),onChange:L})),!Z&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"anonymous",checked:Boolean(C.anonymous),label:R("EditAdminSendAnonymously"),blocking:!0,disabled:$("anonymous"),onChange:L})),v&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},R("Channel.EditAdmin.CannotEdit")),!Z&&a.ZP.createElement(Te.Z,{id:"admin-title",label:R("EditAdminRank"),onChange:D,value:M,disabled:v,maxLength:16}),m!==r&&!v&&!n&&a.ZP.createElement(Ae.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:S},R("EditAdminRemoveAdmin")))),a.ZP.createElement(mn.Z,{isShown:b,onClick:F,ariaLabel:R("Save"),disabled:y},y?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),!n&&a.ZP.createElement(Xe.Z,{isOpen:k,onClose:w,text:"Are you sure you want to dismiss this admin?",confirmLabel:R("Channel.Admin.Dismiss"),confirmHandler:B,confirmIsDestructive:!0}))}))),il=(0,a.X$)((0,s.c$)(((e,t)=>{var n,a;let{chatId:s}=t;const r=(0,p.Z1)(e,s),{statusesById:l}=e.users,o=null==r||null===(n=r.fullInfo)||void 0===n?void 0:n.members,i=null==r||null===(a=r.fullInfo)||void 0===a?void 0:a.adminMembers,c=r&&(0,g.eA)(r),{userIds:d}=e.contactList||{},{query:m,fetchingStatus:u,globalUserIds:h,localUserIds:Z}=e.userSearch;return{members:o,adminMembers:i,userStatusesById:l,isChannel:c,localContactIds:d,searchQuery:m,isSearching:u,globalUserIds:h,localUserIds:Z,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{noAdmins:t,members:n,adminMembers:r,userStatusesById:o,isChannel:i,isActive:c,globalUserIds:d,localContactIds:m,localUserIds:Z,isSearching:v,searchQuery:P,serverTimeOffset:p,onClose:E,onScreenSelect:C,onChatMemberSelect:f}=e;const{openChat:b,setUserSearchQuery:I,loadContactList:y}=(0,s.uC)(),N=(0,h.Z)(),k=(0,a.sO)(null),S=(0,a.sO)(null),w=(0,a.Ye)((()=>t&&(null==r?void 0:r.map((e=>{let{userId:t}=e;return t})))||[]),[r,t]),M=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId;if(!n||!e)return[];const a=(0,g.Z0)(n.map((e=>{let{userId:t}=e;return t})),e,o,void 0,p);return t?a.filter((e=>!w.includes(e))):a}),[n,o,p,t,w]),T=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId,n=(0,s.Rd)().chats.byId,a=Boolean(P),r=a?m?(0,g.kK)(m,e,P):[]:M;return(0,g.ih)((0,me.Tw)([...r,...a&&Z||[],...a&&d||[]]).filter((n=>{const a=e[n];return!a||(i||a.canBeInvitedToGroup||!(0,g.cS)(a))&&(!t||!w.includes(n))})),n,!0)}),[M,m,P,Z,d,i,t,w]),[R,A]=(0,Ne.Z)(y,T,Boolean(P)),L=(0,a.I4)((e=>{t?(f(e,!1),C(l.u1.ChatNewAdminRights)):b({id:e})}),[t,f,C,b]),F=(0,a.I4)((e=>{I({query:e.target.value})}),[I]),B=(0,ke.Z)(S,c,(e=>{R&&R.length>0&&L(R[-1===e?0:e])}),".ListItem-button",!0);return(0,u.ZP)(c,E),a.ZP.createElement("div",{className:"Management"},t&&a.ZP.createElement("div",{className:"Management__filter",dir:N.isRtl?"rtl":void 0},a.ZP.createElement(Te.Z,{ref:k,value:P,onChange:F,placeholder:N("Search")})),a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},null!=R&&R.length?a.ZP.createElement(Re.Z,{className:"picker-list custom-scroll",items:T,onLoadMore:A,noScrollRestore:Boolean(P),ref:S,onKeyDown:B},R.map((e=>a.ZP.createElement(Ae.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>L(e)},a.ZP.createElement(Fe.Z,{userId:e,forceShowSelf:!0}))))):v||!R||R.length?a.ZP.createElement(we.Z,null):a.ZP.createElement(St.Z,{teactOrderKey:0,key:"nothing-found",text:i?"No subscribers found":"No members found"}))))}))),cl=(0,a.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,p.Z1)(e,a),{byId:r,statusesById:l}=e.users;return{members:null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.members,usersById:r,userStatusesById:l,isChannel:s&&(0,g.eA)(s),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{usersById:t,userStatusesById:n,members:s,isChannel:r,onScreenSelect:o,onChatMemberSelect:i,onClose:c,isActive:d,serverTimeOffset:m}=e;(0,u.ZP)(d,c);const h=(0,a.Ye)((()=>{if(s&&t)return(0,g.Z0)(s.filter((e=>!e.isOwner)).map((e=>{let{userId:t}=e;return t})),t,n,void 0,m)}),[s,m,t,n]),Z=(0,a.I4)((e=>{i(e),o(l.u1.GroupUserPermissions)}),[i,o]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},h?h.map(((e,t)=>a.ZP.createElement(Ae.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>Z(e)},a.ZP.createElement(Fe.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(St.Z,{teactOrderKey:0,key:"nothing-found",text:r?"No subscribers found":"No members found"}))))})));var dl=n(2357),ml=n(2267);function ul(e,t){const{isPermanent:n,usage:a=0,date:s}=e,{isPermanent:r,usage:l=0,date:o}=t;return n||r?Number(n)-Number(r):a||l?l-a:o-s}const hl=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const{invites:a,revokedInvites:s}=e.management.byChatId[n],r=(0,p.Z1)(e,n),l=r&&(0,g.eA)(r);return{exportedInvites:a,revokedExportedInvites:s,chat:r,serverTimeOffset:e.serverTimeOffset,isChannel:l}}))((e=>{let{chatId:t,chat:n,exportedInvites:r,revokedExportedInvites:c,isActive:m,isChannel:Z,serverTimeOffset:v,onClose:P,onScreenSelect:g}=e;const{setEditingExportedInvite:p,showNotification:E,editExportedChatInvite:C,deleteExportedChatInvite:f,deleteRevokedExportedChatInvites:b,setOpenedInviteInfo:I}=(0,s.uC)(),y=(0,h.Z)(),[N,k,S]=(0,ye.Z)(),[w,M,T]=(0,ye.Z)(),[A,L]=(0,a.eJ)(),[$,x,D]=(0,ye.Z)(),[O,U]=(0,a.eJ)(),[G,J]=(0,a.eJ)(),[X,z]=(0,a.eJ)(!1),_=(0,a.I4)((()=>z(!0)),[]);(0,a.d4)((()=>{G||(0,dt.Z)("Invite").then(J)}),[G]),(0,u.ZP)(m,P);const Y=(0,a.Ye)((()=>{if(r)return r.some((e=>{let{expireDate:t}=e;return t&&t-(0,ml.b)(v)<j.xR/1e3}))}),[r,v]),H=(0,d.Z)();(0,dl.Z)((()=>{H()}),Y?1e3:void 0);const V=null==r?void 0:r.find((e=>{let{isPermanent:t}=e;return t})),q=null!=n&&n.username?`t.me/${n.username}`:null==V?void 0:V.link,K=(0,a.Ye)((()=>{const e=null!=n&&n.username?r:null==r?void 0:r.filter((e=>{let{isPermanent:t}=e;return!t}));return null==e?void 0:e.sort(ul)}),[null==n?void 0:n.username,r]),W=(0,a.I4)((e=>{const{link:n,title:a,isRequestNeeded:s,expireDate:r,usageLimit:l}=e;C({chatId:t,link:n,title:a,isRequestNeeded:s,expireDate:r,usageLimit:l,isRevoked:!0})}),[t,C]),Q=(0,a.I4)((e=>{L(e),M()}),[M]),ee=(0,a.I4)((()=>{A&&(W(A),L(void 0),T())}),[T,W,A]),te=(0,a.I4)((()=>{g(l.u1.EditInvite)}),[g]),ne=(0,a.I4)((()=>{V&&Q(V)}),[Q,V]),ae=(0,a.I4)((()=>{b({chatId:t}),S()}),[t,S,b]),se=(0,a.I4)((e=>{I({chatId:t,invite:e}),g(l.u1.InviteInfo)}),[t,g,I]),re=(0,a.I4)((e=>{f({chatId:t,link:e.link})}),[t,f]),le=(0,a.I4)((e=>{U(e),x()}),[x]),oe=(0,a.I4)((()=>{O&&(re(O),U(void 0),D())}),[D,re,O]),ie=(0,a.I4)((e=>{(0,ss.TE)(e),E({message:y("LinkCopied")})}),[y,E]),ce=(0,a.I4)((()=>{ie(q)}),[ie,q]),de=e=>{const{usage:t=0,usageLimit:n,expireDate:a,isPermanent:s,requested:r,isRevoked:l}=e;let o="";if(o=!l&&n&&t<n?y("CanJoin",n-t):t?y("PeopleJoined",t):y("NoOneJoined"),l)return o+=` • ${y("Revoked")}`,o;if(r&&(o+=` • ${y("JoinRequests",r)}`),void 0!==n&&t===n)o+=` • ${y("LinkLimitReached")}`;else if(a){const e=1e3*(a-(0,ml.b)(v));o+=" • ",o+=e>0?y("InviteLink.ExpiresIn",(0,j.D)(y,e)):y("InviteLink.Expired")}else s&&(o+=` • ${y("Permanent")}`);return o},me=e=>{const n=[];return n.push({title:y("Copy"),icon:"copy",handler:()=>ie(e.link)}),e.isPermanent||e.isRevoked||n.push({title:y("Edit"),icon:"edit",handler:()=>(e=>{p({chatId:t,invite:e}),g(l.u1.EditInvite)})(e)}),e.isRevoked?n.push({title:y("DeleteLink"),icon:"delete",handler:()=>le(e),destructive:!0}):n.push({title:y("RevokeButton"),icon:"delete",handler:()=>Q(e),destructive:!0}),n},ue=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(R.Z,{round:!0,ripple:!i.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"Actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);return a.ZP.createElement("div",{className:"Management ManageInvites"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-icon"},G&&a.ZP.createElement(mt.Z,{id:"inviteDuck",size:o.jV,animationData:G,play:X,onLoad:_})),a.ZP.createElement("p",{className:"text-muted"},y(Z?"PrimaryLinkHelpChannel":"PrimaryLinkHelp"))),q&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",{className:"text-muted"},null!=n&&n.username?y("PublicLink"):y("lng_create_permanent_link_title")),a.ZP.createElement("div",{className:"primary-link"},a.ZP.createElement("input",{className:"form-control primary-link-input",value:q,readOnly:!0,onClick:ce}),a.ZP.createElement(F.Z,{className:"primary-link-more-menu",trigger:ue,positionX:"right"},a.ZP.createElement(B.Z,{icon:"copy",onClick:ce},y("Copy")),!(null!=n&&n.username)&&a.ZP.createElement(B.Z,{icon:"delete",onClick:ne,destructive:!0},y("RevokeButton")))),a.ZP.createElement(R.Z,{onClick:ce},y("CopyLink"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement(R.Z,{isText:!0,key:"create",className:"create-link",onClick:te},y("CreateNewLink")),(!K||!K.length)&&a.ZP.createElement(St.Z,{text:"No links found",key:"nothing"}),null==K?void 0:K.map((e=>a.ZP.createElement(Ae.Z,{icon:"link",secondaryIcon:"more",multiline:!0,onClick:()=>se(e),contextActions:me(e),key:e.link},a.ZP.createElement("span",{className:"title invite-title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},de(e))))),a.ZP.createElement("p",{className:"text-muted hint",key:"links-hint"},y("ManageLinksInfoHelp"))),c&&Boolean(c.length)&&a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{className:"text-muted",key:"title"},y("RevokedLinks")),a.ZP.createElement(Ae.Z,{icon:"delete",destructive:!0,key:"delete",onClick:k},a.ZP.createElement("span",{className:"title"},y("DeleteAllRevokedLinks"))),null==c?void 0:c.map((e=>a.ZP.createElement(Ae.Z,{icon:"link",secondaryIcon:"more",multiline:!0,onClick:()=>se(e),contextActions:me(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},de(e))))))),a.ZP.createElement(Xe.Z,{isOpen:N,onClose:S,title:y("DeleteAllRevokedLinks"),text:y("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:y("DeleteAll"),confirmHandler:ae}),a.ZP.createElement(Xe.Z,{isOpen:w,onClose:T,title:y("RevokeLink"),text:y("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:y("RevokeButton"),confirmHandler:ee}),a.ZP.createElement(Xe.Z,{isOpen:$,onClose:D,title:y("DeleteLink"),text:y("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:y("Delete"),confirmHandler:oe}))}))),Zl=[1,10,100],vl={hour:36e5,day:864e5,week:6048e5},Pl=vl.hour,gl=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const{editingInvite:a}=e.management.byChatId[n];return{editingInvite:a,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,editingInvite:n,isActive:r,serverTimeOffset:o,onClose:i,onScreenSelect:c}=e;const{editExportedChatInvite:d,exportChatInvite:m}=(0,s.uC)(),Z=(0,h.Z)(),[v,P,g]=(0,ye.Z)(),[p,E]=(0,a.eJ)(!1),[C,f]=(0,a.eJ)(""),[b,I]=(0,a.eJ)(Date.now()+Pl),[y,N]=(0,a.eJ)("unlimited"),[k,S]=(0,a.eJ)(10),[w,M]=(0,a.eJ)("0"),[T,A]=(0,a.eJ)(!1);(0,u.ZP)(r,i),(0,Or.Z)((e=>{let[t]=e;if(t!==n)if(n){const{title:e,usageLimit:t,expireDate:a,isRequestNeeded:s}=n;if(e&&f(e),t&&(M(Zl.includes(t)?t.toString():"custom"),S(t)),a){const e=(0,ml.b)(o)+Pl;N("custom"),I(1e3*Math.max(a,e))}s&&E(!0)}else f(""),N("unlimited"),M("0"),I(1e3*(0,ml.b)(o)+Pl),S(10),E(!1)}),[n,o]);const L=(0,a.I4)((e=>{E(e.target.checked)}),[]),F=(0,a.I4)((e=>{f(e.target.value)}),[]),B=(0,a.I4)((e=>{S(Number.parseInt(e.target.value,10))}),[]),$=(0,a.I4)((e=>{I(e.getTime()),g()}),[g]),x=(0,a.I4)((()=>{A(!0);const e="custom"===w?k:w;let a;switch(y){case"custom":a=(0,ml.b)(o)+(b-Date.now())/1e3;break;case"hour":case"day":case"week":a=(0,ml.b)(o)+vl[y]/1e3;break;default:a=void 0}n?d({link:n.link,chatId:t,title:C,isRequestNeeded:p,expireDate:a,usageLimit:e}):m({chatId:t,title:C,isRequestNeeded:p,expireDate:a,usageLimit:e}),c(l.u1.Invites)}),[t,b,k,d,n,m,p,y,w,C,c,o]);return a.ZP.createElement("div",{className:"Management ManageInvite"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(fn.Z,{label:Z("ApproveNewMembers"),subLabel:Z("ApproveNewMembersDescription"),checked:p,onChange:L})),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{className:"link-name",placeholder:Z("LinkNameHint"),value:C,onChange:F}),a.ZP.createElement("p",{className:"text-muted hint"},Z("LinkNameHelp"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},Z("LimitByPeriod")),a.ZP.createElement(at.Z,{name:"expireOptions",options:[{value:"hour",label:Z("Hours",1)},{value:"day",label:Z("Days",1)},{value:"week",label:Z("Weeks",1)},{value:"unlimited",label:Z("NoLimit")},{value:"custom",label:Z("lng_group_invite_expire_custom")}],onChange:N,selected:y}),"custom"===y&&a.ZP.createElement(R.Z,{className:"expire-limit",isText:!0,onClick:P},(0,j.Tu)(Z,b)," ",(0,j.mr)(Z,b)),a.ZP.createElement("p",{className:"text-muted hint"},Z("TimeLimitHelp"))),!p&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},Z("LimitNumberOfUses")),a.ZP.createElement(at.Z,{name:"usageOptions",options:[...Zl.map((e=>({value:e.toString(),label:e}))),{value:"0",label:Z("NoLimit")},{value:"custom",label:Z("lng_group_invite_usage_custom")}],onChange:M,selected:w}),"custom"===w&&a.ZP.createElement("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:k,onChange:B}),a.ZP.createElement("p",{className:"text-muted hint"},Z("UsesLimitHelp"))),a.ZP.createElement(mn.Z,{isShown:!0,onClick:x,disabled:T,ariaLabel:Z(n?"SaveLink":"CreateLink")},a.ZP.createElement("i",{className:"icon-check"}))),a.ZP.createElement(je,{isOpen:v,isFutureMode:!0,withTimePicker:!0,onClose:g,onSubmit:$,selectedAt:b,submitButtonLabel:Z("Save")}))}))),pl=(0,a.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,p.Z1)(e,a);return{enabledReactions:null===(n=s.fullInfo)||void 0===n?void 0:n.enabledReactions,availableReactions:e.availableReactions,chat:s}}))((e=>{let{availableReactions:t,enabledReactions:n,chat:r,isActive:l,onClose:o}=e;const{setChatEnabledReactions:i}=(0,s.uC)(),c=(0,h.Z)(),[d,m]=(0,a.eJ)(!1),[Z,v]=(0,a.eJ)(!1),[P,g]=(0,a.eJ)(n||[]);(0,u.ZP)(l,o);const p=(0,a.I4)((()=>{r&&(v(!0),i({chatId:r.id,enabledReactions:P}))}),[r,P,i]);(0,a.d4)((()=>{n&&(v(!1),m(!1),g(n))}),[n]);const E=(0,a.I4)((e=>{if(!r||!t)return;const{name:n,checked:a}=e.currentTarget,s="all"===n?a?t.map((e=>e.reaction)):[]:a?[...P,n]:P.filter((e=>e!==n));g(s),m(!0)}),[t,r,P]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:"all",checked:!P||P.length>0,label:c("EnableReactions"),onChange:E})),null==t?void 0:t.filter((e=>!e.isInactive)).map((e=>{let{reaction:t,title:n}=e;return a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(fn.Z,{name:t,checked:!P||(null==P?void 0:P.includes(t)),disabled:0===(null==P?void 0:P.length),label:a.ZP.createElement("div",{className:"Reaction"},a.ZP.createElement(it.Z,{reaction:t}),n),onChange:E}))})))),a.ZP.createElement(mn.Z,{isShown:d,onClick:p,ariaLabel:c("Save"),disabled:Z},Z?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),El=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const{inviteInfo:a}=e.management.byChatId[n],{invite:s,importers:r,requesters:l}=a||{},o=(0,p.Z1)(e,n);return{invite:s,importers:r,requesters:l,isChannel:o&&(0,g.eA)(o),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,invite:n,importers:r,requesters:l,isChannel:o,isActive:i,serverTimeOffset:c,onClose:d}=e;const{showNotification:m,loadChatInviteImporters:Z,loadChatInviteRequesters:v,openChat:P}=(0,s.uC)(),g=(0,h.Z)(),{usage:p=0,usageLimit:E,link:C,adminId:f}=n||{},b=(null==n?void 0:n.expireDate)&&1e3*(n.expireDate-(0,ml.b)(c))+Date.now(),I=((null==n?void 0:n.expireDate)||0)-(0,ml.b)(c)<0;(0,a.d4)((()=>{C&&(Z({chatId:t,link:C}),v({chatId:t,link:C}))}),[t,C,Z,v]);const y=(0,a.I4)((()=>{(0,ss.TE)(n.link),m({message:g("LinkCopied")})}),[n,g,m]);return(0,u.ZP)(i,d),a.ZP.createElement("div",{className:"Management ManageInviteInfo"},a.ZP.createElement("div",{className:"custom-scroll"},!n&&a.ZP.createElement("p",{className:"text-muted"},g("Loading")),n&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"link-title"},n.title||n.link),a.ZP.createElement("input",{className:"form-control",value:n.link,readOnly:!0,onClick:y}),a.ZP.createElement(R.Z,{className:"copy-link",onClick:y},g("CopyLink")),b&&a.ZP.createElement("p",{className:"text-muted"},I?g("ExpiredLink"):g("LinkExpiresIn",`${(0,j.Tu)(g,b)} ${(0,j.mr)(g,b)}`))),f&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,g("LinkCreatedeBy")),a.ZP.createElement(Ae.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P({id:f})},a.ZP.createElement(Fe.Z,{userId:f,status:(0,j.ZK)(g,1e3*n.date,!0),forceShowSelf:!0}))),(()=>{if(null!=r&&r.length||null==l||!l.length)return r?a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,r.length?g("PeopleJoined",p):g("NoOneJoined")),a.ZP.createElement("p",{className:"text-muted"},!r.length&&(E?g("PeopleCanJoinViaLinkCount",E-p):g("NoOneJoinedYet")),r.map((e=>a.ZP.createElement(Ae.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P({id:e.userId})},a.ZP.createElement(Fe.Z,{userId:e.userId,status:(0,j.ZK)(g,1e3*e.date,!0),forceShowSelf:!0})))))):a.ZP.createElement(J.Z,null)})(),(()=>{if(null==n||!n.isRevoked){if(!l&&r)return a.ZP.createElement(J.Z,null);if(null!=l&&l.length)return a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,g(o?"SubscribeRequests":"MemberRequests")),a.ZP.createElement("p",{className:"text-muted"},l.map((e=>a.ZP.createElement(Ae.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P({id:e.userId})},a.ZP.createElement(Fe.Z,{userId:e.userId,status:(0,j.ZK)(g,1e3*e.date,!0),forceShowSelf:!0}))))))}})())))}))),Cl=(0,a.X$)((0,s.c$)(((e,t)=>{let{userId:n}=t;return{user:(0,p.dy)(e,n),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{userId:t,about:n,date:r,isChannel:l,user:o,serverTimeOffset:i,chatId:c}=e;const{openChat:d,hideChatJoinRequest:m}=(0,s.uC)(),u=(0,X.y)("JoinRequest"),Z=(0,h.Z)(),v=(0,g.Js)(o),P=1e3*(r-(0,ml.b)(i))+Date.now(),p=(0,j.zk)(new Date(P))?(0,j.mr)(Z,P):(0,j.j1)(Z,P,!0,!1,!0),E=(0,a.I4)((()=>{m({chatId:c,userId:t,isApproved:!0})}),[c,m,t]),C=(0,a.I4)((()=>{m({chatId:c,userId:t,isApproved:!1})}),[c,m,t]);return a.ZP.createElement("div",{className:u("&")},a.ZP.createElement("div",{className:u("top")},a.ZP.createElement("div",{className:u("user"),onClick:()=>{d({id:t})}},a.ZP.createElement(ge.Z,{key:t,size:"medium",user:o}),a.ZP.createElement("div",{className:u("user-info")},a.ZP.createElement("div",{className:u("user-name")},v),a.ZP.createElement("div",{className:u("user-subtitle")},n))),a.ZP.createElement("div",{className:u("date")},p)),a.ZP.createElement("div",{className:u("buttons")},a.ZP.createElement(R.Z,{className:u("button"),onClick:E},Z(l?"ChannelAddToChannel":"ChannelAddToGroup")),a.ZP.createElement(R.Z,{className:u("button"),isText:!0,onClick:C},Z("DismissRequest"))))}))),fl=(0,a.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,p.Z1)(e,n);return{chat:a,serverTimeOffset:e.serverTimeOffset,isChannel:a&&(0,g.eA)(a)}}))((e=>{var t,n,r;let{chat:l,chatId:i,isActive:c,isChannel:d,onClose:m}=e;const{hideAllChatJoinRequests:Z,loadChatJoinRequests:v}=(0,s.uC)(),[P,p,E]=(0,ye.Z)(),[C,f,b]=(0,ye.Z)(),I=(0,h.Z)(),[y,N]=(0,a.eJ)(),[k,S]=(0,a.eJ)(!1),w=(0,a.I4)((()=>S(!0)),[]);(0,a.d4)((()=>{y||(0,dt.Z)("JoinRequest").then(N)}),[y]),(0,u.ZP)(c,m),(0,a.d4)((()=>{null!=l&&l.joinRequests||(0,g.YC)(i)||v({chatId:i})}),[l,i,v]);const M=(0,a.I4)((()=>{Z({chatId:i,isApproved:!0}),E()}),[Z,i,E]),T=(0,a.I4)((()=>{Z({chatId:i,isApproved:!1}),b()}),[Z,i,b]);return a.ZP.createElement("div",{className:"Management ManageJoinRequests"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-icon"},y&&a.ZP.createElement(mt.Z,{id:"joinRequestDucks",size:o.PM,animationData:y,play:k,onLoad:w})),Boolean(null==l||null===(t=l.joinRequests)||void 0===t?void 0:t.length)&&a.ZP.createElement("div",{className:"bulk-actions"},a.ZP.createElement(R.Z,{className:"bulk-action-button",onClick:p},"Accept all"),a.ZP.createElement(R.Z,{className:"bulk-action-button",onClick:f,isText:!0},"Dismiss all"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"custom-scroll",teactFastList:!0},a.ZP.createElement("p",{key:"title"},null!=l&&l.joinRequests?l.joinRequests.length?I("JoinRequests",l.joinRequests.length):I("NoMemberRequests"):I("Loading")),!(null!=l&&l.joinRequests)&&a.ZP.createElement(J.Z,{key:"loading"}),0===(null==l||null===(n=l.joinRequests)||void 0===n?void 0:n.length)&&a.ZP.createElement("p",{className:"text-muted",key:"empty"},I(d?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")),null==l||null===(r=l.joinRequests)||void 0===r?void 0:r.map((e=>{let{userId:t,about:n,date:s}=e;return a.ZP.createElement(Cl,{userId:t,about:n,date:s,isChannel:d,chatId:i,key:t})})))),a.ZP.createElement(Xe.Z,{isOpen:P,onClose:E,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:M}),a.ZP.createElement(Xe.Z,{isOpen:C,onClose:b,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:T}))}))),bl=(0,a.X$)((0,s.c$)((e=>({managementType:(0,p.pP)(e)})))((e=>{let{chatId:t,currentScreen:n,selectedChatMemberId:s,isPromotedByCurrentUser:r,onScreenSelect:o,onChatMemberSelect:i,onClose:c,isActive:d,managementType:m}=e;switch(n){case l.u1.Initial:switch(m){case"user":return a.ZP.createElement(Hr,{key:t,userId:t,onClose:c,isActive:d});case"group":return a.ZP.createElement(qr,{key:t,chatId:t,onScreenSelect:o,onClose:c,isActive:d||[l.u1.ChatPrivacyType,l.u1.Discussion,l.u1.GroupPermissions,l.u1.ChatAdministrators,l.u1.GroupRemovedUsers,l.u1.GroupUserPermissionsCreate,l.u1.GroupUserPermissions,l.u1.ChatAdminRights,l.u1.ChatNewAdminRights,l.u1.GroupRecentActions].includes(n)});case"channel":return a.ZP.createElement(el,{key:t,chatId:t,onScreenSelect:o,onClose:c,isActive:d||[l.u1.ChannelSubscribers,l.u1.ChatAdministrators,l.u1.Discussion,l.u1.ChatPrivacyType,l.u1.ChatAdminRights,l.u1.ChatNewAdminRights,l.u1.GroupRecentActions].includes(n)})}break;case l.u1.ChatPrivacyType:return a.ZP.createElement(nl,{chatId:t,isActive:d,onClose:c});case l.u1.Discussion:return a.ZP.createElement(al,{chatId:t,onScreenSelect:o,isActive:d,onClose:c});case l.u1.GroupPermissions:return a.ZP.createElement(jr,{chatId:t,onScreenSelect:o,onChatMemberSelect:i,isActive:d||[l.u1.GroupRemovedUsers,l.u1.GroupUserPermissionsCreate,l.u1.GroupUserPermissions].includes(n),onClose:c});case l.u1.GroupRemovedUsers:return a.ZP.createElement(Wr,{chatId:t,isActive:d,onClose:c});case l.u1.GroupUserPermissionsCreate:return a.ZP.createElement(cl,{chatId:t,onChatMemberSelect:i,onScreenSelect:o,isActive:d||[l.u1.GroupUserPermissions].includes(n),onClose:c});case l.u1.GroupUserPermissions:return a.ZP.createElement(sl,{chatId:t,selectedChatMemberId:s,isPromotedByCurrentUser:r,onScreenSelect:o,isActive:d,onClose:c});case l.u1.ChatAdministrators:return a.ZP.createElement(rl,{chatId:t,onScreenSelect:o,onChatMemberSelect:i,isActive:d||[l.u1.ChatAdminRights,l.u1.ChatNewAdminRights,l.u1.GroupRecentActions].includes(n),onClose:c});case l.u1.GroupRecentActions:return a.ZP.createElement(ll,{chatId:t,isActive:d,onClose:c});case l.u1.ChatNewAdminRights:case l.u1.ChatAdminRights:return a.ZP.createElement(ol,{chatId:t,isNewAdmin:n===l.u1.ChatNewAdminRights,selectedUserId:s,isPromotedByCurrentUser:r,onScreenSelect:o,isActive:d,onClose:c});case l.u1.ChannelSubscribers:case l.u1.GroupMembers:return a.ZP.createElement(il,{chatId:t,isActive:d,onClose:c});case l.u1.Invites:return a.ZP.createElement(hl,{chatId:t,isActive:d,onClose:c,onScreenSelect:o});case l.u1.EditInvite:return a.ZP.createElement(gl,{chatId:t,isActive:d,onClose:c,onScreenSelect:o});case l.u1.GroupAddAdmins:return a.ZP.createElement(il,{chatId:t,noAdmins:!0,isActive:d,onClose:c,onScreenSelect:o,onChatMemberSelect:i});case l.u1.Reactions:return a.ZP.createElement(pl,{chatId:t,isActive:d,onClose:c});case l.u1.InviteInfo:return a.ZP.createElement(El,{chatId:t,isActive:d,onClose:c});case l.u1.JoinRequests:return a.ZP.createElement(fl,{chatId:t,isActive:d,onClose:c})}})));var Il=n(9937);const yl=/^4[0-9]{12}(?:[0-9]{1,3})?$/,Nl=/^5[1-5][0-9]{11,14}$/,kl=/^2[2-7][0-9]{11,14}$/;let Sl;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(Sl||(Sl={}));const wl={[Sl.Default]:"",[Sl.Visa]:"visa",[Sl.Mastercard]:"mastercard"};function Ml(e){return e=e.replace(/\s/g,""),yl.test(e)?Sl.Visa:Nl.test(e)||kl.test(e)?Sl.Mastercard:Sl.Default}const Tl={},Rl=/(\d{1,3})(\d{1,3})?(\d{1,3})?(\d{1,3})?(\d{1,3})?/,Al="AF🇦🇫93Afghanistan333\nAO🇦🇴244Angola333\nAL🇦🇱355Albania234\nAD🇦🇩376Andorra222\nAE🇦🇪971United Arab Emirates234\nAI🇦🇮1264Anguilla34\nAR🇦🇷54Argentina\nAM🇦🇲374Armenia233\nAG🇦🇬1268Antigua and Barbuda34\nAU🇦🇺61Australia333\nAS🇦🇸1684American Samoa34\nAT🇦🇹43Austria\nAW🇦🇼297Aruba34\nAZ🇦🇿994Azerbaijan2322\nBI🇧🇮257Burundi224\nBE🇧🇪32Belgium3222\nBJ🇧🇯229Benin233\nBF🇧🇫226Burkina Faso2222\nBD🇧🇩880Bangladesh\nBG🇧🇬359Bulgaria\nBH🇧🇭973Bahrain44\nBS🇧🇸1242Bahamas34\nBA🇧🇦387Bosnia and Herzegovina\nBY🇧🇾375Belarus2322\nBZ🇧🇿501Belize\nBO🇧🇴591Bolivia134\nBR🇧🇷55Brazil254\nBB🇧🇧1246Barbados34\nBM🇧🇲1441Bermuda34\nBN🇧🇳673Brunei34\nBQ🇧🇶599Bonaire, Sint Eustatius and Saba\nBT🇧🇹975Bhutan\nBW🇧🇼267Botswana233\nCF🇨🇫236Central African Republic2222\nCA🇨🇦1Canada334\nCH🇨🇭41Switzerland234\nCK🇨🇰682Cook Islands\nCL🇨🇱56Chile144\nCN🇨🇳86China344\nCI🇨🇮225Côte d`Ivoire233\nCM🇨🇲237Cameroon44\nCD🇨🇩243DR Congo234\nCG🇨🇬242Republic of the Congo234\nCO🇨🇴57Colombia334\nKM🇰🇲269Comoros34\nCV🇨🇻238Cape Verde34\nCR🇨🇷506Costa Rica\nCU🇨🇺53Cuba44\nCY🇨🇾357Cyprus44\nCW🇨🇼599Curaçao\nCZ🇨🇿420Czech Republic\nDE🇩🇪49Germany38\nDJ🇩🇯253Djibouti2222\nDM🇩🇲1767Dominica34\nDK🇩🇰45Denmark44\nDO🇩🇴1Dominican Republic334\nDZ🇩🇿213Algeria3222\nEC🇪🇨593Ecuador\nEG🇪🇬20Egypt234\nER🇪🇷291Eritrea133\nES🇪🇸34Spain333\nEE🇪🇪372Estonia\nET🇪🇹251Ethiopia234\nFI🇫🇮358Finland\nFJ🇫🇯679Fiji\nFK🇫🇰500Falkland Islands\nFM🇫🇲691Micronesia\nFO🇫🇴298Faroe Islands33\nFR🇫🇷33France12222\nGA🇬🇦241Gabon1222\nGB🇬🇧44United Kingdom46\nGE🇬🇪995Georgia\nGF🇬🇫594French Guiana\nGH🇬🇭233Ghana\nGI🇬🇮350Gibraltar44\nGL🇬🇱299Greenland33\nGN🇬🇳224Guinea333\nGM🇬🇲220Gambia34\nGP🇬🇵590Guadeloupe\nGU🇬🇺1671Guam34\nGW🇬🇼245Guinea-Bissau34\nGQ🇬🇶240Equatorial Guinea333\nGR🇬🇷30Greece244\nGD🇬🇩1473Grenada34\nGT🇬🇹502Guatemala134\nGY🇬🇾592Guyana\nHK🇭🇰852Hong Kong\nHN🇭🇳504Honduras44\nHR🇭🇷385Croatia\nHT🇭🇹509Haiti\nHU🇭🇺36Hungary234\nID🇮🇩62Indonesia\nIN🇮🇳91India55\nIO🇩🇬246Diego Garcia34\nIE🇮🇪353Ireland234\nIR🇮🇷98Iran334\nIQ🇮🇶964Iraq334\nIS🇮🇸354Iceland34\nIL🇮🇱972Israel234\nIT🇮🇹39Italy334\nJM🇯🇲1876Jamaica34\nJO🇯🇴962Jordan144\nJP🇯🇵81Japan244\nKZ🇰🇿7Kazakhstan3322\nKE🇰🇪254Kenya333\nKG🇰🇬996Kyrgyzstan\nKH🇰🇭855Cambodia\nKI🇰🇮686Kiribati\nKN🇰🇳1869Saint Kitts and Nevis34\nKR🇰🇷82South Korea\nKW🇰🇼965Kuwait44\nKY🇰🇾1345Cayman Islands34\nLA🇱🇦856Laos\nLB🇱🇧961Lebanon\nLR🇱🇷231Liberia\nLY🇱🇾218Libya234\nLC🇱🇨1758Saint Lucia34\nLI🇱🇮423Liechtenstein\nLK🇱🇰94Sri Lanka234\nLS🇱🇸266Lesotho233\nLT🇱🇹370Lithuania35\nLU🇱🇺352Luxembourg\nLV🇱🇻371Latvia35\nMA🇲🇦212Morocco234\nMC🇲🇨377Monaco44\nMD🇲🇩373Moldova233\nMG🇲🇬261Madagascar2232\nMP🇲🇵1670Northern Mariana Islands34\nMO🇲🇴853Macau\nMS🇲🇸1664Montserrat34\nMV🇲🇻960Maldives\nMX🇲🇽52Mexico\nMH🇲🇭692Marshall Islands\nMK🇲🇰389Macedonia\nML🇲🇱223Mali44\nMT🇲🇹356Malta2222\nMM🇲🇲95Myanmar\nME🇲🇪382Montenegro\nMN🇲🇳976Mongolia\nMZ🇲🇿258Mozambique234\nMQ🇲🇶596Martinique\nMR🇲🇷222Mauritania44\nMU🇲🇺230Mauritius\nMW🇲🇼265Malawi\nMY🇲🇾60Malaysia\nNA🇳🇦264Namibia234\nNC🇳🇨687New Caledonia6\nNE🇳🇪227Niger2222\nNF🇳🇫672Norfolk Island\nNG🇳🇬234Nigeria\nNI🇳🇮505Nicaragua44\nNL🇳🇱31Netherlands12222\nNO🇳🇴47Norway44\nNP🇳🇵977Nepal\nNU🇳🇺683Niue\nNR🇳🇷674Nauru\nNZ🇳🇿64New Zealand\nOM🇴🇲968Oman44\nPK🇵🇰92Pakistan334\nPA🇵🇦507Panama44\nPE🇵🇪51Peru333\nPF🇵🇫689French Polynesia\nPH🇵🇭63Philippines334\nPM🇵🇲508Saint Pierre and Miquelon\nPR🇵🇷1Puerto Rico334\nPS🇵🇸970Palestine324\nPW🇵🇼680Palau\nPG🇵🇬675Papua New Guinea\nPL🇵🇱48Poland333\nKP🇰🇵850North Korea\nPT🇵🇹351Portugal144\nPY🇵🇾595Paraguay333\nQA🇶🇦974Qatar\nRE🇷🇪262Réunion333\nRO🇷🇴40Romania333\nRU🇷🇺7Russia3322\nRW🇷🇼250Rwanda333\nSA🇸🇦966Saudi Arabia\nSD🇸🇩249Sudan234\nSN🇸🇳221Senegal234\nSG🇸🇬65Singapore44\nSH🇸🇭290Saint Helena23\nSH🇸🇭247Saint Helena4\nSB🇸🇧677Solomon Islands\nSL🇸🇱232Sierra Leone233\nSV🇸🇻503El Salvador44\nSM🇸🇲378San Marino334\nSO🇸🇴252Somalia233\nRS🇷🇸381Serbia234\nSS🇸🇸211South Sudan234\nST🇸🇹239São Tomé and Príncipe25\nSR🇸🇷597Suriname34\nSK🇸🇰421Slovakia\nSI🇸🇮386Slovenia\nSE🇸🇪46Sweden234\nSZ🇸🇿268Swaziland44\nSC🇸🇨248Seychelles1222\nSX🇸🇽1721Sint Maarten34\nSY🇸🇾963Syria\nTC🇹🇨1649Turks and Caicos Islands34\nTD🇹🇩235Chad2222\nTG🇹🇬228Togo233\nTH🇹🇭66Thailand144\nTJ🇹🇯992Tajikistan\nTK🇹🇰690Tokelau\nTM🇹🇲993Turkmenistan26\nTL🇹🇱670Timor-Leste\nTO🇹🇴676Tonga\nTT🇹🇹1868Trinidad and Tobago34\nTN🇹🇳216Tunisia233\nTR🇹🇷90Turkey334\nTV🇹🇻688Tuvalu\nTW🇹🇼886Taiwan\nTZ🇹🇿255Tanzania234\nUG🇺🇬256Uganda234\nUA🇺🇦380Ukraine2322\nUY🇺🇾598Uruguay44\nUS🇺🇸1United States334\nUZ🇺🇿998Uzbekistan27\nVA🇻🇦3Vatican City\nVC🇻🇨1784Saint Vincent and the Grenadines34\nVE🇻🇪58Venezuela334\nVG🇻🇬1284British Virgin Islands34\nVI🇻🇮1340US Virgin Islands34\nVN🇻🇳84Vietnam\nVU🇻🇺678Vanuatu\nWF🇼🇫681Wallis and Futuna\nWS🇼🇸685Samoa\nXK🇽🇰383Kosovo44\nYE🇾🇪967Yemen333\nZA🇿🇦27South Africa234\nZM🇿🇲260Zambia234\nZW🇿🇼263Zimbabwe234".split("\n").map((e=>({id:e.substr(0,2),flag:e.substr(2,4),code:`+${e.match(/\d+/)[0]}`,name:e.split(/\d+/)[1],phoneFormat:function(e){if(!e)return Rl;const t=e[0];let n;if(!Tl[t]){const e=t.split("").map(Number);n=e.reduce(((e,t,n)=>`${e}(\\d{1,${t}})${n>0?"?":""}`),""),Tl[t]=new RegExp(`${n}${"()?".repeat(5-e.length)}`)}return Tl[t]}(e.match(/\d+$/))}))),Ll={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Fl=(e,t)=>{switch(t.type){case"changeAddress1":return{...e,streetLine1:t.payload,formErrors:{...e.formErrors,streetLine1:void 0}};case"changeAddress2":return{...e,streetLine2:t.payload,formErrors:{...e.formErrors,streetLine2:void 0}};case"changeCity":return{...e,city:t.payload,formErrors:{...e.formErrors,city:void 0}};case"changeState":return{...e,state:t.payload,formErrors:{...e.formErrors,state:void 0}};case"changeCountry":return{...e,countryIso2:t.payload,billingCountry:Bl(t.payload),formErrors:{...e.formErrors,countryIso2:void 0}};case"changePostCode":return{...e,postCode:t.payload,formErrors:{...e.formErrors,postCode:void 0}};case"changeFullName":return{...e,fullName:t.payload,formErrors:{...e.formErrors,fullName:void 0}};case"changeEmail":return{...e,email:t.payload,formErrors:{...e.formErrors,email:void 0}};case"changePhone":return{...e,phone:t.payload,formErrors:{...e.formErrors,phone:void 0}};case"changeShipping":return{...e,shipping:t.payload};case"changeCardNumber":return{...e,cardNumber:t.payload,formErrors:{...e.formErrors,cardNumber:void 0}};case"changeCardholder":return{...e,cardholder:t.payload,formErrors:{...e.formErrors,cardholder:void 0}};case"changeExpiryDate":return{...e,expiry:t.payload,formErrors:{...e.formErrors,expiry:void 0}};case"changeCvvCode":return{...e,cvv:t.payload,formErrors:{...e.formErrors,cvv:void 0}};case"changeBillingCountry":return{...e,billingCountry:t.payload,formErrors:{...e.formErrors,billingCountry:void 0}};case"changeBillingZip":return{...e,billingZip:t.payload,formErrors:{...e.formErrors,billingZip:void 0}};case"changeSaveInfo":return{...e,saveInfo:t.payload};case"changeSaveCredentials":return{...e,saveCredentials:t.payload};case"updateUserInfo":return t.payload.countryIso2?{...e,...t.payload,billingCountry:Bl(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function Bl(e){const t=Al.find((t=>{let{id:n}=t;return n===e}));return t?t.name:""}function $l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400;(0,a.d4)((()=>{i.$b||setTimeout((()=>{(0,G.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const xl=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:r,error:l,ref:o,placeholder:i,onChange:c,children:d}=e,m=l||s,u=(0,X.Z)("input-group",n&&"touched",l&&"error",m&&"with-label",r&&"with-arrow","input-group");return a.ZP.createElement("div",{className:u},a.ZP.createElement("select",{className:"form-control",id:t,value:n||"",onChange:c,placeholder:i||s,ref:o},d),m&&t&&a.ZP.createElement("label",{htmlFor:t},m))})),Dl=(0,a.X$)((e=>{let{state:t,needEmail:n,needPhone:s,needName:r,needAddress:l,dispatch:o}=e;const i=(0,a.sO)(null),c=(0,a.sO)(null),d=(0,a.sO)(null);(0,a.d4)((()=>{d.current&&d.current.value!==t.countryIso2&&(d.current.value=t.countryIso2)}),[t.countryIso2]);const m=(0,h.Z)();$l(i);const u=(0,a.I4)((e=>{o({type:"changeAddress1",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeAddress2",payload:e.target.value})}),[o]),v=(0,a.I4)((e=>{o({type:"changeCity",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeState",payload:e.target.value})}),[o]),g=(0,a.I4)((e=>{o({type:"changeCountry",payload:e.target.value})}),[o]),p=(0,a.I4)((e=>{o({type:"changePostCode",payload:e.target.value})}),[o]),E=(0,a.I4)((e=>{o({type:"changeFullName",payload:e.target.value})}),[o]),C=(0,a.I4)((e=>{o({type:"changeEmail",payload:e.target.value})}),[o]),f=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,c.current&&(c.current.value=t),o({type:"changePhone",payload:t})}),[o]),b=(0,a.I4)((e=>{o({type:"changeSaveInfo",payload:e.target.value})}),[o]),{formErrors:I}=t;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,l?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,m("PaymentShippingAddress")),a.ZP.createElement(Te.Z,{ref:i,label:"Address1 (Street)",onChange:u,value:t.streetLine1,inputMode:"text",error:I.streetLine1}),a.ZP.createElement(Te.Z,{label:"Address2 (Street)",onChange:Z,value:t.streetLine2,inputMode:"text",error:I.streetLine2}),a.ZP.createElement(Te.Z,{label:"City",onChange:v,value:t.city,inputMode:"text",error:I.city}),a.ZP.createElement(Te.Z,{label:"State",onChange:P,value:t.state,inputMode:"text",error:I.state}),a.ZP.createElement(xl,{label:"Country",placeholder:"Country",onChange:g,value:t.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:I.countryIso2,ref:d},Al.map((e=>{let{name:t,id:n}=e;return a.ZP.createElement("option",{value:n,className:"county-item"},t)}))),a.ZP.createElement(Te.Z,{label:"Post Code",onChange:p,value:t.postCode,inputMode:"text",error:I.postCode})):void 0,r||n||s?a.ZP.createElement("h5",null,m("PaymentShippingReceiver")):void 0,r&&a.ZP.createElement(Te.Z,{label:"Full name",onChange:E,value:t.fullName,inputMode:"text",error:I.fullName}),n&&a.ZP.createElement(Te.Z,{label:"Email",onChange:C,value:t.email,inputMode:"email",error:I.email}),s&&a.ZP.createElement(Te.Z,{label:"Phone number",onChange:f,value:t.phone,inputMode:"tel",error:I.phone,ref:c}),a.ZP.createElement(fn.Z,{label:m("PaymentShippingSave"),subLabel:m("PaymentShippingSaveInfo"),checked:Boolean(t.saveInfo),onChange:b})))})),Ol=(0,a.X$)((e=>{let{state:t,shippingOptions:n,currency:s,dispatch:r}=e;const l=(0,h.Z)();(0,a.d4)((()=>{n&&!t.shipping&&r({type:"changeShipping",payload:n[0].id})}),[n,t.shipping,r]);const o=(0,a.I4)((e=>{r({type:"changeShipping",payload:e})}),[r]),i=(0,a.Ye)((()=>n.map((e=>{let{id:t,title:n,amount:a}=e;return{label:n,subLabel:(0,Il.x)(a,s,l.code),value:t}}))),[n,s,l.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,"Select shipping method"),a.ZP.createElement(at.Z,{name:"shipping-options",options:i,onChange:o,selected:t.shipping})))}));function Ul(e,t,n,s){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return a.ZP.createElement("div",{className:"price-info-item "+(r?"price-info-item-main":"")},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("div",{className:"value"},(0,Il.x)(n,s,e)))}function Gl(e,t,n){return a.ZP.createElement("div",{className:"checkout-info-item"},a.ZP.createElement("i",{className:e}," "),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("p",{className:"data"},n)))}const Jl=(0,a.X$)((e=>{let{invoiceContent:t,prices:n,shippingPrices:s,checkoutInfo:r,currency:l,totalPrice:o}=e;const i=(0,h.Z)(),{photoUrl:c,title:d,text:m}=t||{},{paymentMethod:u,paymentProvider:Z,shippingAddress:v,name:P,phone:g,shippingMethod:p}=r||{};return a.ZP.createElement("div",{className:"Checkout"},a.ZP.createElement("div",{className:"description has-image"},c&&a.ZP.createElement("img",{src:c,alt:""}),a.ZP.createElement("div",{className:"text"},a.ZP.createElement("h5",null,d),a.ZP.createElement("p",null,m))),a.ZP.createElement("div",{className:"price-info"},n&&n.map((e=>Ul(i.code,e.label,e.amount,l))),s&&s.map((e=>Ul(i.code,e.label,e.amount,l))),void 0!==o&&Ul(i.code,i("Checkout.TotalAmount"),o,l,!0)),a.ZP.createElement("div",{className:"invoice-info"},u&&Gl("icon-card",u,"Payment method"),Z&&Gl("stripe-provider",Z,"Payment provider"),v&&Gl("icon-location",v,"Shipping address"),P&&Gl("icon-user",P,"Name"),g&&Gl("icon-phone",g,"Phone number"),p&&Gl("icon-truck",p,"Shipping method")))})),Xl=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const r=(0,a.sO)(null),l=(0,a.I4)((e=>{if("Backspace"===e.key&&"/"===t.charAt(t.length-1)){const e=t.slice(0,t.length-1);r.current&&(r.current.value=e)}}),[t]),o=(0,a.I4)((e=>{s(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return null!=t&&t[0]&&Number(t[0])>12&&(t[0]="12"),null!=t&&t[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))}),[s]);return a.ZP.createElement(Te.Z,{label:"Expiry date",ref:r,onChange:o,onKeyDown:l,value:t,error:n,inputMode:"numeric",maxLength:5})}));var zl=n(6352),_l=n(5753);const Yl=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const r=(0,a.sO)(null);$l(r);const[l,o]=(0,a.eJ)(Sl.Default);(0,a.d4)((()=>{const e=Ml(t);o(e)}),[]);const i=(0,a.I4)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),n=Ml(e.target.value);o(n),s(t),r.current&&(r.current.value=t)}),[s,r]),c=function(e){switch(e){case Sl.Mastercard:return a.ZP.createElement("img",{src:zl,alt:""});case Sl.Visa:return a.ZP.createElement("img",{src:_l,alt:""});default:return}}(l);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement("span",{className:"left-addon"},c),a.ZP.createElement(Te.Z,{ref:r,label:"Card number",onChange:i,value:t,inputMode:"numeric",className:l?"has-left-addon":"",error:n,maxLength:23}))})),Hl=(0,a.X$)((e=>{let{state:t,canSaveCredentials:n,needCardholderName:s,needCountry:r,needZip:l,dispatch:o}=e;const i=(0,a.sO)(null);(0,a.d4)((()=>{i.current&&i.current.value!==t.billingCountry&&(i.current.value=t.billingCountry)}),[t.billingCountry]);const c=(0,a.I4)((e=>{o({type:"changeCardNumber",payload:e})}),[o]),d=(0,a.I4)((e=>{o({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[o]),m=(0,a.I4)((e=>{o({type:"changeExpiryDate",payload:e})}),[o]),u=(0,a.I4)((e=>{o({type:"changeCvvCode",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeBillingCountry",payload:e.target.value})}),[o]),v=(0,a.I4)((e=>{o({type:"changeBillingZip",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeSaveCredentials",payload:e.target.value})}),[o]),g=(0,h.Z)(),{formErrors:p={}}=t;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,g("PaymentCardTitle")),a.ZP.createElement(Yl,{onChange:c,value:t.cardNumber,error:p.cardNumber}),s&&a.ZP.createElement(Te.Z,{label:"Name on card",onChange:d,value:t.cardholder,inputMode:"text",error:p.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(Xl,{value:t.expiry,onChange:m,error:p.expiry}),a.ZP.createElement(Te.Z,{label:"CVV code",onChange:u,value:t.cvv,inputMode:"numeric",maxLength:3,error:p.cvv})),r||l?a.ZP.createElement("h5",null,g("PaymentBillingAddress")):void 0,r&&a.ZP.createElement(xl,{label:"Country",placeholder:"Country",onChange:Z,value:t.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:p.billingCountry,ref:i},Al.map((e=>{let{name:t}=e;return a.ZP.createElement("option",{value:t,className:"county-item"},t)}))),l&&a.ZP.createElement(Te.Z,{label:"Post Code",onChange:v,value:t.billingZip,inputMode:"text",error:p.billingZip}),n&&a.ZP.createElement(fn.Z,{label:g("PaymentCardSavePaymentInformation"),checked:t.saveCredentials,onChange:P})))})),Vl=(0,a.X$)((0,s.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:r,invoiceContent:l,nativeProvider:o,nativeParams:i,passwordMissing:c,error:d}=e.payment,m=Boolean(r&&(!o||"stripe"!==o)),{needCardholderName:u,needCountry:h,needZip:Z}=i||{},{nameRequested:v,phoneRequested:P,emailRequested:g,shippingAddressRequested:p,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I}=r||{};return{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:o,passwordMissing:c,nameRequested:v,shippingAddressRequested:p,phoneRequested:P,emailRequested:g,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I,isProviderError:m,invoiceContent:l,needCardholderName:u,needCountry:h,needZip:Z,error:d}}))((e=>{let{isOpen:t,onClose:n,step:r,shippingOptions:o,savedInfo:i,canSaveCredentials:c,nameRequested:d,shippingAddressRequested:m,phoneRequested:u,emailRequested:Z,phoneToProvider:v,emailToProvider:P,currency:g,passwordMissing:p,isProviderError:E,invoiceContent:C,nativeProvider:f,prices:b,needCardholderName:I,needCountry:y,needZip:N,error:k}=e;const{validateRequestedInfo:S,sendPaymentForm:w,setPaymentStep:M,sendCredentialsInfo:T,clearPaymentError:A}=(0,s.uC)(),[F,B]=(0,nn.Z)(Fl,Ll),[$,x]=(0,a.eJ)(!1),D=(0,h.Z)();(0,a.d4)((()=>{(r||k)&&x(!1)}),[r,k]),(0,a.d4)((()=>{null!=k&&k.field&&B({type:"setFormErrors",payload:{[k.field]:k.message}})}),[k,B]),(0,a.d4)((()=>{if(i){const{name:e,phone:t,email:n,shippingAddress:a}=i;B({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...a||{}}})}}),[i,B]);const O=(0,a.I4)((()=>{A()}),[A]),U=(0,a.Ye)((()=>r!==l.KB.Checkout?0:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;const a=t?jl(t,n):[];let s=0;const r=e.concat(a||[]);return s=r.reduce(((e,t)=>e+t.amount),s),s}(b,o,F.shipping)),[r,F.shipping,b,o]),G=(0,a.Ye)((()=>{if(r===l.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=Ml(e);return wl[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:l}=e,o=t?ql(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:l,phone:r,shippingMethod:null==o?void 0:o.title}}(F,o,f||"")}),[r,F,o,f]),X=(0,a.I4)((()=>{const{saveInfo:e}=F,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:l,fullName:o,phone:i,email:c}=e;return{name:o,phone:i,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:l}}}(F);S({requestInfo:t,saveInfo:e})}),[S,F]),z=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:r,billingZip:l}=e,[o,i]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:o,expiryYear:i,cvv:s,country:r,zip:l}}}(F);T({credentials:e})}),[T,F]),_=(0,a.I4)((()=>{w({shippingOptionId:F.shipping,saveCredentials:F.saveCredentials})}),[w,F]),Y=(0,a.I4)((e=>{M({step:e})}),[M]),H=(0,a.I4)((()=>{switch(x(!0),r){case l.KB.ShippingInfo:return X();case l.KB.Shipping:return Y(l.KB.PaymentInfo);case l.KB.PaymentInfo:return z();case l.KB.Checkout:return _();default:return()=>{}}}),[r,X,Y,z,_]),V=(0,a.Ye)((()=>{switch(r){case l.KB.ShippingInfo:return D("PaymentShippingInfo");case l.KB.Shipping:return D("PaymentShippingMethod");case l.KB.PaymentInfo:return D("PaymentCardInfo");case l.KB.Checkout:return D("PaymentCheckout");default:return""}}),[r,D]),q=(0,a.Ye)((()=>r===l.KB.Checkout?D("Checkout.PayPrice",(0,Il.x)(U,g,D.code)):D("Next")),[r,D,g,U]);return E?a.ZP.createElement(Me.Z,{className:"error",isOpen:t,onClose:n},a.ZP.createElement("p",null,"Sorry, Telegram WebZ doesn't support payments with this provider yet. ",a.ZP.createElement("br",null),"Please use one of our mobile apps to do this."),a.ZP.createElement(R.Z,{isText:!0,onClick:n},D("OK"))):a.ZP.createElement(Me.Z,{className:"PaymentModal",isOpen:t,onClose:n},a.ZP.createElement("div",{className:"header",dir:D.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:n,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null,V)),void 0!==r?a.ZP.createElement(L.Z,{name:"slide",activeKey:r},(()=>a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case l.KB.ShippingInfo:return a.ZP.createElement(Dl,{state:F,dispatch:B,needAddress:Boolean(m),needEmail:Boolean(Z||P),needPhone:Boolean(u||v),needName:Boolean(d)});case l.KB.Shipping:return a.ZP.createElement(Ol,{state:F,dispatch:B,shippingOptions:o||[],currency:g});case l.KB.PaymentInfo:return a.ZP.createElement(Hl,{state:F,dispatch:B,canSaveCredentials:Boolean(!p&&c),needCardholderName:I,needCountry:y,needZip:N});case l.KB.Checkout:return a.ZP.createElement(Jl,{prices:b,shippingPrices:F.shipping&&o?jl(o,F.shipping):void 0,totalPrice:U,invoiceContent:C,checkoutInfo:G,currency:g});default:return}}(r)))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(J.Z,{color:"gray"})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(R.Z,{type:"submit",onClick:H,disabled:$,isLoading:$},q)),k&&!k.field&&function(){if(k)return a.ZP.createElement(Me.Z,{className:"error",isOpen:Boolean(k),onClose:O},a.ZP.createElement("h4",null,k.description||"Error"),a.ZP.createElement("p",null,k.description||"Error"),a.ZP.createElement(R.Z,{isText:!0,onClick:A},D("OK")))}())})));function ql(e,t){return e.find((e=>{let{id:n}=e;return n===t}))}function jl(e,t){const n=ql(e,t);return null==n?void 0:n.prices}const Kl=(0,a.X$)((0,s.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:l,shippingPrices:o,shippingMethod:i,photoUrl:c,text:d,title:m}=t||{};return{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:l,shippingPrices:o,shippingMethod:i,photoUrl:c,text:d,title:m}}))((e=>{let{isOpen:t,onClose:n,prices:s,shippingPrices:r,totalAmount:l,currency:o,info:i,photoUrl:c,text:d,title:m,credentialsTitle:u,shippingMethod:Z}=e;const v=(0,h.Z)(),P=(0,a.Ye)((()=>function(e,t,n){if(!t)return{paymentMethod:e};const{shippingAddress:a}=t,s=null!=a&&a.streetLine1?`${a.streetLine1}, ${a.city}, ${a.countryIso2}`:void 0,{phone:r,name:l}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:s,name:l,phone:r,shippingMethod:n}}(u,i,Z)),[i,Z,u]);return a.ZP.createElement(Me.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:t,onClose:n},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:n,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null," ",v("PaymentReceipt")," ")),a.ZP.createElement("div",{className:"receipt-content custom-scroll"},a.ZP.createElement(Jl,{prices:s,shippingPrices:r,totalPrice:l,invoiceContent:{photoUrl:c,text:d,title:m},checkoutInfo:P,currency:o}))))})))},9364:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(4050),s=n(3716),r=n(7361),l=n(6752),o=n(9107),i=n(231);const c=r.wB?550:400,d=(0,a.X$)((e=>{let{isLoading:t=!1,isPasswordVisible:n,error:d,hint:m,placeholder:u="Password",submitLabel:h="Next",clearError:Z,onChangePasswordVisibility:v,onInputChange:P,onSubmit:g}=e;const p=(0,a.sO)(null),E=(0,o.Z)(),[C,f]=(0,a.eJ)(""),[b,I]=(0,a.eJ)(!1);return(0,a.d4)((()=>{r.$b||setTimeout((()=>{p.current.focus()}),c)}),[]),(0,a.d4)((()=>{d&&requestAnimationFrame((()=>{p.current.focus(),p.current.select()}))}),[d]),a.ZP.createElement("form",{action:"",onSubmit:function(e){e.preventDefault(),t||b&&g(C)},autoComplete:"off"},a.ZP.createElement("div",{className:(0,l.Z)("input-group password-input",C&&"touched",d&&"error"),dir:E.isRtl?"rtl":void 0},a.ZP.createElement("input",{ref:p,className:"form-control",type:n?"text":"password",id:"sign-in-password",value:C||"",autoComplete:"current-password",onChange:function(e){d&&Z();const{target:t}=e;f(t.value),I(t.value.length>=s.lo),P&&P(t.value)},dir:"auto"}),a.ZP.createElement("label",null,d||m||u),a.ZP.createElement("div",{className:"toggle-password",onClick:function(){v(!n)},role:"button",tabIndex:0,title:"Toggle password visibility"},a.ZP.createElement("i",{className:n?"icon-eye":"icon-eye-closed"}))),b&&a.ZP.createElement(i.Z,{type:"submit",ripple:!0,isLoading:t},h))}))},3490:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(4050),s=n(3716),r=n(7361),l=n(7324),o=n(7799);const i=[0,50],c=[0,20],d=[20,0],m=r.wB?s.qp:s.z7,u=(0,a.X$)((e=>{let{isPasswordVisible:t,isBig:n}=e;const[r,u]=(0,a.eJ)(),[h,Z]=(0,a.eJ)(),[v,P]=(0,a.eJ)(!1),[g,p]=(0,a.eJ)(!1);(0,a.d4)((()=>{r?setTimeout((()=>p(!0)),2e3):(0,l.Z)("MonkeyClose").then(u)}),[r]),(0,a.d4)((()=>{h||(0,l.Z)("MonkeyPeek").then(Z)}),[h]);const E=(0,a.I4)((()=>P(!0)),[]);return a.ZP.createElement("div",{id:"monkey",className:n?"big":""},!v&&a.ZP.createElement("div",{className:"monkey-preview"}),r&&a.ZP.createElement(o.Z,{id:"closeMonkey",size:n?s.K2:m,className:g?"hidden":"shown",animationData:r,playSegment:i,noLoop:!0,onLoad:E}),h&&a.ZP.createElement(o.Z,{id:"peekMonkey",size:n?s.K2:m,className:g?"shown":"hidden",animationData:h,playSegment:t?c:d,noLoop:!0}))}))},710:(e,t,n)=>{n.d(t,{Z:()=>P});var a=n(4050),s=n(6752),r=n(3716),l=n(1394),o=n(9107),i=n(231),c=n(3103),d=n(4288);const m={type:"blob",quality:1,format:"jpeg",circle:!1,size:{width:1024,height:1024}};let u,h,Z;const v=(0,a.X$)((e=>{let{file:t,onChange:s,onClose:v}=e;const[P,g]=(0,a.eJ)(!1);(0,a.d4)((()=>{t&&(P?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:n,offsetHeight:a}=t;Z=new u(t,{enableZoom:!0,boundary:{width:n,height:a},viewport:{width:n-16,height:a-16,type:"circle"}});const s=await(0,l.YJ)(e);await Z.bind({url:s})}catch(e){r.eM&&console.error(e)}}(t):async function(){return h||(h=Promise.all([n.e(99),n.e(472)]).then(n.bind(n,3472)),u=(await h).default),h}().then((()=>g(!0))))}),[t,P]);const p=(0,o.Z)();return a.ZP.createElement(c.Z,{isOpen:Boolean(t),onClose:v,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},P?a.ZP.createElement("div",{id:"avatar-crop"}):a.ZP.createElement(d.Z,null),a.ZP.createElement(i.Z,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!Z)return;const e=await Z.result(m),t="string"==typeof e?e:(0,l.hl)(e,"avatar.jpg");s(t)},ariaLabel:p("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),P=(0,a.X$)((e=>{let{title:t="Change your profile picture",disabled:n,currentAvatarBlobUrl:r,onChange:l}=e;const[o,i]=(0,a.eJ)(),[c,d]=(0,a.eJ)(r);(0,a.d4)((()=>{d(r)}),[r]);const m=(0,s.Z)(c&&"filled",n&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:m,role:"button",tabIndex:0,title:t},a.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(i(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),a.ZP.createElement("i",{className:"icon-camera-add"}),c&&a.ZP.createElement("img",{src:c,alt:"Avatar"})),a.ZP.createElement(v,{file:o,onClose:function(){i(void 0)},onChange:function(e){i(void 0),l(e),c&&URL.revokeObjectURL(c),d(URL.createObjectURL(e))}}))}))},6352:(e,t,n)=>{e.exports=n.p+"mastercard.4216118edafe23cc2dec..svg"},5753:(e,t,n)=>{e.exports=n.p+"visa.e5a7c336e1deb4b92a63..svg"}}]);
|
||
//# sourceMappingURL=126.56949b6fb714b8786c3b.js.map
|